#include "monty.h"
#include "fusion_p.h"

template<typename T> struct _checked_ptr_1
{
  T * ptr;
  size_t sz;
  _checked_ptr_1<T>(T * ptr, size_t sz) : ptr(ptr), sz(sz) {}
  T & operator[](ptrdiff_t i) { assert(i >= 0 && i < sz); return ptr[i]; }
  const T & operator[](ptrdiff_t i) const { assert(i >= 0 && i < sz); return ptr[i]; }
  void update(T * ptr_, size_t sz_) { ptr = ptr_; sz = sz_; }
};

template<typename T> struct _checked_ptr_2
{
  T * ptr;
  size_t sz0, sz1;
  _checked_ptr_2<T>(T * ptr, size_t sz0, size_t sz1) : ptr(ptr), sz0(sz0),sz1(sz1) {}
  T & operator()(ptrdiff_t i0, ptrdiff_t i1) { assert(i0 >= 0 && i0 < sz0 && i1 >= 0 && i1 < sz1); return ptr[i0 * sz1 + i1]; }
  const T & operator()(ptrdiff_t i0, ptrdiff_t i1) const { assert(i0 >= 0 && i0 < sz0 && i1 >= 0 && i1 < sz1); return ptr[i0 * sz1 + i1]; }
  void update(T * ptr_, size_t sz0_, size_t sz1_) { ptr = ptr_; sz0 = sz0_; sz1 = sz1_; }
};

// See http://www.cplusplus.com/articles/DE18T05o/
//                 A      && ( (       B      && B1 && B2      ) || (      C      &&   C1 &&   C2  ) )
// A a and b a have different signs
// B, B1, B2 a and b are both non-negative, r is less than both a and b
// C, C1, C2 a and b are both negative, r is greater than both a and b

struct InternalNumericOverflow {};

template<typename T>
static inline T checked_add(T a, T b, bool & overflow) {
  int r = a+b;
  overflow = ((a ^ b) >= 0) && ( (( (a & b) >= 0) && r < a && r < b) || ( ((a & b) < 0) && a < r && b < r) );
  return r;
}

template<typename T>
static inline T safe_add_(T a, T b) {
  bool overflow;
  T r = checked_add(a,b,overflow);
  if (overflow)
    throw InternalNumericOverflow();
  else
    return r;
}

static inline int      safe_add(int32_t a, int32_t b) { return safe_add_<int64_t>(a,b); }
static inline int64_t  safe_add(int64_t a, int64_t b) { return safe_add_<int64_t>(a,b); }
static inline int64_t  safe_add(int32_t a, int64_t b) { return safe_add_<int64_t>(a,b); }
static inline int64_t  safe_add(int64_t a, int32_t b) { return safe_add_<int64_t>(a,b); }

template<typename T>
static inline T checked_mul(T a, T b, bool & overflow) {
  T r = a * b;
  overflow = b != 0 && (((a ^ b) >= 0 && a > std::numeric_limits<T>::max() / b) || ((a ^ b) < 0 && a < std::numeric_limits<T>::min() / b));
  return r;
}

template<typename T>
static inline T safe_mul_(T a, T b) {
  bool overflow;
  T r = checked_mul(a,b,overflow);
  if (overflow)
    throw InternalNumericOverflow();
  else
    return r;
}

static inline           int safe_mul(int a, int b) { return safe_mul_<int64_t>(a,b); }
static inline int64_t safe_mul(int64_t a, int64_t b) { return safe_mul_<int64_t>(a,b); }
static inline int64_t safe_mul(int a, int64_t b) { return safe_mul_<int64_t>(a,b); }
static inline int64_t safe_mul(int64_t a, int b) { return safe_mul_<int64_t>(a,b); }

std::ostream & mosek::fusion::operator<<(std::ostream & os,mosek::fusion::DJCDomainType val)
{
  switch (val)
  {
    case DJCDomainType::EqualTo: os << "DJCDomainType::EqualTo"; break;
    case DJCDomainType::LessThan: os << "DJCDomainType::LessThan"; break;
    case DJCDomainType::GreaterThan: os << "DJCDomainType::GreaterThan"; break;
    case DJCDomainType::IsFree: os << "DJCDomainType::IsFree"; break;
    case DJCDomainType::InRange: os << "DJCDomainType::InRange"; break;
    case DJCDomainType::InQCone: os << "DJCDomainType::InQCone"; break;
    case DJCDomainType::InRotatedQCone: os << "DJCDomainType::InRotatedQCone"; break;
    case DJCDomainType::InPExpCone: os << "DJCDomainType::InPExpCone"; break;
    case DJCDomainType::InPPowCone: os << "DJCDomainType::InPPowCone"; break;
    case DJCDomainType::InDExpCone: os << "DJCDomainType::InDExpCone"; break;
    case DJCDomainType::InDPowCone: os << "DJCDomainType::InDPowCone"; break;
    case DJCDomainType::InOneNormCone: os << "DJCDomainType::InOneNormCone"; break;
    case DJCDomainType::InInfNormCone: os << "DJCDomainType::InInfNormCone"; break;
    case DJCDomainType::InPGeoMeanCone: os << "DJCDomainType::InPGeoMeanCone"; break;
    case DJCDomainType::InDGeoMeanCone: os << "DJCDomainType::InDGeoMeanCone"; break;
    case DJCDomainType::InPSDCone: os << "DJCDomainType::InPSDCone"; break;
    default: os << "DJCDomainType.<invalid>"; break;
  }
  return os;
}
std::ostream & mosek::fusion::operator<<(std::ostream & os,mosek::fusion::StatusKey val)
{
  switch (val)
  {
    case StatusKey::Unknown: os << "StatusKey::Unknown"; break;
    case StatusKey::Basic: os << "StatusKey::Basic"; break;
    case StatusKey::SuperBasic: os << "StatusKey::SuperBasic"; break;
    case StatusKey::OnBound: os << "StatusKey::OnBound"; break;
    case StatusKey::Infinity: os << "StatusKey::Infinity"; break;
    default: os << "StatusKey.<invalid>"; break;
  }
  return os;
}
std::ostream & mosek::fusion::operator<<(std::ostream & os,mosek::fusion::SolutionType val)
{
  switch (val)
  {
    case SolutionType::Default: os << "SolutionType::Default"; break;
    case SolutionType::Basic: os << "SolutionType::Basic"; break;
    case SolutionType::Interior: os << "SolutionType::Interior"; break;
    case SolutionType::Integer: os << "SolutionType::Integer"; break;
    default: os << "SolutionType.<invalid>"; break;
  }
  return os;
}
std::ostream & mosek::fusion::operator<<(std::ostream & os,mosek::fusion::SolverStatus val)
{
  switch (val)
  {
    case SolverStatus::OK: os << "SolverStatus::OK"; break;
    case SolverStatus::Error: os << "SolverStatus::Error"; break;
    case SolverStatus::LostRace: os << "SolverStatus::LostRace"; break;
    default: os << "SolverStatus.<invalid>"; break;
  }
  return os;
}
std::ostream & mosek::fusion::operator<<(std::ostream & os,mosek::fusion::ProblemStatus val)
{
  switch (val)
  {
    case ProblemStatus::Unknown: os << "ProblemStatus::Unknown"; break;
    case ProblemStatus::PrimalAndDualFeasible: os << "ProblemStatus::PrimalAndDualFeasible"; break;
    case ProblemStatus::PrimalFeasible: os << "ProblemStatus::PrimalFeasible"; break;
    case ProblemStatus::DualFeasible: os << "ProblemStatus::DualFeasible"; break;
    case ProblemStatus::PrimalInfeasible: os << "ProblemStatus::PrimalInfeasible"; break;
    case ProblemStatus::DualInfeasible: os << "ProblemStatus::DualInfeasible"; break;
    case ProblemStatus::PrimalAndDualInfeasible: os << "ProblemStatus::PrimalAndDualInfeasible"; break;
    case ProblemStatus::IllPosed: os << "ProblemStatus::IllPosed"; break;
    case ProblemStatus::PrimalInfeasibleOrUnbounded: os << "ProblemStatus::PrimalInfeasibleOrUnbounded"; break;
    default: os << "ProblemStatus.<invalid>"; break;
  }
  return os;
}
std::ostream & mosek::fusion::operator<<(std::ostream & os,mosek::fusion::AccSolutionStatus val)
{
  switch (val)
  {
    case AccSolutionStatus::Anything: os << "AccSolutionStatus::Anything"; break;
    case AccSolutionStatus::Optimal: os << "AccSolutionStatus::Optimal"; break;
    case AccSolutionStatus::Feasible: os << "AccSolutionStatus::Feasible"; break;
    case AccSolutionStatus::Certificate: os << "AccSolutionStatus::Certificate"; break;
    default: os << "AccSolutionStatus.<invalid>"; break;
  }
  return os;
}
std::ostream & mosek::fusion::operator<<(std::ostream & os,mosek::fusion::SolutionStatus val)
{
  switch (val)
  {
    case SolutionStatus::Undefined: os << "SolutionStatus::Undefined"; break;
    case SolutionStatus::Unknown: os << "SolutionStatus::Unknown"; break;
    case SolutionStatus::Optimal: os << "SolutionStatus::Optimal"; break;
    case SolutionStatus::Feasible: os << "SolutionStatus::Feasible"; break;
    case SolutionStatus::Certificate: os << "SolutionStatus::Certificate"; break;
    case SolutionStatus::IllposedCert: os << "SolutionStatus::IllposedCert"; break;
    default: os << "SolutionStatus.<invalid>"; break;
  }
  return os;
}
std::ostream & mosek::fusion::operator<<(std::ostream & os,mosek::fusion::ObjectiveSense val)
{
  switch (val)
  {
    case ObjectiveSense::Undefined: os << "ObjectiveSense::Undefined"; break;
    case ObjectiveSense::Minimize: os << "ObjectiveSense::Minimize"; break;
    case ObjectiveSense::Maximize: os << "ObjectiveSense::Maximize"; break;
    default: os << "ObjectiveSense.<invalid>"; break;
  }
  return os;
}
std::ostream & mosek::fusion::operator<<(std::ostream & os,mosek::fusion::QConeKey val)
{
  switch (val)
  {
    case QConeKey::InQCone: os << "QConeKey::InQCone"; break;
    case QConeKey::InRotatedQCone: os << "QConeKey::InRotatedQCone"; break;
    case QConeKey::InPExpCone: os << "QConeKey::InPExpCone"; break;
    case QConeKey::InPPowCone: os << "QConeKey::InPPowCone"; break;
    case QConeKey::InPPowConeSeq: os << "QConeKey::InPPowConeSeq"; break;
    case QConeKey::InDExpCone: os << "QConeKey::InDExpCone"; break;
    case QConeKey::InDPowCone: os << "QConeKey::InDPowCone"; break;
    case QConeKey::InDPowConeSeq: os << "QConeKey::InDPowConeSeq"; break;
    case QConeKey::InPGeoMeanCone: os << "QConeKey::InPGeoMeanCone"; break;
    case QConeKey::InDGeoMeanCone: os << "QConeKey::InDGeoMeanCone"; break;
    case QConeKey::Positive: os << "QConeKey::Positive"; break;
    case QConeKey::Negative: os << "QConeKey::Negative"; break;
    case QConeKey::Unbounded: os << "QConeKey::Unbounded"; break;
    case QConeKey::Zero: os << "QConeKey::Zero"; break;
    case QConeKey::InPSDCone: os << "QConeKey::InPSDCone"; break;
    case QConeKey::InSVecPSDCone: os << "QConeKey::InSVecPSDCone"; break;
    default: os << "QConeKey.<invalid>"; break;
  }
  return os;
}
std::ostream & mosek::fusion::operator<<(std::ostream & os,mosek::fusion::PSDKey val)
{
  switch (val)
  {
    case PSDKey::IsSymPSD: os << "PSDKey::IsSymPSD"; break;
    case PSDKey::IsTrilPSD: os << "PSDKey::IsTrilPSD"; break;
    default: os << "PSDKey.<invalid>"; break;
  }
  return os;
}
std::ostream & mosek::fusion::operator<<(std::ostream & os,mosek::fusion::RelationKey val)
{
  switch (val)
  {
    case RelationKey::EqualsTo: os << "RelationKey::EqualsTo"; break;
    case RelationKey::LessThan: os << "RelationKey::LessThan"; break;
    case RelationKey::GreaterThan: os << "RelationKey::GreaterThan"; break;
    case RelationKey::IsFree: os << "RelationKey::IsFree"; break;
    case RelationKey::InRange: os << "RelationKey::InRange"; break;
    default: os << "RelationKey.<invalid>"; break;
  }
  return os;
}
// class Disjunction { // @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:350:4-355:5
mosek::fusion::Disjunction::Disjunction(mosek::fusion::p_Disjunction *_impl) : _impl(_impl) { /*std::cout << "Disjunction() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::Disjunction::~Disjunction() { delete _impl; _impl = nullptr; }
mosek::fusion::p_Disjunction::p_Disjunction
  (::mosek::fusion::Disjunction * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.Disjunction.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:352:6-354:7
mosek::fusion::Disjunction::t mosek::fusion::p_Disjunction::_new_Disjunction
  (int64_t _7_id)
{ return new mosek::fusion::Disjunction(_7_id); }
mosek::fusion::Disjunction::Disjunction
  (int64_t _7_id) : 
   Disjunction(new mosek::fusion::p_Disjunction(this))
{ mosek::fusion::p_Disjunction::_get_impl(this)->_initialize(_7_id); }
void mosek::fusion::p_Disjunction::_initialize  (int64_t _7_id)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_Disjunction::_get_impl(::mosek::fusion::Disjunction::t(_pubthis))->id = _7_id;
  }
}
// mosek.fusion.Disjunction.ctor

void mosek::fusion::p_Disjunction::destroy()
{
}
void mosek::fusion::Disjunction::destroy() { mosek::fusion::p_Disjunction::_get_impl(this)->destroy(); }
// } class Disjunction
// class DisjunctionTerms { // @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:321:4-345:5
mosek::fusion::DisjunctionTerms::DisjunctionTerms(mosek::fusion::p_DisjunctionTerms *_impl) : _impl(_impl) { /*std::cout << "DisjunctionTerms() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::DisjunctionTerms::~DisjunctionTerms() { delete _impl; _impl = nullptr; }
mosek::fusion::p_DisjunctionTerms::p_DisjunctionTerms
  (::mosek::fusion::DisjunctionTerms * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.DisjunctionTerms.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:344:6-97
mosek::fusion::DisjunctionTerms::t mosek::fusion::p_DisjunctionTerms::_new_DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _8_terms1,
    monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _9_term)
{ return new mosek::fusion::DisjunctionTerms(_8_terms1,_9_term); }
mosek::fusion::DisjunctionTerms::DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _8_terms1,
    monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _9_term) : 
   DisjunctionTerms(new mosek::fusion::p_DisjunctionTerms(this))
{ mosek::fusion::p_DisjunctionTerms::_get_impl(this)->_initialize(_8_terms1,_9_term); }
void mosek::fusion::p_DisjunctionTerms::_initialize  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _8_terms1,
    monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _9_term)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_DisjunctionTerms::_initialize(_8_terms1,::mosek::fusion::p_DJC::term(_9_term));
  }
}
// mosek.fusion.DisjunctionTerms.ctor

// mosek.fusion.DisjunctionTerms.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:343:6-98
mosek::fusion::DisjunctionTerms::t mosek::fusion::p_DisjunctionTerms::_new_DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _10_terms1,
    monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _11_term)
{ return new mosek::fusion::DisjunctionTerms(_10_terms1,_11_term); }
mosek::fusion::DisjunctionTerms::DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _10_terms1,
    monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _11_term) : 
   DisjunctionTerms(new mosek::fusion::p_DisjunctionTerms(this))
{ mosek::fusion::p_DisjunctionTerms::_get_impl(this)->_initialize(_10_terms1,_11_term); }
void mosek::fusion::p_DisjunctionTerms::_initialize  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _10_terms1,
    monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _11_term)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_DisjunctionTerms::_initialize(_10_terms1,::mosek::fusion::p_DJC::term(_11_term));
  }
}
// mosek.fusion.DisjunctionTerms.ctor

// mosek.fusion.DisjunctionTerms.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:340:6-342:7
mosek::fusion::DisjunctionTerms::t mosek::fusion::p_DisjunctionTerms::_new_DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _12_terms1,
    monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _13_term2)
{ return new mosek::fusion::DisjunctionTerms(_12_terms1,_13_term2); }
mosek::fusion::DisjunctionTerms::DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _12_terms1,
    monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _13_term2) : 
   DisjunctionTerms(new mosek::fusion::p_DisjunctionTerms(this))
{ mosek::fusion::p_DisjunctionTerms::_get_impl(this)->_initialize(_12_terms1,_13_term2); }
void mosek::fusion::p_DisjunctionTerms::_initialize  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _12_terms1,
    monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _13_term2)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_DisjunctionTerms::_initialize(_12_terms1,mosek::fusion::p_DisjunctionTerms::_get_impl(_13_term2)->terms);
  }
}
// mosek.fusion.DisjunctionTerms.ctor

// mosek.fusion.DisjunctionTerms.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:334:6-339:7
mosek::fusion::DisjunctionTerms::t mosek::fusion::p_DisjunctionTerms::_new_DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _14_term1,
    std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _15_term2)
{ return new mosek::fusion::DisjunctionTerms(_14_term1,_15_term2); }
mosek::fusion::DisjunctionTerms::DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _14_term1,
    std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _15_term2) : 
   DisjunctionTerms(new mosek::fusion::p_DisjunctionTerms(this))
{ mosek::fusion::p_DisjunctionTerms::_get_impl(this)->_initialize(_14_term1,_15_term2); }
void mosek::fusion::p_DisjunctionTerms::_initialize  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _14_term1,
    std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _15_term2)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    int32_t _16_n1 = (int)((mosek::fusion::p_DisjunctionTerms::_get_impl(_14_term1)->terms)->size(0));
    terms = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >(monty::shape(safe_add( (int)((mosek::fusion::p_DisjunctionTerms::_get_impl(_14_term1)->terms)->size(0)),(int)((_15_term2)->size(0)) ))));
    {
      int32_t _17_i = (int)0;
      for(;(_17_i < (int)((mosek::fusion::p_DisjunctionTerms::_get_impl(_14_term1)->terms)->size(0)));++ _17_i)
      {
        {
          ((*terms)(_17_i)) = ((*mosek::fusion::p_DisjunctionTerms::_get_impl(_14_term1)->terms)(_17_i));
        }
      }
    }
    {
      int32_t _18_i = (int)0;
      for(;(_18_i < (int)((_15_term2)->size(0)));++ _18_i)
      {
        {
          ((*terms)(safe_add( _18_i,_16_n1 ))) = ((*_15_term2)(_18_i));
        }
      }
    }
  }
}
// mosek.fusion.DisjunctionTerms.ctor

// mosek.fusion.DisjunctionTerms.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:329:6-333:7
mosek::fusion::DisjunctionTerms::t mosek::fusion::p_DisjunctionTerms::_new_DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _19_term1,
    monty::rc_ptr< ::mosek::fusion::Term > _20_term2)
{ return new mosek::fusion::DisjunctionTerms(_19_term1,_20_term2); }
mosek::fusion::DisjunctionTerms::DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _19_term1,
    monty::rc_ptr< ::mosek::fusion::Term > _20_term2) : 
   DisjunctionTerms(new mosek::fusion::p_DisjunctionTerms(this))
{ mosek::fusion::p_DisjunctionTerms::_get_impl(this)->_initialize(_19_term1,_20_term2); }
void mosek::fusion::p_DisjunctionTerms::_initialize  (monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _19_term1,
    monty::rc_ptr< ::mosek::fusion::Term > _20_term2)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    terms = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >(monty::shape(safe_add( (int)((mosek::fusion::p_DisjunctionTerms::_get_impl(_19_term1)->terms)->size(0)),(int)1 ))));
    {
      int32_t _21_i = (int)0;
      for(;(_21_i < (int)((mosek::fusion::p_DisjunctionTerms::_get_impl(_19_term1)->terms)->size(0)));++ _21_i)
      {
        {
          ((*terms)(_21_i)) = ((*mosek::fusion::p_DisjunctionTerms::_get_impl(_19_term1)->terms)(_21_i));
        }
      }
    }
    ((*terms)((int)((mosek::fusion::p_DisjunctionTerms::_get_impl(_19_term1)->terms)->size(0)))) = _20_term2;
  }
}
// mosek.fusion.DisjunctionTerms.ctor

// mosek.fusion.DisjunctionTerms.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:326:6-328:7
mosek::fusion::DisjunctionTerms::t mosek::fusion::p_DisjunctionTerms::_new_DisjunctionTerms
  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _22_terms)
{ return new mosek::fusion::DisjunctionTerms(_22_terms); }
mosek::fusion::DisjunctionTerms::DisjunctionTerms
  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _22_terms) : 
   DisjunctionTerms(new mosek::fusion::p_DisjunctionTerms(this))
{ mosek::fusion::p_DisjunctionTerms::_get_impl(this)->_initialize(_22_terms); }
void mosek::fusion::p_DisjunctionTerms::_initialize  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _22_terms)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    std::vector<monty::rc_ptr< ::mosek::fusion::Term >> _9282_;
    for (int32_t _23_i = (int)0, _9283_ = (int)((_22_terms)->size(0)); _23_i < _9283_ ; ++_23_i)
    {
      _9282_.push_back(((*_22_terms)(_23_i)));
    }
    auto _9284_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >(monty::shape(_9282_.size()),_9282_.begin(),_9282_.end()));
    mosek::fusion::p_DisjunctionTerms::_get_impl(::mosek::fusion::DisjunctionTerms::t(_pubthis))->terms = _9284_;
  }
}
// mosek.fusion.DisjunctionTerms.ctor

// mosek.fusion.DisjunctionTerms.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:325:6-79
mosek::fusion::DisjunctionTerms::t mosek::fusion::p_DisjunctionTerms::_new_DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _24_term)
{ return new mosek::fusion::DisjunctionTerms(_24_term); }
mosek::fusion::DisjunctionTerms::DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _24_term) : 
   DisjunctionTerms(new mosek::fusion::p_DisjunctionTerms(this))
{ mosek::fusion::p_DisjunctionTerms::_get_impl(this)->_initialize(_24_term); }
void mosek::fusion::p_DisjunctionTerms::_initialize  (monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _24_term)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    terms = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >{::monty::rc_ptr<::mosek::fusion::Term>(::mosek::fusion::p_DJC::term(_24_term).get())});
  }
}
// mosek.fusion.DisjunctionTerms.ctor

// mosek.fusion.DisjunctionTerms.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:323:6-80
mosek::fusion::DisjunctionTerms::t mosek::fusion::p_DisjunctionTerms::_new_DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _25_term)
{ return new mosek::fusion::DisjunctionTerms(_25_term); }
mosek::fusion::DisjunctionTerms::DisjunctionTerms
  (monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _25_term) : 
   DisjunctionTerms(new mosek::fusion::p_DisjunctionTerms(this))
{ mosek::fusion::p_DisjunctionTerms::_get_impl(this)->_initialize(_25_term); }
void mosek::fusion::p_DisjunctionTerms::_initialize  (monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _25_term)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    terms = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >{::monty::rc_ptr<::mosek::fusion::Term>(::mosek::fusion::p_DJC::term(_25_term).get())});
  }
}
// mosek.fusion.DisjunctionTerms.ctor

void mosek::fusion::p_DisjunctionTerms::destroy()
{
  terms.reset();
}
void mosek::fusion::DisjunctionTerms::destroy() { mosek::fusion::p_DisjunctionTerms::_get_impl(this)->destroy(); }
// } class DisjunctionTerms
// class Term { // @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:243:4-317:5
mosek::fusion::Term::Term(mosek::fusion::p_Term *_impl) : _impl(_impl) { /*std::cout << "Term() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::Term::~Term() { delete _impl; _impl = nullptr; }
mosek::fusion::p_Term::p_Term
  (::mosek::fusion::Term * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.Term.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:261:6-269:7
mosek::fusion::Term::t mosek::fusion::p_Term::_new_Term
  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _26_elist,
    std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::DJCDomain >,1 > > _27_dlist)
{ return new mosek::fusion::Term(_26_elist,_27_dlist); }
mosek::fusion::Term::Term
  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _26_elist,
    std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::DJCDomain >,1 > > _27_dlist) : 
   Term(new mosek::fusion::p_Term(this))
{ mosek::fusion::p_Term::_get_impl(this)->_initialize(_26_elist,_27_dlist); }
void mosek::fusion::p_Term::_initialize  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _26_elist,
    std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::DJCDomain >,1 > > _27_dlist)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    int32_t _28_n = (int)((_26_elist)->size(0));
    exprs = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >(monty::shape(_28_n)));
    domains = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::DJCDomain >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::DJCDomain >,1 >(monty::shape(_28_n)));
    int32_t _9285_ = (int)0;
    int32_t _9286_ = _28_n;
    for (int32_t _29_i = _9285_; _29_i < _9286_; ++_29_i)
    {
      {
        ((*exprs)(_29_i)) = ((*_26_elist)(_29_i));
        ((*domains)(_29_i)) = ((*_27_dlist)(_29_i));
      }
    }
  }
}
// mosek.fusion.Term.ctor

// mosek.fusion.Term.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:259:6-90
mosek::fusion::Term::t mosek::fusion::p_Term::_new_Term
  (monty::rc_ptr< ::mosek::fusion::Expression > _30_e,
    monty::rc_ptr< ::mosek::fusion::DJCDomain > _31_d)
{ return new mosek::fusion::Term(_30_e,_31_d); }
mosek::fusion::Term::Term
  (monty::rc_ptr< ::mosek::fusion::Expression > _30_e,
    monty::rc_ptr< ::mosek::fusion::DJCDomain > _31_d) : 
   Term(new mosek::fusion::p_Term(this))
{ mosek::fusion::p_Term::_get_impl(this)->_initialize(_30_e,_31_d); }
void mosek::fusion::p_Term::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _30_e,
    monty::rc_ptr< ::mosek::fusion::DJCDomain > _31_d)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    exprs = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_30_e.get())});
    domains = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::DJCDomain >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::DJCDomain >,1 >{::monty::rc_ptr<::mosek::fusion::DJCDomain>(_31_d.get())});
  }
}
// mosek.fusion.Term.ctor

// mosek.fusion.Term.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:247:6-255:7
mosek::fusion::Term::t mosek::fusion::p_Term::_new_Term
  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::SimpleTerm >,1 > > _32_t)
{ return new mosek::fusion::Term(_32_t); }
mosek::fusion::Term::Term
  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::SimpleTerm >,1 > > _32_t) : 
   Term(new mosek::fusion::p_Term(this))
{ mosek::fusion::p_Term::_get_impl(this)->_initialize(_32_t); }
void mosek::fusion::p_Term::_initialize  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::SimpleTerm >,1 > > _32_t)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    int32_t _33_n = (int)((_32_t)->size(0));
    exprs = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >(monty::shape(_33_n)));
    domains = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::DJCDomain >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::DJCDomain >,1 >(monty::shape(_33_n)));
    int32_t _9287_ = (int)0;
    int32_t _9288_ = _33_n;
    for (int32_t _34_i = _9287_; _34_i < _9288_; ++_34_i)
    {
      {
        ((*exprs)(_34_i)) = ((*mosek::fusion::p_Term::_get_impl(((*_32_t)(_34_i)))->exprs)((int)0));
        ((*domains)(_34_i)) = ((*mosek::fusion::p_Term::_get_impl(((*_32_t)(_34_i)))->domains)((int)0));
      }
    }
  }
}
// mosek.fusion.Term.ctor

// Begin mosek.fusion.Term.numaccterms
// Method mosek.fusion.Term.numaccterms @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:316:6-128
int32_t mosek::fusion::p_Term::numaccterms()
{
  int32_t _35_n = (int)0;
  int32_t _9289_ = (int)0;
  int32_t _9290_ = (int)((domains)->size(0));
  for (int32_t _36_i = _9289_; _36_i < _9290_; ++_36_i)
  {
    {
      _35_n += mosek::fusion::p_DJCDomain::_get_impl(((*domains)(_36_i)).get())->numaccterms();
    }
  }
  return _35_n;
}
// End mosek.fusion.Term.numaccterms

// Begin mosek.fusion.Term.numaccrows
// Method mosek.fusion.Term.numaccrows @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:315:6-127
int32_t mosek::fusion::p_Term::numaccrows()
{
  int32_t _37_n = (int)0;
  int32_t _9291_ = (int)0;
  int32_t _9292_ = (int)((domains)->size(0));
  for (int32_t _38_i = _9291_; _38_i < _9292_; ++_38_i)
  {
    {
      _37_n += mosek::fusion::p_DJCDomain::_get_impl(((*domains)(_38_i)).get())->numaccrows();
    }
  }
  return _37_n;
}
// End mosek.fusion.Term.numaccrows

// Begin mosek.fusion.Term.num
// Method mosek.fusion.Term.num @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:314:6-67
int32_t mosek::fusion::p_Term::num()
{
  return (int)((domains)->size(0));
}
// End mosek.fusion.Term.num

// Begin mosek.fusion.Term.size
// Method mosek.fusion.Term.size @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:313:6-121
int32_t mosek::fusion::Term :: size() { return mosek::fusion::p_Term::_get_impl(this)->size(); }
int32_t mosek::fusion::p_Term::size()
{
  int32_t _39_s = (int)0;
  int32_t _9293_ = (int)0;
  int32_t _9294_ = (int)((domains)->size(0));
  for (int32_t _40_i = _9293_; _40_i < _9294_; ++_40_i)
  {
    {
      _39_s += ((*domains)(_40_i))->size();
    }
  }
  return _39_s;
}
// End mosek.fusion.Term.size

// Begin mosek.fusion.Term.toDJCTerm
// Method mosek.fusion.Term.toDJCTerm @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:257:6-53
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::Term :: __mosek_2fusion_2Term__toDJCTerm() { return mosek::fusion::p_Term::_get_impl(this)->__mosek_2fusion_2Term__toDJCTerm(); }
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::Term::toDJCTerm() { return __mosek_2fusion_2Term__toDJCTerm(); }
/* override: mosek.fusion.ExprDomain.toDJCTerm*/
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::Term::__mosek_2fusion_2ExprDomain__toDJCTerm() { return __mosek_2fusion_2Term__toDJCTerm(); }
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::p_Term::__mosek_2fusion_2Term__toDJCTerm()
{
  return ::mosek::fusion::Term::t(_pubthis);
}
// End mosek.fusion.Term.toDJCTerm

void mosek::fusion::p_Term::destroy()
{
  domains.reset();
  exprs.reset();
}
void mosek::fusion::Term::destroy() { mosek::fusion::p_Term::_get_impl(this)->destroy(); }
// } class Term
// class SimpleTerm { // @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:228:4-230:5
mosek::fusion::SimpleTerm::SimpleTerm(mosek::fusion::p_SimpleTerm *_impl) : mosek::fusion::Term(_impl) { /*std::cout << "SimpleTerm()" << this << std::endl; */ }
mosek::fusion::SimpleTerm::~SimpleTerm() {  /* std::cout << "~SimpleTerm()" << this << std::endl << std::flush; */ }
mosek::fusion::p_SimpleTerm::p_SimpleTerm
  (::mosek::fusion::SimpleTerm * _pubthis) :     mosek::fusion::p_Term(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.SimpleTerm.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:229:6-64
mosek::fusion::SimpleTerm::t mosek::fusion::p_SimpleTerm::_new_SimpleTerm
  (monty::rc_ptr< ::mosek::fusion::Expression > _41_e,
    monty::rc_ptr< ::mosek::fusion::DJCDomain > _42_d)
{ return new mosek::fusion::SimpleTerm(_41_e,_42_d); }
mosek::fusion::SimpleTerm::SimpleTerm
  (monty::rc_ptr< ::mosek::fusion::Expression > _41_e,
    monty::rc_ptr< ::mosek::fusion::DJCDomain > _42_d) : 
   SimpleTerm(new mosek::fusion::p_SimpleTerm(this))
{ mosek::fusion::p_SimpleTerm::_get_impl(this)->_initialize(_41_e,_42_d); }
void mosek::fusion::p_SimpleTerm::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _41_e,
    monty::rc_ptr< ::mosek::fusion::DJCDomain > _42_d)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_Term::_initialize(_41_e,_42_d);
  }
}
// mosek.fusion.SimpleTerm.ctor

void mosek::fusion::p_SimpleTerm::destroy()
{
}
void mosek::fusion::SimpleTerm::destroy() { mosek::fusion::p_SimpleTerm::_get_impl(this)->destroy(); }
// } class SimpleTerm
// class DJCDomain { // @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:171:4-217:5
mosek::fusion::DJCDomain::DJCDomain(mosek::fusion::p_DJCDomain *_impl) : _impl(_impl) { /*std::cout << "DJCDomain() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::DJCDomain::~DJCDomain() { delete _impl; _impl = nullptr; }
mosek::fusion::p_DJCDomain::p_DJCDomain
  (::mosek::fusion::DJCDomain * _pubthis) :     _pubthis(_pubthis)
{}
mosek::fusion::DJCDomainType mosek::fusion::DJCDomain::get_dom() { return _impl->dom; }
void mosek::fusion::DJCDomain::set_dom(mosek::fusion::DJCDomainType _val) { _impl->dom = _val; }
int32_t mosek::fusion::DJCDomain::get_conedim() { return _impl->conedim; }
void mosek::fusion::DJCDomain::set_conedim(int32_t _val) { _impl->conedim = _val; }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::DJCDomain::get_shape() { return _impl->shape; }
void mosek::fusion::DJCDomain::set_shape(std::shared_ptr< monty::ndarray< int32_t,1 > > _val) { _impl->shape = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::DJCDomain::get_par() { return _impl->par; }
void mosek::fusion::DJCDomain::set_par(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->par = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::DJCDomain::get_b() { return _impl->b; }
void mosek::fusion::DJCDomain::set_b(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->b = _val; }
// mosek.fusion.DJCDomain.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:190:6-199:7
mosek::fusion::DJCDomain::t mosek::fusion::p_DJCDomain::_new_DJCDomain
  (std::shared_ptr< monty::ndarray< double,1 > > _43_b_,
    std::shared_ptr< monty::ndarray< double,1 > > _44_par_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _45_shape_,
    mosek::fusion::DJCDomainType _46_dom_)
{ return new mosek::fusion::DJCDomain(_43_b_,_44_par_,_45_shape_,_46_dom_); }
mosek::fusion::DJCDomain::DJCDomain
  (std::shared_ptr< monty::ndarray< double,1 > > _43_b_,
    std::shared_ptr< monty::ndarray< double,1 > > _44_par_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _45_shape_,
    mosek::fusion::DJCDomainType _46_dom_) : 
   DJCDomain(new mosek::fusion::p_DJCDomain(this))
{ mosek::fusion::p_DJCDomain::_get_impl(this)->_initialize(_43_b_,_44_par_,_45_shape_,_46_dom_); }
void mosek::fusion::p_DJCDomain::_initialize  (std::shared_ptr< monty::ndarray< double,1 > > _43_b_,
    std::shared_ptr< monty::ndarray< double,1 > > _44_par_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _45_shape_,
    mosek::fusion::DJCDomainType _46_dom_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__43_b_(_43_b_ ? _43_b_->raw() : nullptr, _43_b_ ? _43_b_->size(0) : 0);
    _checked_ptr_1<double> _ptr__44_par_(_44_par_ ? _44_par_->raw() : nullptr, _44_par_ ? _44_par_->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__45_shape_(_45_shape_ ? _45_shape_->raw() : nullptr, _45_shape_ ? _45_shape_->size(0) : 0);
    b = _43_b_;
    par = _44_par_;
    shape = _45_shape_;
    dom = _46_dom_;
    conedim = ((int)((_45_shape_)->size(0)) - (int)1);
  }
}
// mosek.fusion.DJCDomain.ctor

// mosek.fusion.DJCDomain.ctor @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:178:6-188:7
mosek::fusion::DJCDomain::t mosek::fusion::p_DJCDomain::_new_DJCDomain
  (std::shared_ptr< monty::ndarray< double,1 > > _47_b_,
    std::shared_ptr< monty::ndarray< double,1 > > _48_par_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _49_shape_,
    int32_t _50_conedim_,
    mosek::fusion::DJCDomainType _51_dom_)
{ return new mosek::fusion::DJCDomain(_47_b_,_48_par_,_49_shape_,_50_conedim_,_51_dom_); }
mosek::fusion::DJCDomain::DJCDomain
  (std::shared_ptr< monty::ndarray< double,1 > > _47_b_,
    std::shared_ptr< monty::ndarray< double,1 > > _48_par_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _49_shape_,
    int32_t _50_conedim_,
    mosek::fusion::DJCDomainType _51_dom_) : 
   DJCDomain(new mosek::fusion::p_DJCDomain(this))
{ mosek::fusion::p_DJCDomain::_get_impl(this)->_initialize(_47_b_,_48_par_,_49_shape_,_50_conedim_,_51_dom_); }
void mosek::fusion::p_DJCDomain::_initialize  (std::shared_ptr< monty::ndarray< double,1 > > _47_b_,
    std::shared_ptr< monty::ndarray< double,1 > > _48_par_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _49_shape_,
    int32_t _50_conedim_,
    mosek::fusion::DJCDomainType _51_dom_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__47_b_(_47_b_ ? _47_b_->raw() : nullptr, _47_b_ ? _47_b_->size(0) : 0);
    _checked_ptr_1<double> _ptr__48_par_(_48_par_ ? _48_par_->raw() : nullptr, _48_par_ ? _48_par_->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__49_shape_(_49_shape_ ? _49_shape_->raw() : nullptr, _49_shape_ ? _49_shape_->size(0) : 0);
    b = _47_b_;
    par = _48_par_;
    shape = _49_shape_;
    dom = _51_dom_;
    conedim = _50_conedim_;
  }
}
// mosek.fusion.DJCDomain.ctor

// Begin mosek.fusion.DJCDomain.numaccterms
// Method mosek.fusion.DJCDomain.numaccterms @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:211:6-216:7
int32_t mosek::fusion::p_DJCDomain::numaccterms()
{
  if ((dom == ::mosek::fusion::DJCDomainType::InRange))
  {
    {
      return (int)2;
    }
  }
  else
  {
    {
      return (int)1;
    }
  }
}
// End mosek.fusion.DJCDomain.numaccterms

// Begin mosek.fusion.DJCDomain.numaccrows
// Method mosek.fusion.DJCDomain.numaccrows @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:205:6-210:7
int32_t mosek::fusion::p_DJCDomain::numaccrows()
{
  if ((dom == ::mosek::fusion::DJCDomainType::InRange))
  {
    {
      return safe_mul( _pubthis->size(),(int)2 );
    }
  }
  else
  {
    {
      return _pubthis->size();
    }
  }
}
// End mosek.fusion.DJCDomain.numaccrows

// Begin mosek.fusion.DJCDomain.size
// Method mosek.fusion.DJCDomain.size @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:201:6-204:7
int32_t mosek::fusion::DJCDomain :: size() { return mosek::fusion::p_DJCDomain::_get_impl(this)->size(); }
int32_t mosek::fusion::p_DJCDomain::size()
{
  int32_t _52_s = (int)1;
  int32_t _9295_ = (int)0;
  int32_t _9296_ = (int)((shape)->size(0));
  for (int32_t _53_i = _9295_; _53_i < _9296_; ++_53_i)
  {
    {
      _52_s *= ((*shape)(_53_i));
    }
  }
  return _52_s;
}
// End mosek.fusion.DJCDomain.size

void mosek::fusion::p_DJCDomain::destroy()
{
  shape.reset();
  par.reset();
  b.reset();
}
void mosek::fusion::DJCDomain::destroy() { mosek::fusion::p_DJCDomain::_get_impl(this)->destroy(); }
// } class DJCDomain
// class DJC { // @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:32:4-139:5
mosek::fusion::DJC::DJC(mosek::fusion::p_DJC *_impl) : _impl(_impl) { /*std::cout << "DJC() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::DJC::~DJC() { delete _impl; _impl = nullptr; }
mosek::fusion::p_DJC::p_DJC
  (::mosek::fusion::DJC * _pubthis) :     _pubthis(_pubthis)
{}
// Begin mosek.fusion.DJC.ANDFromTerms
// Method mosek.fusion.DJC.ANDFromTerms @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:121:6-137:7
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::DJC::ANDFromTerms
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _54_tlist) { return mosek::fusion::p_DJC::ANDFromTerms(_54_tlist); }
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::p_DJC::ANDFromTerms(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _54_tlist)
{
  int32_t _55_n = (int)0;
  int32_t _9297_ = (int)0;
  int32_t _9298_ = (int)((_54_tlist)->size(0));
  for (int32_t _56_i = _9297_; _56_i < _9298_; ++_56_i)
  {
    {
      _55_n += mosek::fusion::p_Term::_get_impl(((*_54_tlist)(_56_i)).get())->num();
    }
  }
  std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _57_el = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >(monty::shape(_55_n)));
  std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::DJCDomain >,1 > > _58_dl = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::DJCDomain >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::DJCDomain >,1 >(monty::shape(_55_n)));
  _55_n = (int)0;
  int32_t _9299_ = (int)0;
  int32_t _9300_ = (int)((_54_tlist)->size(0));
  for (int32_t _59_i = _9299_; _59_i < _9300_; ++_59_i)
  {
    {
      int32_t _9301_ = (int)0;
      int32_t _9302_ = mosek::fusion::p_Term::_get_impl(((*_54_tlist)(_59_i)).get())->num();
      for (int32_t _60_j = _9301_; _60_j < _9302_; ++_60_j)
      {
        {
          ((*_57_el)(_55_n)) = ((*mosek::fusion::p_Term::_get_impl(((*_54_tlist)(_59_i)))->exprs)(_60_j));
          ((*_58_dl)(_55_n)) = ((*mosek::fusion::p_Term::_get_impl(((*_54_tlist)(_59_i)))->domains)(_60_j));
          _55_n += (int)1;
        }
      }
    }
  }
  return ::mosek::fusion::p_Term::_new_Term(_57_el,_58_dl);
}
// End mosek.fusion.DJC.ANDFromTerms

// Begin mosek.fusion.DJC.AND
// Method mosek.fusion.DJC.AND @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:116:6-136
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::DJC::AND
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ExprDomain >,1 > > _61_elist) { return mosek::fusion::p_DJC::AND(_61_elist); }
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::p_DJC::AND(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ExprDomain >,1 > > _61_elist)
{
  std::vector<monty::rc_ptr< ::mosek::fusion::Term >> _9303_;
  for (int32_t _62_i = (int)0, _9304_ = (int)((_61_elist)->size(0)); _62_i < _9304_ ; ++_62_i)
  {
    _9303_.push_back(((*_61_elist)(_62_i))->__mosek_2fusion_2ExprDomain__toDJCTerm());
  }
  auto _9305_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >(monty::shape(_9303_.size()),_9303_.begin(),_9303_.end()));
  return ::mosek::fusion::p_DJC::ANDFromTerms(_9305_);
}
// End mosek.fusion.DJC.AND

// Begin mosek.fusion.DJC.AND
// Method mosek.fusion.DJC.AND @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:114:6-114
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::DJC::AND
  ( monty::rc_ptr< ::mosek::fusion::SimpleTerm > _63_s1,
    monty::rc_ptr< ::mosek::fusion::SimpleTerm > _64_s2,
    monty::rc_ptr< ::mosek::fusion::SimpleTerm > _65_s3) { return mosek::fusion::p_DJC::AND(_63_s1,_64_s2,_65_s3); }
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::p_DJC::AND(monty::rc_ptr< ::mosek::fusion::SimpleTerm > _63_s1,monty::rc_ptr< ::mosek::fusion::SimpleTerm > _64_s2,monty::rc_ptr< ::mosek::fusion::SimpleTerm > _65_s3)
{
  return ::mosek::fusion::p_DJC::AND(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::SimpleTerm >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::SimpleTerm >,1 >{::monty::rc_ptr<::mosek::fusion::SimpleTerm>(_63_s1.get()),::monty::rc_ptr<::mosek::fusion::SimpleTerm>(_64_s2.get()),::monty::rc_ptr<::mosek::fusion::SimpleTerm>(_65_s3.get())}));
}
// End mosek.fusion.DJC.AND

// Begin mosek.fusion.DJC.AND
// Method mosek.fusion.DJC.AND @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:113:6-96
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::DJC::AND
  ( monty::rc_ptr< ::mosek::fusion::SimpleTerm > _66_s1,
    monty::rc_ptr< ::mosek::fusion::SimpleTerm > _67_s2) { return mosek::fusion::p_DJC::AND(_66_s1,_67_s2); }
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::p_DJC::AND(monty::rc_ptr< ::mosek::fusion::SimpleTerm > _66_s1,monty::rc_ptr< ::mosek::fusion::SimpleTerm > _67_s2)
{
  return ::mosek::fusion::p_DJC::AND(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::SimpleTerm >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::SimpleTerm >,1 >{::monty::rc_ptr<::mosek::fusion::SimpleTerm>(_66_s1.get()),::monty::rc_ptr<::mosek::fusion::SimpleTerm>(_67_s2.get())}));
}
// End mosek.fusion.DJC.AND

// Begin mosek.fusion.DJC.AND
// Method mosek.fusion.DJC.AND @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:112:6-78
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::DJC::AND
  ( monty::rc_ptr< ::mosek::fusion::SimpleTerm > _68_s1) { return mosek::fusion::p_DJC::AND(_68_s1); }
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::p_DJC::AND(monty::rc_ptr< ::mosek::fusion::SimpleTerm > _68_s1)
{
  return ::mosek::fusion::p_DJC::AND(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::SimpleTerm >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::SimpleTerm >,1 >{::monty::rc_ptr<::mosek::fusion::SimpleTerm>(_68_s1.get())}));
}
// End mosek.fusion.DJC.AND

// Begin mosek.fusion.DJC.AND
// Method mosek.fusion.DJC.AND @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:111:6-84
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::DJC::AND
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::SimpleTerm >,1 > > _69_slist) { return mosek::fusion::p_DJC::AND(_69_slist); }
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::p_DJC::AND(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::SimpleTerm >,1 > > _69_slist)
{
  return ::mosek::fusion::p_Term::_new_Term(_69_slist);
}
// End mosek.fusion.DJC.AND

// Begin mosek.fusion.DJC.term
// Method mosek.fusion.DJC.term @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:80:6-109:7
monty::rc_ptr< ::mosek::fusion::SimpleTerm > mosek::fusion::DJC::term
  ( monty::rc_ptr< ::mosek::fusion::Expression > _70_expr,
    monty::rc_ptr< ::mosek::fusion::RangeDomain > _71_dom) { return mosek::fusion::p_DJC::term(_70_expr,_71_dom); }
monty::rc_ptr< ::mosek::fusion::SimpleTerm > mosek::fusion::p_DJC::term(monty::rc_ptr< ::mosek::fusion::Expression > _70_expr,monty::rc_ptr< ::mosek::fusion::RangeDomain > _71_dom)
{
  if ((NULL != mosek::fusion::p_RangeDomain::_get_impl(_71_dom)->sparsity.get()))
  {
    {
      throw ::mosek::fusion::DomainError(std::string ("Sparse domain is not acceptable in disjunctive constraints"));
    }
  }
  {}
  if (mosek::fusion::p_RangeDomain::_get_impl(_71_dom)->cardinal_flag)
  {
    {
      throw ::mosek::fusion::DomainError(std::string ("Integer domain is not acceptable in disjunctive constraints"));
    }
  }
  {}
  std::shared_ptr< monty::ndarray< double,1 > > _72_domlb = mosek::fusion::p_RangeDomain::_get_impl(_71_dom)->lb;
  _checked_ptr_1<double> _ptr__72_domlb(_72_domlb ? _72_domlb->raw() : nullptr,_72_domlb ? _72_domlb->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _73_domub = mosek::fusion::p_RangeDomain::_get_impl(_71_dom)->ub;
  _checked_ptr_1<double> _ptr__73_domub(_73_domub ? _73_domub->raw() : nullptr,_73_domub ? _73_domub->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _74_eshape = _70_expr->getShape();
  _checked_ptr_1<int32_t> _ptr__74_eshape(_74_eshape ? _74_eshape->raw() : nullptr,_74_eshape ? _74_eshape->size(0) : 0);
  int64_t _75_esize = _70_expr->getSize();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _76_shape = mosek::fusion::p_RangeDomain::_get_impl(_71_dom)->shape;
  _checked_ptr_1<int32_t> _ptr__76_shape(_76_shape ? _76_shape->raw() : nullptr,_76_shape ? _76_shape->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _77_bl;
  _checked_ptr_1<double> _ptr__77_bl(_77_bl ? _77_bl->raw() : nullptr,_77_bl ? _77_bl->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _78_bu;
  _checked_ptr_1<double> _ptr__78_bu(_78_bu ? _78_bu->raw() : nullptr,_78_bu ? _78_bu->size(0) : 0);
  if ((NULL == _76_shape.get()))
  {
    {
      _76_shape = _74_eshape;
      _ptr__76_shape.update(_76_shape ? _76_shape->raw() : nullptr, _76_shape ? _76_shape->size(0) : 0);
    }
  }
  else
  {
    {
      if (((int)((_76_shape)->size(0)) != (int)((_74_eshape)->size(0))))
      {
        {
          throw ::mosek::fusion::DomainError(std::string ("Mismatching shapes"));
        }
      }
      else
      {
        {
          int32_t _9306_ = (int)0;
          int32_t _9307_ = (int)((_76_shape)->size(0));
          for (int32_t _79_i = _9306_; _79_i < _9307_; ++_79_i)
          {
            {
              if ((_ptr__76_shape[_79_i] != _ptr__74_eshape[_79_i]))
              {
                {
                  throw ::mosek::fusion::DomainError(std::string ("Mismatching shapes"));
                }
              }
              {}
            }
          }
        }
      }
    }
  }
  if (mosek::fusion::p_RangeDomain::_get_impl(_71_dom)->scalable)
  {
    {
      std::vector<double> _9308_;
      for (int64_t _80_i = (int)0, _9309_ = _75_esize; _80_i < _9309_ ; ++_80_i)
      {
        _9308_.push_back(_ptr__72_domlb[(int)0]);
      }
      auto _9310_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_9308_.size()),_9308_.begin(),_9308_.end()));
      _77_bl = _9310_;
      _ptr__77_bl.update(_77_bl ? _77_bl->raw() : nullptr, _77_bl ? _77_bl->size(0) : 0);
      std::vector<double> _9311_;
      for (int64_t _81_i = (int)0, _9312_ = _75_esize; _81_i < _9312_ ; ++_81_i)
      {
        _9311_.push_back(_ptr__73_domub[(int)0]);
      }
      auto _9313_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_9311_.size()),_9311_.begin(),_9311_.end()));
      _78_bu = _9313_;
      _ptr__78_bu.update(_78_bu ? _78_bu->raw() : nullptr, _78_bu ? _78_bu->size(0) : 0);
    }
  }
  else
  {
    {
      _77_bl = _72_domlb;
      _ptr__77_bl.update(_77_bl ? _77_bl->raw() : nullptr, _77_bl ? _77_bl->size(0) : 0);
      _78_bu = _73_domub;
      _ptr__78_bu.update(_78_bu ? _78_bu->raw() : nullptr, _78_bu ? _78_bu->size(0) : 0);
    }
  }
  return ::mosek::fusion::p_SimpleTerm::_new_SimpleTerm(_70_expr,::mosek::fusion::p_DJCDomain::_new_DJCDomain(_77_bl,_78_bu,_76_shape,::mosek::fusion::DJCDomainType::InRange));
}
// End mosek.fusion.DJC.term

// Begin mosek.fusion.DJC.term
// Method mosek.fusion.DJC.term @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:78:6-105
monty::rc_ptr< ::mosek::fusion::SimpleTerm > mosek::fusion::DJC::term
  ( monty::rc_ptr< ::mosek::fusion::Variable > _82_x,
    monty::rc_ptr< ::mosek::fusion::RangeDomain > _83_dom) { return mosek::fusion::p_DJC::term(_82_x,_83_dom); }
monty::rc_ptr< ::mosek::fusion::SimpleTerm > mosek::fusion::p_DJC::term(monty::rc_ptr< ::mosek::fusion::Variable > _82_x,monty::rc_ptr< ::mosek::fusion::RangeDomain > _83_dom)
{
  return ::mosek::fusion::p_DJC::term(_82_x->__mosek_2fusion_2Variable__asExpr(),_83_dom);
}
// End mosek.fusion.DJC.term

// Begin mosek.fusion.DJC.term
// Method mosek.fusion.DJC.term @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:76:6-110
monty::rc_ptr< ::mosek::fusion::SimpleTerm > mosek::fusion::DJC::term
  ( monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _84_exprdom) { return mosek::fusion::p_DJC::term(_84_exprdom); }
monty::rc_ptr< ::mosek::fusion::SimpleTerm > mosek::fusion::p_DJC::term(monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _84_exprdom)
{
  return ::mosek::fusion::p_DJC::term(mosek::fusion::p_ExprRangeDomain::_get_impl(_84_exprdom)->expr,mosek::fusion::p_ExprRangeDomain::_get_impl(_84_exprdom)->dom);
}
// End mosek.fusion.DJC.term

// Begin mosek.fusion.DJC.term
// Method mosek.fusion.DJC.term @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:41:6-73:7
monty::rc_ptr< ::mosek::fusion::SimpleTerm > mosek::fusion::DJC::term
  ( monty::rc_ptr< ::mosek::fusion::Expression > _85_expr,
    monty::rc_ptr< ::mosek::fusion::LinearDomain > _86_dom) { return mosek::fusion::p_DJC::term(_85_expr,_86_dom); }
monty::rc_ptr< ::mosek::fusion::SimpleTerm > mosek::fusion::p_DJC::term(monty::rc_ptr< ::mosek::fusion::Expression > _85_expr,monty::rc_ptr< ::mosek::fusion::LinearDomain > _86_dom)
{
  if ((NULL != mosek::fusion::p_LinearDomain::_get_impl(_86_dom)->sparsity.get()))
  {
    {
      throw ::mosek::fusion::DomainError(std::string ("Sparse domain is not acceptable in disjunctive constraints"));
    }
  }
  {}
  if (mosek::fusion::p_LinearDomain::_get_impl(_86_dom)->cardinal_flag)
  {
    {
      throw ::mosek::fusion::DomainError(std::string ("Integer domain is not acceptable in disjunctive constraints"));
    }
  }
  {}
  std::shared_ptr< monty::ndarray< double,1 > > _87_dombnd = mosek::fusion::p_LinearDomain::_get_impl(_86_dom)->bnd;
  _checked_ptr_1<double> _ptr__87_dombnd(_87_dombnd ? _87_dombnd->raw() : nullptr,_87_dombnd ? _87_dombnd->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _88_eshape = _85_expr->getShape();
  _checked_ptr_1<int32_t> _ptr__88_eshape(_88_eshape ? _88_eshape->raw() : nullptr,_88_eshape ? _88_eshape->size(0) : 0);
  int64_t _89_esize = _85_expr->getSize();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _90_shape = mosek::fusion::p_LinearDomain::_get_impl(_86_dom)->shape;
  _checked_ptr_1<int32_t> _ptr__90_shape(_90_shape ? _90_shape->raw() : nullptr,_90_shape ? _90_shape->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _91_b;
  _checked_ptr_1<double> _ptr__91_b(_91_b ? _91_b->raw() : nullptr,_91_b ? _91_b->size(0) : 0);
  if ((NULL == _90_shape.get()))
  {
    {
      _90_shape = _88_eshape;
      _ptr__90_shape.update(_90_shape ? _90_shape->raw() : nullptr, _90_shape ? _90_shape->size(0) : 0);
    }
  }
  else
  {
    {
      if (((int)((_90_shape)->size(0)) != (int)((_88_eshape)->size(0))))
      {
        {
          throw ::mosek::fusion::DomainError(std::string ("Mismatching shapes"));
        }
      }
      else
      {
        {
          int32_t _9314_ = (int)0;
          int32_t _9315_ = (int)((_90_shape)->size(0));
          for (int32_t _92_i = _9314_; _92_i < _9315_; ++_92_i)
          {
            {
              if ((_ptr__90_shape[_92_i] != _ptr__88_eshape[_92_i]))
              {
                {
                  throw ::mosek::fusion::DomainError(std::string ("Mismatching shapes"));
                }
              }
              {}
            }
          }
        }
      }
    }
  }
  if ((NULL == mosek::fusion::p_LinearDomain::_get_impl(_86_dom)->bnd.get()))
  {
    {
      _91_b = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_89_esize)));
      _ptr__91_b.update(_91_b ? _91_b->raw() : nullptr, _91_b ? _91_b->size(0) : 0);
    }
  }
  else if(mosek::fusion::p_LinearDomain::_get_impl(_86_dom)->scalable)
  {
    {
      std::vector<double> _9316_;
      for (int64_t _93_i = (int)0, _9317_ = _89_esize; _93_i < _9317_ ; ++_93_i)
      {
        _9316_.push_back(_ptr__87_dombnd[(int)0]);
      }
      auto _9318_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_9316_.size()),_9316_.begin(),_9316_.end()));
      _91_b = _9318_;
      _ptr__91_b.update(_91_b ? _91_b->raw() : nullptr, _91_b ? _91_b->size(0) : 0);
    }
  }
  else if(mosek::fusion::p_LinearDomain::_get_impl(_86_dom)->empty)
  {
    {
      _91_b = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_89_esize)));
      _ptr__91_b.update(_91_b ? _91_b->raw() : nullptr, _91_b ? _91_b->size(0) : 0);
    }
  }
  else
  {
    {
      _91_b = _87_dombnd;
      _ptr__91_b.update(_91_b ? _91_b->raw() : nullptr, _91_b ? _91_b->size(0) : 0);
    }
  }
  if ((mosek::fusion::p_LinearDomain::_get_impl(_86_dom)->key == ::mosek::fusion::RelationKey::EqualsTo))
  {
    {
      return ::mosek::fusion::p_SimpleTerm::_new_SimpleTerm(_85_expr,::mosek::fusion::p_DJCDomain::_new_DJCDomain(_91_b,nullptr,_90_shape,::mosek::fusion::DJCDomainType::EqualTo));
    }
  }
  else if((mosek::fusion::p_LinearDomain::_get_impl(_86_dom)->key == ::mosek::fusion::RelationKey::LessThan))
  {
    {
      return ::mosek::fusion::p_SimpleTerm::_new_SimpleTerm(_85_expr,::mosek::fusion::p_DJCDomain::_new_DJCDomain(_91_b,nullptr,_90_shape,::mosek::fusion::DJCDomainType::LessThan));
    }
  }
  else if((mosek::fusion::p_LinearDomain::_get_impl(_86_dom)->key == ::mosek::fusion::RelationKey::GreaterThan))
  {
    {
      return ::mosek::fusion::p_SimpleTerm::_new_SimpleTerm(_85_expr,::mosek::fusion::p_DJCDomain::_new_DJCDomain(_91_b,nullptr,_90_shape,::mosek::fusion::DJCDomainType::GreaterThan));
    }
  }
  else if((mosek::fusion::p_LinearDomain::_get_impl(_86_dom)->key == ::mosek::fusion::RelationKey::IsFree))
  {
    {
      return ::mosek::fusion::p_SimpleTerm::_new_SimpleTerm(_85_expr,::mosek::fusion::p_DJCDomain::_new_DJCDomain(_91_b,nullptr,_90_shape,::mosek::fusion::DJCDomainType::IsFree));
    }
  }
  else
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Invalid linear domain"));
    }
  }
}
// End mosek.fusion.DJC.term

// Begin mosek.fusion.DJC.term
// Method mosek.fusion.DJC.term @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:36:6-111
monty::rc_ptr< ::mosek::fusion::SimpleTerm > mosek::fusion::DJC::term
  ( monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _94_exprdom) { return mosek::fusion::p_DJC::term(_94_exprdom); }
monty::rc_ptr< ::mosek::fusion::SimpleTerm > mosek::fusion::p_DJC::term(monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _94_exprdom)
{
  return ::mosek::fusion::p_DJC::term(mosek::fusion::p_ExprLinearDomain::_get_impl(_94_exprdom)->expr,mosek::fusion::p_ExprLinearDomain::_get_impl(_94_exprdom)->dom);
}
// End mosek.fusion.DJC.term

// Begin mosek.fusion.DJC.term
// Method mosek.fusion.DJC.term @ bld/grindsted/final/default/src/fusion/Disjunction.mbi:33:6-105
monty::rc_ptr< ::mosek::fusion::SimpleTerm > mosek::fusion::DJC::term
  ( monty::rc_ptr< ::mosek::fusion::Variable > _95_x,
    monty::rc_ptr< ::mosek::fusion::LinearDomain > _96_dom) { return mosek::fusion::p_DJC::term(_95_x,_96_dom); }
monty::rc_ptr< ::mosek::fusion::SimpleTerm > mosek::fusion::p_DJC::term(monty::rc_ptr< ::mosek::fusion::Variable > _95_x,monty::rc_ptr< ::mosek::fusion::LinearDomain > _96_dom)
{
  return ::mosek::fusion::p_DJC::term(_95_x->__mosek_2fusion_2Variable__asExpr(),_96_dom);
}
// End mosek.fusion.DJC.term

void mosek::fusion::p_DJC::destroy()
{
}
void mosek::fusion::DJC::destroy() { mosek::fusion::p_DJC::_get_impl(this)->destroy(); }
// } class DJC
// class Sort { // @ bld/grindsted/final/default/src/fusion/Sort.mbi:6:4-262:5
mosek::fusion::Sort::Sort(mosek::fusion::p_Sort *_impl) : _impl(_impl) { /*std::cout << "Sort() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::Sort::~Sort() { delete _impl; _impl = nullptr; }
mosek::fusion::p_Sort::p_Sort
  (::mosek::fusion::Sort * _pubthis) :     _pubthis(_pubthis)
{}
// Begin mosek.fusion.Sort.argTransposeSort
// Method mosek.fusion.Sort.argTransposeSort @ bld/grindsted/final/default/src/fusion/Sort.mbi:249:6-261:7
void mosek::fusion::Sort::argTransposeSort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _309_perm,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _310_ptrb,
    int32_t _311_m,
    int32_t _312_n,
    int32_t _313_p,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _314_val) { mosek::fusion::p_Sort::argTransposeSort(_309_perm,_310_ptrb,_311_m,_312_n,_313_p,_314_val); }
void mosek::fusion::p_Sort::argTransposeSort(std::shared_ptr< monty::ndarray< int64_t,1 > > _309_perm,std::shared_ptr< monty::ndarray< int64_t,1 > > _310_ptrb,int32_t _311_m,int32_t _312_n,int32_t _313_p,std::shared_ptr< monty::ndarray< int64_t,1 > > _314_val)
{
  _checked_ptr_1<int64_t> _ptr__309_perm(_309_perm ? _309_perm->raw() : nullptr, _309_perm ? _309_perm->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__310_ptrb(_310_ptrb ? _310_ptrb->raw() : nullptr, _310_ptrb ? _310_ptrb->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__314_val(_314_val ? _314_val->raw() : nullptr, _314_val ? _314_val->size(0) : 0);
  int32_t _9319_ = (int)0;
  int32_t _9320_ = safe_add( safe_mul( _311_m,_313_p ),(int)1 );
  for (int32_t _315_q = _9319_; _315_q < _9320_; ++_315_q)
  {
    {
      _ptr__310_ptrb[_315_q] = (int)0;
    }
  }
  int32_t _9321_ = (int)0;
  int32_t _9322_ = (int)((_314_val)->size(0));
  for (int32_t _316_q = _9321_; _316_q < _9322_; ++_316_q)
  {
    {
      ++ _ptr__310_ptrb[safe_add( safe_add( safe_mul( (_ptr__314_val[_ptr__309_perm[_316_q]] / safe_mul( _312_n,_313_p )),_313_p ),(_ptr__314_val[_ptr__309_perm[_316_q]] % _313_p) ),(int)1 )];
    }
  }
  int32_t _9323_ = (int)0;
  int32_t _9324_ = safe_mul( _311_m,_313_p );
  for (int32_t _317_i = _9323_; _317_i < _9324_; ++_317_i)
  {
    {
      _ptr__310_ptrb[safe_add( _317_i,(int)1 )] = safe_add( _ptr__310_ptrb[safe_add( _317_i,(int)1 )],_ptr__310_ptrb[_317_i] );
    }
  }
  std::vector<int64_t> _9325_;
  for (int32_t _319_i = (int)0, _9326_ = (int)((_309_perm)->size(0)); _319_i < _9326_ ; ++_319_i)
  {
    _9325_.push_back(_ptr__309_perm[_319_i]);
  }
  auto _9327_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9325_.size()),_9325_.begin(),_9325_.end()));
  std::shared_ptr< monty::ndarray< int64_t,1 > > _318_per2 = _9327_;
  _checked_ptr_1<int64_t> _ptr__318_per2(_318_per2 ? _318_per2->raw() : nullptr,_318_per2 ? _318_per2->size(0) : 0);
  int64_t _9328_ = (int64_t)0;
  int64_t _9329_ = (int64_t)((_314_val)->size(0));
  for (int64_t _320_q = _9328_; _320_q < _9329_; ++_320_q)
  {
    {
      int64_t _321_k = safe_add( safe_mul( (_ptr__314_val[_ptr__318_per2[_320_q]] / safe_mul( _312_n,_313_p )),_313_p ),(_ptr__314_val[_ptr__318_per2[_320_q]] % _313_p) );
      _ptr__309_perm[_ptr__310_ptrb[_321_k]] = _ptr__318_per2[_320_q];
      ++ _ptr__310_ptrb[_321_k];
    }
  }
}
// End mosek.fusion.Sort.argTransposeSort

// Begin mosek.fusion.Sort.argsort
// Method mosek.fusion.Sort.argsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:207:6-210:7
void mosek::fusion::Sort::argsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _322_idx,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _323_vals1) { mosek::fusion::p_Sort::argsort(_322_idx,_323_vals1); }
void mosek::fusion::p_Sort::argsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _322_idx,std::shared_ptr< monty::ndarray< int64_t,1 > > _323_vals1)
{
  _checked_ptr_1<int64_t> _ptr__322_idx(_322_idx ? _322_idx->raw() : nullptr, _322_idx ? _322_idx->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__323_vals1(_323_vals1 ? _323_vals1->raw() : nullptr, _323_vals1 ? _323_vals1->size(0) : 0);
  ::mosek::fusion::p_Sort::argsort(_322_idx,_323_vals1,(int64_t)((int)0),(int64_t)((int)((_322_idx)->size(0))),false);
}
// End mosek.fusion.Sort.argsort

// Begin mosek.fusion.Sort.argsort
// Method mosek.fusion.Sort.argsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:202:6-205:7
void mosek::fusion::Sort::argsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _324_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _325_vals1) { mosek::fusion::p_Sort::argsort(_324_idx,_325_vals1); }
void mosek::fusion::p_Sort::argsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _324_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _325_vals1)
{
  _checked_ptr_1<int64_t> _ptr__324_idx(_324_idx ? _324_idx->raw() : nullptr, _324_idx ? _324_idx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__325_vals1(_325_vals1 ? _325_vals1->raw() : nullptr, _325_vals1 ? _325_vals1->size(0) : 0);
  ::mosek::fusion::p_Sort::argsort(_324_idx,_325_vals1,(int64_t)((int)0),(int64_t)((int)((_324_idx)->size(0))),false);
}
// End mosek.fusion.Sort.argsort

// Begin mosek.fusion.Sort.argsort
// Method mosek.fusion.Sort.argsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:197:6-200:7
void mosek::fusion::Sort::argsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _326_idx,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _327_vals1,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _328_vals2) { mosek::fusion::p_Sort::argsort(_326_idx,_327_vals1,_328_vals2); }
void mosek::fusion::p_Sort::argsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _326_idx,std::shared_ptr< monty::ndarray< int64_t,1 > > _327_vals1,std::shared_ptr< monty::ndarray< int64_t,1 > > _328_vals2)
{
  _checked_ptr_1<int64_t> _ptr__326_idx(_326_idx ? _326_idx->raw() : nullptr, _326_idx ? _326_idx->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__327_vals1(_327_vals1 ? _327_vals1->raw() : nullptr, _327_vals1 ? _327_vals1->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__328_vals2(_328_vals2 ? _328_vals2->raw() : nullptr, _328_vals2 ? _328_vals2->size(0) : 0);
  ::mosek::fusion::p_Sort::argsort(_326_idx,_327_vals1,_328_vals2,(int64_t)((int)0),(int64_t)((int)((_326_idx)->size(0))),false);
}
// End mosek.fusion.Sort.argsort

// Begin mosek.fusion.Sort.argsort
// Method mosek.fusion.Sort.argsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:193:6-196:7
void mosek::fusion::Sort::argsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _329_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _330_vals1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _331_vals2) { mosek::fusion::p_Sort::argsort(_329_idx,_330_vals1,_331_vals2); }
void mosek::fusion::p_Sort::argsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _329_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _330_vals1,std::shared_ptr< monty::ndarray< int32_t,1 > > _331_vals2)
{
  _checked_ptr_1<int64_t> _ptr__329_idx(_329_idx ? _329_idx->raw() : nullptr, _329_idx ? _329_idx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__330_vals1(_330_vals1 ? _330_vals1->raw() : nullptr, _330_vals1 ? _330_vals1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__331_vals2(_331_vals2 ? _331_vals2->raw() : nullptr, _331_vals2 ? _331_vals2->size(0) : 0);
  ::mosek::fusion::p_Sort::argsort(_329_idx,_330_vals1,_331_vals2,(int64_t)((int)0),(int64_t)((int)((_329_idx)->size(0))),false);
}
// End mosek.fusion.Sort.argsort

// Begin mosek.fusion.Sort.argsort
// Method mosek.fusion.Sort.argsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:188:6-191:7
void mosek::fusion::Sort::argsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _332_idx,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _333_vals1,
    int64_t _334_first,
    int64_t _335_last) { mosek::fusion::p_Sort::argsort(_332_idx,_333_vals1,_334_first,_335_last); }
void mosek::fusion::p_Sort::argsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _332_idx,std::shared_ptr< monty::ndarray< int64_t,1 > > _333_vals1,int64_t _334_first,int64_t _335_last)
{
  _checked_ptr_1<int64_t> _ptr__332_idx(_332_idx ? _332_idx->raw() : nullptr, _332_idx ? _332_idx->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__333_vals1(_333_vals1 ? _333_vals1->raw() : nullptr, _333_vals1 ? _333_vals1->size(0) : 0);
  ::mosek::fusion::p_Sort::argsort(_332_idx,_333_vals1,_334_first,_335_last,false);
}
// End mosek.fusion.Sort.argsort

// Begin mosek.fusion.Sort.argsort
// Method mosek.fusion.Sort.argsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:183:6-186:7
void mosek::fusion::Sort::argsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _336_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _337_vals1,
    int64_t _338_first,
    int64_t _339_last) { mosek::fusion::p_Sort::argsort(_336_idx,_337_vals1,_338_first,_339_last); }
void mosek::fusion::p_Sort::argsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _336_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _337_vals1,int64_t _338_first,int64_t _339_last)
{
  _checked_ptr_1<int64_t> _ptr__336_idx(_336_idx ? _336_idx->raw() : nullptr, _336_idx ? _336_idx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__337_vals1(_337_vals1 ? _337_vals1->raw() : nullptr, _337_vals1 ? _337_vals1->size(0) : 0);
  ::mosek::fusion::p_Sort::argsort(_336_idx,_337_vals1,_338_first,_339_last,false);
}
// End mosek.fusion.Sort.argsort

// Begin mosek.fusion.Sort.argsort
// Method mosek.fusion.Sort.argsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:178:6-181:7
void mosek::fusion::Sort::argsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _340_idx,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _341_vals1,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _342_vals2,
    int64_t _343_first,
    int64_t _344_last) { mosek::fusion::p_Sort::argsort(_340_idx,_341_vals1,_342_vals2,_343_first,_344_last); }
void mosek::fusion::p_Sort::argsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _340_idx,std::shared_ptr< monty::ndarray< int64_t,1 > > _341_vals1,std::shared_ptr< monty::ndarray< int64_t,1 > > _342_vals2,int64_t _343_first,int64_t _344_last)
{
  _checked_ptr_1<int64_t> _ptr__340_idx(_340_idx ? _340_idx->raw() : nullptr, _340_idx ? _340_idx->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__341_vals1(_341_vals1 ? _341_vals1->raw() : nullptr, _341_vals1 ? _341_vals1->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__342_vals2(_342_vals2 ? _342_vals2->raw() : nullptr, _342_vals2 ? _342_vals2->size(0) : 0);
  ::mosek::fusion::p_Sort::argsort(_340_idx,_341_vals1,_342_vals2,_343_first,_344_last,false);
}
// End mosek.fusion.Sort.argsort

// Begin mosek.fusion.Sort.argsort
// Method mosek.fusion.Sort.argsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:174:6-177:7
void mosek::fusion::Sort::argsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _345_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _346_vals1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _347_vals2,
    int64_t _348_first,
    int64_t _349_last) { mosek::fusion::p_Sort::argsort(_345_idx,_346_vals1,_347_vals2,_348_first,_349_last); }
void mosek::fusion::p_Sort::argsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _345_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _346_vals1,std::shared_ptr< monty::ndarray< int32_t,1 > > _347_vals2,int64_t _348_first,int64_t _349_last)
{
  _checked_ptr_1<int64_t> _ptr__345_idx(_345_idx ? _345_idx->raw() : nullptr, _345_idx ? _345_idx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__346_vals1(_346_vals1 ? _346_vals1->raw() : nullptr, _346_vals1 ? _346_vals1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__347_vals2(_347_vals2 ? _347_vals2->raw() : nullptr, _347_vals2 ? _347_vals2->size(0) : 0);
  ::mosek::fusion::p_Sort::argsort(_345_idx,_346_vals1,_347_vals2,_348_first,_349_last,false);
}
// End mosek.fusion.Sort.argsort

// Begin mosek.fusion.Sort.argsort
// Method mosek.fusion.Sort.argsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:156:6-171:7
void mosek::fusion::Sort::argsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _350_idx,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _351_vals1,
    int64_t _352_first,
    int64_t _353_last,
    bool _354_check) { mosek::fusion::p_Sort::argsort(_350_idx,_351_vals1,_352_first,_353_last,_354_check); }
void mosek::fusion::p_Sort::argsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _350_idx,std::shared_ptr< monty::ndarray< int64_t,1 > > _351_vals1,int64_t _352_first,int64_t _353_last,bool _354_check)
{
  _checked_ptr_1<int64_t> _ptr__350_idx(_350_idx ? _350_idx->raw() : nullptr, _350_idx ? _350_idx->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__351_vals1(_351_vals1 ? _351_vals1->raw() : nullptr, _351_vals1 ? _351_vals1->size(0) : 0);
  if (((!_354_check) || ((_353_last - _352_first) < (int)16)))
  {
    {
      ::mosek::fusion::Utils::Tools::argsort(_350_idx,_351_vals1,_352_first,_353_last);
    }
  }
  else if((!::mosek::fusion::p_Sort::issorted(_350_idx,_351_vals1,_352_first,_353_last,_354_check)))
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _355_minmax = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)4)));
      _checked_ptr_1<int64_t> _ptr__355_minmax(_355_minmax ? _355_minmax->raw() : nullptr,_355_minmax ? _355_minmax->size(0) : 0);
      int32_t _356_scale = (int)2;
      ::mosek::fusion::p_Sort::getminmax(_350_idx,_351_vals1,nullptr,_352_first,_353_last,_355_minmax);
      if (((_ptr__355_minmax[(int)1] - _ptr__355_minmax[(int)0]) < safe_mul( _356_scale,(_353_last - _352_first) )))
      {
        {
          ::mosek::fusion::p_Sort::argbucketsort(_350_idx,_351_vals1,_352_first,_353_last,_ptr__355_minmax[(int)0],_ptr__355_minmax[(int)1]);
        }
      }
      else
      {
        {
          ::mosek::fusion::Utils::Tools::argsort(_350_idx,_351_vals1,_352_first,_353_last);
        }
      }
    }
  }
  {}
}
// End mosek.fusion.Sort.argsort

// Begin mosek.fusion.Sort.argsort
// Method mosek.fusion.Sort.argsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:137:6-154:7
void mosek::fusion::Sort::argsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _357_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _358_vals1,
    int64_t _359_first,
    int64_t _360_last,
    bool _361_check) { mosek::fusion::p_Sort::argsort(_357_idx,_358_vals1,_359_first,_360_last,_361_check); }
void mosek::fusion::p_Sort::argsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _357_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _358_vals1,int64_t _359_first,int64_t _360_last,bool _361_check)
{
  _checked_ptr_1<int64_t> _ptr__357_idx(_357_idx ? _357_idx->raw() : nullptr, _357_idx ? _357_idx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__358_vals1(_358_vals1 ? _358_vals1->raw() : nullptr, _358_vals1 ? _358_vals1->size(0) : 0);
  if (((!_361_check) || ((_360_last - _359_first) < (int)16)))
  {
    {
      ::mosek::fusion::Utils::Tools::argsort(_357_idx,_358_vals1,_359_first,_360_last);
    }
  }
  else if((!::mosek::fusion::p_Sort::issorted(_357_idx,_358_vals1,_359_first,_360_last,_361_check)))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _362_minmax = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)4)));
      _checked_ptr_1<int32_t> _ptr__362_minmax(_362_minmax ? _362_minmax->raw() : nullptr,_362_minmax ? _362_minmax->size(0) : 0);
      int32_t _363_scale = (int)2;
      ::mosek::fusion::p_Sort::getminmax(_357_idx,_358_vals1,nullptr,_359_first,_360_last,_362_minmax);
      if (((_ptr__362_minmax[(int)1] - _ptr__362_minmax[(int)0]) < safe_mul( _363_scale,(_360_last - _359_first) )))
      {
        {
          ::mosek::fusion::p_Sort::argbucketsort(_357_idx,_358_vals1,_359_first,_360_last,_ptr__362_minmax[(int)0],_ptr__362_minmax[(int)1]);
        }
      }
      else
      {
        {
          ::mosek::fusion::Utils::Tools::argsort(_357_idx,_358_vals1,_359_first,_360_last);
        }
      }
    }
  }
  {}
}
// End mosek.fusion.Sort.argsort

// Begin mosek.fusion.Sort.argsort
// Method mosek.fusion.Sort.argsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:116:6-135:7
void mosek::fusion::Sort::argsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _364_idx,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _365_vals1,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _366_vals2,
    int64_t _367_first,
    int64_t _368_last,
    bool _369_check) { mosek::fusion::p_Sort::argsort(_364_idx,_365_vals1,_366_vals2,_367_first,_368_last,_369_check); }
void mosek::fusion::p_Sort::argsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _364_idx,std::shared_ptr< monty::ndarray< int64_t,1 > > _365_vals1,std::shared_ptr< monty::ndarray< int64_t,1 > > _366_vals2,int64_t _367_first,int64_t _368_last,bool _369_check)
{
  _checked_ptr_1<int64_t> _ptr__364_idx(_364_idx ? _364_idx->raw() : nullptr, _364_idx ? _364_idx->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__365_vals1(_365_vals1 ? _365_vals1->raw() : nullptr, _365_vals1 ? _365_vals1->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__366_vals2(_366_vals2 ? _366_vals2->raw() : nullptr, _366_vals2 ? _366_vals2->size(0) : 0);
  if (((!_369_check) || ((_368_last - _367_first) < (int)16)))
  {
    {
      ::mosek::fusion::Utils::Tools::argsort(_364_idx,_365_vals1,_366_vals2,_367_first,_368_last);
    }
  }
  else if((!::mosek::fusion::p_Sort::issorted(_364_idx,_365_vals1,_366_vals2,_367_first,_368_last,_369_check)))
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _370_minmax = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)4)));
      _checked_ptr_1<int64_t> _ptr__370_minmax(_370_minmax ? _370_minmax->raw() : nullptr,_370_minmax ? _370_minmax->size(0) : 0);
      int32_t _371_scale = (int)2;
      ::mosek::fusion::p_Sort::getminmax(_364_idx,_365_vals1,_366_vals2,_367_first,_368_last,_370_minmax);
      if ((((_ptr__370_minmax[(int)1] - _ptr__370_minmax[(int)0]) < safe_mul( _371_scale,(_368_last - _367_first) )) && ((_ptr__370_minmax[(int)3] - _ptr__370_minmax[(int)2]) < safe_mul( _371_scale,(_368_last - _367_first) ))))
      {
        {
          ::mosek::fusion::p_Sort::argbucketsort(_364_idx,_366_vals2,_367_first,_368_last,_ptr__370_minmax[(int)2],_ptr__370_minmax[(int)3]);
          ::mosek::fusion::p_Sort::argbucketsort(_364_idx,_365_vals1,_367_first,_368_last,_ptr__370_minmax[(int)0],_ptr__370_minmax[(int)1]);
        }
      }
      else
      {
        {
          ::mosek::fusion::Utils::Tools::argsort(_364_idx,_365_vals1,_366_vals2,_367_first,_368_last);
        }
      }
    }
  }
  {}
}
// End mosek.fusion.Sort.argsort

// Begin mosek.fusion.Sort.argsort
// Method mosek.fusion.Sort.argsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:95:6-114:7
void mosek::fusion::Sort::argsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _372_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _373_vals1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _374_vals2,
    int64_t _375_first,
    int64_t _376_last,
    bool _377_check) { mosek::fusion::p_Sort::argsort(_372_idx,_373_vals1,_374_vals2,_375_first,_376_last,_377_check); }
void mosek::fusion::p_Sort::argsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _372_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _373_vals1,std::shared_ptr< monty::ndarray< int32_t,1 > > _374_vals2,int64_t _375_first,int64_t _376_last,bool _377_check)
{
  _checked_ptr_1<int64_t> _ptr__372_idx(_372_idx ? _372_idx->raw() : nullptr, _372_idx ? _372_idx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__373_vals1(_373_vals1 ? _373_vals1->raw() : nullptr, _373_vals1 ? _373_vals1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__374_vals2(_374_vals2 ? _374_vals2->raw() : nullptr, _374_vals2 ? _374_vals2->size(0) : 0);
  if (((!_377_check) || ((_376_last - _375_first) < (int)16)))
  {
    {
      ::mosek::fusion::Utils::Tools::argsort(_372_idx,_373_vals1,_374_vals2,_375_first,_376_last);
    }
  }
  else if((!::mosek::fusion::p_Sort::issorted(_372_idx,_373_vals1,_374_vals2,_375_first,_376_last,_377_check)))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _378_minmax = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)4)));
      _checked_ptr_1<int32_t> _ptr__378_minmax(_378_minmax ? _378_minmax->raw() : nullptr,_378_minmax ? _378_minmax->size(0) : 0);
      int32_t _379_scale = (int)2;
      ::mosek::fusion::p_Sort::getminmax(_372_idx,_373_vals1,_374_vals2,_375_first,_376_last,_378_minmax);
      if ((((_ptr__378_minmax[(int)1] - _ptr__378_minmax[(int)0]) < safe_mul( _379_scale,(_376_last - _375_first) )) && ((_ptr__378_minmax[(int)3] - _ptr__378_minmax[(int)2]) < safe_mul( _379_scale,(_376_last - _375_first) ))))
      {
        {
          ::mosek::fusion::p_Sort::argbucketsort(_372_idx,_374_vals2,_375_first,_376_last,_ptr__378_minmax[(int)2],_ptr__378_minmax[(int)3]);
          ::mosek::fusion::p_Sort::argbucketsort(_372_idx,_373_vals1,_375_first,_376_last,_ptr__378_minmax[(int)0],_ptr__378_minmax[(int)1]);
        }
      }
      else
      {
        {
          ::mosek::fusion::Utils::Tools::argsort(_372_idx,_373_vals1,_374_vals2,_375_first,_376_last);
        }
      }
    }
  }
  {}
}
// End mosek.fusion.Sort.argsort

// Begin mosek.fusion.Sort.argbucketsort
// Method mosek.fusion.Sort.argbucketsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:90:6-93:7
void mosek::fusion::Sort::argbucketsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _380_idx,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _381_vals,
    int64_t _382_first,
    int64_t _383_last,
    int64_t _384_minv,
    int64_t _385_maxv) { mosek::fusion::p_Sort::argbucketsort(_380_idx,_381_vals,_382_first,_383_last,_384_minv,_385_maxv); }
void mosek::fusion::p_Sort::argbucketsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _380_idx,std::shared_ptr< monty::ndarray< int64_t,1 > > _381_vals,int64_t _382_first,int64_t _383_last,int64_t _384_minv,int64_t _385_maxv)
{
  _checked_ptr_1<int64_t> _ptr__380_idx(_380_idx ? _380_idx->raw() : nullptr, _380_idx ? _380_idx->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__381_vals(_381_vals ? _381_vals->raw() : nullptr, _381_vals ? _381_vals->size(0) : 0);
  ::mosek::fusion::Utils::Tools::bucketsort(_380_idx,_382_first,_383_last,_381_vals,_384_minv,_385_maxv);
}
// End mosek.fusion.Sort.argbucketsort

// Begin mosek.fusion.Sort.argbucketsort
// Method mosek.fusion.Sort.argbucketsort @ bld/grindsted/final/default/src/fusion/Sort.mbi:85:6-88:7
void mosek::fusion::Sort::argbucketsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _386_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _387_vals,
    int64_t _388_first,
    int64_t _389_last,
    int32_t _390_minv,
    int32_t _391_maxv) { mosek::fusion::p_Sort::argbucketsort(_386_idx,_387_vals,_388_first,_389_last,_390_minv,_391_maxv); }
void mosek::fusion::p_Sort::argbucketsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _386_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _387_vals,int64_t _388_first,int64_t _389_last,int32_t _390_minv,int32_t _391_maxv)
{
  _checked_ptr_1<int64_t> _ptr__386_idx(_386_idx ? _386_idx->raw() : nullptr, _386_idx ? _386_idx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__387_vals(_387_vals ? _387_vals->raw() : nullptr, _387_vals ? _387_vals->size(0) : 0);
  ::mosek::fusion::Utils::Tools::bucketsort(_386_idx,_388_first,_389_last,_387_vals,_390_minv,_391_maxv);
}
// End mosek.fusion.Sort.argbucketsort

// Begin mosek.fusion.Sort.getminmax
// Method mosek.fusion.Sort.getminmax @ bld/grindsted/final/default/src/fusion/Sort.mbi:61:6-80:7
void mosek::fusion::Sort::getminmax
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _392_idx,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _393_vals1,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _394_vals2,
    int64_t _395_first,
    int64_t _396_last,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _397_res) { mosek::fusion::p_Sort::getminmax(_392_idx,_393_vals1,_394_vals2,_395_first,_396_last,_397_res); }
void mosek::fusion::p_Sort::getminmax(std::shared_ptr< monty::ndarray< int64_t,1 > > _392_idx,std::shared_ptr< monty::ndarray< int64_t,1 > > _393_vals1,std::shared_ptr< monty::ndarray< int64_t,1 > > _394_vals2,int64_t _395_first,int64_t _396_last,std::shared_ptr< monty::ndarray< int64_t,1 > > _397_res)
{
  _checked_ptr_1<int64_t> _ptr__392_idx(_392_idx ? _392_idx->raw() : nullptr, _392_idx ? _392_idx->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__393_vals1(_393_vals1 ? _393_vals1->raw() : nullptr, _393_vals1 ? _393_vals1->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__394_vals2(_394_vals2 ? _394_vals2->raw() : nullptr, _394_vals2 ? _394_vals2->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__397_res(_397_res ? _397_res->raw() : nullptr, _397_res ? _397_res->size(0) : 0);
  _ptr__397_res[(int)0] = _ptr__393_vals1[_ptr__392_idx[_395_first]];
  _ptr__397_res[(int)1] = _ptr__393_vals1[_ptr__392_idx[_395_first]];
  int64_t _9330_ = safe_add( _395_first,(int)1 );
  int64_t _9331_ = _396_last;
  for (int64_t _398_i = _9330_; _398_i < _9331_; ++_398_i)
  {
    {
      if ((_ptr__397_res[(int)0] > _ptr__393_vals1[_ptr__392_idx[_398_i]]))
      {
        {
          _ptr__397_res[(int)0] = _ptr__393_vals1[_ptr__392_idx[_398_i]];
        }
      }
      {}
      if ((_ptr__397_res[(int)1] < _ptr__393_vals1[_ptr__392_idx[_398_i]]))
      {
        {
          _ptr__397_res[(int)1] = _ptr__393_vals1[_ptr__392_idx[_398_i]];
        }
      }
      {}
    }
  }
  if ((NULL != _394_vals2.get()))
  {
    {
      _ptr__397_res[(int)2] = _ptr__394_vals2[_ptr__392_idx[_395_first]];
      _ptr__397_res[(int)3] = _ptr__394_vals2[_ptr__392_idx[_395_first]];
      int64_t _9332_ = safe_add( _395_first,(int)1 );
      int64_t _9333_ = _396_last;
      for (int64_t _399_i = _9332_; _399_i < _9333_; ++_399_i)
      {
        {
          if ((_ptr__397_res[(int)2] > _ptr__394_vals2[_ptr__392_idx[_399_i]]))
          {
            {
              _ptr__397_res[(int)2] = _ptr__394_vals2[_ptr__392_idx[_399_i]];
            }
          }
          {}
          if ((_ptr__397_res[(int)3] < _ptr__394_vals2[_ptr__392_idx[_399_i]]))
          {
            {
              _ptr__397_res[(int)3] = _ptr__394_vals2[_ptr__392_idx[_399_i]];
            }
          }
          {}
        }
      }
    }
  }
  {}
}
// End mosek.fusion.Sort.getminmax

// Begin mosek.fusion.Sort.getminmax
// Method mosek.fusion.Sort.getminmax @ bld/grindsted/final/default/src/fusion/Sort.mbi:40:6-59:7
void mosek::fusion::Sort::getminmax
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _400_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _401_vals1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _402_vals2,
    int64_t _403_first,
    int64_t _404_last,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _405_res) { mosek::fusion::p_Sort::getminmax(_400_idx,_401_vals1,_402_vals2,_403_first,_404_last,_405_res); }
void mosek::fusion::p_Sort::getminmax(std::shared_ptr< monty::ndarray< int64_t,1 > > _400_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _401_vals1,std::shared_ptr< monty::ndarray< int32_t,1 > > _402_vals2,int64_t _403_first,int64_t _404_last,std::shared_ptr< monty::ndarray< int32_t,1 > > _405_res)
{
  _checked_ptr_1<int64_t> _ptr__400_idx(_400_idx ? _400_idx->raw() : nullptr, _400_idx ? _400_idx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__401_vals1(_401_vals1 ? _401_vals1->raw() : nullptr, _401_vals1 ? _401_vals1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__402_vals2(_402_vals2 ? _402_vals2->raw() : nullptr, _402_vals2 ? _402_vals2->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__405_res(_405_res ? _405_res->raw() : nullptr, _405_res ? _405_res->size(0) : 0);
  _ptr__405_res[(int)0] = _ptr__401_vals1[_ptr__400_idx[_403_first]];
  _ptr__405_res[(int)1] = _ptr__401_vals1[_ptr__400_idx[_403_first]];
  int64_t _9334_ = safe_add( _403_first,(int)1 );
  int64_t _9335_ = _404_last;
  for (int64_t _406_i = _9334_; _406_i < _9335_; ++_406_i)
  {
    {
      if ((_ptr__405_res[(int)0] > _ptr__401_vals1[_ptr__400_idx[_406_i]]))
      {
        {
          _ptr__405_res[(int)0] = _ptr__401_vals1[_ptr__400_idx[_406_i]];
        }
      }
      {}
      if ((_ptr__405_res[(int)1] < _ptr__401_vals1[_ptr__400_idx[_406_i]]))
      {
        {
          _ptr__405_res[(int)1] = _ptr__401_vals1[_ptr__400_idx[_406_i]];
        }
      }
      {}
    }
  }
  if ((NULL != _402_vals2.get()))
  {
    {
      _ptr__405_res[(int)2] = _ptr__402_vals2[_ptr__400_idx[_403_first]];
      _ptr__405_res[(int)3] = _ptr__402_vals2[_ptr__400_idx[_403_first]];
      int64_t _9336_ = safe_add( _403_first,(int)1 );
      int64_t _9337_ = _404_last;
      for (int64_t _407_i = _9336_; _407_i < _9337_; ++_407_i)
      {
        {
          if ((_ptr__405_res[(int)2] > _ptr__402_vals2[_ptr__400_idx[_407_i]]))
          {
            {
              _ptr__405_res[(int)2] = _ptr__402_vals2[_ptr__400_idx[_407_i]];
            }
          }
          {}
          if ((_ptr__405_res[(int)3] < _ptr__402_vals2[_ptr__400_idx[_407_i]]))
          {
            {
              _ptr__405_res[(int)3] = _ptr__402_vals2[_ptr__400_idx[_407_i]];
            }
          }
          {}
        }
      }
    }
  }
  {}
}
// End mosek.fusion.Sort.getminmax

// Begin mosek.fusion.Sort.issorted
// Method mosek.fusion.Sort.issorted @ bld/grindsted/final/default/src/fusion/Sort.mbi:32:6-38:7
bool mosek::fusion::Sort::issorted
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _408_idx,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _409_vals1,
    int64_t _410_first,
    int64_t _411_last,
    bool _412_check) { return mosek::fusion::p_Sort::issorted(_408_idx,_409_vals1,_410_first,_411_last,_412_check); }
bool mosek::fusion::p_Sort::issorted(std::shared_ptr< monty::ndarray< int64_t,1 > > _408_idx,std::shared_ptr< monty::ndarray< int64_t,1 > > _409_vals1,int64_t _410_first,int64_t _411_last,bool _412_check)
{
  _checked_ptr_1<int64_t> _ptr__408_idx(_408_idx ? _408_idx->raw() : nullptr, _408_idx ? _408_idx->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__409_vals1(_409_vals1 ? _409_vals1->raw() : nullptr, _409_vals1 ? _409_vals1->size(0) : 0);
  int64_t _9338_ = _410_first;
  int64_t _9339_ = (_411_last - (int)1);
  for (int64_t _413_i = _9338_; _413_i < _9339_; ++_413_i)
  {
    {
      if ((_ptr__409_vals1[_ptr__408_idx[_413_i]] > _ptr__409_vals1[_ptr__408_idx[safe_add( _413_i,(int)1 )]]))
      {
        {
          return false;
        }
      }
      {}
    }
  }
  return true;
}
// End mosek.fusion.Sort.issorted

// Begin mosek.fusion.Sort.issorted
// Method mosek.fusion.Sort.issorted @ bld/grindsted/final/default/src/fusion/Sort.mbi:24:6-30:7
bool mosek::fusion::Sort::issorted
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _414_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _415_vals1,
    int64_t _416_first,
    int64_t _417_last,
    bool _418_check) { return mosek::fusion::p_Sort::issorted(_414_idx,_415_vals1,_416_first,_417_last,_418_check); }
bool mosek::fusion::p_Sort::issorted(std::shared_ptr< monty::ndarray< int64_t,1 > > _414_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _415_vals1,int64_t _416_first,int64_t _417_last,bool _418_check)
{
  _checked_ptr_1<int64_t> _ptr__414_idx(_414_idx ? _414_idx->raw() : nullptr, _414_idx ? _414_idx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__415_vals1(_415_vals1 ? _415_vals1->raw() : nullptr, _415_vals1 ? _415_vals1->size(0) : 0);
  int64_t _9340_ = _416_first;
  int64_t _9341_ = (_417_last - (int)1);
  for (int64_t _419_i = _9340_; _419_i < _9341_; ++_419_i)
  {
    {
      if ((_ptr__415_vals1[_ptr__414_idx[_419_i]] > _ptr__415_vals1[_ptr__414_idx[safe_add( _419_i,(int)1 )]]))
      {
        {
          return false;
        }
      }
      {}
    }
  }
  return true;
}
// End mosek.fusion.Sort.issorted

// Begin mosek.fusion.Sort.issorted
// Method mosek.fusion.Sort.issorted @ bld/grindsted/final/default/src/fusion/Sort.mbi:16:6-22:7
bool mosek::fusion::Sort::issorted
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _420_idx,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _421_vals1,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _422_vals2,
    int64_t _423_first,
    int64_t _424_last,
    bool _425_check) { return mosek::fusion::p_Sort::issorted(_420_idx,_421_vals1,_422_vals2,_423_first,_424_last,_425_check); }
bool mosek::fusion::p_Sort::issorted(std::shared_ptr< monty::ndarray< int64_t,1 > > _420_idx,std::shared_ptr< monty::ndarray< int64_t,1 > > _421_vals1,std::shared_ptr< monty::ndarray< int64_t,1 > > _422_vals2,int64_t _423_first,int64_t _424_last,bool _425_check)
{
  _checked_ptr_1<int64_t> _ptr__420_idx(_420_idx ? _420_idx->raw() : nullptr, _420_idx ? _420_idx->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__421_vals1(_421_vals1 ? _421_vals1->raw() : nullptr, _421_vals1 ? _421_vals1->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__422_vals2(_422_vals2 ? _422_vals2->raw() : nullptr, _422_vals2 ? _422_vals2->size(0) : 0);
  int64_t _9342_ = _423_first;
  int64_t _9343_ = (_424_last - (int)1);
  for (int64_t _426_i = _9342_; _426_i < _9343_; ++_426_i)
  {
    {
      if (((_ptr__421_vals1[_ptr__420_idx[_426_i]] > _ptr__421_vals1[_ptr__420_idx[safe_add( _426_i,(int)1 )]]) || ((_ptr__421_vals1[_ptr__420_idx[safe_add( _426_i,(int)1 )]] == _ptr__421_vals1[_ptr__420_idx[_426_i]]) && (_ptr__422_vals2[_ptr__420_idx[_426_i]] > _ptr__422_vals2[_ptr__420_idx[safe_add( _426_i,(int)1 )]]))))
      {
        {
          return false;
        }
      }
      {}
    }
  }
  return true;
}
// End mosek.fusion.Sort.issorted

// Begin mosek.fusion.Sort.issorted
// Method mosek.fusion.Sort.issorted @ bld/grindsted/final/default/src/fusion/Sort.mbi:8:6-14:7
bool mosek::fusion::Sort::issorted
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _427_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _428_vals1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _429_vals2,
    int64_t _430_first,
    int64_t _431_last,
    bool _432_check) { return mosek::fusion::p_Sort::issorted(_427_idx,_428_vals1,_429_vals2,_430_first,_431_last,_432_check); }
bool mosek::fusion::p_Sort::issorted(std::shared_ptr< monty::ndarray< int64_t,1 > > _427_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _428_vals1,std::shared_ptr< monty::ndarray< int32_t,1 > > _429_vals2,int64_t _430_first,int64_t _431_last,bool _432_check)
{
  _checked_ptr_1<int64_t> _ptr__427_idx(_427_idx ? _427_idx->raw() : nullptr, _427_idx ? _427_idx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__428_vals1(_428_vals1 ? _428_vals1->raw() : nullptr, _428_vals1 ? _428_vals1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__429_vals2(_429_vals2 ? _429_vals2->raw() : nullptr, _429_vals2 ? _429_vals2->size(0) : 0);
  int64_t _9344_ = _430_first;
  int64_t _9345_ = (_431_last - (int)1);
  for (int64_t _433_i = _9344_; _433_i < _9345_; ++_433_i)
  {
    {
      if (((_ptr__428_vals1[_ptr__427_idx[_433_i]] > _ptr__428_vals1[_ptr__427_idx[safe_add( _433_i,(int)1 )]]) || ((_ptr__428_vals1[_ptr__427_idx[_433_i]] == _ptr__428_vals1[_ptr__427_idx[safe_add( _433_i,(int)1 )]]) && (_ptr__429_vals2[_ptr__427_idx[_433_i]] > _ptr__429_vals2[_ptr__427_idx[safe_add( _433_i,(int)1 )]]))))
      {
        {
          return false;
        }
      }
      {}
    }
  }
  return true;
}
// End mosek.fusion.Sort.issorted

void mosek::fusion::p_Sort::destroy()
{
}
void mosek::fusion::Sort::destroy() { mosek::fusion::p_Sort::_get_impl(this)->destroy(); }
// } class Sort
// class IndexCounter { // @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:446:4-523:5
mosek::fusion::IndexCounter::IndexCounter(mosek::fusion::p_IndexCounter *_impl) : _impl(_impl) { /*std::cout << "IndexCounter() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::IndexCounter::~IndexCounter() { delete _impl; _impl = nullptr; }
mosek::fusion::p_IndexCounter::p_IndexCounter
  (::mosek::fusion::IndexCounter * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.IndexCounter.ctor @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:486:6-496:7
mosek::fusion::IndexCounter::t mosek::fusion::p_IndexCounter::_new_IndexCounter
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _434_shape)
{ return new mosek::fusion::IndexCounter(_434_shape); }
mosek::fusion::IndexCounter::IndexCounter
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _434_shape) : 
   IndexCounter(new mosek::fusion::p_IndexCounter(this))
{ mosek::fusion::p_IndexCounter::_get_impl(this)->_initialize(_434_shape); }
void mosek::fusion::p_IndexCounter::_initialize  (std::shared_ptr< monty::ndarray< int32_t,1 > > _434_shape)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__434_shape(_434_shape ? _434_shape->raw() : nullptr, _434_shape ? _434_shape->size(0) : 0);
    n = (int)((_434_shape)->size(0));
    ii = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(n)));
    st = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(n)));
    start = (int64_t)0;
    strides = ::mosek::fusion::p_Set::strides(_434_shape);
    std::vector<int32_t> _9346_;
    for (int32_t _435_i = (int)0, _9347_ = (int)((_434_shape)->size(0)); _435_i < _9347_ ; ++_435_i)
    {
      _9346_.push_back(_ptr__434_shape[_435_i]);
    }
    auto _9348_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9346_.size()),_9346_.begin(),_9346_.end()));
    dims = _9348_;
  }
}
// mosek.fusion.IndexCounter.ctor

// mosek.fusion.IndexCounter.ctor @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:471:6-484:7
mosek::fusion::IndexCounter::t mosek::fusion::p_IndexCounter::_new_IndexCounter
  (int64_t _436_start_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _437_dims_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _438_shape)
{ return new mosek::fusion::IndexCounter(_436_start_,_437_dims_,_438_shape); }
mosek::fusion::IndexCounter::IndexCounter
  (int64_t _436_start_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _437_dims_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _438_shape) : 
   IndexCounter(new mosek::fusion::p_IndexCounter(this))
{ mosek::fusion::p_IndexCounter::_get_impl(this)->_initialize(_436_start_,_437_dims_,_438_shape); }
void mosek::fusion::p_IndexCounter::_initialize  (int64_t _436_start_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _437_dims_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _438_shape)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__437_dims_(_437_dims_ ? _437_dims_->raw() : nullptr, _437_dims_ ? _437_dims_->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__438_shape(_438_shape ? _438_shape->raw() : nullptr, _438_shape ? _438_shape->size(0) : 0);
    int32_t _439_nd = (int)((_438_shape)->size(0));
    n = (int)((_437_dims_)->size(0));
    ii = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(n)));
    st = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(n)));
    int32_t _9349_ = (int)0;
    int32_t _9350_ = n;
    for (int32_t _440_i = _9349_; _440_i < _9350_; ++_440_i)
    {
      {
        ((*st)(_440_i)) = _436_start_;
      }
    }
    strides = ::mosek::fusion::p_Set::strides(_438_shape);
    dims = _437_dims_;
    start = _436_start_;
  }
}
// mosek.fusion.IndexCounter.ctor

// mosek.fusion.IndexCounter.ctor @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:457:6-469:7
mosek::fusion::IndexCounter::t mosek::fusion::p_IndexCounter::_new_IndexCounter
  (int64_t _441_start_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _442_dims_,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _443_strides_)
{ return new mosek::fusion::IndexCounter(_441_start_,_442_dims_,_443_strides_); }
mosek::fusion::IndexCounter::IndexCounter
  (int64_t _441_start_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _442_dims_,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _443_strides_) : 
   IndexCounter(new mosek::fusion::p_IndexCounter(this))
{ mosek::fusion::p_IndexCounter::_get_impl(this)->_initialize(_441_start_,_442_dims_,_443_strides_); }
void mosek::fusion::p_IndexCounter::_initialize  (int64_t _441_start_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _442_dims_,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _443_strides_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__442_dims_(_442_dims_ ? _442_dims_->raw() : nullptr, _442_dims_ ? _442_dims_->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__443_strides_(_443_strides_ ? _443_strides_->raw() : nullptr, _443_strides_ ? _443_strides_->size(0) : 0);
    n = (int)((_442_dims_)->size(0));
    ii = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(n)));
    st = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(n)));
    int32_t _9351_ = (int)0;
    int32_t _9352_ = n;
    for (int32_t _444_i = _9351_; _444_i < _9352_; ++_444_i)
    {
      {
        ((*st)(_444_i)) = _441_start_;
      }
    }
    strides = _443_strides_;
    dims = _442_dims_;
    start = _441_start_;
  }
}
// mosek.fusion.IndexCounter.ctor

// Begin mosek.fusion.IndexCounter.atEnd
// Method mosek.fusion.IndexCounter.atEnd @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:522:6-66
bool mosek::fusion::IndexCounter :: atEnd() { return mosek::fusion::p_IndexCounter::_get_impl(this)->atEnd(); }
bool mosek::fusion::p_IndexCounter::atEnd()
{
  return (((*ii)((n - (int)1))) >= ((*dims)((n - (int)1))));
}
// End mosek.fusion.IndexCounter.atEnd

// Begin mosek.fusion.IndexCounter.getIndex
// Method mosek.fusion.IndexCounter.getIndex @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:520:6-54
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::IndexCounter :: getIndex() { return mosek::fusion::p_IndexCounter::_get_impl(this)->getIndex(); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_IndexCounter::getIndex()
{
  return ii;
}
// End mosek.fusion.IndexCounter.getIndex

// Begin mosek.fusion.IndexCounter.next
// Method mosek.fusion.IndexCounter.next @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:519:6-68
int64_t mosek::fusion::IndexCounter :: next() { return mosek::fusion::p_IndexCounter::_get_impl(this)->next(); }
int64_t mosek::fusion::p_IndexCounter::next()
{
  int64_t _445_r = _pubthis->get();
  _pubthis->inc();
  return _445_r;
}
// End mosek.fusion.IndexCounter.next

// Begin mosek.fusion.IndexCounter.get
// Method mosek.fusion.IndexCounter.get @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:517:6-49
int64_t mosek::fusion::IndexCounter :: get() { return mosek::fusion::p_IndexCounter::_get_impl(this)->get(); }
int64_t mosek::fusion::p_IndexCounter::get()
{
  return ((*st)((int)0));
}
// End mosek.fusion.IndexCounter.get

// Begin mosek.fusion.IndexCounter.inc
// Method mosek.fusion.IndexCounter.inc @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:503:6-515:7
void mosek::fusion::IndexCounter :: inc() { mosek::fusion::p_IndexCounter::_get_impl(this)->inc(); }
void mosek::fusion::p_IndexCounter::inc()
{
  ++ ((*ii)((int)0));
  ((*st)((int)0)) = safe_add( ((*st)((int)0)),((*strides)((n - (int)1))) );
  int32_t _446_i;
  {
    _446_i = (int)0;
    for(;((_446_i < (n - (int)1)) && (((*ii)(_446_i)) == ((*dims)(((n - _446_i) - (int)1)))));++ _446_i)
    {
      {
        ((*ii)(_446_i)) = (int)0;
        ++ ((*ii)(safe_add( _446_i,(int)1 )));
        ((*st)(safe_add( _446_i,(int)1 ))) = safe_add( ((*st)(safe_add( _446_i,(int)1 ))),((*strides)(((n - _446_i) - (int)2))) );
      }
    }
  }
  int32_t _9353_ = (int)0;
  int32_t _9354_ = _446_i;
  for (int32_t _447_j = _9353_; _447_j < _9354_; ++_447_j)
  {
    {
      ((*st)(_447_j)) = ((*st)(_446_i));
    }
  }
}
// End mosek.fusion.IndexCounter.inc

// Begin mosek.fusion.IndexCounter.reset
// Method mosek.fusion.IndexCounter.reset @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:498:6-501:7
void mosek::fusion::IndexCounter :: reset() { mosek::fusion::p_IndexCounter::_get_impl(this)->reset(); }
void mosek::fusion::p_IndexCounter::reset()
{
  st = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(n)));
  int32_t _9355_ = (int)0;
  int32_t _9356_ = n;
  for (int32_t _448_i = _9355_; _448_i < _9356_; ++_448_i)
  {
    {
      ((*st)(_448_i)) = start;
    }
  }
}
// End mosek.fusion.IndexCounter.reset

void mosek::fusion::p_IndexCounter::destroy()
{
  dims.reset();
  strides.reset();
  st.reset();
  ii.reset();
}
void mosek::fusion::IndexCounter::destroy() { mosek::fusion::p_IndexCounter::_get_impl(this)->destroy(); }
// } class IndexCounter
// class CommonTools { // @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:6:4-443:5
mosek::fusion::CommonTools::CommonTools(mosek::fusion::p_CommonTools *_impl) : _impl(_impl) { /*std::cout << "CommonTools() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::CommonTools::~CommonTools() { delete _impl; _impl = nullptr; }
mosek::fusion::p_CommonTools::p_CommonTools
  (::mosek::fusion::CommonTools * _pubthis) :     _pubthis(_pubthis)
{}
// Begin mosek.fusion.CommonTools.resize
// Method mosek.fusion.CommonTools.resize @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:431:6-442:7
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::CommonTools::resize
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _449_values,
    int32_t _450_newsize) { return mosek::fusion::p_CommonTools::resize(_449_values,_450_newsize); }
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::p_CommonTools::resize(std::shared_ptr< monty::ndarray< int64_t,1 > > _449_values,int32_t _450_newsize)
{
  _checked_ptr_1<int64_t> _ptr__449_values(_449_values ? _449_values->raw() : nullptr, _449_values ? _449_values->size(0) : 0);
  if ((_450_newsize == (int)((_449_values)->size(0))))
  {
    {
      return _449_values;
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _451_newvals = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_450_newsize)));
      _checked_ptr_1<int64_t> _ptr__451_newvals(_451_newvals ? _451_newvals->raw() : nullptr,_451_newvals ? _451_newvals->size(0) : 0);
      if ((_450_newsize > (int)((_449_values)->size(0))))
      {
        {
          ::mosek::fusion::Utils::Tools::arraycopy(_449_values,(int)0,_451_newvals,(int)0,(int)((_449_values)->size(0)));
        }
      }
      else
      {
        {
          ::mosek::fusion::Utils::Tools::arraycopy(_449_values,(int)0,_451_newvals,(int)0,_450_newsize);
        }
      }
      return _451_newvals;
    }
  }
}
// End mosek.fusion.CommonTools.resize

// Begin mosek.fusion.CommonTools.resize
// Method mosek.fusion.CommonTools.resize @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:419:6-430:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::CommonTools::resize
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _452_values,
    int32_t _453_newsize) { return mosek::fusion::p_CommonTools::resize(_452_values,_453_newsize); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_CommonTools::resize(std::shared_ptr< monty::ndarray< int32_t,1 > > _452_values,int32_t _453_newsize)
{
  _checked_ptr_1<int32_t> _ptr__452_values(_452_values ? _452_values->raw() : nullptr, _452_values ? _452_values->size(0) : 0);
  if ((_453_newsize == (int)((_452_values)->size(0))))
  {
    {
      return _452_values;
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _454_newvals = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_453_newsize)));
      _checked_ptr_1<int32_t> _ptr__454_newvals(_454_newvals ? _454_newvals->raw() : nullptr,_454_newvals ? _454_newvals->size(0) : 0);
      if ((_453_newsize > (int)((_452_values)->size(0))))
      {
        {
          ::mosek::fusion::Utils::Tools::arraycopy(_452_values,(int)0,_454_newvals,(int)0,(int)((_452_values)->size(0)));
        }
      }
      else
      {
        {
          ::mosek::fusion::Utils::Tools::arraycopy(_452_values,(int)0,_454_newvals,(int)0,_453_newsize);
        }
      }
      return _454_newvals;
    }
  }
}
// End mosek.fusion.CommonTools.resize

// Begin mosek.fusion.CommonTools.resize
// Method mosek.fusion.CommonTools.resize @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:407:6-418:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::CommonTools::resize
  ( std::shared_ptr< monty::ndarray< double,1 > > _455_values,
    int32_t _456_newsize) { return mosek::fusion::p_CommonTools::resize(_455_values,_456_newsize); }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_CommonTools::resize(std::shared_ptr< monty::ndarray< double,1 > > _455_values,int32_t _456_newsize)
{
  _checked_ptr_1<double> _ptr__455_values(_455_values ? _455_values->raw() : nullptr, _455_values ? _455_values->size(0) : 0);
  if ((_456_newsize == (int)((_455_values)->size(0))))
  {
    {
      return _455_values;
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _457_newvals = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_456_newsize)));
      _checked_ptr_1<double> _ptr__457_newvals(_457_newvals ? _457_newvals->raw() : nullptr,_457_newvals ? _457_newvals->size(0) : 0);
      if ((_456_newsize > (int)((_455_values)->size(0))))
      {
        {
          ::mosek::fusion::Utils::Tools::arraycopy(_455_values,(int)0,_457_newvals,(int)0,(int)((_455_values)->size(0)));
        }
      }
      else
      {
        {
          ::mosek::fusion::Utils::Tools::arraycopy(_455_values,(int)0,_457_newvals,(int)0,_456_newsize);
        }
      }
      return _457_newvals;
    }
  }
}
// End mosek.fusion.CommonTools.resize

// Begin mosek.fusion.CommonTools.binarySearch
// Method mosek.fusion.CommonTools.binarySearch @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:389:6-405:7
int32_t mosek::fusion::CommonTools::binarySearch
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _458_values,
    int32_t _459_target) { return mosek::fusion::p_CommonTools::binarySearch(_458_values,_459_target); }
int32_t mosek::fusion::p_CommonTools::binarySearch(std::shared_ptr< monty::ndarray< int32_t,1 > > _458_values,int32_t _459_target)
{
  _checked_ptr_1<int32_t> _ptr__458_values(_458_values ? _458_values->raw() : nullptr, _458_values ? _458_values->size(0) : 0);
  int32_t _460_i0 = (int)0;
  int32_t _461_i1 = (int)((_458_values)->size(0));
  if ((_ptr__458_values[_460_i0] == _459_target))
  {
    {
      return _460_i0;
    }
  }
  else if((_ptr__458_values[(_461_i1 - (int)1)] == _459_target))
  {
    {
      return (_461_i1 - (int)1);
    }
  }
  {}
  while ( (_460_i0 < (_461_i1 - (int)1)) )
  {
    {
      int32_t _462_p = ((_461_i1 - _460_i0) / (int)2);
      if ((_459_target < _ptr__458_values[_462_p]))
      {
        {
          _460_i0 = safe_add( _462_p,(int)1 );
        }
      }
      else if((_459_target > _ptr__458_values[_462_p]))
      {
        {
          _461_i1 = _462_p;
        }
      }
      else
      {
        {
          return _462_p;
        }
      }
    }
  }
  return (-(int)1);
}
// End mosek.fusion.CommonTools.binarySearch

// Begin mosek.fusion.CommonTools.binarySearch
// Method mosek.fusion.CommonTools.binarySearch @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:381:6-387:7
int32_t mosek::fusion::CommonTools::binarySearch
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _463_values,
    int64_t _464_target) { return mosek::fusion::p_CommonTools::binarySearch(_463_values,_464_target); }
int32_t mosek::fusion::p_CommonTools::binarySearch(std::shared_ptr< monty::ndarray< int64_t,1 > > _463_values,int64_t _464_target)
{
  _checked_ptr_1<int64_t> _ptr__463_values(_463_values ? _463_values->raw() : nullptr, _463_values ? _463_values->size(0) : 0);
  int32_t _465_i = ::mosek::fusion::p_CommonTools::binarySearchL(_463_values,_464_target);
  if (((_465_i < (int)((_463_values)->size(0))) && (_ptr__463_values[_465_i] == _464_target)))
  {
    {
      return _465_i;
    }
  }
  else
  {
    {
      return (-(int)1);
    }
  }
}
// End mosek.fusion.CommonTools.binarySearch

// Begin mosek.fusion.CommonTools.binarySearchR
// Method mosek.fusion.CommonTools.binarySearchR @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:365:6-379:7
int32_t mosek::fusion::CommonTools::binarySearchR
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _466_values,
    int64_t _467_target) { return mosek::fusion::p_CommonTools::binarySearchR(_466_values,_467_target); }
int32_t mosek::fusion::p_CommonTools::binarySearchR(std::shared_ptr< monty::ndarray< int64_t,1 > > _466_values,int64_t _467_target)
{
  _checked_ptr_1<int64_t> _ptr__466_values(_466_values ? _466_values->raw() : nullptr, _466_values ? _466_values->size(0) : 0);
  int32_t _468_i0 = (int)0;
  int32_t _469_i1 = (int)((_466_values)->size(0));
  if ((_ptr__466_values[_468_i0] > _467_target))
  {
    {
      return _468_i0;
    }
  }
  {}
  while ( (_468_i0 < (_469_i1 - (int)1)) )
  {
    {
      int32_t _470_p = (safe_add( _469_i1,_468_i0 ) / (int)2);
      if ((_467_target >= _ptr__466_values[_470_p]))
      {
        {
          _468_i0 = _470_p;
        }
      }
      else
      {
        {
          _469_i1 = _470_p;
        }
      }
    }
  }
  return _469_i1;
}
// End mosek.fusion.CommonTools.binarySearchR

// Begin mosek.fusion.CommonTools.binarySearchL
// Method mosek.fusion.CommonTools.binarySearchL @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:348:6-362:7
int32_t mosek::fusion::CommonTools::binarySearchL
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _471_values,
    int64_t _472_target) { return mosek::fusion::p_CommonTools::binarySearchL(_471_values,_472_target); }
int32_t mosek::fusion::p_CommonTools::binarySearchL(std::shared_ptr< monty::ndarray< int64_t,1 > > _471_values,int64_t _472_target)
{
  _checked_ptr_1<int64_t> _ptr__471_values(_471_values ? _471_values->raw() : nullptr, _471_values ? _471_values->size(0) : 0);
  int32_t _473_i0 = (int)0;
  int32_t _474_i1 = (int)((_471_values)->size(0));
  if ((_472_target <= _ptr__471_values[_473_i0]))
  {
    {
      return _473_i0;
    }
  }
  {}
  while ( (_473_i0 < (_474_i1 - (int)1)) )
  {
    {
      int32_t _475_p = (safe_add( _474_i1,_473_i0 ) / (int)2);
      if ((_ptr__471_values[_475_p] < _472_target))
      {
        {
          _473_i0 = _475_p;
        }
      }
      else
      {
        {
          _474_i1 = _475_p;
        }
      }
    }
  }
  return _474_i1;
}
// End mosek.fusion.CommonTools.binarySearchL

// Begin mosek.fusion.CommonTools.ndIncr
// Method mosek.fusion.CommonTools.ndIncr @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:335:6-344:7
void mosek::fusion::CommonTools::ndIncr
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _476_ndidx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _477_first,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _478_last) { mosek::fusion::p_CommonTools::ndIncr(_476_ndidx,_477_first,_478_last); }
void mosek::fusion::p_CommonTools::ndIncr(std::shared_ptr< monty::ndarray< int32_t,1 > > _476_ndidx,std::shared_ptr< monty::ndarray< int32_t,1 > > _477_first,std::shared_ptr< monty::ndarray< int32_t,1 > > _478_last)
{
  _checked_ptr_1<int32_t> _ptr__476_ndidx(_476_ndidx ? _476_ndidx->raw() : nullptr, _476_ndidx ? _476_ndidx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__477_first(_477_first ? _477_first->raw() : nullptr, _477_first ? _477_first->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__478_last(_478_last ? _478_last->raw() : nullptr, _478_last ? _478_last->size(0) : 0);
  int32_t _479_i = ((int)((_476_ndidx)->size(0)) - (int)1);
  ++ _ptr__476_ndidx[_479_i];
  while ( ((_479_i > (int)0) && (_ptr__476_ndidx[_479_i] >= _ptr__478_last[_479_i])) )
  {
    {
      _ptr__476_ndidx[_479_i] = _ptr__477_first[_479_i];
      ++ _ptr__476_ndidx[(_479_i - (int)1)];
    }
  }
}
// End mosek.fusion.CommonTools.ndIncr

// Begin mosek.fusion.CommonTools.transposeTriplets
// Method mosek.fusion.CommonTools.transposeTriplets @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:288:6-333:7
void mosek::fusion::CommonTools::transposeTriplets
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _480_subi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _481_subj,
    std::shared_ptr< monty::ndarray< double,1 > > _482_val,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int64_t,1 > >,1 > > _483_tsubi_,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int64_t,1 > >,1 > > _484_tsubj_,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< double,1 > >,1 > > _485_tval_,
    int64_t _486_nelm,
    int32_t _487_dimi,
    int32_t _488_dimj) { mosek::fusion::p_CommonTools::transposeTriplets(_480_subi,_481_subj,_482_val,_483_tsubi_,_484_tsubj_,_485_tval_,_486_nelm,_487_dimi,_488_dimj); }
void mosek::fusion::p_CommonTools::transposeTriplets(std::shared_ptr< monty::ndarray< int32_t,1 > > _480_subi,std::shared_ptr< monty::ndarray< int32_t,1 > > _481_subj,std::shared_ptr< monty::ndarray< double,1 > > _482_val,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int64_t,1 > >,1 > > _483_tsubi_,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int64_t,1 > >,1 > > _484_tsubj_,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< double,1 > >,1 > > _485_tval_,int64_t _486_nelm,int32_t _487_dimi,int32_t _488_dimj)
{
  _checked_ptr_1<int32_t> _ptr__480_subi(_480_subi ? _480_subi->raw() : nullptr, _480_subi ? _480_subi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__481_subj(_481_subj ? _481_subj->raw() : nullptr, _481_subj ? _481_subj->size(0) : 0);
  _checked_ptr_1<double> _ptr__482_val(_482_val ? _482_val->raw() : nullptr, _482_val ? _482_val->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _489_rptrb = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( _487_dimi,(int)2 ))));
  _checked_ptr_1<int64_t> _ptr__489_rptrb(_489_rptrb ? _489_rptrb->raw() : nullptr,_489_rptrb ? _489_rptrb->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _490_cptrb = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( _488_dimj,(int)2 ))));
  _checked_ptr_1<int64_t> _ptr__490_cptrb(_490_cptrb ? _490_cptrb->raw() : nullptr,_490_cptrb ? _490_cptrb->size(0) : 0);
  {
    int64_t _491_i = (int64_t)0;
    for(;(_491_i < _486_nelm);++ _491_i)
    {
      {
        _ptr__490_cptrb[safe_add( _ptr__481_subj[_491_i],(int)2 )] = safe_add( _ptr__490_cptrb[safe_add( _ptr__481_subj[_491_i],(int)2 )],(int)1 );
        _ptr__489_rptrb[safe_add( _ptr__480_subi[_491_i],(int)2 )] = safe_add( _ptr__489_rptrb[safe_add( _ptr__480_subi[_491_i],(int)2 )],(int)1 );
      }
    }
  }
  {
    int32_t _492_i = (int)1;
    for(;(_492_i < _487_dimi);++ _492_i)
    {
      {
        _ptr__489_rptrb[safe_add( _492_i,(int)1 )] = safe_add( _ptr__489_rptrb[safe_add( _492_i,(int)1 )],_ptr__489_rptrb[_492_i] );
      }
    }
  }
  {
    int32_t _493_i = (int)1;
    for(;(_493_i < _488_dimj);++ _493_i)
    {
      {
        _ptr__490_cptrb[safe_add( _493_i,(int)1 )] = safe_add( _ptr__490_cptrb[safe_add( _493_i,(int)1 )],_ptr__490_cptrb[_493_i] );
      }
    }
  }
  std::shared_ptr< monty::ndarray< int64_t,1 > > _494_tsubi = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_486_nelm)));
  _checked_ptr_1<int64_t> _ptr__494_tsubi(_494_tsubi ? _494_tsubi->raw() : nullptr,_494_tsubi ? _494_tsubi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _495_tsubj = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_486_nelm)));
  _checked_ptr_1<int64_t> _ptr__495_tsubj(_495_tsubj ? _495_tsubj->raw() : nullptr,_495_tsubj ? _495_tsubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _496_tval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_486_nelm)));
  _checked_ptr_1<double> _ptr__496_tval(_496_tval ? _496_tval->raw() : nullptr,_496_tval ? _496_tval->size(0) : 0);
  int32_t _9357_ = (int)0;
  int32_t _9358_ = _487_dimi;
  for (int32_t _497_i = _9357_; _497_i < _9358_; ++_497_i)
  {
    {
      {
        int64_t _498_k = _ptr__489_rptrb[_497_i];
        for(;(_498_k < _ptr__489_rptrb[safe_add( _497_i,(int)1 )]);++ _498_k)
        {
          {
            int32_t _499_j = _ptr__481_subj[_498_k];
            int64_t _500_cidx = _ptr__490_cptrb[_499_j];
            _ptr__494_tsubi[_500_cidx] = _497_i;
            _ptr__495_tsubj[_500_cidx] = _499_j;
            _ptr__496_tval[_500_cidx] = _ptr__482_val[_498_k];
            _ptr__490_cptrb[_499_j] = safe_add( _500_cidx,(int)1 );
          }
        }
      }
    }
  }
  ((*_483_tsubi_)((int)0)) = _495_tsubj;
  ((*_484_tsubj_)((int)0)) = _494_tsubi;
  ((*_485_tval_)((int)0)) = _496_tval;
}
// End mosek.fusion.CommonTools.transposeTriplets

// Begin mosek.fusion.CommonTools.transposeTriplets
// Method mosek.fusion.CommonTools.transposeTriplets @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:240:6-285:7
void mosek::fusion::CommonTools::transposeTriplets
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _501_subi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _502_subj,
    std::shared_ptr< monty::ndarray< double,1 > > _503_val,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _504_tsubi_,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _505_tsubj_,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< double,1 > >,1 > > _506_tval_,
    int64_t _507_nelm,
    int32_t _508_dimi,
    int32_t _509_dimj) { mosek::fusion::p_CommonTools::transposeTriplets(_501_subi,_502_subj,_503_val,_504_tsubi_,_505_tsubj_,_506_tval_,_507_nelm,_508_dimi,_509_dimj); }
void mosek::fusion::p_CommonTools::transposeTriplets(std::shared_ptr< monty::ndarray< int32_t,1 > > _501_subi,std::shared_ptr< monty::ndarray< int32_t,1 > > _502_subj,std::shared_ptr< monty::ndarray< double,1 > > _503_val,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _504_tsubi_,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _505_tsubj_,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< double,1 > >,1 > > _506_tval_,int64_t _507_nelm,int32_t _508_dimi,int32_t _509_dimj)
{
  _checked_ptr_1<int32_t> _ptr__501_subi(_501_subi ? _501_subi->raw() : nullptr, _501_subi ? _501_subi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__502_subj(_502_subj ? _502_subj->raw() : nullptr, _502_subj ? _502_subj->size(0) : 0);
  _checked_ptr_1<double> _ptr__503_val(_503_val ? _503_val->raw() : nullptr, _503_val ? _503_val->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _510_rptrb = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( _508_dimi,(int)2 ))));
  _checked_ptr_1<int64_t> _ptr__510_rptrb(_510_rptrb ? _510_rptrb->raw() : nullptr,_510_rptrb ? _510_rptrb->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _511_cptrb = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( _509_dimj,(int)2 ))));
  _checked_ptr_1<int64_t> _ptr__511_cptrb(_511_cptrb ? _511_cptrb->raw() : nullptr,_511_cptrb ? _511_cptrb->size(0) : 0);
  {
    int64_t _512_i = (int64_t)0;
    for(;(_512_i < _507_nelm);++ _512_i)
    {
      {
        _ptr__511_cptrb[safe_add( _ptr__502_subj[_512_i],(int)2 )] = safe_add( _ptr__511_cptrb[safe_add( _ptr__502_subj[_512_i],(int)2 )],(int)1 );
        _ptr__510_rptrb[safe_add( _ptr__501_subi[_512_i],(int)2 )] = safe_add( _ptr__510_rptrb[safe_add( _ptr__501_subi[_512_i],(int)2 )],(int)1 );
      }
    }
  }
  {
    int32_t _513_i = (int)1;
    for(;(_513_i < _508_dimi);++ _513_i)
    {
      {
        _ptr__510_rptrb[safe_add( _513_i,(int)1 )] = safe_add( _ptr__510_rptrb[safe_add( _513_i,(int)1 )],_ptr__510_rptrb[_513_i] );
      }
    }
  }
  {
    int32_t _514_i = (int)1;
    for(;(_514_i < _509_dimj);++ _514_i)
    {
      {
        _ptr__511_cptrb[safe_add( _514_i,(int)1 )] = safe_add( _ptr__511_cptrb[safe_add( _514_i,(int)1 )],_ptr__511_cptrb[_514_i] );
      }
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _515_tsubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_507_nelm)));
  _checked_ptr_1<int32_t> _ptr__515_tsubi(_515_tsubi ? _515_tsubi->raw() : nullptr,_515_tsubi ? _515_tsubi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _516_tsubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_507_nelm)));
  _checked_ptr_1<int32_t> _ptr__516_tsubj(_516_tsubj ? _516_tsubj->raw() : nullptr,_516_tsubj ? _516_tsubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _517_tval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_507_nelm)));
  _checked_ptr_1<double> _ptr__517_tval(_517_tval ? _517_tval->raw() : nullptr,_517_tval ? _517_tval->size(0) : 0);
  {
    int32_t _518_i = (int)0;
    for(;(_518_i < _508_dimi);++ _518_i)
    {
      {
        int64_t _9359_ = _ptr__510_rptrb[_518_i];
        int64_t _9360_ = _ptr__510_rptrb[safe_add( _518_i,(int)1 )];
        for (int64_t _519_k = _9359_; _519_k < _9360_; ++_519_k)
        {
          {
            int32_t _520_j = _ptr__502_subj[_519_k];
            int64_t _521_cidx = _ptr__511_cptrb[_520_j];
            _ptr__515_tsubi[_521_cidx] = _518_i;
            _ptr__516_tsubj[_521_cidx] = _520_j;
            _ptr__517_tval[_521_cidx] = _ptr__503_val[_519_k];
            _ptr__511_cptrb[_520_j] = safe_add( _521_cidx,(int)1 );
          }
        }
      }
    }
  }
  ((*_504_tsubi_)((int)0)) = _516_tsubj;
  ((*_505_tsubj_)((int)0)) = _515_tsubi;
  ((*_506_tval_)((int)0)) = _517_tval;
}
// End mosek.fusion.CommonTools.transposeTriplets

// Begin mosek.fusion.CommonTools.tripletSort
// Method mosek.fusion.CommonTools.tripletSort @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:114:6-213:7
void mosek::fusion::CommonTools::tripletSort
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _522_subi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _523_subj,
    std::shared_ptr< monty::ndarray< double,1 > > _524_val,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _525_tsubi_,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _526_tsubj_,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< double,1 > >,1 > > _527_tval_,
    int64_t _528_nelm,
    int32_t _529_dimi,
    int32_t _530_dimj) { mosek::fusion::p_CommonTools::tripletSort(_522_subi,_523_subj,_524_val,_525_tsubi_,_526_tsubj_,_527_tval_,_528_nelm,_529_dimi,_530_dimj); }
void mosek::fusion::p_CommonTools::tripletSort(std::shared_ptr< monty::ndarray< int32_t,1 > > _522_subi,std::shared_ptr< monty::ndarray< int32_t,1 > > _523_subj,std::shared_ptr< monty::ndarray< double,1 > > _524_val,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _525_tsubi_,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _526_tsubj_,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< double,1 > >,1 > > _527_tval_,int64_t _528_nelm,int32_t _529_dimi,int32_t _530_dimj)
{
  _checked_ptr_1<int32_t> _ptr__522_subi(_522_subi ? _522_subi->raw() : nullptr, _522_subi ? _522_subi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__523_subj(_523_subj ? _523_subj->raw() : nullptr, _523_subj ? _523_subj->size(0) : 0);
  _checked_ptr_1<double> _ptr__524_val(_524_val ? _524_val->raw() : nullptr, _524_val ? _524_val->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _531_cols = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_528_nelm)));
  _checked_ptr_1<int32_t> _ptr__531_cols(_531_cols ? _531_cols->raw() : nullptr,_531_cols ? _531_cols->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _532_cptrb = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( _530_dimj,(int)2 ))));
  _checked_ptr_1<int64_t> _ptr__532_cptrb(_532_cptrb ? _532_cptrb->raw() : nullptr,_532_cptrb ? _532_cptrb->size(0) : 0);
  int64_t _9361_ = (int64_t)0;
  int64_t _9362_ = _528_nelm;
  for (int64_t _533_i = _9361_; _533_i < _9362_; ++_533_i)
  {
    {
      _ptr__532_cptrb[safe_add( _ptr__523_subj[_533_i],(int)2 )] = safe_add( _ptr__532_cptrb[safe_add( _ptr__523_subj[_533_i],(int)2 )],(int)1 );
    }
  }
  int32_t _9363_ = (int)1;
  int32_t _9364_ = _530_dimj;
  for (int32_t _534_i = _9363_; _534_i < _9364_; ++_534_i)
  {
    {
      _ptr__532_cptrb[safe_add( _534_i,(int)1 )] = safe_add( _ptr__532_cptrb[safe_add( _534_i,(int)1 )],_ptr__532_cptrb[_534_i] );
    }
  }
  int32_t _9365_ = (int)0;
  int32_t _9366_ = (int32_t)_528_nelm;
  for (int32_t _535_i = _9365_; _535_i < _9366_; ++_535_i)
  {
    {
      int32_t _536_cidx = _ptr__523_subj[_535_i];
      _ptr__531_cols[_ptr__532_cptrb[safe_add( _536_cidx,(int)1 )]] = _535_i;
      _ptr__532_cptrb[safe_add( _536_cidx,(int)1 )] = safe_add( _ptr__532_cptrb[safe_add( _536_cidx,(int)1 )],(int)1 );
    }
  }
  std::shared_ptr< monty::ndarray< int64_t,1 > > _537_rptrb = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( _529_dimi,(int)2 ))));
  _checked_ptr_1<int64_t> _ptr__537_rptrb(_537_rptrb ? _537_rptrb->raw() : nullptr,_537_rptrb ? _537_rptrb->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _538_rows = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_528_nelm)));
  _checked_ptr_1<int32_t> _ptr__538_rows(_538_rows ? _538_rows->raw() : nullptr,_538_rows ? _538_rows->size(0) : 0);
  {
    int32_t _539_i = (int)0;
    for(;(_539_i < _528_nelm);++ _539_i)
    {
      {
        _ptr__537_rptrb[safe_add( _ptr__522_subi[_539_i],(int)2 )] = safe_add( _ptr__537_rptrb[safe_add( _ptr__522_subi[_539_i],(int)2 )],(int)1 );
      }
    }
  }
  {
    int32_t _540_i = (int)1;
    for(;(_540_i < _529_dimi);++ _540_i)
    {
      {
        _ptr__537_rptrb[safe_add( _540_i,(int)1 )] = safe_add( _ptr__537_rptrb[safe_add( _540_i,(int)1 )],_ptr__537_rptrb[_540_i] );
      }
    }
  }
  {
    int32_t _541_j = (int)0;
    for(;(_541_j < _530_dimj);++ _541_j)
    {
      {
        {
          int64_t _542_i = _ptr__532_cptrb[_541_j];
          for(;(_542_i < _ptr__532_cptrb[safe_add( _541_j,(int)1 )]);++ _542_i)
          {
            {
              int32_t _543_ridx = _ptr__522_subi[_ptr__531_cols[_542_i]];
              _ptr__538_rows[_ptr__537_rptrb[safe_add( _543_ridx,(int)1 )]] = _ptr__531_cols[_542_i];
              _ptr__537_rptrb[safe_add( _543_ridx,(int)1 )] = safe_add( _ptr__537_rptrb[safe_add( _543_ridx,(int)1 )],(int)1 );
            }
          }
        }
      }
    }
  }
  int32_t _544_nunique = (int)1;
  {
    int32_t _545_si = _ptr__522_subi[_ptr__538_rows[(int)0]];
    int32_t _546_sj = _ptr__523_subj[_ptr__538_rows[(int)0]];
    {
      int32_t _547_i = (int)1;
      for(;(_547_i < _528_nelm);++ _547_i)
      {
        {
          int32_t _548_idx = _ptr__538_rows[_547_i];
          if (((_545_si != _ptr__522_subi[_548_idx]) || (_546_sj != _ptr__523_subj[_548_idx])))
          {
            {
              _545_si = _ptr__522_subi[_548_idx];
              _546_sj = _ptr__523_subj[_548_idx];
              ++ _544_nunique;
            }
          }
          {}
        }
      }
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _549_tsubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_544_nunique)));
  _checked_ptr_1<int32_t> _ptr__549_tsubi(_549_tsubi ? _549_tsubi->raw() : nullptr,_549_tsubi ? _549_tsubi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _550_tsubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_544_nunique)));
  _checked_ptr_1<int32_t> _ptr__550_tsubj(_550_tsubj ? _550_tsubj->raw() : nullptr,_550_tsubj ? _550_tsubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _551_tval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_544_nunique)));
  _checked_ptr_1<double> _ptr__551_tval(_551_tval ? _551_tval->raw() : nullptr,_551_tval ? _551_tval->size(0) : 0);
  {
    int32_t _552_idx = _ptr__538_rows[(int)0];
    _ptr__549_tsubi[(int)0] = _ptr__522_subi[_552_idx];
    _ptr__550_tsubj[(int)0] = _ptr__523_subj[_552_idx];
    _ptr__551_tval[(int)0] = _ptr__524_val[_552_idx];
  }
  int32_t _553_di = (int)1;
  int32_t _9367_ = (int)1;
  int64_t _9368_ = _528_nelm;
  for (int64_t _554_i = _9367_; _554_i < _9368_; ++_554_i)
  {
    {
      int32_t _555_idx = _ptr__538_rows[_554_i];
      if (((_ptr__549_tsubi[(_553_di - (int)1)] == _ptr__522_subi[_555_idx]) && (_ptr__550_tsubj[(_553_di - (int)1)] == _ptr__523_subj[_555_idx])))
      {
        {
          _ptr__551_tval[(_553_di - (int)1)] = (_ptr__551_tval[(_553_di - (int)1)] + _ptr__524_val[_555_idx]);
        }
      }
      else
      {
        {
          _ptr__549_tsubi[_553_di] = _ptr__522_subi[_555_idx];
          _ptr__550_tsubj[_553_di] = _ptr__523_subj[_555_idx];
          _ptr__551_tval[_553_di] = _ptr__524_val[_555_idx];
          ++ _553_di;
        }
      }
    }
  }
  ((*_525_tsubi_)((int)0)) = _549_tsubi;
  ((*_526_tsubj_)((int)0)) = _550_tsubj;
  ((*_527_tval_)((int)0)) = _551_tval;
}
// End mosek.fusion.CommonTools.tripletSort

// Begin mosek.fusion.CommonTools.argMSort
// Method mosek.fusion.CommonTools.argMSort @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:67:6-87:7
void mosek::fusion::CommonTools::argMSort
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _556_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _557_vals) { mosek::fusion::p_CommonTools::argMSort(_556_idx,_557_vals); }
void mosek::fusion::p_CommonTools::argMSort(std::shared_ptr< monty::ndarray< int32_t,1 > > _556_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _557_vals)
{
  _checked_ptr_1<int32_t> _ptr__556_idx(_556_idx ? _556_idx->raw() : nullptr, _556_idx ? _556_idx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__557_vals(_557_vals ? _557_vals->raw() : nullptr, _557_vals ? _557_vals->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _558_temp = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)((_556_idx)->size(0)))));
  _checked_ptr_1<int32_t> _ptr__558_temp(_558_temp ? _558_temp->raw() : nullptr,_558_temp ? _558_temp->size(0) : 0);
  bool _559_alt = false;
  {
    int32_t _560_intvlen = (int)1;
    for(;(_560_intvlen < (int)((_556_idx)->size(0)));_560_intvlen *= (int)2)
    {
      {
        _559_alt = (!_559_alt);
        int32_t _9369_ = (int)0;
        int32_t _9370_ = (int)((_556_idx)->size(0));
        int32_t _9371_ = safe_mul( _560_intvlen,(int)2 );
        for (int32_t _561_i = _9369_; _561_i < _9370_; _561_i += _9371_)
        {
          {
            if (_559_alt)
            {
              {
                ::mosek::fusion::p_CommonTools::mergeInto(_556_idx,_558_temp,_557_vals,_561_i,safe_add( _561_i,_560_intvlen ),safe_add( _561_i,safe_mul( (int)2,_560_intvlen ) ));
              }
            }
            else
            {
              {
                ::mosek::fusion::p_CommonTools::mergeInto(_558_temp,_556_idx,_557_vals,_561_i,safe_add( _561_i,_560_intvlen ),safe_add( _561_i,safe_mul( (int)2,_560_intvlen ) ));
              }
            }
          }
        }
      }
    }
  }
  if (_559_alt)
  {
    {
      ::mosek::fusion::Utils::Tools::arraycopy(_558_temp,(int)0,_556_idx,(int)0,(int)((_556_idx)->size(0)));
    }
  }
  {}
}
// End mosek.fusion.CommonTools.argMSort

// Begin mosek.fusion.CommonTools.mergeInto
// Method mosek.fusion.CommonTools.mergeInto @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:29:6-54:7
void mosek::fusion::p_CommonTools::mergeInto(std::shared_ptr< monty::ndarray< int32_t,1 > > _562_src,std::shared_ptr< monty::ndarray< int32_t,1 > > _563_tgt,std::shared_ptr< monty::ndarray< int32_t,1 > > _564_vals,int32_t _565_si0,int32_t _566_si1_,int32_t _567_si2_)
{
  _checked_ptr_1<int32_t> _ptr__562_src(_562_src ? _562_src->raw() : nullptr, _562_src ? _562_src->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__563_tgt(_563_tgt ? _563_tgt->raw() : nullptr, _563_tgt ? _563_tgt->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__564_vals(_564_vals ? _564_vals->raw() : nullptr, _564_vals ? _564_vals->size(0) : 0);
  int32_t _9372_;
  bool _9373_ = (_567_si2_ > (int)((_562_src)->size(0)));
  if (_9373_)
  {
    _9372_ = (int)((_562_src)->size(0));
  }
  else
  {
    _9372_ = _567_si2_;
  }
  int32_t _568_si2 = _9372_;
  int32_t _9374_;
  bool _9375_ = (_566_si1_ > _568_si2);
  if (_9375_)
  {
    _9374_ = _568_si2;
  }
  else
  {
    _9374_ = _566_si1_;
  }
  int32_t _569_si1 = _9374_;
  if ((_569_si1 == _568_si2))
  {
    {
      ::mosek::fusion::Utils::Tools::arraycopy(_562_src,_565_si0,_563_tgt,_565_si0,(_569_si1 - _565_si0));
    }
  }
  else
  {
    {
      int32_t _570_i0 = _565_si0;
      int32_t _571_i1 = _569_si1;
      int32_t _572_i;
      {
        _572_i = _565_si0;
        for(;((_570_i0 < _569_si1) && (_571_i1 < _568_si2));++ _572_i)
        {
          {
            if ((_ptr__564_vals[_ptr__562_src[_570_i0]] < _ptr__564_vals[_ptr__562_src[_571_i1]]))
            {
              {
                _ptr__563_tgt[_572_i] = _ptr__562_src[_570_i0];
                ++ _570_i0;
              }
            }
            else
            {
              {
                _ptr__563_tgt[_572_i] = _ptr__562_src[_571_i1];
                ++ _571_i1;
              }
            }
          }
        }
      }
      while ( (_570_i0 < _569_si1) )
      {
        {
          _ptr__563_tgt[_572_i] = _ptr__562_src[_570_i0];
          ++ _570_i0;
          ++ _572_i;
        }
      }
      while ( (_571_i1 < _568_si2) )
      {
        {
          _ptr__563_tgt[_572_i] = _ptr__562_src[_571_i1];
          ++ _571_i1;
          ++ _572_i;
        }
      }
    }
  }
}
// End mosek.fusion.CommonTools.mergeInto

// Begin mosek.fusion.CommonTools.argQsort
// Method mosek.fusion.CommonTools.argQsort @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:16:6-22:7
void mosek::fusion::CommonTools::argQsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _573_idx,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _574_vals1,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _575_vals2,
    int64_t _576_first,
    int64_t _577_last) { mosek::fusion::p_CommonTools::argQsort(_573_idx,_574_vals1,_575_vals2,_576_first,_577_last); }
void mosek::fusion::p_CommonTools::argQsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _573_idx,std::shared_ptr< monty::ndarray< int64_t,1 > > _574_vals1,std::shared_ptr< monty::ndarray< int64_t,1 > > _575_vals2,int64_t _576_first,int64_t _577_last)
{
  _checked_ptr_1<int64_t> _ptr__573_idx(_573_idx ? _573_idx->raw() : nullptr, _573_idx ? _573_idx->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__574_vals1(_574_vals1 ? _574_vals1->raw() : nullptr, _574_vals1 ? _574_vals1->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__575_vals2(_575_vals2 ? _575_vals2->raw() : nullptr, _575_vals2 ? _575_vals2->size(0) : 0);
  if ((NULL == _575_vals2.get()))
  {
    {
      ::mosek::fusion::Utils::Tools::argsort(_573_idx,_574_vals1,_576_first,_577_last);
    }
  }
  else
  {
    {
      ::mosek::fusion::Utils::Tools::argsort(_573_idx,_574_vals1,_575_vals2,_576_first,_577_last);
    }
  }
}
// End mosek.fusion.CommonTools.argQsort

// Begin mosek.fusion.CommonTools.argQsort
// Method mosek.fusion.CommonTools.argQsort @ bld/grindsted/final/default/src/fusion/CommonUtil.mbi:8:6-14:7
void mosek::fusion::CommonTools::argQsort
  ( std::shared_ptr< monty::ndarray< int64_t,1 > > _578_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _579_vals1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _580_vals2,
    int64_t _581_first,
    int64_t _582_last) { mosek::fusion::p_CommonTools::argQsort(_578_idx,_579_vals1,_580_vals2,_581_first,_582_last); }
void mosek::fusion::p_CommonTools::argQsort(std::shared_ptr< monty::ndarray< int64_t,1 > > _578_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _579_vals1,std::shared_ptr< monty::ndarray< int32_t,1 > > _580_vals2,int64_t _581_first,int64_t _582_last)
{
  _checked_ptr_1<int64_t> _ptr__578_idx(_578_idx ? _578_idx->raw() : nullptr, _578_idx ? _578_idx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__579_vals1(_579_vals1 ? _579_vals1->raw() : nullptr, _579_vals1 ? _579_vals1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__580_vals2(_580_vals2 ? _580_vals2->raw() : nullptr, _580_vals2 ? _580_vals2->size(0) : 0);
  if ((NULL == _580_vals2.get()))
  {
    {
      ::mosek::fusion::Utils::Tools::argsort(_578_idx,_579_vals1,_581_first,_582_last);
    }
  }
  else
  {
    {
      ::mosek::fusion::Utils::Tools::argsort(_578_idx,_579_vals1,_580_vals2,_581_first,_582_last);
    }
  }
}
// End mosek.fusion.CommonTools.argQsort

void mosek::fusion::p_CommonTools::destroy()
{
}
void mosek::fusion::CommonTools::destroy() { mosek::fusion::p_CommonTools::_get_impl(this)->destroy(); }
// } class CommonTools
// class SolutionStruct { // @ bld/grindsted/final/default/src/fusion/Model.mbi:5469:4-5804:5
mosek::fusion::SolutionStruct::SolutionStruct(mosek::fusion::p_SolutionStruct *_impl) : _impl(_impl) { /*std::cout << "SolutionStruct() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::SolutionStruct::~SolutionStruct() { delete _impl; _impl = nullptr; }
mosek::fusion::p_SolutionStruct::p_SolutionStruct
  (::mosek::fusion::SolutionStruct * _pubthis) :     _pubthis(_pubthis)
{}
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SolutionStruct::get_accy() { return _impl->accy; }
void mosek::fusion::SolutionStruct::set_accy(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->accy = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SolutionStruct::get_accx() { return _impl->accx; }
void mosek::fusion::SolutionStruct::set_accx(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->accx = _val; }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::SolutionStruct::get_accptr() { return _impl->accptr; }
void mosek::fusion::SolutionStruct::set_accptr(std::shared_ptr< monty::ndarray< int32_t,1 > > _val) { _impl->accptr = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SolutionStruct::get_yx() { return _impl->yx; }
void mosek::fusion::SolutionStruct::set_yx(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->yx = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SolutionStruct::get_sux() { return _impl->sux; }
void mosek::fusion::SolutionStruct::set_sux(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->sux = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SolutionStruct::get_slx() { return _impl->slx; }
void mosek::fusion::SolutionStruct::set_slx(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->slx = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SolutionStruct::get_bars() { return _impl->bars; }
void mosek::fusion::SolutionStruct::set_bars(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->bars = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SolutionStruct::get_barx() { return _impl->barx; }
void mosek::fusion::SolutionStruct::set_barx(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->barx = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SolutionStruct::get_y() { return _impl->y; }
void mosek::fusion::SolutionStruct::set_y(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->y = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SolutionStruct::get_suc() { return _impl->suc; }
void mosek::fusion::SolutionStruct::set_suc(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->suc = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SolutionStruct::get_slc() { return _impl->slc; }
void mosek::fusion::SolutionStruct::set_slc(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->slc = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SolutionStruct::get_xx() { return _impl->xx; }
void mosek::fusion::SolutionStruct::set_xx(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->xx = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SolutionStruct::get_xc() { return _impl->xc; }
void mosek::fusion::SolutionStruct::set_xc(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->xc = _val; }
double mosek::fusion::SolutionStruct::get_dobj() { return _impl->dobj; }
void mosek::fusion::SolutionStruct::set_dobj(double _val) { _impl->dobj = _val; }
double mosek::fusion::SolutionStruct::get_pobj() { return _impl->pobj; }
void mosek::fusion::SolutionStruct::set_pobj(double _val) { _impl->pobj = _val; }
mosek::fusion::ProblemStatus mosek::fusion::SolutionStruct::get_probstatus() { return _impl->probstatus; }
void mosek::fusion::SolutionStruct::set_probstatus(mosek::fusion::ProblemStatus _val) { _impl->probstatus = _val; }
mosek::fusion::SolutionStatus mosek::fusion::SolutionStruct::get_dstatus() { return _impl->dstatus; }
void mosek::fusion::SolutionStruct::set_dstatus(mosek::fusion::SolutionStatus _val) { _impl->dstatus = _val; }
mosek::fusion::SolutionStatus mosek::fusion::SolutionStruct::get_pstatus() { return _impl->pstatus; }
void mosek::fusion::SolutionStruct::set_pstatus(mosek::fusion::SolutionStatus _val) { _impl->pstatus = _val; }
int32_t mosek::fusion::SolutionStruct::get_sol_numbarvar() { return _impl->sol_numbarvar; }
void mosek::fusion::SolutionStruct::set_sol_numbarvar(int32_t _val) { _impl->sol_numbarvar = _val; }
int32_t mosek::fusion::SolutionStruct::get_sol_numaccelm() { return _impl->sol_numaccelm; }
void mosek::fusion::SolutionStruct::set_sol_numaccelm(int32_t _val) { _impl->sol_numaccelm = _val; }
int32_t mosek::fusion::SolutionStruct::get_sol_numacc() { return _impl->sol_numacc; }
void mosek::fusion::SolutionStruct::set_sol_numacc(int32_t _val) { _impl->sol_numacc = _val; }
int32_t mosek::fusion::SolutionStruct::get_sol_numvar() { return _impl->sol_numvar; }
void mosek::fusion::SolutionStruct::set_sol_numvar(int32_t _val) { _impl->sol_numvar = _val; }
int32_t mosek::fusion::SolutionStruct::get_sol_numcon() { return _impl->sol_numcon; }
void mosek::fusion::SolutionStruct::set_sol_numcon(int32_t _val) { _impl->sol_numcon = _val; }
// mosek.fusion.SolutionStruct.ctor @ bld/grindsted/final/default/src/fusion/Model.mbi:5744:6-5803:7
mosek::fusion::SolutionStruct::t mosek::fusion::p_SolutionStruct::_new_SolutionStruct
  (int32_t _583_numvar,
    int32_t _584_numcon,
    int32_t _585_numbarvar,
    int32_t _586_numacc,
    int32_t _587_numaccelm)
{ return new mosek::fusion::SolutionStruct(_583_numvar,_584_numcon,_585_numbarvar,_586_numacc,_587_numaccelm); }
mosek::fusion::SolutionStruct::SolutionStruct
  (int32_t _583_numvar,
    int32_t _584_numcon,
    int32_t _585_numbarvar,
    int32_t _586_numacc,
    int32_t _587_numaccelm) : 
   SolutionStruct(new mosek::fusion::p_SolutionStruct(this))
{ mosek::fusion::p_SolutionStruct::_get_impl(this)->_initialize(_583_numvar,_584_numcon,_585_numbarvar,_586_numacc,_587_numaccelm); }
void mosek::fusion::p_SolutionStruct::_initialize  (int32_t _583_numvar,
    int32_t _584_numcon,
    int32_t _585_numbarvar,
    int32_t _586_numacc,
    int32_t _587_numaccelm)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    pobj = 0.0;
    dobj = 0.0;
    pstatus = ::mosek::fusion::SolutionStatus::Unknown;
    dstatus = ::mosek::fusion::SolutionStatus::Unknown;
    probstatus = ::mosek::fusion::ProblemStatus::Unknown;
    sol_numvar = _583_numvar;
    sol_numcon = _584_numcon;
    sol_numbarvar = _585_numbarvar;
    sol_numacc = _586_numacc;
    sol_numaccelm = _587_numaccelm;
    slx = nullptr;
    sux = nullptr;
    xx = nullptr;
    yx = nullptr;
    slc = nullptr;
    suc = nullptr;
    y = nullptr;
    xc = nullptr;
    barx = nullptr;
    bars = nullptr;
    accx = nullptr;
    accy = nullptr;
    accptr = nullptr;
    if ((_583_numvar > (int)0))
    {
      {
        slx = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_583_numvar)));
        sux = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_583_numvar)));
        xx = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_583_numvar)));
        yx = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_583_numvar)));
      }
    }
    {}
    if ((_585_numbarvar > (int)0))
    {
      {
        barx = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_585_numbarvar)));
        bars = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_585_numbarvar)));
      }
    }
    {}
    if ((_584_numcon > (int)0))
    {
      {
        slc = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_584_numcon)));
        suc = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_584_numcon)));
        y = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_584_numcon)));
        xc = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_584_numcon)));
      }
    }
    {}
    if ((_586_numacc > (int)0))
    {
      {
        accx = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_587_numaccelm)));
        accy = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_587_numaccelm)));
        accptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _586_numacc,(int)1 ))));
      }
    }
    {}
  }
}
// mosek.fusion.SolutionStruct.ctor

// mosek.fusion.SolutionStruct.ctor @ bld/grindsted/final/default/src/fusion/Model.mbi:5711:6-5741:7
mosek::fusion::SolutionStruct::t mosek::fusion::p_SolutionStruct::_new_SolutionStruct
  (monty::rc_ptr< ::mosek::fusion::SolutionStruct > _588_that)
{ return new mosek::fusion::SolutionStruct(_588_that); }
mosek::fusion::SolutionStruct::SolutionStruct
  (monty::rc_ptr< ::mosek::fusion::SolutionStruct > _588_that) : 
   SolutionStruct(new mosek::fusion::p_SolutionStruct(this))
{ mosek::fusion::p_SolutionStruct::_get_impl(this)->_initialize(_588_that); }
void mosek::fusion::p_SolutionStruct::_initialize  (monty::rc_ptr< ::mosek::fusion::SolutionStruct > _588_that)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    sol_numcon = mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->sol_numcon;
    sol_numvar = mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->sol_numvar;
    sol_numbarvar = mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->sol_numbarvar;
    sol_numacc = mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->sol_numacc;
    sol_numaccelm = mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->sol_numaccelm;
    pstatus = mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->pstatus;
    dstatus = mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->dstatus;
    probstatus = mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->probstatus;
    pobj = mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->pobj;
    dobj = mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->dobj;
    std::shared_ptr< monty::ndarray< double,1 > > _9376_;
    bool _9377_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->xc.get());
    if (_9377_)
    {
      _9376_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->xc);
    }
    else
    {
      _9376_ = nullptr;
    }
    xc = _9376_;
    std::shared_ptr< monty::ndarray< double,1 > > _9378_;
    bool _9379_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->xx.get());
    if (_9379_)
    {
      _9378_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->xx);
    }
    else
    {
      _9378_ = nullptr;
    }
    xx = _9378_;
    std::shared_ptr< monty::ndarray< double,1 > > _9380_;
    bool _9381_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->yx.get());
    if (_9381_)
    {
      _9380_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->yx);
    }
    else
    {
      _9380_ = nullptr;
    }
    yx = _9380_;
    std::shared_ptr< monty::ndarray< double,1 > > _9382_;
    bool _9383_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->slc.get());
    if (_9383_)
    {
      _9382_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->slc);
    }
    else
    {
      _9382_ = nullptr;
    }
    slc = _9382_;
    std::shared_ptr< monty::ndarray< double,1 > > _9384_;
    bool _9385_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->suc.get());
    if (_9385_)
    {
      _9384_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->suc);
    }
    else
    {
      _9384_ = nullptr;
    }
    suc = _9384_;
    std::shared_ptr< monty::ndarray< double,1 > > _9386_;
    bool _9387_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->y.get());
    if (_9387_)
    {
      _9386_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->y);
    }
    else
    {
      _9386_ = nullptr;
    }
    y = _9386_;
    std::shared_ptr< monty::ndarray< double,1 > > _9388_;
    bool _9389_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->barx.get());
    if (_9389_)
    {
      _9388_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->barx);
    }
    else
    {
      _9388_ = nullptr;
    }
    barx = _9388_;
    std::shared_ptr< monty::ndarray< double,1 > > _9390_;
    bool _9391_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->bars.get());
    if (_9391_)
    {
      _9390_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->bars);
    }
    else
    {
      _9390_ = nullptr;
    }
    bars = _9390_;
    std::shared_ptr< monty::ndarray< double,1 > > _9392_;
    bool _9393_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->slx.get());
    if (_9393_)
    {
      _9392_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->slx);
    }
    else
    {
      _9392_ = nullptr;
    }
    slx = _9392_;
    std::shared_ptr< monty::ndarray< double,1 > > _9394_;
    bool _9395_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->sux.get());
    if (_9395_)
    {
      _9394_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->sux);
    }
    else
    {
      _9394_ = nullptr;
    }
    sux = _9394_;
    std::shared_ptr< monty::ndarray< int32_t,1 > > _9396_;
    bool _9397_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->accptr.get());
    if (_9397_)
    {
      _9396_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->accptr);
    }
    else
    {
      _9396_ = nullptr;
    }
    accptr = _9396_;
    std::shared_ptr< monty::ndarray< double,1 > > _9398_;
    bool _9399_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->accx.get());
    if (_9399_)
    {
      _9398_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->accx);
    }
    else
    {
      _9398_ = nullptr;
    }
    accx = _9398_;
    std::shared_ptr< monty::ndarray< double,1 > > _9400_;
    bool _9401_ = (NULL != mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->accy.get());
    if (_9401_)
    {
      _9400_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_588_that)->accy);
    }
    else
    {
      _9400_ = nullptr;
    }
    accy = _9400_;
  }
}
// mosek.fusion.SolutionStruct.ctor

// Begin mosek.fusion.SolutionStruct.clone
// Method mosek.fusion.SolutionStruct.clone @ bld/grindsted/final/default/src/fusion/Model.mbi:5742:6-79
monty::rc_ptr< ::mosek::fusion::SolutionStruct > mosek::fusion::SolutionStruct :: __mosek_2fusion_2SolutionStruct__clone() { return mosek::fusion::p_SolutionStruct::_get_impl(this)->__mosek_2fusion_2SolutionStruct__clone(); }
monty::rc_ptr< ::mosek::fusion::SolutionStruct > mosek::fusion::SolutionStruct::clone() { return __mosek_2fusion_2SolutionStruct__clone(); }
monty::rc_ptr< ::mosek::fusion::SolutionStruct > mosek::fusion::p_SolutionStruct::__mosek_2fusion_2SolutionStruct__clone()
{
  return ::mosek::fusion::p_SolutionStruct::_new_SolutionStruct(::mosek::fusion::SolutionStruct::t(_pubthis));
}
// End mosek.fusion.SolutionStruct.clone

// Begin mosek.fusion.SolutionStruct.resize
// Method mosek.fusion.SolutionStruct.resize @ bld/grindsted/final/default/src/fusion/Model.mbi:5536:6-5706:7
void mosek::fusion::SolutionStruct :: resize(int32_t _589_numvar,int32_t _590_numcon,int32_t _591_numbarvar,int32_t _592_numacc,int32_t _593_numaccelm) { mosek::fusion::p_SolutionStruct::_get_impl(this)->resize(_589_numvar,_590_numcon,_591_numbarvar,_592_numacc,_593_numaccelm); }
void mosek::fusion::p_SolutionStruct::resize(int32_t _589_numvar,int32_t _590_numcon,int32_t _591_numbarvar,int32_t _592_numacc,int32_t _593_numaccelm)
{
  if ((_592_numacc <= (int)0))
  {
    {
      sol_numacc = (int)0;
    }
  }
  else if((_592_numacc <= ((int)((accptr)->size(0)) - (int)1)))
  {
    {
      sol_numacc = _592_numacc;
    }
  }
  else
  {
    {
      int32_t _594_newnum = safe_mul( ((int)((accptr)->size(0)) - (int)1),(int)2 );
      if ((_594_newnum < _592_numacc))
      {
        {
          _594_newnum = _592_numacc;
        }
      }
      {}
      std::shared_ptr< monty::ndarray< int32_t,1 > > _595_new_accptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _594_newnum,(int)1 ))));
      _checked_ptr_1<int32_t> _ptr__595_new_accptr(_595_new_accptr ? _595_new_accptr->raw() : nullptr,_595_new_accptr ? _595_new_accptr->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(accptr,(int)0,_595_new_accptr,(int)0,safe_add( _592_numacc,(int)1 ));
      accptr = _595_new_accptr;
      sol_numacc = _592_numacc;
    }
  }
  if ((_593_numaccelm <= (int)0))
  {
    {
      sol_numaccelm = (int)0;
    }
  }
  else if((_593_numaccelm > (int)((accx)->size(0))))
  {
    {
      sol_numaccelm = _593_numaccelm;
    }
  }
  else
  {
    {
      int32_t _596_newnum = safe_mul( (int)((accx)->size(0)),(int)2 );
      if ((_596_newnum < _593_numaccelm))
      {
        {
          _596_newnum = _593_numaccelm;
        }
      }
      {}
      std::shared_ptr< monty::ndarray< double,1 > > _597_new_accx = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_596_newnum)));
      _checked_ptr_1<double> _ptr__597_new_accx(_597_new_accx ? _597_new_accx->raw() : nullptr,_597_new_accx ? _597_new_accx->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _598_new_accy = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_596_newnum)));
      _checked_ptr_1<double> _ptr__598_new_accy(_598_new_accy ? _598_new_accy->raw() : nullptr,_598_new_accy ? _598_new_accy->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(accx,(int)0,_597_new_accx,(int)0,_593_numaccelm);
      ::mosek::fusion::Utils::Tools::arraycopy(accy,(int)0,_598_new_accy,(int)0,_593_numaccelm);
      accx = _597_new_accx;
      accy = _598_new_accy;
      sol_numaccelm = _593_numaccelm;
    }
  }
  if ((_591_numbarvar < (int)0))
  {
    {
    }
  }
  else if((_591_numbarvar <= sol_numbarvar))
  {
    {
      sol_numbarvar = _591_numbarvar;
    }
  }
  else if((_591_numbarvar <= (int)((barx)->size(0))))
  {
    {
    }
  }
  else
  {
    {
      int32_t _599_newsize;
      if ((safe_mul( sol_numbarvar,(int)2 ) > safe_add( _591_numbarvar,(int)100 )))
      {
        {
          _599_newsize = safe_mul( sol_numbarvar,(int)2 );
        }
      }
      else
      {
        {
          _599_newsize = safe_add( _591_numbarvar,(int)100 );
        }
      }
      barx = ::mosek::fusion::p_CommonTools::resize(barx,_599_newsize);
      bars = ::mosek::fusion::p_CommonTools::resize(bars,_599_newsize);
      sol_numbarvar = _599_newsize;
    }
  }
  if ((_589_numvar < (int)0))
  {
    {
    }
  }
  else if((_589_numvar <= sol_numvar))
  {
    {
      sol_numvar = _589_numvar;
    }
  }
  else if((_589_numvar <= (int)((xx)->size(0))))
  {
    {
      int32_t _9402_ = sol_numvar;
      int32_t _9403_ = _589_numvar;
      for (int32_t _600_i = _9402_; _600_i < _9403_; ++_600_i)
      {
        {
          ((*slx)(_600_i)) = 0.0;
          ((*sux)(_600_i)) = 0.0;
          ((*xx)(_600_i)) = 0.0;
          ((*yx)(_600_i)) = 0.0;
        }
      }
      sol_numvar = _589_numvar;
    }
  }
  else
  {
    {
      int32_t _601_newsize;
      if ((safe_mul( sol_numvar,(int)2 ) > safe_add( _589_numvar,(int)100 )))
      {
        {
          _601_newsize = safe_mul( sol_numvar,(int)2 );
        }
      }
      else
      {
        {
          _601_newsize = safe_add( _589_numvar,(int)100 );
        }
      }
      std::shared_ptr< monty::ndarray< double,1 > > _602_newslx = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_601_newsize)));
      _checked_ptr_1<double> _ptr__602_newslx(_602_newslx ? _602_newslx->raw() : nullptr,_602_newslx ? _602_newslx->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(slx,(int)0,_602_newslx,(int)0,(int)((slx)->size(0)));
      slx = _602_newslx;
      std::shared_ptr< monty::ndarray< double,1 > > _603_newsux = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_601_newsize)));
      _checked_ptr_1<double> _ptr__603_newsux(_603_newsux ? _603_newsux->raw() : nullptr,_603_newsux ? _603_newsux->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(sux,(int)0,_603_newsux,(int)0,(int)((sux)->size(0)));
      sux = _603_newsux;
      std::shared_ptr< monty::ndarray< double,1 > > _604_newxx = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_601_newsize)));
      _checked_ptr_1<double> _ptr__604_newxx(_604_newxx ? _604_newxx->raw() : nullptr,_604_newxx ? _604_newxx->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(xx,(int)0,_604_newxx,(int)0,(int)((xx)->size(0)));
      xx = _604_newxx;
      std::shared_ptr< monty::ndarray< double,1 > > _605_newyx = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_601_newsize)));
      _checked_ptr_1<double> _ptr__605_newyx(_605_newyx ? _605_newyx->raw() : nullptr,_605_newyx ? _605_newyx->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(yx,(int)0,_605_newyx,(int)0,(int)((yx)->size(0)));
      yx = _605_newyx;
      {
        int32_t _606_i = sol_numvar;
        for(;(_606_i < _589_numvar);++ _606_i)
        {
          {
            ((*slx)(_606_i)) = 0.0;
            ((*sux)(_606_i)) = 0.0;
            ((*xx)(_606_i)) = 0.0;
          }
        }
      }
      sol_numvar = _589_numvar;
    }
  }
  if ((_590_numcon < (int)0))
  {
    {
    }
  }
  else if((_590_numcon <= sol_numcon))
  {
    {
      sol_numcon = _590_numcon;
    }
  }
  else if((_590_numcon <= (int)((xx)->size(0))))
  {
    {
      int32_t _9404_ = sol_numcon;
      int32_t _9405_ = _590_numcon;
      for (int32_t _607_i = _9404_; _607_i < _9405_; ++_607_i)
      {
        {
          ((*slc)(_607_i)) = 0.0;
          ((*suc)(_607_i)) = 0.0;
          ((*xc)(_607_i)) = 0.0;
          ((*y)(_607_i)) = 0.0;
        }
      }
      sol_numcon = _590_numcon;
    }
  }
  else
  {
    {
      int32_t _608_newsize;
      if ((safe_mul( sol_numcon,(int)2 ) > safe_add( _590_numcon,(int)100 )))
      {
        {
          _608_newsize = safe_mul( sol_numcon,(int)2 );
        }
      }
      else
      {
        {
          _608_newsize = safe_add( _590_numcon,(int)100 );
        }
      }
      std::shared_ptr< monty::ndarray< double,1 > > _609_newslc = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_608_newsize)));
      _checked_ptr_1<double> _ptr__609_newslc(_609_newslc ? _609_newslc->raw() : nullptr,_609_newslc ? _609_newslc->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(slc,(int)0,_609_newslc,(int)0,(int)((slc)->size(0)));
      slc = _609_newslc;
      std::shared_ptr< monty::ndarray< double,1 > > _610_newsuc = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_608_newsize)));
      _checked_ptr_1<double> _ptr__610_newsuc(_610_newsuc ? _610_newsuc->raw() : nullptr,_610_newsuc ? _610_newsuc->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(suc,(int)0,_610_newsuc,(int)0,(int)((suc)->size(0)));
      suc = _610_newsuc;
      std::shared_ptr< monty::ndarray< double,1 > > _611_newxc = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_608_newsize)));
      _checked_ptr_1<double> _ptr__611_newxc(_611_newxc ? _611_newxc->raw() : nullptr,_611_newxc ? _611_newxc->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(xc,(int)0,_611_newxc,(int)0,(int)((xc)->size(0)));
      xc = _611_newxc;
      std::shared_ptr< monty::ndarray< double,1 > > _612_newy = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_608_newsize)));
      _checked_ptr_1<double> _ptr__612_newy(_612_newy ? _612_newy->raw() : nullptr,_612_newy ? _612_newy->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(y,(int)0,_612_newy,(int)0,(int)((y)->size(0)));
      y = _612_newy;
      int32_t _9406_ = sol_numcon;
      int32_t _9407_ = _590_numcon;
      for (int32_t _613_i = _9406_; _613_i < _9407_; ++_613_i)
      {
        {
          ((*slc)(_613_i)) = 0.0;
          ((*suc)(_613_i)) = 0.0;
          ((*xc)(_613_i)) = 0.0;
          ((*y)(_613_i)) = 0.0;
        }
      }
      sol_numcon = _590_numcon;
    }
  }
}
// End mosek.fusion.SolutionStruct.resize

// Begin mosek.fusion.SolutionStruct.isDualAcceptable
// Method mosek.fusion.SolutionStruct.isDualAcceptable @ bld/grindsted/final/default/src/fusion/Model.mbi:5531:6-5534:7
bool mosek::fusion::SolutionStruct :: isDualAcceptable(mosek::fusion::AccSolutionStatus _614_acceptable_sol) { return mosek::fusion::p_SolutionStruct::_get_impl(this)->isDualAcceptable(_614_acceptable_sol); }
bool mosek::fusion::p_SolutionStruct::isDualAcceptable(mosek::fusion::AccSolutionStatus _614_acceptable_sol)
{
  return isAcceptable(dstatus,_614_acceptable_sol);
}
// End mosek.fusion.SolutionStruct.isDualAcceptable

// Begin mosek.fusion.SolutionStruct.isPrimalAcceptable
// Method mosek.fusion.SolutionStruct.isPrimalAcceptable @ bld/grindsted/final/default/src/fusion/Model.mbi:5526:6-5529:7
bool mosek::fusion::SolutionStruct :: isPrimalAcceptable(mosek::fusion::AccSolutionStatus _615_acceptable_sol) { return mosek::fusion::p_SolutionStruct::_get_impl(this)->isPrimalAcceptable(_615_acceptable_sol); }
bool mosek::fusion::p_SolutionStruct::isPrimalAcceptable(mosek::fusion::AccSolutionStatus _615_acceptable_sol)
{
  return isAcceptable(pstatus,_615_acceptable_sol);
}
// End mosek.fusion.SolutionStruct.isPrimalAcceptable

// Begin mosek.fusion.SolutionStruct.isAcceptable
// Method mosek.fusion.SolutionStruct.isAcceptable @ bld/grindsted/final/default/src/fusion/Model.mbi:5500:6-5524:7
bool mosek::fusion::p_SolutionStruct::isAcceptable(mosek::fusion::SolutionStatus _616_stat,mosek::fusion::AccSolutionStatus _617_accstat)
{
  if ((_617_accstat == ::mosek::fusion::AccSolutionStatus::Anything))
  {
    {
      return true;
    }
  }
  else if((_617_accstat == ::mosek::fusion::AccSolutionStatus::Optimal))
  {
    {
      return (_616_stat == ::mosek::fusion::SolutionStatus::Optimal);
    }
  }
  else if((_617_accstat == ::mosek::fusion::AccSolutionStatus::Feasible))
  {
    {
      return ((_616_stat == ::mosek::fusion::SolutionStatus::Optimal) || (_616_stat == ::mosek::fusion::SolutionStatus::Feasible));
    }
  }
  else if((_617_accstat == ::mosek::fusion::AccSolutionStatus::Certificate))
  {
    {
      return (_616_stat == ::mosek::fusion::SolutionStatus::Certificate);
    }
  }
  {}
  return false;
}
// End mosek.fusion.SolutionStruct.isAcceptable

void mosek::fusion::p_SolutionStruct::destroy()
{
  accy.reset();
  accx.reset();
  accptr.reset();
  yx.reset();
  sux.reset();
  slx.reset();
  bars.reset();
  barx.reset();
  y.reset();
  suc.reset();
  slc.reset();
  xx.reset();
  xc.reset();
}
void mosek::fusion::SolutionStruct::destroy() { mosek::fusion::p_SolutionStruct::_get_impl(this)->destroy(); }
// } class SolutionStruct
// class RowBlockManager { // @ bld/grindsted/final/default/src/fusion/Model.mbi:4944:4-5464:5
mosek::fusion::RowBlockManager::RowBlockManager(mosek::fusion::p_RowBlockManager *_impl) : _impl(_impl) { /*std::cout << "RowBlockManager() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::RowBlockManager::~RowBlockManager() { delete _impl; _impl = nullptr; }
mosek::fusion::p_RowBlockManager::p_RowBlockManager
  (::mosek::fusion::RowBlockManager * _pubthis) :     _pubthis(_pubthis)
{}
int32_t mosek::fusion::RowBlockManager::get_varidx_used() { return _impl->varidx_used; }
void mosek::fusion::RowBlockManager::set_varidx_used(int32_t _val) { _impl->varidx_used = _val; }
int32_t mosek::fusion::RowBlockManager::get_code_used() { return _impl->code_used; }
void mosek::fusion::RowBlockManager::set_code_used(int32_t _val) { _impl->code_used = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::RowBlockManager::get_cconst() { return _impl->cconst; }
void mosek::fusion::RowBlockManager::set_cconst(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->cconst = _val; }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::RowBlockManager::get_code() { return _impl->code; }
void mosek::fusion::RowBlockManager::set_code(std::shared_ptr< monty::ndarray< int32_t,1 > > _val) { _impl->code = _val; }
int32_t mosek::fusion::RowBlockManager::get_first_free_codeitem() { return _impl->first_free_codeitem; }
void mosek::fusion::RowBlockManager::set_first_free_codeitem(int32_t _val) { _impl->first_free_codeitem = _val; }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::RowBlockManager::get_param_code_sizes() { return _impl->param_code_sizes; }
void mosek::fusion::RowBlockManager::set_param_code_sizes(std::shared_ptr< monty::ndarray< int32_t,1 > > _val) { _impl->param_code_sizes = _val; }
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::RowBlockManager::get_param_varidx() { return _impl->param_varidx; }
void mosek::fusion::RowBlockManager::set_param_varidx(std::shared_ptr< monty::ndarray< int64_t,1 > > _val) { _impl->param_varidx = _val; }
int32_t mosek::fusion::RowBlockManager::get_first_free_entry() { return _impl->first_free_entry; }
void mosek::fusion::RowBlockManager::set_first_free_entry(int32_t _val) { _impl->first_free_entry = _val; }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::RowBlockManager::get_row_code_ptr() { return _impl->row_code_ptr; }
void mosek::fusion::RowBlockManager::set_row_code_ptr(std::shared_ptr< monty::ndarray< int32_t,1 > > _val) { _impl->row_code_ptr = _val; }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::RowBlockManager::get_row_param_ptre() { return _impl->row_param_ptre; }
void mosek::fusion::RowBlockManager::set_row_param_ptre(std::shared_ptr< monty::ndarray< int32_t,1 > > _val) { _impl->row_param_ptre = _val; }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::RowBlockManager::get_row_param_ptrb() { return _impl->row_param_ptrb; }
void mosek::fusion::RowBlockManager::set_row_param_ptrb(std::shared_ptr< monty::ndarray< int32_t,1 > > _val) { _impl->row_param_ptrb = _val; }
monty::rc_ptr< ::mosek::fusion::LinkedBlocks > mosek::fusion::RowBlockManager::get_blocks() { return _impl->blocks; }
void mosek::fusion::RowBlockManager::set_blocks(monty::rc_ptr< ::mosek::fusion::LinkedBlocks > _val) { _impl->blocks = _val; }
// mosek.fusion.RowBlockManager.ctor @ bld/grindsted/final/default/src/fusion/Model.mbi:5007:6-5023:7
mosek::fusion::RowBlockManager::t mosek::fusion::p_RowBlockManager::_new_RowBlockManager
  (monty::rc_ptr< ::mosek::fusion::RowBlockManager > _618_that)
{ return new mosek::fusion::RowBlockManager(_618_that); }
mosek::fusion::RowBlockManager::RowBlockManager
  (monty::rc_ptr< ::mosek::fusion::RowBlockManager > _618_that) : 
   RowBlockManager(new mosek::fusion::p_RowBlockManager(this))
{ mosek::fusion::p_RowBlockManager::_get_impl(this)->_initialize(_618_that); }
void mosek::fusion::p_RowBlockManager::_initialize  (monty::rc_ptr< ::mosek::fusion::RowBlockManager > _618_that)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    blocks = ::mosek::fusion::p_LinkedBlocks::_new_LinkedBlocks(mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->blocks);
    std::shared_ptr< monty::ndarray< int32_t,1 > > _9408_;
    bool _9409_ = (NULL != mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->row_param_ptrb.get());
    if (_9409_)
    {
      _9408_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->row_param_ptrb);
    }
    else
    {
      _9408_ = nullptr;
    }
    row_param_ptrb = _9408_;
    std::shared_ptr< monty::ndarray< int32_t,1 > > _9410_;
    bool _9411_ = (NULL != mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->row_param_ptre.get());
    if (_9411_)
    {
      _9410_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->row_param_ptre);
    }
    else
    {
      _9410_ = nullptr;
    }
    row_param_ptre = _9410_;
    std::shared_ptr< monty::ndarray< int32_t,1 > > _9412_;
    bool _9413_ = (NULL != mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->row_code_ptr.get());
    if (_9413_)
    {
      _9412_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->row_code_ptr);
    }
    else
    {
      _9412_ = nullptr;
    }
    row_code_ptr = _9412_;
    first_free_entry = mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->first_free_entry;
    std::shared_ptr< monty::ndarray< int64_t,1 > > _9414_;
    bool _9415_ = (NULL != mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->param_varidx.get());
    if (_9415_)
    {
      _9414_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->param_varidx);
    }
    else
    {
      _9414_ = nullptr;
    }
    param_varidx = _9414_;
    std::shared_ptr< monty::ndarray< int32_t,1 > > _9416_;
    bool _9417_ = (NULL != mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->param_code_sizes.get());
    if (_9417_)
    {
      _9416_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->param_code_sizes);
    }
    else
    {
      _9416_ = nullptr;
    }
    param_code_sizes = _9416_;
    first_free_codeitem = mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->first_free_codeitem;
    std::shared_ptr< monty::ndarray< int32_t,1 > > _9418_;
    bool _9419_ = (NULL != mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->code.get());
    if (_9419_)
    {
      _9418_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->code);
    }
    else
    {
      _9418_ = nullptr;
    }
    code = _9418_;
    std::shared_ptr< monty::ndarray< double,1 > > _9420_;
    bool _9421_ = (NULL != mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->cconst.get());
    if (_9421_)
    {
      _9420_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->cconst);
    }
    else
    {
      _9420_ = nullptr;
    }
    cconst = _9420_;
    code_used = mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->code_used;
    varidx_used = mosek::fusion::p_RowBlockManager::_get_impl(_618_that)->varidx_used;
  }
}
// mosek.fusion.RowBlockManager.ctor

// mosek.fusion.RowBlockManager.ctor @ bld/grindsted/final/default/src/fusion/Model.mbi:4991:6-5005:7
mosek::fusion::RowBlockManager::t mosek::fusion::p_RowBlockManager::_new_RowBlockManager
  ()
{ return new mosek::fusion::RowBlockManager(); }
mosek::fusion::RowBlockManager::RowBlockManager
  () : 
   RowBlockManager(new mosek::fusion::p_RowBlockManager(this))
{ mosek::fusion::p_RowBlockManager::_get_impl(this)->_initialize(); }
void mosek::fusion::p_RowBlockManager::_initialize  ()
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    blocks = ::mosek::fusion::p_LinkedBlocks::_new_LinkedBlocks();
    row_param_ptrb = nullptr;
    row_param_ptre = nullptr;
    row_code_ptr = nullptr;
    first_free_entry = (int)0;
    param_varidx = nullptr;
    param_code_sizes = nullptr;
    first_free_codeitem = (int)0;
    code = nullptr;
    cconst = nullptr;
    code_used = (int)0;
    varidx_used = (int)0;
  }
}
// mosek.fusion.RowBlockManager.ctor

// Begin mosek.fusion.RowBlockManager.num_parameterized
// Method mosek.fusion.RowBlockManager.num_parameterized @ bld/grindsted/final/default/src/fusion/Model.mbi:5345:6-69
int32_t mosek::fusion::RowBlockManager :: num_parameterized() { return mosek::fusion::p_RowBlockManager::_get_impl(this)->num_parameterized(); }
int32_t mosek::fusion::p_RowBlockManager::num_parameterized()
{
  return varidx_used;
}
// End mosek.fusion.RowBlockManager.num_parameterized

// Begin mosek.fusion.RowBlockManager.is_parameterized
// Method mosek.fusion.RowBlockManager.is_parameterized @ bld/grindsted/final/default/src/fusion/Model.mbi:5344:6-69
bool mosek::fusion::RowBlockManager :: is_parameterized() { return mosek::fusion::p_RowBlockManager::_get_impl(this)->is_parameterized(); }
bool mosek::fusion::p_RowBlockManager::is_parameterized()
{
  return (code_used > (int)0);
}
// End mosek.fusion.RowBlockManager.is_parameterized

// Begin mosek.fusion.RowBlockManager.blocksize
// Method mosek.fusion.RowBlockManager.blocksize @ bld/grindsted/final/default/src/fusion/Model.mbi:5343:6-79
int32_t mosek::fusion::RowBlockManager :: blocksize(int32_t _619_id) { return mosek::fusion::p_RowBlockManager::_get_impl(this)->blocksize(_619_id); }
int32_t mosek::fusion::p_RowBlockManager::blocksize(int32_t _619_id)
{
  return blocks->blocksize(_619_id);
}
// End mosek.fusion.RowBlockManager.blocksize

// Begin mosek.fusion.RowBlockManager.block_capacity
// Method mosek.fusion.RowBlockManager.block_capacity @ bld/grindsted/final/default/src/fusion/Model.mbi:5342:6-79
int32_t mosek::fusion::RowBlockManager :: block_capacity() { return mosek::fusion::p_RowBlockManager::_get_impl(this)->block_capacity(); }
int32_t mosek::fusion::p_RowBlockManager::block_capacity()
{
  return blocks->block_capacity();
}
// End mosek.fusion.RowBlockManager.block_capacity

// Begin mosek.fusion.RowBlockManager.capacity
// Method mosek.fusion.RowBlockManager.capacity @ bld/grindsted/final/default/src/fusion/Model.mbi:5341:6-67
int32_t mosek::fusion::RowBlockManager :: capacity() { return mosek::fusion::p_RowBlockManager::_get_impl(this)->capacity(); }
int32_t mosek::fusion::p_RowBlockManager::capacity()
{
  return blocks->capacity();
}
// End mosek.fusion.RowBlockManager.capacity

// Begin mosek.fusion.RowBlockManager.get
// Method mosek.fusion.RowBlockManager.get @ bld/grindsted/final/default/src/fusion/Model.mbi:5340:6-102
void mosek::fusion::RowBlockManager :: get(int32_t _620_id,std::shared_ptr< monty::ndarray< int32_t,1 > > _621_target,int32_t _622_offset) { mosek::fusion::p_RowBlockManager::_get_impl(this)->get(_620_id,_621_target,_622_offset); }
void mosek::fusion::p_RowBlockManager::get(int32_t _620_id,std::shared_ptr< monty::ndarray< int32_t,1 > > _621_target,int32_t _622_offset)
{
  _checked_ptr_1<int32_t> _ptr__621_target(_621_target ? _621_target->raw() : nullptr, _621_target ? _621_target->size(0) : 0);
  blocks->get(_620_id,_621_target,_622_offset);
}
// End mosek.fusion.RowBlockManager.get

// Begin mosek.fusion.RowBlockManager.evaluate
// Method mosek.fusion.RowBlockManager.evaluate @ bld/grindsted/final/default/src/fusion/Model.mbi:5272:6-5338:7
void mosek::fusion::RowBlockManager :: evaluate(monty::rc_ptr< ::mosek::fusion::WorkStack > _623_xs,std::shared_ptr< monty::ndarray< double,1 > > _624_param_value,std::shared_ptr< monty::ndarray< int32_t,1 > > _625_subi,std::shared_ptr< monty::ndarray< int32_t,1 > > _626_subj,std::shared_ptr< monty::ndarray< double,1 > > _627_val) { mosek::fusion::p_RowBlockManager::_get_impl(this)->evaluate(_623_xs,_624_param_value,_625_subi,_626_subj,_627_val); }
void mosek::fusion::p_RowBlockManager::evaluate(monty::rc_ptr< ::mosek::fusion::WorkStack > _623_xs,std::shared_ptr< monty::ndarray< double,1 > > _624_param_value,std::shared_ptr< monty::ndarray< int32_t,1 > > _625_subi,std::shared_ptr< monty::ndarray< int32_t,1 > > _626_subj,std::shared_ptr< monty::ndarray< double,1 > > _627_val)
{
  _checked_ptr_1<double> _ptr__624_param_value(_624_param_value ? _624_param_value->raw() : nullptr, _624_param_value ? _624_param_value->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__625_subi(_625_subi ? _625_subi->raw() : nullptr, _625_subi ? _625_subi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__626_subj(_626_subj ? _626_subj->raw() : nullptr, _626_subj ? _626_subj->size(0) : 0);
  _checked_ptr_1<double> _ptr__627_val(_627_val ? _627_val->raw() : nullptr, _627_val ? _627_val->size(0) : 0);
  int32_t _628_stack = _623_xs->allocf64(code_used);
  int32_t _629_stackp = (int)0;
  std::shared_ptr< monty::ndarray< double,1 > > _630_xf64 = mosek::fusion::p_WorkStack::_get_impl(_623_xs)->f64;
  _checked_ptr_1<double> _ptr__630_xf64(_630_xf64 ? _630_xf64->raw() : nullptr,_630_xf64 ? _630_xf64->size(0) : 0);
  int32_t _631_idx = (int)0;
  int32_t _9422_ = (int)0;
  int32_t _9423_ = (int)((row_param_ptrb)->size(0));
  for (int32_t _632_i = _9422_; _632_i < _9423_; ++_632_i)
  {
    {
      if ((((*row_param_ptrb)(_632_i)) < ((*row_param_ptre)(_632_i))))
      {
        {
          int32_t _633_k = ((*row_code_ptr)(_632_i));
          int32_t _9424_ = ((*row_param_ptrb)(_632_i));
          int32_t _9425_ = ((*row_param_ptre)(_632_i));
          for (int32_t _634_j = _9424_; _634_j < _9425_; ++_634_j)
          {
            {
              int32_t _9426_ = (int)0;
              int32_t _9427_ = ((*param_code_sizes)(_634_j));
              for (int32_t _635_l = _9426_; _635_l < _9427_; ++_635_l)
              {
                {
                  if ((((*code)(_633_k)) == 0))
                  {
                    {
                    }
                  }
                  else
                  {
                    {
                      if ((((*code)(_633_k)) == 1))
                      {
                        {
                          _ptr__630_xf64[safe_add( _628_stack,_629_stackp )] = _ptr__624_param_value[(int32_t)((*cconst)(_633_k))];
                          ++ _629_stackp;
                        }
                      }
                      else
                      {
                        {
                          if ((((*code)(_633_k)) == 2))
                          {
                            {
                              _ptr__630_xf64[safe_add( _628_stack,_629_stackp )] = ((*cconst)(_633_k));
                              ++ _629_stackp;
                            }
                          }
                          else
                          {
                            {
                              if ((((*code)(_633_k)) == 3))
                              {
                                {
                                  _ptr__630_xf64[(safe_add( _628_stack,_629_stackp ) - (int)2)] += _ptr__630_xf64[(safe_add( _628_stack,_629_stackp ) - (int)1)];
                                  -- _629_stackp;
                                }
                              }
                              else
                              {
                                {
                                  if ((((*code)(_633_k)) == 4))
                                  {
                                    {
                                      _ptr__630_xf64[(safe_add( _628_stack,_629_stackp ) - (int)1)] = (-_ptr__630_xf64[(safe_add( _628_stack,_629_stackp ) - (int)1)]);
                                    }
                                  }
                                  else
                                  {
                                    {
                                      if ((((*code)(_633_k)) == 5))
                                      {
                                        {
                                          _ptr__630_xf64[(safe_add( _628_stack,_629_stackp ) - (int)2)] *= _ptr__630_xf64[(safe_add( _628_stack,_629_stackp ) - (int)1)];
                                          -- _629_stackp;
                                        }
                                      }
                                      else
                                      {
                                        {
                                          if ((((*code)(_633_k)) == 6))
                                          {
                                            {
                                              _ptr__630_xf64[(safe_add( _628_stack,_629_stackp ) - (int)1)] = (1.0 / _ptr__630_xf64[(safe_add( _628_stack,_629_stackp ) - (int)1)]);
                                            }
                                          }
                                          else
                                          {
                                            {
                                              if ((((*code)(_633_k)) == 8))
                                              {
                                                {
                                                  double _636_v = 0.0;
                                                  int32_t _9428_ = (int)0;
                                                  int32_t _9429_ = (int32_t)((*cconst)(_633_k));
                                                  for (int32_t _637_i = _9428_; _637_i < _9429_; ++_637_i)
                                                  {
                                                    {
                                                      _636_v += _ptr__630_xf64[(safe_add( _628_stack,_629_stackp ) - (int)1)];
                                                      -- _629_stackp;
                                                    }
                                                  }
                                                  _ptr__630_xf64[safe_add( _628_stack,_629_stackp )] = _636_v;
                                                  ++ _629_stackp;
                                                }
                                              }
                                              else
                                              {
                                                {
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                  ++ _633_k;
                }
              }
              _ptr__625_subi[_631_idx] = _632_i;
              _ptr__626_subj[_631_idx] = (int32_t)((*param_varidx)(_634_j));
              _ptr__627_val[_631_idx] = _ptr__630_xf64[_628_stack];
              _629_stackp = (int)0;
              ++ _631_idx;
            }
          }
        }
      }
      {}
    }
  }
  _623_xs->popf64(code_used);
}
// End mosek.fusion.RowBlockManager.evaluate

// Begin mosek.fusion.RowBlockManager.replace_row_code
// Method mosek.fusion.RowBlockManager.replace_row_code @ bld/grindsted/final/default/src/fusion/Model.mbi:5167:6-5270:7
void mosek::fusion::RowBlockManager :: replace_row_code(monty::rc_ptr< ::mosek::fusion::WorkStack > _638_rs,std::shared_ptr< monty::ndarray< int32_t,1 > > _639_nativeidxs,int32_t _640_ptr,int32_t _641_nidxs,int32_t _642_codeptr,int32_t _643_code_p,int32_t _644_cconst_p) { mosek::fusion::p_RowBlockManager::_get_impl(this)->replace_row_code(_638_rs,_639_nativeidxs,_640_ptr,_641_nidxs,_642_codeptr,_643_code_p,_644_cconst_p); }
void mosek::fusion::p_RowBlockManager::replace_row_code(monty::rc_ptr< ::mosek::fusion::WorkStack > _638_rs,std::shared_ptr< monty::ndarray< int32_t,1 > > _639_nativeidxs,int32_t _640_ptr,int32_t _641_nidxs,int32_t _642_codeptr,int32_t _643_code_p,int32_t _644_cconst_p)
{
  _checked_ptr_1<int32_t> _ptr__639_nativeidxs(_639_nativeidxs ? _639_nativeidxs->raw() : nullptr, _639_nativeidxs ? _639_nativeidxs->size(0) : 0);
  int32_t _645_nelem = (int)((_639_nativeidxs)->size(0));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _646_ri32 = mosek::fusion::p_WorkStack::_get_impl(_638_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__646_ri32(_646_ri32 ? _646_ri32->raw() : nullptr,_646_ri32 ? _646_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _647_ri64 = mosek::fusion::p_WorkStack::_get_impl(_638_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__647_ri64(_647_ri64 ? _647_ri64->raw() : nullptr,_647_ri64 ? _647_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _648_rf64 = mosek::fusion::p_WorkStack::_get_impl(_638_rs)->f64;
  _checked_ptr_1<double> _ptr__648_rf64(_648_rf64 ? _648_rf64->raw() : nullptr,_648_rf64 ? _648_rf64->size(0) : 0);
  bool _649_ok = true;
  {
    int32_t _650_numop = (int)0;
    int32_t _651_nentry = (int)0;
    {
      int32_t _9430_ = (int)0;
      int32_t _9431_ = _645_nelem;
      for (int32_t _652_i = _9430_; _652_i < _9431_; ++_652_i)
      {
        {
          int32_t _9432_ = _ptr__646_ri32[safe_add( _640_ptr,_652_i )];
          int32_t _9433_ = _ptr__646_ri32[safe_add( safe_add( _640_ptr,_652_i ),(int)1 )];
          for (int32_t _653_j = _9432_; _653_j < _9433_; ++_653_j)
          {
            {
              if ((((_ptr__646_ri32[safe_add( safe_add( _642_codeptr,_653_j ),(int)1 )] - _ptr__646_ri32[safe_add( _642_codeptr,_653_j )]) == (int)1) && ((_ptr__646_ri32[safe_add( _643_code_p,_ptr__646_ri32[safe_add( _642_codeptr,_653_j )] )] == 10) || (_ptr__646_ri32[safe_add( _643_code_p,_ptr__646_ri32[safe_add( _642_codeptr,_653_j )] )] == 2))))
              {
                {
                }
              }
              else
              {
                {
                  ++ _651_nentry;
                  _650_numop += (_ptr__646_ri32[safe_add( safe_add( _642_codeptr,_653_j ),(int)1 )] - _ptr__646_ri32[safe_add( _642_codeptr,_653_j )]);
                }
              }
            }
          }
        }
      }
      _pubthis->clear_row_code(_639_nativeidxs);
    }
    ensure_code_cap(_651_nentry,_650_numop);
    code_used += _650_numop;
    varidx_used += _651_nentry;
  }
  if ((first_free_codeitem > safe_mul( code_used,(int)2 )))
  {
    {
      compress();
    }
  }
  {}
  {
    int32_t _9434_ = (int)0;
    int32_t _9435_ = _645_nelem;
    for (int32_t _654_i = _9434_; _654_i < _9435_; ++_654_i)
    {
      {
        int32_t _655_subi = _ptr__639_nativeidxs[_654_i];
        int32_t _656_cnnz = (int)0;
        int32_t _657_rncodeatom = (int)0;
        int32_t _9436_ = _ptr__646_ri32[safe_add( _640_ptr,_654_i )];
        int32_t _9437_ = _ptr__646_ri32[safe_add( safe_add( _640_ptr,_654_i ),(int)1 )];
        for (int32_t _658_j = _9436_; _658_j < _9437_; ++_658_j)
        {
          {
            if ((((_ptr__646_ri32[safe_add( safe_add( _642_codeptr,_658_j ),(int)1 )] - _ptr__646_ri32[safe_add( _642_codeptr,_658_j )]) == (int)1) && ((_ptr__646_ri32[safe_add( _643_code_p,_ptr__646_ri32[safe_add( _642_codeptr,_658_j )] )] == 10) || (_ptr__646_ri32[safe_add( _643_code_p,_ptr__646_ri32[safe_add( _642_codeptr,_658_j )] )] == 2))))
            {
              {
              }
            }
            else
            {
              {
                ++ _656_cnnz;
                _657_rncodeatom += (_ptr__646_ri32[safe_add( safe_add( _642_codeptr,_658_j ),(int)1 )] - _ptr__646_ri32[safe_add( _642_codeptr,_658_j )]);
              }
            }
          }
        }
        int32_t _659_ni = _ptr__639_nativeidxs[_654_i];
        int32_t _660_n = (((*row_param_ptre)(_659_ni)) - ((*row_param_ptrb)(_659_ni)));
        if ((_656_cnnz > (int)0))
        {
          {
            ((*row_param_ptrb)(_655_subi)) = first_free_entry;
            ((*row_param_ptre)(_655_subi)) = safe_add( first_free_entry,_656_cnnz );
            ((*row_code_ptr)(_655_subi)) = first_free_codeitem;
            first_free_entry += _656_cnnz;
            first_free_codeitem += _657_rncodeatom;
          }
        }
        {}
      }
    }
  }
  int32_t _9438_ = (int)0;
  int32_t _9439_ = _645_nelem;
  for (int32_t _661_i = _9438_; _661_i < _9439_; ++_661_i)
  {
    {
      int32_t _662_subi = _ptr__639_nativeidxs[_661_i];
      int32_t _663_codei = ((*row_code_ptr)(_662_subi));
      int32_t _664_elmi = ((*row_param_ptrb)(_662_subi));
      int32_t _9440_ = _ptr__646_ri32[safe_add( _640_ptr,_661_i )];
      int32_t _9441_ = _ptr__646_ri32[safe_add( safe_add( _640_ptr,_661_i ),(int)1 )];
      for (int32_t _665_j = _9440_; _665_j < _9441_; ++_665_j)
      {
        {
          if ((((_ptr__646_ri32[safe_add( safe_add( _642_codeptr,_665_j ),(int)1 )] - _ptr__646_ri32[safe_add( _642_codeptr,_665_j )]) == (int)1) && ((_ptr__646_ri32[safe_add( _643_code_p,_ptr__646_ri32[safe_add( _642_codeptr,_665_j )] )] == 10) || (_ptr__646_ri32[safe_add( _643_code_p,_ptr__646_ri32[safe_add( _642_codeptr,_665_j )] )] == 2))))
          {
            {
            }
          }
          else
          {
            {
              int32_t _9442_ = _ptr__646_ri32[safe_add( _642_codeptr,_665_j )];
              int32_t _9443_ = _ptr__646_ri32[safe_add( safe_add( _642_codeptr,_665_j ),(int)1 )];
              for (int32_t _666_k = _9442_; _666_k < _9443_; ++_666_k)
              {
                {
                  ((*code)(_663_codei)) = _ptr__646_ri32[safe_add( _643_code_p,_666_k )];
                  ((*cconst)(_663_codei)) = _ptr__648_rf64[safe_add( _644_cconst_p,_666_k )];
                  ++ _663_codei;
                }
              }
              ((*param_code_sizes)(_664_elmi)) = (_ptr__646_ri32[safe_add( safe_add( _642_codeptr,_665_j ),(int)1 )] - _ptr__646_ri32[safe_add( _642_codeptr,_665_j )]);
              ((*param_varidx)(_664_elmi)) = _ptr__647_ri64[safe_add( _641_nidxs,_665_j )];
              _649_ok = (_649_ok && (_ptr__647_ri64[safe_add( _641_nidxs,_665_j )] >= (int)0));
              ++ _664_elmi;
            }
          }
        }
      }
    }
  }
  if ((!_649_ok))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Expression contains parameterized SDP non-zero"));
    }
  }
  {}
}
// End mosek.fusion.RowBlockManager.replace_row_code

// Begin mosek.fusion.RowBlockManager.clear_row_code
// Method mosek.fusion.RowBlockManager.clear_row_code @ bld/grindsted/final/default/src/fusion/Model.mbi:5140:6-5156:7
void mosek::fusion::RowBlockManager :: clear_row_code(std::shared_ptr< monty::ndarray< int32_t,1 > > _667_nativeidxs) { mosek::fusion::p_RowBlockManager::_get_impl(this)->clear_row_code(_667_nativeidxs); }
void mosek::fusion::p_RowBlockManager::clear_row_code(std::shared_ptr< monty::ndarray< int32_t,1 > > _667_nativeidxs)
{
  _checked_ptr_1<int32_t> _ptr__667_nativeidxs(_667_nativeidxs ? _667_nativeidxs->raw() : nullptr, _667_nativeidxs ? _667_nativeidxs->size(0) : 0);
  if ((NULL != row_param_ptrb.get()))
  {
    {
      int32_t _9444_ = (int)0;
      int32_t _9445_ = (int)((_667_nativeidxs)->size(0));
      for (int32_t _668_i = _9444_; _668_i < _9445_; ++_668_i)
      {
        {
          int32_t _9446_ = ((*row_param_ptrb)(_ptr__667_nativeidxs[_668_i]));
          int32_t _9447_ = ((*row_param_ptre)(_ptr__667_nativeidxs[_668_i]));
          for (int32_t _669_j = _9446_; _669_j < _9447_; ++_669_j)
          {
            {
              code_used -= ((*param_code_sizes)(_669_j));
            }
          }
          varidx_used -= (((*row_param_ptre)(_ptr__667_nativeidxs[_668_i])) - ((*row_param_ptrb)(_ptr__667_nativeidxs[_668_i])));
          ((*row_param_ptrb)(_ptr__667_nativeidxs[_668_i])) = (int)0;
          ((*row_param_ptre)(_ptr__667_nativeidxs[_668_i])) = (int)0;
        }
      }
    }
  }
  {}
}
// End mosek.fusion.RowBlockManager.clear_row_code

// Begin mosek.fusion.RowBlockManager.compress
// Method mosek.fusion.RowBlockManager.compress @ bld/grindsted/final/default/src/fusion/Model.mbi:5096:6-5138:7
void mosek::fusion::p_RowBlockManager::compress()
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _670_newcode = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(code_used)));
  _checked_ptr_1<int32_t> _ptr__670_newcode(_670_newcode ? _670_newcode->raw() : nullptr,_670_newcode ? _670_newcode->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _671_newcconst = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(code_used)));
  _checked_ptr_1<double> _ptr__671_newcconst(_671_newcconst ? _671_newcconst->raw() : nullptr,_671_newcconst ? _671_newcconst->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _672_newvaridx = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(first_free_entry)));
  _checked_ptr_1<int64_t> _ptr__672_newvaridx(_672_newvaridx ? _672_newvaridx->raw() : nullptr,_672_newvaridx ? _672_newvaridx->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _673_newcodesizes = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(first_free_entry)));
  _checked_ptr_1<int32_t> _ptr__673_newcodesizes(_673_newcodesizes ? _673_newcodesizes->raw() : nullptr,_673_newcodesizes ? _673_newcodesizes->size(0) : 0);
  int32_t _674_tgtptr = (int)0;
  int32_t _675_tgtcptr = (int)0;
  int32_t _9448_ = (int)0;
  int32_t _9449_ = (int)((row_param_ptrb)->size(0));
  for (int32_t _676_i = _9448_; _676_i < _9449_; ++_676_i)
  {
    {
      int32_t _677_codesize = (int)0;
      int32_t _678_n = (((*row_param_ptre)(_676_i)) - ((*row_param_ptrb)(_676_i)));
      ::mosek::fusion::Utils::Tools::arraycopy(param_varidx,((*row_param_ptrb)(_676_i)),_672_newvaridx,_674_tgtptr,_678_n);
      ::mosek::fusion::Utils::Tools::arraycopy(param_code_sizes,((*row_param_ptrb)(_676_i)),_673_newcodesizes,_674_tgtptr,_678_n);
      int32_t _9450_ = ((*row_param_ptrb)(_676_i));
      int32_t _9451_ = ((*row_param_ptre)(_676_i));
      for (int32_t _679_j = _9450_; _679_j < _9451_; ++_679_j)
      {
        {
          _677_codesize += ((*param_code_sizes)(_679_j));
        }
      }
      ::mosek::fusion::Utils::Tools::arraycopy(code,((*row_code_ptr)(_676_i)),_670_newcode,_675_tgtcptr,_677_codesize);
      ::mosek::fusion::Utils::Tools::arraycopy(cconst,((*row_code_ptr)(_676_i)),_671_newcconst,_675_tgtcptr,_677_codesize);
      ((*row_param_ptrb)(_676_i)) = _674_tgtptr;
      ((*row_param_ptre)(_676_i)) = safe_add( _674_tgtptr,_678_n );
      ((*row_code_ptr)(_676_i)) = _675_tgtcptr;
      _675_tgtcptr += _677_codesize;
      _674_tgtptr += _678_n;
    }
  }
  ::mosek::fusion::Utils::Tools::arraycopy(_672_newvaridx,(int)0,param_varidx,(int)0,_674_tgtptr);
  ::mosek::fusion::Utils::Tools::arraycopy(_673_newcodesizes,(int)0,param_code_sizes,(int)0,_674_tgtptr);
  ::mosek::fusion::Utils::Tools::arraycopy(_670_newcode,(int)0,code,(int)0,_675_tgtcptr);
  ::mosek::fusion::Utils::Tools::arraycopy(_671_newcconst,(int)0,cconst,(int)0,_675_tgtcptr);
  first_free_codeitem = _675_tgtcptr;
  first_free_entry = _674_tgtptr;
}
// End mosek.fusion.RowBlockManager.compress

// Begin mosek.fusion.RowBlockManager.ensure_code_cap
// Method mosek.fusion.RowBlockManager.ensure_code_cap @ bld/grindsted/final/default/src/fusion/Model.mbi:5060:6-5094:7
void mosek::fusion::p_RowBlockManager::ensure_code_cap(int32_t _680_nentry,int32_t _681_codesize)
{
  if ((NULL == row_code_ptr.get()))
  {
    {
      int32_t _682_n = (int)128;
      while ( (_682_n < _680_nentry) )
      {
        {
          _682_n *= (int)2;
        }
      }
      int32_t _683_m = (int)128;
      while ( (_683_m < _681_codesize) )
      {
        {
          _683_m *= (int)2;
        }
      }
      row_param_ptrb = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(blocks->capacity())));
      row_param_ptre = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(blocks->capacity())));
      row_code_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(blocks->capacity())));
      param_varidx = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_682_n)));
      param_code_sizes = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_682_n)));
      code = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_683_m)));
      cconst = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_683_m)));
    }
  }
  else
  {
    {
      if ((_680_nentry > ((int)((param_varidx)->size(0)) - first_free_entry)))
      {
        {
          int32_t _684_n = (int)((param_varidx)->size(0));
          while ( ((_684_n - first_free_entry) < _680_nentry) )
          {
            {
              _684_n *= (int)2;
            }
          }
          std::shared_ptr< monty::ndarray< int32_t,1 > > _685_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_684_n)));
          _checked_ptr_1<int32_t> _ptr__685_ptr(_685_ptr ? _685_ptr->raw() : nullptr,_685_ptr ? _685_ptr->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _686_varidx = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_684_n)));
          _checked_ptr_1<int64_t> _ptr__686_varidx(_686_varidx ? _686_varidx->raw() : nullptr,_686_varidx ? _686_varidx->size(0) : 0);
          std::shared_ptr< monty::ndarray< int32_t,1 > > _687_code_sizes = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_684_n)));
          _checked_ptr_1<int32_t> _ptr__687_code_sizes(_687_code_sizes ? _687_code_sizes->raw() : nullptr,_687_code_sizes ? _687_code_sizes->size(0) : 0);
          ::mosek::fusion::Utils::Tools::arraycopy(param_varidx,(int)0,_686_varidx,(int)0,first_free_entry);
          ::mosek::fusion::Utils::Tools::arraycopy(param_code_sizes,(int)0,_687_code_sizes,(int)0,first_free_entry);
          param_varidx = _686_varidx;
          param_code_sizes = _687_code_sizes;
        }
      }
      {}
      if ((_681_codesize > ((int)((code)->size(0)) - first_free_codeitem)))
      {
        {
          int32_t _688_n = (int)((code)->size(0));
          while ( (_681_codesize > (_688_n - first_free_codeitem)) )
          {
            {
              _688_n *= (int)2;
            }
          }
          std::shared_ptr< monty::ndarray< int32_t,1 > > _689_tcode = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_688_n)));
          _checked_ptr_1<int32_t> _ptr__689_tcode(_689_tcode ? _689_tcode->raw() : nullptr,_689_tcode ? _689_tcode->size(0) : 0);
          ::mosek::fusion::Utils::Tools::arraycopy(code,(int)0,_689_tcode,(int)0,first_free_codeitem);
          std::shared_ptr< monty::ndarray< double,1 > > _690_tcconst = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_688_n)));
          _checked_ptr_1<double> _ptr__690_tcconst(_690_tcconst ? _690_tcconst->raw() : nullptr,_690_tcconst ? _690_tcconst->size(0) : 0);
          ::mosek::fusion::Utils::Tools::arraycopy(cconst,(int)0,_690_tcconst,(int)0,first_free_codeitem);
          code = _689_tcode;
          cconst = _690_tcconst;
        }
      }
      {}
    }
  }
}
// End mosek.fusion.RowBlockManager.ensure_code_cap

// Begin mosek.fusion.RowBlockManager.release
// Method mosek.fusion.RowBlockManager.release @ bld/grindsted/final/default/src/fusion/Model.mbi:5047:6-5058:7
void mosek::fusion::RowBlockManager :: release(int32_t _691_id,std::shared_ptr< monty::ndarray< int32_t,1 > > _692_nativeidxs) { mosek::fusion::p_RowBlockManager::_get_impl(this)->release(_691_id,_692_nativeidxs); }
void mosek::fusion::p_RowBlockManager::release(int32_t _691_id,std::shared_ptr< monty::ndarray< int32_t,1 > > _692_nativeidxs)
{
  _checked_ptr_1<int32_t> _ptr__692_nativeidxs(_692_nativeidxs ? _692_nativeidxs->raw() : nullptr, _692_nativeidxs ? _692_nativeidxs->size(0) : 0);
  int32_t _693_num = blocks->blocksize(_691_id);
  blocks->get(_691_id,_692_nativeidxs,(int)0);
  blocks->free(_691_id);
  if ((NULL != row_code_ptr.get()))
  {
    {
      int32_t _9452_ = (int)0;
      int32_t _9453_ = _693_num;
      for (int32_t _694_i = _9452_; _694_i < _9453_; ++_694_i)
      {
        {
          int32_t _695_ni = _ptr__692_nativeidxs[_694_i];
          code_used -= (((*row_param_ptre)(_695_ni)) - ((*row_param_ptrb)(_695_ni)));
          ((*row_param_ptre)(_695_ni)) = (int)0;
          ((*row_param_ptrb)(_695_ni)) = (int)0;
        }
      }
    }
  }
  {}
}
// End mosek.fusion.RowBlockManager.release

// Begin mosek.fusion.RowBlockManager.allocate
// Method mosek.fusion.RowBlockManager.allocate @ bld/grindsted/final/default/src/fusion/Model.mbi:5029:6-5045:7
int32_t mosek::fusion::RowBlockManager :: allocate(std::shared_ptr< monty::ndarray< int32_t,1 > > _696_nativeidxs) { return mosek::fusion::p_RowBlockManager::_get_impl(this)->allocate(_696_nativeidxs); }
int32_t mosek::fusion::p_RowBlockManager::allocate(std::shared_ptr< monty::ndarray< int32_t,1 > > _696_nativeidxs)
{
  _checked_ptr_1<int32_t> _ptr__696_nativeidxs(_696_nativeidxs ? _696_nativeidxs->raw() : nullptr, _696_nativeidxs ? _696_nativeidxs->size(0) : 0);
  int32_t _697_num = (int)((_696_nativeidxs)->size(0));
  int32_t _698_id = blocks->alloc(_697_num);
  blocks->get(_698_id,_696_nativeidxs,(int)0);
  if (((NULL != row_code_ptr.get()) && (blocks->capacity() > (int)((row_param_ptrb)->size(0)))))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _699_ptrb = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(blocks->capacity())));
      _checked_ptr_1<int32_t> _ptr__699_ptrb(_699_ptrb ? _699_ptrb->raw() : nullptr,_699_ptrb ? _699_ptrb->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(row_param_ptrb,(int)0,_699_ptrb,(int)0,(int)((row_param_ptrb)->size(0)));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _700_ptre = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(blocks->capacity())));
      _checked_ptr_1<int32_t> _ptr__700_ptre(_700_ptre ? _700_ptre->raw() : nullptr,_700_ptre ? _700_ptre->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(row_param_ptre,(int)0,_700_ptre,(int)0,(int)((row_param_ptre)->size(0)));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _701_cptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(blocks->capacity())));
      _checked_ptr_1<int32_t> _ptr__701_cptr(_701_cptr ? _701_cptr->raw() : nullptr,_701_cptr ? _701_cptr->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(row_code_ptr,(int)0,_701_cptr,(int)0,(int)((row_code_ptr)->size(0)));
      row_param_ptrb = _699_ptrb;
      row_param_ptre = _700_ptre;
      row_code_ptr = _701_cptr;
    }
  }
  {}
  return _698_id;
}
// End mosek.fusion.RowBlockManager.allocate

// Begin mosek.fusion.RowBlockManager.row_is_parameterized
// Method mosek.fusion.RowBlockManager.row_is_parameterized @ bld/grindsted/final/default/src/fusion/Model.mbi:5025:6-5027:7
bool mosek::fusion::RowBlockManager :: row_is_parameterized(int32_t _702_i) { return mosek::fusion::p_RowBlockManager::_get_impl(this)->row_is_parameterized(_702_i); }
bool mosek::fusion::p_RowBlockManager::row_is_parameterized(int32_t _702_i)
{
  return ((NULL != row_param_ptrb.get()) && (((*row_param_ptrb)(_702_i)) < ((*row_param_ptre)(_702_i))));
}
// End mosek.fusion.RowBlockManager.row_is_parameterized

void mosek::fusion::p_RowBlockManager::destroy()
{
  cconst.reset();
  code.reset();
  param_code_sizes.reset();
  param_varidx.reset();
  row_code_ptr.reset();
  row_param_ptre.reset();
  row_param_ptrb.reset();
  blocks.reset();
}
void mosek::fusion::RowBlockManager::destroy() { mosek::fusion::p_RowBlockManager::_get_impl(this)->destroy(); }
// } class RowBlockManager
// class Model { // @ bld/grindsted/final/default/src/fusion/Model.mbi:365:4-4941:5
mosek::fusion::Model::Model(mosek::fusion::p_Model *_impl) : mosek::fusion::BaseModel(_impl) { /*std::cout << "Model()" << this << std::endl; */ }
mosek::fusion::Model::~Model() {  /* std::cout << "~Model()" << this << std::endl << std::flush; */ }
mosek::fusion::p_Model::p_Model
  (::mosek::fusion::Model * _pubthis) :     mosek::fusion::p_BaseModel(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.Model.ctor @ bld/grindsted/final/default/src/fusion/Model.mbi:593:6-661:7
mosek::fusion::Model::t mosek::fusion::p_Model::_new_Model
  (monty::rc_ptr< ::mosek::fusion::Model > _703_m)
{ return new mosek::fusion::Model(_703_m); }
mosek::fusion::Model::Model
  (monty::rc_ptr< ::mosek::fusion::Model > _703_m) : 
   Model(new mosek::fusion::p_Model(this))
{ mosek::fusion::p_Model::_get_impl(this)->_initialize(_703_m); }
void mosek::fusion::p_Model::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _703_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseModel::_initialize(_703_m);
    monty::rc_ptr< ::mosek::fusion::Model > _704_self = ::mosek::fusion::Model::t(_pubthis);
    model_name = mosek::fusion::p_Model::_get_impl(_703_m)->model_name;
    acceptable_sol = mosek::fusion::p_Model::_get_impl(_703_m)->acceptable_sol;
    solutionptr = mosek::fusion::p_Model::_get_impl(_703_m)->solutionptr;
    cache_evaluations = mosek::fusion::p_Model::_get_impl(_703_m)->cache_evaluations;
    monty::rc_ptr< ::mosek::fusion::SolutionStruct > _9454_;
    bool _9455_ = (NULL != mosek::fusion::p_Model::_get_impl(_703_m)->sol_itr.get());
    if (_9455_)
    {
      _9454_ = mosek::fusion::p_Model::_get_impl(_703_m)->sol_itr->__mosek_2fusion_2SolutionStruct__clone();
    }
    else
    {
      _9454_ = nullptr;
    }
    sol_itr = _9454_;
    monty::rc_ptr< ::mosek::fusion::SolutionStruct > _9456_;
    bool _9457_ = (NULL != mosek::fusion::p_Model::_get_impl(_703_m)->sol_itg.get());
    if (_9457_)
    {
      _9456_ = mosek::fusion::p_Model::_get_impl(_703_m)->sol_itg->__mosek_2fusion_2SolutionStruct__clone();
    }
    else
    {
      _9456_ = nullptr;
    }
    sol_itg = _9456_;
    monty::rc_ptr< ::mosek::fusion::SolutionStruct > _9458_;
    bool _9459_ = (NULL != mosek::fusion::p_Model::_get_impl(_703_m)->sol_bas.get());
    if (_9459_)
    {
      _9458_ = mosek::fusion::p_Model::_get_impl(_703_m)->sol_bas->__mosek_2fusion_2SolutionStruct__clone();
    }
    else
    {
      _9458_ = nullptr;
    }
    sol_bas = _9458_;
    num_task_afe = mosek::fusion::p_Model::_get_impl(_703_m)->num_task_afe;
    num_task_con = mosek::fusion::p_Model::_get_impl(_703_m)->num_task_con;
    num_task_acc = mosek::fusion::p_Model::_get_impl(_703_m)->num_task_acc;
    con_blocks = ::mosek::fusion::p_RowBlockManager::_new_RowBlockManager(mosek::fusion::p_Model::_get_impl(_703_m)->con_blocks);
    afe_blocks = ::mosek::fusion::p_RowBlockManager::_new_RowBlockManager(mosek::fusion::p_Model::_get_impl(_703_m)->afe_blocks);
    obj_blocks = ::mosek::fusion::p_RowBlockManager::_new_RowBlockManager(mosek::fusion::p_Model::_get_impl(_703_m)->obj_blocks);
    acc_block_map = ::mosek::fusion::p_LinkedBlocks::_new_LinkedBlocks(mosek::fusion::p_Model::_get_impl(_703_m)->acc_block_map);
    acon_block_map = ::mosek::fusion::p_LinkedBlocks::_new_LinkedBlocks(mosek::fusion::p_Model::_get_impl(_703_m)->acon_block_map);
    acon_acc = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->acon_acc);
    acon_afe = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->acon_afe);
    acon_elm_accid = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->acon_elm_accid);
    acon_elm_scale = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->acon_elm_scale);
    acon_elm_ofs = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->acon_elm_ofs);
    acon_elm_afe = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->acon_elm_afe);
    task_numaferow = mosek::fusion::p_Model::_get_impl(_703_m)->task_numaferow;
    var_block_map = ::mosek::fusion::p_LinkedBlocks::_new_LinkedBlocks(mosek::fusion::p_Model::_get_impl(_703_m)->var_block_map);
    var_block_acc_id = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->var_block_acc_id);
    var_elm_acc_idx = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->var_elm_acc_idx);
    var_elm_acc_ofs = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->var_elm_acc_ofs);
    barvar_num = (int)0;
    barvar_dim = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->barvar_dim);
    barvar_block_ptr = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->barvar_block_ptr);
    barvar_block_dim = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->barvar_block_dim);
    barvar_block_elm_ptr = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->barvar_block_elm_ptr);
    barvar_block_elm_barj = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->barvar_block_elm_barj);
    barvar_block_elm_i = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->barvar_block_elm_i);
    barvar_block_elm_j = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->barvar_block_elm_j);
    std::vector<monty::rc_ptr< ::mosek::fusion::ModelVariable >> _9460_;
    for (int32_t _705_i = (int)0, _9461_ = (int)((mosek::fusion::p_Model::_get_impl(_703_m)->vars)->size(0)); _705_i < _9461_ ; ++_705_i)
    {
      monty::rc_ptr< ::mosek::fusion::ModelVariable > _9462_;
      bool _9463_ = (NULL != ((*mosek::fusion::p_Model::_get_impl(_703_m)->vars)(_705_i)).get());
      if (_9463_)
      {
        _9462_ = mosek::fusion::p_ModelVariable::_get_impl(((*mosek::fusion::p_Model::_get_impl(_703_m)->vars)(_705_i)).get())->__mosek_2fusion_2ModelVariable__clone(_704_self);
      }
      else
      {
        _9462_ = nullptr;
      }
      _9460_.push_back(_9462_);
    }
    auto _9464_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 >(monty::shape(_9460_.size()),_9460_.begin(),_9460_.end()));
    vars = _9464_;
    std::vector<monty::rc_ptr< ::mosek::fusion::ModelVariable >> _9465_;
    for (int32_t _706_i = (int)0, _9466_ = (int)((mosek::fusion::p_Model::_get_impl(_703_m)->barvars)->size(0)); _706_i < _9466_ ; ++_706_i)
    {
      monty::rc_ptr< ::mosek::fusion::ModelVariable > _9467_;
      bool _9468_ = (NULL != ((*mosek::fusion::p_Model::_get_impl(_703_m)->barvars)(_706_i)).get());
      if (_9468_)
      {
        _9467_ = mosek::fusion::p_ModelVariable::_get_impl(((*mosek::fusion::p_Model::_get_impl(_703_m)->barvars)(_706_i)).get())->__mosek_2fusion_2ModelVariable__clone(_704_self);
      }
      else
      {
        _9467_ = nullptr;
      }
      _9465_.push_back(_9467_);
    }
    auto _9469_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 >(monty::shape(_9465_.size()),_9465_.begin(),_9465_.end()));
    barvars = _9469_;
    var_map = mosek::fusion::p_Model::_get_impl(_703_m)->var_map->__mosek_2fusion_2Utils_2StringIntMap__clone();
    std::vector<monty::rc_ptr< ::mosek::fusion::ModelConstraint >> _9470_;
    for (int32_t _707_i = (int)0, _9471_ = (int)((mosek::fusion::p_Model::_get_impl(_703_m)->cons)->size(0)); _707_i < _9471_ ; ++_707_i)
    {
      monty::rc_ptr< ::mosek::fusion::ModelConstraint > _9472_;
      bool _9473_ = (NULL != ((*mosek::fusion::p_Model::_get_impl(_703_m)->cons)(_707_i)).get());
      if (_9473_)
      {
        _9472_ = mosek::fusion::p_ModelConstraint::_get_impl(((*mosek::fusion::p_Model::_get_impl(_703_m)->cons)(_707_i)).get())->__mosek_2fusion_2ModelConstraint__clone(_704_self);
      }
      else
      {
        _9472_ = nullptr;
      }
      _9470_.push_back(_9472_);
    }
    auto _9474_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 >(monty::shape(_9470_.size()),_9470_.begin(),_9470_.end()));
    cons = _9474_;
    std::vector<monty::rc_ptr< ::mosek::fusion::ModelConstraint >> _9475_;
    for (int32_t _708_i = (int)0, _9476_ = (int)((mosek::fusion::p_Model::_get_impl(_703_m)->acons)->size(0)); _708_i < _9476_ ; ++_708_i)
    {
      monty::rc_ptr< ::mosek::fusion::ModelConstraint > _9477_;
      bool _9478_ = (NULL != ((*mosek::fusion::p_Model::_get_impl(_703_m)->acons)(_708_i)).get());
      if (_9478_)
      {
        _9477_ = mosek::fusion::p_ModelConstraint::_get_impl(((*mosek::fusion::p_Model::_get_impl(_703_m)->acons)(_708_i)).get())->__mosek_2fusion_2ModelConstraint__clone(_704_self);
      }
      else
      {
        _9477_ = nullptr;
      }
      _9475_.push_back(_9477_);
    }
    auto _9479_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 >(monty::shape(_9475_.size()),_9475_.begin(),_9475_.end()));
    acons = _9479_;
    con_map = mosek::fusion::p_Model::_get_impl(_703_m)->con_map->__mosek_2fusion_2Utils_2StringIntMap__clone();
    numparameter = mosek::fusion::p_Model::_get_impl(_703_m)->numparameter;
    std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > > _9480_;
    bool _9481_ = (NULL == mosek::fusion::p_Model::_get_impl(_703_m)->parameters.get());
    if (_9481_)
    {
      _9480_ = nullptr;
    }
    else
    {
      std::vector<monty::rc_ptr< ::mosek::fusion::Parameter >> _9482_;
      for (int32_t _709_i = (int)0, _9483_ = (int)((mosek::fusion::p_Model::_get_impl(_703_m)->parameters)->size(0)); _709_i < _9483_ ; ++_709_i)
      {
        monty::rc_ptr< ::mosek::fusion::Parameter > _9484_;
        bool _9485_ = (NULL != ((*mosek::fusion::p_Model::_get_impl(_703_m)->parameters)(_709_i)).get());
        if (_9485_)
        {
          _9484_ = ((*mosek::fusion::p_Model::_get_impl(_703_m)->parameters)(_709_i))->__mosek_2fusion_2Parameter__clone(_704_self);
        }
        else
        {
          _9484_ = nullptr;
        }
        _9482_.push_back(_9484_);
      }
      auto _9486_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 >(monty::shape(_9482_.size()),_9482_.begin(),_9482_.end()));
      _9480_ = _9486_;
    }
    parameters = _9480_;
    par_map = mosek::fusion::p_Model::_get_impl(_703_m)->par_map->__mosek_2fusion_2Utils_2StringIntMap__clone();
    param_num = mosek::fusion::p_Model::_get_impl(_703_m)->param_num;
    std::shared_ptr< monty::ndarray< double,1 > > _9487_;
    bool _9488_ = (NULL != mosek::fusion::p_Model::_get_impl(_703_m)->param_value.get());
    if (_9488_)
    {
      _9487_ = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Model::_get_impl(_703_m)->param_value);
    }
    else
    {
      _9487_ = nullptr;
    }
    param_value = _9487_;
    initsol_xx = nullptr;
    initsol_xx_flag = nullptr;
    bfixidx = mosek::fusion::p_Model::_get_impl(_703_m)->bfixidx;
    rs = ::mosek::fusion::p_WorkStack::_new_WorkStack();
    ws = ::mosek::fusion::p_WorkStack::_new_WorkStack();
    xs = ::mosek::fusion::p_WorkStack::_new_WorkStack();
  }
}
// mosek.fusion.Model.ctor

// mosek.fusion.Model.ctor @ bld/grindsted/final/default/src/fusion/Model.mbi:514:6-590:7
mosek::fusion::Model::t mosek::fusion::p_Model::_new_Model
  (const std::string &  _710_name,
    int32_t _711_basesize,
    bool _712_cache_eval)
{ return new mosek::fusion::Model(_710_name,_711_basesize,_712_cache_eval); }
mosek::fusion::Model::Model
  (const std::string &  _710_name,
    int32_t _711_basesize,
    bool _712_cache_eval) : 
   Model(new mosek::fusion::p_Model(this))
{ mosek::fusion::p_Model::_get_impl(this)->_initialize(_710_name,_711_basesize,_712_cache_eval); }
void mosek::fusion::p_Model::_initialize  (const std::string &  _710_name,
    int32_t _711_basesize,
    bool _712_cache_eval)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseModel::_initialize(_710_name,std::string (""));
    model_name = _710_name;
    acceptable_sol = ::mosek::fusion::AccSolutionStatus::Optimal;
    solutionptr = ::mosek::fusion::SolutionType::Default;
    cache_evaluations = _712_cache_eval;
    sol_itr = nullptr;
    sol_itg = nullptr;
    sol_bas = nullptr;
    num_task_afe = (int)0;
    num_task_con = (int)0;
    num_task_acc = (int)0;
    con_blocks = ::mosek::fusion::p_RowBlockManager::_new_RowBlockManager();
    afe_blocks = ::mosek::fusion::p_RowBlockManager::_new_RowBlockManager();
    obj_blocks = ::mosek::fusion::p_RowBlockManager::_new_RowBlockManager();
    acc_block_map = ::mosek::fusion::p_LinkedBlocks::_new_LinkedBlocks();
    acon_block_map = ::mosek::fusion::p_LinkedBlocks::_new_LinkedBlocks();
    task_numaferow = (int)0;
    acon_acc = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(acon_block_map->block_capacity())));
    acon_afe = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(acon_block_map->block_capacity())));
    acon_elm_accid = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(acon_block_map->capacity())));
    std::vector<double> _9489_;
    for (int32_t _713_i = (int)0, _9490_ = acon_block_map->capacity(); _713_i < _9490_ ; ++_713_i)
    {
      _9489_.push_back(1.0);
    }
    auto _9491_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_9489_.size()),_9489_.begin(),_9489_.end()));
    acon_elm_scale = _9491_;
    acon_elm_ofs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(acon_block_map->capacity())));
    acon_elm_afe = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(acon_block_map->capacity())));
    var_block_map = ::mosek::fusion::p_LinkedBlocks::_new_LinkedBlocks();
    var_block_acc_id = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(var_block_map->block_capacity())));
    var_elm_acc_idx = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(var_block_map->capacity())));
    var_elm_acc_ofs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(var_block_map->capacity())));
    barvar_num = (int)0;
    barvar_dim = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_711_basesize)));
    barvar_block_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _711_basesize,(int)1 ))));
    barvar_block_dim = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_711_basesize)));
    barvar_block_elm_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _711_basesize,(int)1 ))));
    barvar_block_elm_barj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_711_basesize)));
    barvar_block_elm_i = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_711_basesize)));
    barvar_block_elm_j = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_711_basesize)));
    std::vector<monty::rc_ptr< ::mosek::fusion::ModelVariable >> _9492_;
    for (int32_t _714_i = (int)0, _9493_ = safe_mul( _711_basesize,(int)8 ); _714_i < _9493_ ; ++_714_i)
    {
      _9492_.push_back(nullptr);
    }
    auto _9494_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 >(monty::shape(_9492_.size()),_9492_.begin(),_9492_.end()));
    vars = _9494_;
    std::vector<monty::rc_ptr< ::mosek::fusion::ModelVariable >> _9495_;
    for (int32_t _715_i = (int)0, _9496_ = _711_basesize; _715_i < _9496_ ; ++_715_i)
    {
      _9495_.push_back(nullptr);
    }
    auto _9497_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 >(monty::shape(_9495_.size()),_9495_.begin(),_9495_.end()));
    barvars = _9497_;
    var_map = ::mosek::fusion::Utils::p_StringIntMap::_new_StringIntMap();
    initsol_xx = nullptr;
    initsol_xx_flag = nullptr;
    std::vector<monty::rc_ptr< ::mosek::fusion::ModelConstraint >> _9498_;
    for (int32_t _716_i = (int)0, _9499_ = safe_mul( _711_basesize,(int)8 ); _716_i < _9499_ ; ++_716_i)
    {
      _9498_.push_back(nullptr);
    }
    auto _9500_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 >(monty::shape(_9498_.size()),_9498_.begin(),_9498_.end()));
    cons = _9500_;
    std::vector<monty::rc_ptr< ::mosek::fusion::ModelConstraint >> _9501_;
    for (int32_t _717_i = (int)0, _9502_ = safe_mul( _711_basesize,(int)8 ); _717_i < _9502_ ; ++_717_i)
    {
      _9501_.push_back(nullptr);
    }
    auto _9503_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 >(monty::shape(_9501_.size()),_9501_.begin(),_9501_.end()));
    acons = _9503_;
    con_map = ::mosek::fusion::Utils::p_StringIntMap::_new_StringIntMap();
    numparameter = (int)0;
    parameters = nullptr;
    par_map = ::mosek::fusion::Utils::p_StringIntMap::_new_StringIntMap();
    param_num = (int)0;
    param_value = nullptr;
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _718_natvarbfixidx = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)1)));
      _checked_ptr_1<int32_t> _ptr__718_natvarbfixidx(_718_natvarbfixidx ? _718_natvarbfixidx->raw() : nullptr,_718_natvarbfixidx ? _718_natvarbfixidx->size(0) : 0);
      int32_t _719_bfixvarid = linearvar_alloc((int)1,_718_natvarbfixidx);
      bfixidx = _ptr__718_natvarbfixidx[(int)0];
    }
    task_var_putboundlist_fx(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(bfixidx)}),std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(1.0)}));
    task_var_name(bfixidx,std::string ("1.0"));
    task_append_domain_empty();
    rs = ::mosek::fusion::p_WorkStack::_new_WorkStack();
    ws = ::mosek::fusion::p_WorkStack::_new_WorkStack();
    xs = ::mosek::fusion::p_WorkStack::_new_WorkStack();
  }
}
// mosek.fusion.Model.ctor

// mosek.fusion.Model.ctor @ bld/grindsted/final/default/src/fusion/Model.mbi:506:6-88
mosek::fusion::Model::t mosek::fusion::p_Model::_new_Model
  (int32_t _720_basesize,
    bool _721_cache_eval)
{ return new mosek::fusion::Model(_720_basesize,_721_cache_eval); }
mosek::fusion::Model::Model
  (int32_t _720_basesize,
    bool _721_cache_eval) : 
   Model(new mosek::fusion::p_Model(this))
{ mosek::fusion::p_Model::_get_impl(this)->_initialize(_720_basesize,_721_cache_eval); }
void mosek::fusion::p_Model::_initialize  (int32_t _720_basesize,
    bool _721_cache_eval)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_Model::_initialize(std::string (""),_720_basesize,_721_cache_eval);
  }
}
// mosek.fusion.Model.ctor

// mosek.fusion.Model.ctor @ bld/grindsted/final/default/src/fusion/Model.mbi:499:6-60
mosek::fusion::Model::t mosek::fusion::p_Model::_new_Model
  (const std::string &  _722_name)
{ return new mosek::fusion::Model(_722_name); }
mosek::fusion::Model::Model
  (const std::string &  _722_name) : 
   Model(new mosek::fusion::p_Model(this))
{ mosek::fusion::p_Model::_get_impl(this)->_initialize(_722_name); }
void mosek::fusion::p_Model::_initialize  (const std::string &  _722_name)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_Model::_initialize(_722_name,(int)128,false);
  }
}
// mosek.fusion.Model.ctor

// mosek.fusion.Model.ctor @ bld/grindsted/final/default/src/fusion/Model.mbi:493:6-45
mosek::fusion::Model::t mosek::fusion::p_Model::_new_Model
  ()
{ return new mosek::fusion::Model(); }
mosek::fusion::Model::Model
  () : 
   Model(new mosek::fusion::p_Model(this))
{ mosek::fusion::p_Model::_get_impl(this)->_initialize(); }
void mosek::fusion::p_Model::_initialize  ()
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_Model::_initialize(std::string (""),(int)128,false);
  }
}
// mosek.fusion.Model.ctor

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4822:6-4940:7
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(const std::string & _723_name,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _724_terms) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_723_name,_724_terms); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(const std::string &  _723_name,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _724_terms) { return __mosek_2fusion_2Model__disjunction(_723_name,_724_terms); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(const std::string & _723_name,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _724_terms)
{
  int32_t _725_n = (int)((_724_terms)->size(0));
  int32_t _726_nrows = (int)0;
  int32_t _727_nterms = (int)0;
  int32_t _728_naccterms = (int)0;
  int32_t _729_naccrows = (int)0;
  int32_t _9504_ = (int)0;
  int32_t _9505_ = _725_n;
  for (int32_t _730_i = _9504_; _730_i < _9505_; ++_730_i)
  {
    {
      _726_nrows += ((*_724_terms)(_730_i))->size();
      _727_nterms += mosek::fusion::p_Term::_get_impl(((*_724_terms)(_730_i)).get())->num();
      _729_naccrows += mosek::fusion::p_Term::_get_impl(((*_724_terms)(_730_i)).get())->numaccrows();
      _728_naccterms += mosek::fusion::p_Term::_get_impl(((*_724_terms)(_730_i)).get())->numaccterms();
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _731_afeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_726_nrows)));
  _checked_ptr_1<int32_t> _ptr__731_afeidxs(_731_afeidxs ? _731_afeidxs->raw() : nullptr,_731_afeidxs ? _731_afeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _732_accafeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_729_naccrows)));
  _checked_ptr_1<int32_t> _ptr__732_accafeidxs(_732_accafeidxs ? _732_accafeidxs->raw() : nullptr,_732_accafeidxs ? _732_accafeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _733_accb = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_729_naccrows)));
  _checked_ptr_1<double> _ptr__733_accb(_733_accb ? _733_accb->raw() : nullptr,_733_accb ? _733_accb->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _734_domidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_728_naccterms)));
  _checked_ptr_1<int64_t> _ptr__734_domidxs(_734_domidxs ? _734_domidxs->raw() : nullptr,_734_domidxs ? _734_domidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _735_termsize = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_725_n)));
  _checked_ptr_1<int64_t> _ptr__735_termsize(_735_termsize ? _735_termsize->raw() : nullptr,_735_termsize ? _735_termsize->size(0) : 0);
  int32_t _736_afeblockid = afe_allocate(_731_afeidxs);
  int32_t _737_term_index = (int)0;
  int32_t _738_acctermptr = (int)0;
  int32_t _739_afetgtptr = (int)0;
  int32_t _740_afeptr = (int)0;
  int32_t _9506_ = (int)0;
  int32_t _9507_ = _725_n;
  for (int32_t _741_term_i = _9506_; _741_term_i < _9507_; ++_741_term_i)
  {
    {
      int32_t _9508_ = (int)0;
      int32_t _9509_ = mosek::fusion::p_Term::_get_impl(((*_724_terms)(_741_term_i)).get())->num();
      for (int32_t _742_simpterm_i = _9508_; _742_simpterm_i < _9509_; ++_742_simpterm_i)
      {
        {
          monty::rc_ptr< ::mosek::fusion::DJCDomain > _743_dom = ((*mosek::fusion::p_Term::_get_impl(((*_724_terms)(_741_term_i)))->domains)(_742_simpterm_i));
          monty::rc_ptr< ::mosek::fusion::ExprDense > _744_e = ::mosek::fusion::p_ExprDense::_new_ExprDense((::mosek::fusion::p_ExprOptimizeCode::_new_ExprOptimizeCode((::mosek::fusion::p_ExprCompress::_new_ExprCompress(((*mosek::fusion::p_Term::_get_impl(((*_724_terms)(_741_term_i)))->exprs)(_742_simpterm_i)))).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>());
          _744_e->recursive_eval(rs,ws,xs,cache_evaluations);
          rs->pop_expr();
          std::shared_ptr< monty::ndarray< int32_t,1 > > _745_ri32 = mosek::fusion::p_WorkStack::_get_impl(rs)->i32;
          _checked_ptr_1<int32_t> _ptr__745_ri32(_745_ri32 ? _745_ri32->raw() : nullptr,_745_ri32 ? _745_ri32->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _746_ri64 = mosek::fusion::p_WorkStack::_get_impl(rs)->i64;
          _checked_ptr_1<int64_t> _ptr__746_ri64(_746_ri64 ? _746_ri64->raw() : nullptr,_746_ri64 ? _746_ri64->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _747_rf64 = mosek::fusion::p_WorkStack::_get_impl(rs)->f64;
          _checked_ptr_1<double> _ptr__747_rf64(_747_rf64 ? _747_rf64->raw() : nullptr,_747_rf64 ? _747_rf64->size(0) : 0);
          int32_t _748_nd = mosek::fusion::p_WorkStack::_get_impl(rs)->nd;
          int32_t _749_shape_base = mosek::fusion::p_WorkStack::_get_impl(rs)->shape_base;
          int32_t _750_nelem = mosek::fusion::p_WorkStack::_get_impl(rs)->nelem;
          int32_t _751_nnz = mosek::fusion::p_WorkStack::_get_impl(rs)->nnz;
          int32_t _752_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(rs)->ncodeatom;
          bool _753_hassp = mosek::fusion::p_WorkStack::_get_impl(rs)->hassp;
          int32_t _754_ptr_base = mosek::fusion::p_WorkStack::_get_impl(rs)->ptr_base;
          int32_t _755_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(rs)->nidxs_base;
          int32_t _756_cof_base = mosek::fusion::p_WorkStack::_get_impl(rs)->cof_base;
          int32_t _757_code = mosek::fusion::p_WorkStack::_get_impl(rs)->code_base;
          int32_t _758_codeptr = mosek::fusion::p_WorkStack::_get_impl(rs)->codeptr_base;
          int32_t _759_cconst = mosek::fusion::p_WorkStack::_get_impl(rs)->cconst_base;
          std::vector<int32_t> _9510_;
          for (int32_t _761_i = (int)0, _9511_ = _748_nd; _761_i < _9511_ ; ++_761_i)
          {
            _9510_.push_back(_ptr__745_ri32[safe_add( _749_shape_base,_761_i )]);
          }
          auto _9512_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9510_.size()),_9510_.begin(),_9510_.end()));
          std::shared_ptr< monty::ndarray< int32_t,1 > > _760_shape = _9512_;
          _checked_ptr_1<int32_t> _ptr__760_shape(_760_shape ? _760_shape->raw() : nullptr,_760_shape ? _760_shape->size(0) : 0);
          putfrows(_731_afeidxs,_740_afeptr,rs,_750_nelem,_751_nnz,_754_ptr_base,_755_nidxs_base,_756_cof_base);
          if ((mosek::fusion::p_DJCDomain::_get_impl(_743_dom)->dom == ::mosek::fusion::DJCDomainType::InRange))
          {
            {
              std::shared_ptr< monty::ndarray< double,1 > > _762_lb = mosek::fusion::p_DJCDomain::_get_impl(_743_dom)->b;
              _checked_ptr_1<double> _ptr__762_lb(_762_lb ? _762_lb->raw() : nullptr,_762_lb ? _762_lb->size(0) : 0);
              std::shared_ptr< monty::ndarray< double,1 > > _763_ub = mosek::fusion::p_DJCDomain::_get_impl(_743_dom)->par;
              _checked_ptr_1<double> _ptr__763_ub(_763_ub ? _763_ub->raw() : nullptr,_763_ub ? _763_ub->size(0) : 0);
              int32_t _9513_ = (int)0;
              int32_t _9514_ = _750_nelem;
              for (int32_t _764_i = _9513_; _764_i < _9514_; ++_764_i)
              {
                {
                  _ptr__732_accafeidxs[safe_add( _739_afetgtptr,_764_i )] = _ptr__731_afeidxs[safe_add( _740_afeptr,_764_i )];
                  _ptr__732_accafeidxs[safe_add( safe_add( _739_afetgtptr,_750_nelem ),_764_i )] = _ptr__731_afeidxs[safe_add( _740_afeptr,_764_i )];
                  _ptr__733_accb[safe_add( _739_afetgtptr,_764_i )] = _ptr__762_lb[_764_i];
                  _ptr__733_accb[safe_add( safe_add( _739_afetgtptr,_750_nelem ),_764_i )] = _ptr__763_ub[_764_i];
                }
              }
              _ptr__734_domidxs[_738_acctermptr] = task_append_domain_rpos(_750_nelem);
              _ptr__734_domidxs[safe_add( _738_acctermptr,(int)1 )] = task_append_domain_rneg(_750_nelem);
              _ptr__735_termsize[_741_term_i] += (int)2;
              _738_acctermptr += (int)2;
              _739_afetgtptr += safe_mul( _750_nelem,(int)2 );
            }
          }
          else if(((mosek::fusion::p_DJCDomain::_get_impl(_743_dom)->dom == ::mosek::fusion::DJCDomainType::EqualTo) || ((mosek::fusion::p_DJCDomain::_get_impl(_743_dom)->dom == ::mosek::fusion::DJCDomainType::LessThan) || ((mosek::fusion::p_DJCDomain::_get_impl(_743_dom)->dom == ::mosek::fusion::DJCDomainType::GreaterThan) || (mosek::fusion::p_DJCDomain::_get_impl(_743_dom)->dom == ::mosek::fusion::DJCDomainType::IsFree)))))
          {
            {
              std::shared_ptr< monty::ndarray< double,1 > > _765_b = mosek::fusion::p_DJCDomain::_get_impl(_743_dom)->b;
              _checked_ptr_1<double> _ptr__765_b(_765_b ? _765_b->raw() : nullptr,_765_b ? _765_b->size(0) : 0);
              int32_t _9515_ = (int)0;
              int32_t _9516_ = _750_nelem;
              for (int32_t _766_i = _9515_; _766_i < _9516_; ++_766_i)
              {
                {
                  _ptr__732_accafeidxs[safe_add( _739_afetgtptr,_766_i )] = _ptr__731_afeidxs[safe_add( _740_afeptr,_766_i )];
                  _ptr__733_accb[safe_add( _739_afetgtptr,_766_i )] = _ptr__765_b[_766_i];
                }
              }
              if ((mosek::fusion::p_DJCDomain::_get_impl(_743_dom)->dom == ::mosek::fusion::DJCDomainType::EqualTo))
              {
                {
                  _ptr__734_domidxs[_738_acctermptr] = task_append_domain_rzero(_750_nelem);
                }
              }
              else if((mosek::fusion::p_DJCDomain::_get_impl(_743_dom)->dom == ::mosek::fusion::DJCDomainType::LessThan))
              {
                {
                  _ptr__734_domidxs[_738_acctermptr] = task_append_domain_rneg(_750_nelem);
                }
              }
              else if((mosek::fusion::p_DJCDomain::_get_impl(_743_dom)->dom == ::mosek::fusion::DJCDomainType::GreaterThan))
              {
                {
                  _ptr__734_domidxs[_738_acctermptr] = task_append_domain_rpos(_750_nelem);
                }
              }
              else
              {
                {
                  _ptr__734_domidxs[_738_acctermptr] = task_append_domain_r(_750_nelem);
                }
              }
              _ptr__735_termsize[_741_term_i] += (int)1;
              _738_acctermptr += (int)1;
              _739_afetgtptr += _750_nelem;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Not implemented: Non-linear conic DJC constraints"));
            }
          }
          if ((_752_ncodeatom > (int)0))
          {
            {
              std::vector<int32_t> _9517_;
              for (int32_t _767_i = (int)0, _9518_ = _750_nelem; _767_i < _9518_ ; ++_767_i)
              {
                _9517_.push_back(_ptr__731_afeidxs[safe_add( _740_afeptr,_767_i )]);
              }
              auto _9519_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9517_.size()),_9517_.begin(),_9517_.end()));
              afe_blocks->replace_row_code(rs,_9519_,_754_ptr_base,_755_nidxs_base,_758_codeptr,_757_code,_759_cconst);
            }
          }
          {}
          _740_afeptr += _750_nelem;
          ++ _737_term_index;
        }
      }
    }
  }
  int64_t _768_djcidx = task_append_djc((int64_t)((int)1));
  std::vector<int64_t> _9520_;
  for (int32_t _769_i = (int)0, _9521_ = (int)((_732_accafeidxs)->size(0)); _769_i < _9521_ ; ++_769_i)
  {
    _9520_.push_back(_ptr__732_accafeidxs[_769_i]);
  }
  auto _9522_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9520_.size()),_9520_.begin(),_9520_.end()));
  task_putdjcslice(_768_djcidx,safe_add( _768_djcidx,(int)1 ),std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >{(int64_t)((int64_t)_725_n)}),_735_termsize,_734_domidxs,_9522_,_733_accb);
  if (((int)((_723_name).size()) > (int)0))
  {
    {
      task_djc_name(_768_djcidx,::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(_723_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("["))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("]"))->toString());
    }
  }
  {}
  return ::mosek::fusion::p_Disjunction::_new_Disjunction(_768_djcidx);
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4821:6-92
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _770_terms) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_770_terms); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _770_terms) { return __mosek_2fusion_2Model__disjunction(_770_terms); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > > _770_terms)
{
  return _pubthis->__mosek_2fusion_2Model__disjunction(std::string (""),_770_terms);
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4819:6-111
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _771_djcterms) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_771_djcterms); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _771_djcterms) { return __mosek_2fusion_2Model__disjunction(_771_djcterms); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _771_djcterms)
{
  return _pubthis->__mosek_2fusion_2Model__disjunction(mosek::fusion::p_DisjunctionTerms::_get_impl(_771_djcterms)->terms);
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4817:6-129
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(const std::string & _772_name,monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _773_djcterms) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_772_name,_773_djcterms); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(const std::string &  _772_name,monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _773_djcterms) { return __mosek_2fusion_2Model__disjunction(_772_name,_773_djcterms); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(const std::string & _772_name,monty::rc_ptr< ::mosek::fusion::DisjunctionTerms > _773_djcterms)
{
  return _pubthis->__mosek_2fusion_2Model__disjunction(_772_name,mosek::fusion::p_DisjunctionTerms::_get_impl(_773_djcterms)->terms);
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4815:6-157
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(const std::string & _774_name,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ExprDomain >,1 > > _775_terms) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_774_name,_775_terms); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(const std::string &  _774_name,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ExprDomain >,1 > > _775_terms) { return __mosek_2fusion_2Model__disjunction(_774_name,_775_terms); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(const std::string & _774_name,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ExprDomain >,1 > > _775_terms)
{
  std::vector<monty::rc_ptr< ::mosek::fusion::Term >> _9523_;
  for (int32_t _776_i = (int)0, _9524_ = (int)((_775_terms)->size(0)); _776_i < _9524_ ; ++_776_i)
  {
    _9523_.push_back(((*_775_terms)(_776_i))->__mosek_2fusion_2ExprDomain__toDJCTerm());
  }
  auto _9525_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >(monty::shape(_9523_.size()),_9523_.begin(),_9523_.end()));
  return _pubthis->__mosek_2fusion_2Model__disjunction(_774_name,_9525_);
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4813:6-142
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ExprDomain >,1 > > _777_terms) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_777_terms); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ExprDomain >,1 > > _777_terms) { return __mosek_2fusion_2Model__disjunction(_777_terms); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ExprDomain >,1 > > _777_terms)
{
  std::vector<monty::rc_ptr< ::mosek::fusion::Term >> _9526_;
  for (int32_t _778_i = (int)0, _9527_ = (int)((_777_terms)->size(0)); _778_i < _9527_ ; ++_778_i)
  {
    _9526_.push_back(((*_777_terms)(_778_i))->__mosek_2fusion_2ExprDomain__toDJCTerm());
  }
  auto _9528_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >(monty::shape(_9526_.size()),_9526_.begin(),_9526_.end()));
  return _pubthis->__mosek_2fusion_2Model__disjunction(std::string (""),_9528_);
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4811:6-128
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(const std::string & _779_name,monty::rc_ptr< ::mosek::fusion::ExprDomain > _780_term) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_779_name,_780_term); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(const std::string &  _779_name,monty::rc_ptr< ::mosek::fusion::ExprDomain > _780_term) { return __mosek_2fusion_2Model__disjunction(_779_name,_780_term); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(const std::string & _779_name,monty::rc_ptr< ::mosek::fusion::ExprDomain > _780_term)
{
  return _pubthis->__mosek_2fusion_2Model__disjunction(_779_name,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >{::monty::rc_ptr<::mosek::fusion::Term>(_780_term->__mosek_2fusion_2ExprDomain__toDJCTerm().get())}));
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4809:6-113
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(monty::rc_ptr< ::mosek::fusion::ExprDomain > _781_term) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_781_term); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(monty::rc_ptr< ::mosek::fusion::ExprDomain > _781_term) { return __mosek_2fusion_2Model__disjunction(_781_term); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(monty::rc_ptr< ::mosek::fusion::ExprDomain > _781_term)
{
  return _pubthis->__mosek_2fusion_2Model__disjunction(std::string (""),std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >{::monty::rc_ptr<::mosek::fusion::Term>(_781_term->__mosek_2fusion_2ExprDomain__toDJCTerm().get())}));
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4806:6-115
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(monty::rc_ptr< ::mosek::fusion::Term > _782_t1,monty::rc_ptr< ::mosek::fusion::Term > _783_t2,monty::rc_ptr< ::mosek::fusion::Term > _784_t3) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_782_t1,_783_t2,_784_t3); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(monty::rc_ptr< ::mosek::fusion::Term > _782_t1,monty::rc_ptr< ::mosek::fusion::Term > _783_t2,monty::rc_ptr< ::mosek::fusion::Term > _784_t3) { return __mosek_2fusion_2Model__disjunction(_782_t1,_783_t2,_784_t3); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(monty::rc_ptr< ::mosek::fusion::Term > _782_t1,monty::rc_ptr< ::mosek::fusion::Term > _783_t2,monty::rc_ptr< ::mosek::fusion::Term > _784_t3)
{
  return _pubthis->__mosek_2fusion_2Model__disjunction(std::string (""),std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >{::monty::rc_ptr<::mosek::fusion::Term>(_782_t1.get()),::monty::rc_ptr<::mosek::fusion::Term>(_783_t2.get()),::monty::rc_ptr<::mosek::fusion::Term>(_784_t3.get())}));
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4805:6-103
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(monty::rc_ptr< ::mosek::fusion::Term > _785_t1,monty::rc_ptr< ::mosek::fusion::Term > _786_t2) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_785_t1,_786_t2); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(monty::rc_ptr< ::mosek::fusion::Term > _785_t1,monty::rc_ptr< ::mosek::fusion::Term > _786_t2) { return __mosek_2fusion_2Model__disjunction(_785_t1,_786_t2); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(monty::rc_ptr< ::mosek::fusion::Term > _785_t1,monty::rc_ptr< ::mosek::fusion::Term > _786_t2)
{
  return _pubthis->__mosek_2fusion_2Model__disjunction(std::string (""),std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >{::monty::rc_ptr<::mosek::fusion::Term>(_785_t1.get()),::monty::rc_ptr<::mosek::fusion::Term>(_786_t2.get())}));
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4804:6-91
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(monty::rc_ptr< ::mosek::fusion::Term > _787_t1) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_787_t1); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(monty::rc_ptr< ::mosek::fusion::Term > _787_t1) { return __mosek_2fusion_2Model__disjunction(_787_t1); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(monty::rc_ptr< ::mosek::fusion::Term > _787_t1)
{
  return _pubthis->__mosek_2fusion_2Model__disjunction(std::string (""),std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >{::monty::rc_ptr<::mosek::fusion::Term>(_787_t1.get())}));
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4802:6-129
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(const std::string & _788_name,monty::rc_ptr< ::mosek::fusion::Term > _789_t1,monty::rc_ptr< ::mosek::fusion::Term > _790_t2,monty::rc_ptr< ::mosek::fusion::Term > _791_t3) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_788_name,_789_t1,_790_t2,_791_t3); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(const std::string &  _788_name,monty::rc_ptr< ::mosek::fusion::Term > _789_t1,monty::rc_ptr< ::mosek::fusion::Term > _790_t2,monty::rc_ptr< ::mosek::fusion::Term > _791_t3) { return __mosek_2fusion_2Model__disjunction(_788_name,_789_t1,_790_t2,_791_t3); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(const std::string & _788_name,monty::rc_ptr< ::mosek::fusion::Term > _789_t1,monty::rc_ptr< ::mosek::fusion::Term > _790_t2,monty::rc_ptr< ::mosek::fusion::Term > _791_t3)
{
  return _pubthis->__mosek_2fusion_2Model__disjunction(_788_name,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >{::monty::rc_ptr<::mosek::fusion::Term>(_789_t1.get()),::monty::rc_ptr<::mosek::fusion::Term>(_790_t2.get()),::monty::rc_ptr<::mosek::fusion::Term>(_791_t3.get())}));
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4801:6-117
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(const std::string & _792_name,monty::rc_ptr< ::mosek::fusion::Term > _793_t1,monty::rc_ptr< ::mosek::fusion::Term > _794_t2) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_792_name,_793_t1,_794_t2); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(const std::string &  _792_name,monty::rc_ptr< ::mosek::fusion::Term > _793_t1,monty::rc_ptr< ::mosek::fusion::Term > _794_t2) { return __mosek_2fusion_2Model__disjunction(_792_name,_793_t1,_794_t2); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(const std::string & _792_name,monty::rc_ptr< ::mosek::fusion::Term > _793_t1,monty::rc_ptr< ::mosek::fusion::Term > _794_t2)
{
  return _pubthis->__mosek_2fusion_2Model__disjunction(_792_name,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >{::monty::rc_ptr<::mosek::fusion::Term>(_793_t1.get()),::monty::rc_ptr<::mosek::fusion::Term>(_794_t2.get())}));
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.disjunction
// Method mosek.fusion.Model.disjunction @ bld/grindsted/final/default/src/fusion/Model.mbi:4800:6-105
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model :: __mosek_2fusion_2Model__disjunction(const std::string & _795_name,monty::rc_ptr< ::mosek::fusion::Term > _796_t1) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__disjunction(_795_name,_796_t1); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::Model::disjunction(const std::string &  _795_name,monty::rc_ptr< ::mosek::fusion::Term > _796_t1) { return __mosek_2fusion_2Model__disjunction(_795_name,_796_t1); }
monty::rc_ptr< ::mosek::fusion::Disjunction > mosek::fusion::p_Model::__mosek_2fusion_2Model__disjunction(const std::string & _795_name,monty::rc_ptr< ::mosek::fusion::Term > _796_t1)
{
  return _pubthis->__mosek_2fusion_2Model__disjunction(_795_name,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Term >,1 >{::monty::rc_ptr<::mosek::fusion::Term>(_796_t1.get())}));
}
// End mosek.fusion.Model.disjunction

// Begin mosek.fusion.Model.formstConstr
// Method mosek.fusion.Model.formstConstr @ bld/grindsted/final/default/src/fusion/Model.mbi:4795:6-4798:7
monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > mosek::fusion::p_Model::__mosek_2fusion_2Model__formstConstr(monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _797_sb,std::shared_ptr< monty::ndarray< int32_t,1 > > _798_shape,std::shared_ptr< monty::ndarray< int32_t,1 > > _799_idxs)
{
  _checked_ptr_1<int32_t> _ptr__798_shape(_798_shape ? _798_shape->raw() : nullptr, _798_shape ? _798_shape->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__799_idxs(_799_idxs ? _799_idxs->raw() : nullptr, _799_idxs ? _799_idxs->size(0) : 0);
  return _797_sb;
}
// End mosek.fusion.Model.formstConstr

// Begin mosek.fusion.Model.acon_release
// Method mosek.fusion.Model.acon_release @ bld/grindsted/final/default/src/fusion/Model.mbi:4685:6-4704:7
void mosek::fusion::p_Model::acon_release(int32_t _800_id)
{
  int32_t _801_num = acon_block_map->blocksize(_800_id);
  if ((_801_num >= (int)0))
  {
    {
      int32_t _802_numcone = acc_block_map->blocksize(((*acon_acc)(_800_id)));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _803_accidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_802_numcone)));
      _checked_ptr_1<int32_t> _ptr__803_accidxs(_803_accidxs ? _803_accidxs->raw() : nullptr,_803_accidxs ? _803_accidxs->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _804_afeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_801_num)));
      _checked_ptr_1<int32_t> _ptr__804_afeidxs(_804_afeidxs ? _804_afeidxs->raw() : nullptr,_804_afeidxs ? _804_afeidxs->size(0) : 0);
      acc_block_map->get(((*acon_acc)(_800_id)),_803_accidxs,(int)0);
      acc_block_map->free(((*acon_acc)(_800_id)));
      afe_blocks->get(((*acon_afe)(_800_id)),_804_afeidxs,(int)0);
      afe_release(((*acon_afe)(_800_id)));
      acon_block_map->free(_800_id);
      std::vector<int64_t> _9529_;
      for (int32_t _805_i = (int)0, _9530_ = _801_num; _805_i < _9530_ ; ++_805_i)
      {
        _9529_.push_back(_ptr__804_afeidxs[_805_i]);
      }
      auto _9531_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9529_.size()),_9529_.begin(),_9529_.end()));
      task_clearafelist(_9531_);
      std::vector<int64_t> _9532_;
      for (int32_t _806_i = (int)0, _9533_ = _802_numcone; _806_i < _9533_ ; ++_806_i)
      {
        _9532_.push_back(_ptr__803_accidxs[_806_i]);
      }
      auto _9534_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9532_.size()),_9532_.begin(),_9532_.end()));
      std::vector<int64_t> _9535_;
      for (int32_t _807_i = (int)0, _9536_ = _802_numcone; _807_i < _9536_ ; ++_807_i)
      {
        _9535_.push_back((int)0);
      }
      auto _9537_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9535_.size()),_9535_.begin(),_9535_.end()));
      task_putacclist(_9534_,_9537_,std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)0))),std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)0))));
    }
  }
  {}
}
// End mosek.fusion.Model.acon_release

// Begin mosek.fusion.Model.acon_allocate
// Method mosek.fusion.Model.acon_allocate @ bld/grindsted/final/default/src/fusion/Model.mbi:4604:6-4683:7
int32_t mosek::fusion::p_Model::acon_allocate(std::shared_ptr< monty::ndarray< int64_t,1 > > _808_domidxs,int32_t _809_conesize,int32_t _810_numcone,std::shared_ptr< monty::ndarray< double,1 > > _811_g,std::shared_ptr< monty::ndarray< int32_t,1 > > _812_afeidxs,std::shared_ptr< monty::ndarray< int32_t,1 > > _813_accidxs)
{
  _checked_ptr_1<int64_t> _ptr__808_domidxs(_808_domidxs ? _808_domidxs->raw() : nullptr, _808_domidxs ? _808_domidxs->size(0) : 0);
  _checked_ptr_1<double> _ptr__811_g(_811_g ? _811_g->raw() : nullptr, _811_g ? _811_g->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__812_afeidxs(_812_afeidxs ? _812_afeidxs->raw() : nullptr, _812_afeidxs ? _812_afeidxs->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__813_accidxs(_813_accidxs ? _813_accidxs->raw() : nullptr, _813_accidxs ? _813_accidxs->size(0) : 0);
  int32_t _814_n = safe_mul( _810_numcone,_809_conesize );
  std::shared_ptr< monty::ndarray< int32_t,1 > > _815_aconidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_814_n)));
  _checked_ptr_1<int32_t> _ptr__815_aconidxs(_815_aconidxs ? _815_aconidxs->raw() : nullptr,_815_aconidxs ? _815_aconidxs->size(0) : 0);
  int32_t _816_aconid = acon_block_map->alloc(_814_n);
  int32_t _817_accid = acc_block_map->alloc(_810_numcone);
  int32_t _818_afeid = afe_allocate(_812_afeidxs);
  acon_block_map->get(_816_aconid,_815_aconidxs,(int)0);
  acc_block_map->get(_817_accid,_813_accidxs,(int)0);
  int32_t _819_acon_block_cap = acon_block_map->block_capacity();
  int32_t _820_acon_cap = acon_block_map->capacity();
  if ((_819_acon_block_cap > (int)((acon_acc)->size(0))))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _821_tmpacc = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_819_acon_block_cap)));
      _checked_ptr_1<int32_t> _ptr__821_tmpacc(_821_tmpacc ? _821_tmpacc->raw() : nullptr,_821_tmpacc ? _821_tmpacc->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _822_tmpafe = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_819_acon_block_cap)));
      _checked_ptr_1<int32_t> _ptr__822_tmpafe(_822_tmpafe ? _822_tmpafe->raw() : nullptr,_822_tmpafe ? _822_tmpafe->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(acon_acc,(int)0,_821_tmpacc,(int)0,(int)((acon_acc)->size(0)));
      ::mosek::fusion::Utils::Tools::arraycopy(acon_afe,(int)0,_822_tmpafe,(int)0,(int)((acon_afe)->size(0)));
      acon_acc = _821_tmpacc;
      acon_afe = _822_tmpafe;
    }
  }
  {}
  ((*acon_acc)(_816_aconid)) = _817_accid;
  ((*acon_afe)(_816_aconid)) = _818_afeid;
  if ((_816_aconid >= (int)((acons)->size(0))))
  {
    {
      std::vector<monty::rc_ptr< ::mosek::fusion::ModelConstraint >> _9538_;
      for (int32_t _824_i = (int)0, _9539_ = safe_mul( (int)((acons)->size(0)),(int)2 ); _824_i < _9539_ ; ++_824_i)
      {
        _9538_.push_back(nullptr);
      }
      auto _9540_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 >(monty::shape(_9538_.size()),_9538_.begin(),_9538_.end()));
      std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 > > _823_newacons = _9540_;
      int32_t _9541_ = (int)0;
      int32_t _9542_ = (int)((acons)->size(0));
      for (int32_t _825_i = _9541_; _825_i < _9542_; ++_825_i)
      {
        {
          ((*_823_newacons)(_825_i)) = ((*acons)(_825_i));
        }
      }
      acons = _823_newacons;
    }
  }
  {}
  if ((_820_acon_cap > (int)((acon_elm_accid)->size(0))))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _826_tmp_accid = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_820_acon_cap)));
      _checked_ptr_1<int32_t> _ptr__826_tmp_accid(_826_tmp_accid ? _826_tmp_accid->raw() : nullptr,_826_tmp_accid ? _826_tmp_accid->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _827_tmp_scale = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_820_acon_cap)));
      _checked_ptr_1<double> _ptr__827_tmp_scale(_827_tmp_scale ? _827_tmp_scale->raw() : nullptr,_827_tmp_scale ? _827_tmp_scale->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _828_tmp_ofs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_820_acon_cap)));
      _checked_ptr_1<int32_t> _ptr__828_tmp_ofs(_828_tmp_ofs ? _828_tmp_ofs->raw() : nullptr,_828_tmp_ofs ? _828_tmp_ofs->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _829_tmp_afe = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_820_acon_cap)));
      _checked_ptr_1<int32_t> _ptr__829_tmp_afe(_829_tmp_afe ? _829_tmp_afe->raw() : nullptr,_829_tmp_afe ? _829_tmp_afe->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(acon_elm_accid,(int)0,_826_tmp_accid,(int)0,(int)((acon_elm_accid)->size(0)));
      ::mosek::fusion::Utils::Tools::arraycopy(acon_elm_scale,(int)0,_827_tmp_scale,(int)0,(int)((acon_elm_scale)->size(0)));
      ::mosek::fusion::Utils::Tools::arraycopy(acon_elm_ofs,(int)0,_828_tmp_ofs,(int)0,(int)((acon_elm_ofs)->size(0)));
      ::mosek::fusion::Utils::Tools::arraycopy(acon_elm_afe,(int)0,_829_tmp_afe,(int)0,(int)((acon_elm_afe)->size(0)));
      acon_elm_accid = _826_tmp_accid;
      acon_elm_ofs = _828_tmp_ofs;
      acon_elm_afe = _829_tmp_afe;
      acon_elm_scale = _827_tmp_scale;
    }
  }
  {}
  int32_t _830_maxaccidx = (int)0;
  int32_t _9543_ = (int)0;
  int32_t _9544_ = (int)((_813_accidxs)->size(0));
  for (int32_t _831_i = _9543_; _831_i < _9544_; ++_831_i)
  {
    {
      if ((_ptr__813_accidxs[_831_i] > _830_maxaccidx))
      {
        {
          _830_maxaccidx = _ptr__813_accidxs[_831_i];
        }
      }
      {}
    }
  }
  _830_maxaccidx += (int)1;
  int32_t _832_nacc = task_numacc();
  if ((_832_nacc < _830_maxaccidx))
  {
    {
      task_append_accs((int64_t)0,(_830_maxaccidx - _832_nacc),std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)0))),std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)0))));
    }
  }
  {}
  std::vector<int64_t> _9545_;
  for (int32_t _833_i = (int)0, _9546_ = (int)((_813_accidxs)->size(0)); _833_i < _9546_ ; ++_833_i)
  {
    _9545_.push_back(_ptr__813_accidxs[_833_i]);
  }
  auto _9547_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9545_.size()),_9545_.begin(),_9545_.end()));
  std::vector<int64_t> _9548_;
  for (int32_t _834_i = (int)0, _9549_ = (int)((_812_afeidxs)->size(0)); _834_i < _9549_ ; ++_834_i)
  {
    _9548_.push_back(_ptr__812_afeidxs[_834_i]);
  }
  auto _9550_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9548_.size()),_9548_.begin(),_9548_.end()));
  task_putacclist(_9547_,_808_domidxs,_9550_,_811_g);
  {
    int32_t _835_k = (int)0;
    int32_t _9551_ = (int)0;
    int32_t _9552_ = _810_numcone;
    for (int32_t _836_i = _9551_; _836_i < _9552_; ++_836_i)
    {
      {
        int32_t _9553_ = (int)0;
        int32_t _9554_ = _809_conesize;
        for (int32_t _837_j = _9553_; _837_j < _9554_; ++_837_j)
        {
          {
            ((*acon_elm_accid)(_ptr__815_aconidxs[_835_k])) = _ptr__813_accidxs[_836_i];
            ((*acon_elm_ofs)(_ptr__815_aconidxs[_835_k])) = _837_j;
            ((*acon_elm_afe)(_ptr__815_aconidxs[_835_k])) = _ptr__812_afeidxs[_835_k];
            ((*acon_elm_scale)(_ptr__815_aconidxs[_835_k])) = 1.0;
            ++ _835_k;
          }
        }
      }
    }
  }
  return _816_aconid;
}
// End mosek.fusion.Model.acon_allocate

// Begin mosek.fusion.Model.afe_release
// Method mosek.fusion.Model.afe_release @ bld/grindsted/final/default/src/fusion/Model.mbi:4596:6-4602:7
void mosek::fusion::p_Model::afe_release(int32_t _838_id)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _839_nidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(afe_blocks->blocksize(_838_id))));
  _checked_ptr_1<int32_t> _ptr__839_nidxs(_839_nidxs ? _839_nidxs->raw() : nullptr,_839_nidxs ? _839_nidxs->size(0) : 0);
  afe_blocks->release(_838_id,_839_nidxs);
  std::vector<int64_t> _9555_;
  for (int32_t _840_i = (int)0, _9556_ = (int)((_839_nidxs)->size(0)); _840_i < _9556_ ; ++_840_i)
  {
    _9555_.push_back(_ptr__839_nidxs[_840_i]);
  }
  auto _9557_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9555_.size()),_9555_.begin(),_9555_.end()));
  task_clearafelist(_9557_);
}
// End mosek.fusion.Model.afe_release

// Begin mosek.fusion.Model.afe_allocate
// Method mosek.fusion.Model.afe_allocate @ bld/grindsted/final/default/src/fusion/Model.mbi:4581:6-4594:7
int32_t mosek::fusion::p_Model::afe_allocate(std::shared_ptr< monty::ndarray< int32_t,1 > > _841_nativeidxs)
{
  _checked_ptr_1<int32_t> _ptr__841_nativeidxs(_841_nativeidxs ? _841_nativeidxs->raw() : nullptr, _841_nativeidxs ? _841_nativeidxs->size(0) : 0);
  int32_t _842_afeid = afe_blocks->allocate(_841_nativeidxs);
  if (((int)((_841_nativeidxs)->size(0)) > (int)0))
  {
    {
      int32_t _843_tasknum = task_numafe();
      int32_t _844_maxidx = _ptr__841_nativeidxs[(int)0];
      int32_t _9558_ = (int)1;
      int32_t _9559_ = (int)((_841_nativeidxs)->size(0));
      for (int32_t _845_i = _9558_; _845_i < _9559_; ++_845_i)
      {
        {
          if ((_ptr__841_nativeidxs[_845_i] > _844_maxidx))
          {
            {
              _844_maxidx = _ptr__841_nativeidxs[_845_i];
            }
          }
          {}
        }
      }
      if ((safe_add( _844_maxidx,(int)1 ) > _843_tasknum))
      {
        {
          int32_t _846_n = (safe_add( _844_maxidx,(int)1 ) - _843_tasknum);
          task_append_afes((int64_t)(_846_n));
          task_numaferow += _846_n;
        }
      }
      {}
    }
  }
  {}
  return _842_afeid;
}
// End mosek.fusion.Model.afe_allocate

// Begin mosek.fusion.Model.con_release
// Method mosek.fusion.Model.con_release @ bld/grindsted/final/default/src/fusion/Model.mbi:4566:6-4576:7
void mosek::fusion::p_Model::con_release(int32_t _847_id)
{
  int32_t _848_num = con_blocks->blocksize(_847_id);
  if ((_848_num >= (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _849_nativeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_848_num)));
      _checked_ptr_1<int32_t> _ptr__849_nativeidxs(_849_nativeidxs ? _849_nativeidxs->raw() : nullptr,_849_nativeidxs ? _849_nativeidxs->size(0) : 0);
      con_blocks->release(_847_id,_849_nativeidxs);
      ((*cons)(_847_id)) = nullptr;
      task_con_putboundlist_fr(_849_nativeidxs);
    }
  }
  {}
}
// End mosek.fusion.Model.con_release

// Begin mosek.fusion.Model.con_allocate
// Method mosek.fusion.Model.con_allocate @ bld/grindsted/final/default/src/fusion/Model.mbi:4546:6-4564:7
int32_t mosek::fusion::p_Model::con_allocate(std::shared_ptr< monty::ndarray< int32_t,1 > > _850_nativeidxs)
{
  _checked_ptr_1<int32_t> _ptr__850_nativeidxs(_850_nativeidxs ? _850_nativeidxs->raw() : nullptr, _850_nativeidxs ? _850_nativeidxs->size(0) : 0);
  int32_t _851_conid = con_blocks->allocate(_850_nativeidxs);
  if (((int)((_850_nativeidxs)->size(0)) > (int)0))
  {
    {
      int32_t _852_maxidx = _ptr__850_nativeidxs[(int)0];
      int32_t _9560_ = (int)1;
      int32_t _9561_ = (int)((_850_nativeidxs)->size(0));
      for (int32_t _853_i = _9560_; _853_i < _9561_; ++_853_i)
      {
        {
          if ((_ptr__850_nativeidxs[_853_i] > _852_maxidx))
          {
            {
              _852_maxidx = _ptr__850_nativeidxs[_853_i];
            }
          }
          {}
        }
      }
      if ((safe_add( _852_maxidx,(int)1 ) > num_task_con))
      {
        {
          int32_t _854_n = (safe_add( _852_maxidx,(int)1 ) - num_task_con);
          task_append_con(_854_n);
          num_task_con += _854_n;
        }
      }
      {}
    }
  }
  {}
  if ((_851_conid >= (int)((cons)->size(0))))
  {
    {
      std::vector<monty::rc_ptr< ::mosek::fusion::ModelConstraint >> _9562_;
      for (int32_t _856_i = (int)0, _9563_ = safe_mul( (int)((cons)->size(0)),(int)2 ); _856_i < _9563_ ; ++_856_i)
      {
        _9562_.push_back(nullptr);
      }
      auto _9564_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 >(monty::shape(_9562_.size()),_9562_.begin(),_9562_.end()));
      std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelConstraint >,1 > > _855_newcons = _9564_;
      int32_t _9565_ = (int)0;
      int32_t _9566_ = (int)((cons)->size(0));
      for (int32_t _857_i = _9565_; _857_i < _9566_; ++_857_i)
      {
        {
          ((*_855_newcons)(_857_i)) = ((*cons)(_857_i));
        }
      }
      cons = _855_newcons;
    }
  }
  {}
  return _851_conid;
}
// End mosek.fusion.Model.con_allocate

// Begin mosek.fusion.Model.barvar_alloc
// Method mosek.fusion.Model.barvar_alloc @ bld/grindsted/final/default/src/fusion/Model.mbi:4439:6-4540:7
int32_t mosek::fusion::p_Model::barvar_alloc(int32_t _858_conedim,int32_t _859_numcone,std::shared_ptr< monty::ndarray< int32_t,1 > > _860_barvaridxs,std::shared_ptr< monty::ndarray< int64_t,1 > > _861_nativeidxs)
{
  _checked_ptr_1<int32_t> _ptr__860_barvaridxs(_860_barvaridxs ? _860_barvaridxs->raw() : nullptr, _860_barvaridxs ? _860_barvaridxs->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__861_nativeidxs(_861_nativeidxs ? _861_nativeidxs->raw() : nullptr, _861_nativeidxs ? _861_nativeidxs->size(0) : 0);
  int32_t _862_barvarid = barvar_num;
  ++ barvar_num;
  int32_t _863_conesize = (safe_mul( _858_conedim,safe_add( _858_conedim,(int)1 ) ) / (int)2);
  int32_t _864_domsize = safe_mul( _863_conesize,_859_numcone );
  int32_t _865_block_num = ((*barvar_block_ptr)(_862_barvarid));
  int32_t _866_block_cap = (int)((barvar_block_dim)->size(0));
  int32_t _867_block_elm_num = ((*barvar_block_elm_ptr)(_862_barvarid));
  int32_t _868_block_elm_cap = (int)((barvar_block_elm_barj)->size(0));
  if ((_866_block_cap < safe_add( _865_block_num,(int)1 )))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _869_new_barvar_block_dim = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_mul( (int)((barvar_block_dim)->size(0)),(int)2 ))));
      _checked_ptr_1<int32_t> _ptr__869_new_barvar_block_dim(_869_new_barvar_block_dim ? _869_new_barvar_block_dim->raw() : nullptr,_869_new_barvar_block_dim ? _869_new_barvar_block_dim->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _870_new_barvar_block_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( safe_mul( (int)((barvar_block_dim)->size(0)),(int)2 ),(int)1 ))));
      _checked_ptr_1<int32_t> _ptr__870_new_barvar_block_ptr(_870_new_barvar_block_ptr ? _870_new_barvar_block_ptr->raw() : nullptr,_870_new_barvar_block_ptr ? _870_new_barvar_block_ptr->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _871_new_barvar_block_elm_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( safe_mul( (int)((barvar_block_dim)->size(0)),(int)2 ),(int)1 ))));
      _checked_ptr_1<int32_t> _ptr__871_new_barvar_block_elm_ptr(_871_new_barvar_block_elm_ptr ? _871_new_barvar_block_elm_ptr->raw() : nullptr,_871_new_barvar_block_elm_ptr ? _871_new_barvar_block_elm_ptr->size(0) : 0);
      std::vector<monty::rc_ptr< ::mosek::fusion::ModelVariable >> _9567_;
      for (int32_t _873_i = (int)0, _9568_ = safe_add( safe_mul( (int)((barvar_block_dim)->size(0)),(int)2 ),(int)1 ); _873_i < _9568_ ; ++_873_i)
      {
        _9567_.push_back(nullptr);
      }
      auto _9569_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 >(monty::shape(_9567_.size()),_9567_.begin(),_9567_.end()));
      std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 > > _872_new_barvars = _9569_;
      int32_t _9570_ = (int)0;
      int32_t _9571_ = (int)((barvars)->size(0));
      for (int32_t _874_i = _9570_; _874_i < _9571_; ++_874_i)
      {
        {
          ((*_872_new_barvars)(_874_i)) = ((*barvars)(_874_i));
        }
      }
      ::mosek::fusion::Utils::Tools::arraycopy(barvar_block_dim,(int)0,_869_new_barvar_block_dim,(int)0,(int)((barvar_block_dim)->size(0)));
      ::mosek::fusion::Utils::Tools::arraycopy(barvar_block_ptr,(int)0,_870_new_barvar_block_ptr,(int)0,(int)((barvar_block_ptr)->size(0)));
      ::mosek::fusion::Utils::Tools::arraycopy(barvar_block_elm_ptr,(int)0,_871_new_barvar_block_elm_ptr,(int)0,(int)((barvar_block_elm_ptr)->size(0)));
      barvar_block_dim = _869_new_barvar_block_dim;
      barvar_block_ptr = _870_new_barvar_block_ptr;
      barvar_block_elm_ptr = _871_new_barvar_block_elm_ptr;
      barvars = _872_new_barvars;
    }
  }
  {}
  if ((_868_block_elm_cap < safe_add( _867_block_elm_num,_864_domsize )))
  {
    {
      int32_t _875_addnum = (safe_add( _868_block_elm_cap,_864_domsize ) - _867_block_elm_num);
      if ((_875_addnum < _868_block_elm_cap))
      {
        {
          _875_addnum = _868_block_elm_cap;
        }
      }
      {}
      int32_t _876_newlen = safe_add( _868_block_elm_cap,_875_addnum );
      std::shared_ptr< monty::ndarray< int32_t,1 > > _877_new_barvar_block_elm_barj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_876_newlen)));
      _checked_ptr_1<int32_t> _ptr__877_new_barvar_block_elm_barj(_877_new_barvar_block_elm_barj ? _877_new_barvar_block_elm_barj->raw() : nullptr,_877_new_barvar_block_elm_barj ? _877_new_barvar_block_elm_barj->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _878_new_barvar_block_elm_i = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_876_newlen)));
      _checked_ptr_1<int32_t> _ptr__878_new_barvar_block_elm_i(_878_new_barvar_block_elm_i ? _878_new_barvar_block_elm_i->raw() : nullptr,_878_new_barvar_block_elm_i ? _878_new_barvar_block_elm_i->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _879_new_barvar_block_elm_j = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_876_newlen)));
      _checked_ptr_1<int32_t> _ptr__879_new_barvar_block_elm_j(_879_new_barvar_block_elm_j ? _879_new_barvar_block_elm_j->raw() : nullptr,_879_new_barvar_block_elm_j ? _879_new_barvar_block_elm_j->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(barvar_block_elm_barj,(int)0,_877_new_barvar_block_elm_barj,(int)0,(int)((barvar_block_elm_barj)->size(0)));
      ::mosek::fusion::Utils::Tools::arraycopy(barvar_block_elm_i,(int)0,_878_new_barvar_block_elm_i,(int)0,(int)((barvar_block_elm_i)->size(0)));
      ::mosek::fusion::Utils::Tools::arraycopy(barvar_block_elm_j,(int)0,_879_new_barvar_block_elm_j,(int)0,(int)((barvar_block_elm_j)->size(0)));
      barvar_block_elm_barj = _877_new_barvar_block_elm_barj;
      barvar_block_elm_i = _878_new_barvar_block_elm_i;
      barvar_block_elm_j = _879_new_barvar_block_elm_j;
    }
  }
  {}
  int32_t _880_firstcone = task_numbarvar();
  int32_t _9572_ = (int)0;
  int32_t _9573_ = _859_numcone;
  for (int32_t _881_i = _9572_; _881_i < _9573_; ++_881_i)
  {
    {
      _ptr__860_barvaridxs[_881_i] = safe_add( _880_firstcone,_881_i );
    }
  }
  if ((safe_add( _880_firstcone,_859_numcone ) >= (int)((barvar_dim)->size(0))))
  {
    {
      int32_t _882_addnum = (safe_add( _880_firstcone,_859_numcone ) - (int)((barvar_dim)->size(0)));
      if ((_882_addnum < (int)((barvar_dim)->size(0))))
      {
        {
          _882_addnum = (int)((barvar_dim)->size(0));
        }
      }
      {}
      int32_t _883_newnum = safe_add( _882_addnum,(int)((barvar_dim)->size(0)) );
      std::shared_ptr< monty::ndarray< int32_t,1 > > _884_new_barvar_dim = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_883_newnum)));
      _checked_ptr_1<int32_t> _ptr__884_new_barvar_dim(_884_new_barvar_dim ? _884_new_barvar_dim->raw() : nullptr,_884_new_barvar_dim ? _884_new_barvar_dim->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(barvar_dim,(int)0,_884_new_barvar_dim,(int)0,(int)((barvar_dim)->size(0)));
      barvar_dim = _884_new_barvar_dim;
    }
  }
  {}
  ((*barvar_block_dim)(_862_barvarid)) = _858_conedim;
  ((*barvar_block_ptr)(safe_add( _862_barvarid,(int)1 ))) = safe_add( ((*barvar_block_ptr)(_862_barvarid)),_859_numcone );
  ((*barvar_block_elm_ptr)(safe_add( _862_barvarid,(int)1 ))) = safe_add( ((*barvar_block_elm_ptr)(_862_barvarid)),_864_domsize );
  {
    int32_t _885_k = (int)0;
    int32_t _886_b = ((*barvar_block_elm_ptr)(_862_barvarid));
    int32_t _9574_ = (int)0;
    int32_t _9575_ = _859_numcone;
    for (int32_t _887_i = _9574_; _887_i < _9575_; ++_887_i)
    {
      {
        int32_t _9576_ = (int)0;
        int32_t _9577_ = _858_conedim;
        for (int32_t _888_j1 = _9576_; _888_j1 < _9577_; ++_888_j1)
        {
          {
            int32_t _9578_ = _888_j1;
            int32_t _9579_ = _858_conedim;
            for (int32_t _889_j0 = _9578_; _889_j0 < _9579_; ++_889_j0)
            {
              {
                ((*barvar_block_elm_barj)(safe_add( _886_b,_885_k ))) = safe_add( _880_firstcone,_887_i );
                ((*barvar_block_elm_i)(safe_add( _886_b,_885_k ))) = _889_j0;
                ((*barvar_block_elm_j)(safe_add( _886_b,_885_k ))) = _888_j1;
                _ptr__861_nativeidxs[_885_k] = safe_add( _886_b,_885_k );
                ++ _885_k;
              }
            }
          }
        }
      }
    }
    int32_t _9580_ = (int)0;
    int32_t _9581_ = _859_numcone;
    for (int32_t _890_i = _9580_; _890_i < _9581_; ++_890_i)
    {
      {
        ((*barvar_dim)(safe_add( _880_firstcone,_890_i ))) = _858_conedim;
      }
    }
  }
  int32_t _891_barvaridx = task_append_barvar(_858_conedim,_859_numcone);
  return _862_barvarid;
}
// End mosek.fusion.Model.barvar_alloc

// Begin mosek.fusion.Model.conicvar_alloc
// Method mosek.fusion.Model.conicvar_alloc @ bld/grindsted/final/default/src/fusion/Model.mbi:4406:6-4437:7
int32_t mosek::fusion::p_Model::conicvar_alloc(std::shared_ptr< monty::ndarray< int64_t,1 > > _892_domidxs,int32_t _893_conesize,int32_t _894_numcone,std::shared_ptr< monty::ndarray< int32_t,1 > > _895_accidxs,std::shared_ptr< monty::ndarray< int32_t,1 > > _896_nativeidxs)
{
  _checked_ptr_1<int64_t> _ptr__892_domidxs(_892_domidxs ? _892_domidxs->raw() : nullptr, _892_domidxs ? _892_domidxs->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__895_accidxs(_895_accidxs ? _895_accidxs->raw() : nullptr, _895_accidxs ? _895_accidxs->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__896_nativeidxs(_896_nativeidxs ? _896_nativeidxs->raw() : nullptr, _896_nativeidxs ? _896_nativeidxs->size(0) : 0);
  int32_t _897_n = safe_mul( _893_conesize,_894_numcone );
  int32_t _898_varid = linearvar_alloc(_897_n,_896_nativeidxs);
  std::shared_ptr< monty::ndarray< double,1 > > _899_g = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_897_n)));
  _checked_ptr_1<double> _ptr__899_g(_899_g ? _899_g->raw() : nullptr,_899_g ? _899_g->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _900_conelmidx = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_897_n)));
  _checked_ptr_1<int32_t> _ptr__900_conelmidx(_900_conelmidx ? _900_conelmidx->raw() : nullptr,_900_conelmidx ? _900_conelmidx->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _901_afeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_897_n)));
  _checked_ptr_1<int32_t> _ptr__901_afeidxs(_901_afeidxs ? _901_afeidxs->raw() : nullptr,_901_afeidxs ? _901_afeidxs->size(0) : 0);
  int32_t _902_conid = acon_allocate(_892_domidxs,_893_conesize,_894_numcone,_899_g,_901_afeidxs,_895_accidxs);
  ((*var_block_acc_id)(_898_varid)) = _902_conid;
  int32_t _9582_ = (int)0;
  int32_t _9583_ = _897_n;
  for (int32_t _903_i = _9582_; _903_i < _9583_; ++_903_i)
  {
    {
      ((*var_elm_acc_idx)(_ptr__896_nativeidxs[_903_i])) = _ptr__895_accidxs[(_903_i / _893_conesize)];
      ((*var_elm_acc_ofs)(_ptr__896_nativeidxs[_903_i])) = (_903_i % _893_conesize);
    }
  }
  std::vector<int64_t> _9584_;
  for (int32_t _904_i = (int)0, _9585_ = (int)((_901_afeidxs)->size(0)); _904_i < _9585_ ; ++_904_i)
  {
    _9584_.push_back(_ptr__901_afeidxs[_904_i]);
  }
  auto _9586_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9584_.size()),_9584_.begin(),_9584_.end()));
  std::vector<int32_t> _9587_;
  for (int32_t _905_i = (int)0, _9588_ = safe_add( _897_n,(int)1 ); _905_i < _9588_ ; ++_905_i)
  {
    _9587_.push_back(_905_i);
  }
  auto _9589_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9587_.size()),_9587_.begin(),_9587_.end()));
  std::vector<double> _9590_;
  for (int32_t _906_i = (int)0, _9591_ = _897_n; _906_i < _9591_ ; ++_906_i)
  {
    _9590_.push_back(1.0);
  }
  auto _9592_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_9590_.size()),_9590_.begin(),_9590_.end()));
  std::vector<double> _9593_;
  for (int32_t _907_i = (int)0, _9594_ = _897_n; _907_i < _9594_ ; ++_907_i)
  {
    _9593_.push_back(0.0);
  }
  auto _9595_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_9593_.size()),_9593_.begin(),_9593_.end()));
  task_putafeflist(_9586_,_9589_,_896_nativeidxs,_9592_,_9595_);
  return _898_varid;
}
// End mosek.fusion.Model.conicvar_alloc

// Begin mosek.fusion.Model.linearvar_alloc
// Method mosek.fusion.Model.linearvar_alloc @ bld/grindsted/final/default/src/fusion/Model.mbi:4368:6-4404:7
int32_t mosek::fusion::p_Model::linearvar_alloc(int32_t _908_n,std::shared_ptr< monty::ndarray< int32_t,1 > > _909_nativeidxs)
{
  _checked_ptr_1<int32_t> _ptr__909_nativeidxs(_909_nativeidxs ? _909_nativeidxs->raw() : nullptr, _909_nativeidxs ? _909_nativeidxs->size(0) : 0);
  int32_t _910_varid = var_block_map->alloc(_908_n);
  int32_t _911_maxvaridx = safe_add( var_block_map->maxidx(_910_varid),(int)1 );
  int32_t _912_cap = var_block_map->capacity();
  int32_t _913_numblocks = var_block_map->block_capacity();
  var_block_map->get(_910_varid,_909_nativeidxs,(int)0);
  if ((task_numvar() < _911_maxvaridx))
  {
    {
      task_append_var((_911_maxvaridx - task_numvar()));
    }
  }
  {}
  if ((_910_varid >= (int)((vars)->size(0))))
  {
    {
      std::vector<monty::rc_ptr< ::mosek::fusion::ModelVariable >> _9596_;
      for (int32_t _915_i = (int)0, _9597_ = safe_mul( (int)((vars)->size(0)),(int)2 ); _915_i < _9597_ ; ++_915_i)
      {
        _9596_.push_back(nullptr);
      }
      auto _9598_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 >(monty::shape(_9596_.size()),_9596_.begin(),_9596_.end()));
      std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::ModelVariable >,1 > > _914_newvars = _9598_;
      int32_t _9599_ = (int)0;
      int32_t _9600_ = (int)((vars)->size(0));
      for (int32_t _916_i = _9599_; _916_i < _9600_; ++_916_i)
      {
        {
          ((*_914_newvars)(_916_i)) = ((*vars)(_916_i));
        }
      }
      vars = _914_newvars;
    }
  }
  {}
  if ((_913_numblocks > (int)((var_block_acc_id)->size(0))))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _917_new_var_block_acc_id = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_913_numblocks)));
      _checked_ptr_1<int32_t> _ptr__917_new_var_block_acc_id(_917_new_var_block_acc_id ? _917_new_var_block_acc_id->raw() : nullptr,_917_new_var_block_acc_id ? _917_new_var_block_acc_id->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(var_block_acc_id,(int)0,_917_new_var_block_acc_id,(int)0,(int)((var_block_acc_id)->size(0)));
      var_block_acc_id = _917_new_var_block_acc_id;
    }
  }
  {}
  if ((_912_cap > (int)((var_elm_acc_idx)->size(0))))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _918_new_var_elm_acc_idx = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_912_cap)));
      _checked_ptr_1<int32_t> _ptr__918_new_var_elm_acc_idx(_918_new_var_elm_acc_idx ? _918_new_var_elm_acc_idx->raw() : nullptr,_918_new_var_elm_acc_idx ? _918_new_var_elm_acc_idx->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(var_elm_acc_idx,(int)0,_918_new_var_elm_acc_idx,(int)0,(int)((var_elm_acc_idx)->size(0)));
      var_elm_acc_idx = _918_new_var_elm_acc_idx;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _919_new_var_elm_acc_ofs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_912_cap)));
      _checked_ptr_1<int32_t> _ptr__919_new_var_elm_acc_ofs(_919_new_var_elm_acc_ofs ? _919_new_var_elm_acc_ofs->raw() : nullptr,_919_new_var_elm_acc_ofs ? _919_new_var_elm_acc_ofs->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(var_elm_acc_ofs,(int)0,_919_new_var_elm_acc_ofs,(int)0,(int)((var_elm_acc_ofs)->size(0)));
      var_elm_acc_ofs = _919_new_var_elm_acc_ofs;
    }
  }
  {}
  ((*var_block_acc_id)(_910_varid)) = (-(int)1);
  int32_t _9601_ = (int)0;
  int32_t _9602_ = _908_n;
  for (int32_t _920_i = _9601_; _920_i < _9602_; ++_920_i)
  {
    {
      ((*var_elm_acc_idx)(_ptr__909_nativeidxs[_920_i])) = (-(int)1);
    }
  }
  return _910_varid;
}
// End mosek.fusion.Model.linearvar_alloc

// Begin mosek.fusion.Model.make_continuous
// Method mosek.fusion.Model.make_continuous @ bld/grindsted/final/default/src/fusion/Model.mbi:4354:6-4365:7
void mosek::fusion::p_Model::make_continuous(std::shared_ptr< monty::ndarray< int64_t,1 > > _921_idxs)
{
  _checked_ptr_1<int64_t> _ptr__921_idxs(_921_idxs ? _921_idxs->raw() : nullptr, _921_idxs ? _921_idxs->size(0) : 0);
  int32_t _922_count = (int)0;
  int32_t _9603_ = (int)0;
  int32_t _9604_ = (int)((_921_idxs)->size(0));
  for (int32_t _923_i = _9603_; _923_i < _9604_; ++_923_i)
  {
    {
      if ((_ptr__921_idxs[_923_i] > (int)0))
      {
        {
          ++ _922_count;
        }
      }
      {}
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _924_nativeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_922_count)));
  _checked_ptr_1<int32_t> _ptr__924_nativeidxs(_924_nativeidxs ? _924_nativeidxs->raw() : nullptr,_924_nativeidxs ? _924_nativeidxs->size(0) : 0);
  int32_t _925_k = (int)0;
  int32_t _9605_ = (int)0;
  int32_t _9606_ = (int)((_921_idxs)->size(0));
  for (int32_t _926_i = _9605_; _926_i < _9606_; ++_926_i)
  {
    {
      if ((_ptr__921_idxs[_926_i] > (int)0))
      {
        {
          _ptr__924_nativeidxs[_925_k] = (int32_t)_ptr__921_idxs[_926_i];
          ++ _925_k;
        }
      }
      {}
    }
  }
  task_var_putcontlist(_924_nativeidxs);
}
// End mosek.fusion.Model.make_continuous

// Begin mosek.fusion.Model.make_integer
// Method mosek.fusion.Model.make_integer @ bld/grindsted/final/default/src/fusion/Model.mbi:4342:6-4352:7
void mosek::fusion::p_Model::make_integer(std::shared_ptr< monty::ndarray< int64_t,1 > > _927_idxs)
{
  _checked_ptr_1<int64_t> _ptr__927_idxs(_927_idxs ? _927_idxs->raw() : nullptr, _927_idxs ? _927_idxs->size(0) : 0);
  int32_t _928_count = (int)0;
  int32_t _9607_ = (int)0;
  int32_t _9608_ = (int)((_927_idxs)->size(0));
  for (int32_t _929_i = _9607_; _929_i < _9608_; ++_929_i)
  {
    {
      if ((_ptr__927_idxs[_929_i] > (int)0))
      {
        {
          ++ _928_count;
        }
      }
      {}
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _930_nativeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_928_count)));
  _checked_ptr_1<int32_t> _ptr__930_nativeidxs(_930_nativeidxs ? _930_nativeidxs->raw() : nullptr,_930_nativeidxs ? _930_nativeidxs->size(0) : 0);
  int32_t _931_k = (int)0;
  int32_t _9609_ = (int)0;
  int32_t _9610_ = (int)((_927_idxs)->size(0));
  for (int32_t _932_i = _9609_; _932_i < _9610_; ++_932_i)
  {
    {
      if ((_ptr__927_idxs[_932_i] > (int)0))
      {
        {
          _ptr__930_nativeidxs[_931_k] = (int32_t)_ptr__927_idxs[_932_i];
          ++ _931_k;
        }
      }
      {}
    }
  }
  task_var_putintlist(_930_nativeidxs);
}
// End mosek.fusion.Model.make_integer

// Begin mosek.fusion.Model.putlicensewait
// Method mosek.fusion.Model.putlicensewait @ bld/grindsted/final/default/src/fusion/Model.mbi:4340:6-87
void mosek::fusion::Model::putlicensewait
  ( bool _933_wait) { mosek::fusion::p_Model::putlicensewait(_933_wait); }
void mosek::fusion::p_Model::putlicensewait(bool _933_wait)
{
  ::mosek::fusion::p_BaseModel::env_putlicensewait(_933_wait);
}
// End mosek.fusion.Model.putlicensewait

// Begin mosek.fusion.Model.putlicensepath
// Method mosek.fusion.Model.putlicensepath @ bld/grindsted/final/default/src/fusion/Model.mbi:4337:6-90
void mosek::fusion::Model::putlicensepath
  ( const std::string & _934_licfile) { mosek::fusion::p_Model::putlicensepath(_934_licfile); }
void mosek::fusion::p_Model::putlicensepath(const std::string & _934_licfile)
{
  ::mosek::fusion::p_BaseModel::env_putlicensepath(_934_licfile);
}
// End mosek.fusion.Model.putlicensepath

// Begin mosek.fusion.Model.putlicensecode
// Method mosek.fusion.Model.putlicensecode @ bld/grindsted/final/default/src/fusion/Model.mbi:4333:6-87
void mosek::fusion::Model::putlicensecode
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _935_code) { mosek::fusion::p_Model::putlicensecode(_935_code); }
void mosek::fusion::p_Model::putlicensecode(std::shared_ptr< monty::ndarray< int32_t,1 > > _935_code)
{
  _checked_ptr_1<int32_t> _ptr__935_code(_935_code ? _935_code->raw() : nullptr, _935_code ? _935_code->size(0) : 0);
  ::mosek::fusion::p_BaseModel::env_putlicensecode(_935_code);
}
// End mosek.fusion.Model.putlicensecode

// Begin mosek.fusion.Model.dispose
// Method mosek.fusion.Model.dispose @ bld/grindsted/final/default/src/fusion/Model.mbi:4318:6-4327:7
void mosek::fusion::Model :: dispose() { mosek::fusion::p_Model::_get_impl(this)->dispose(); }
void mosek::fusion::p_Model::dispose()
{
  int32_t _9611_ = (int)0;
  int32_t _9612_ = (int)((vars)->size(0));
  for (int32_t _936_i = _9611_; _936_i < _9612_; ++_936_i)
  {
    {
      ((*vars)(_936_i)) = nullptr;
    }
  }
  int32_t _9613_ = (int)0;
  int32_t _9614_ = (int)((cons)->size(0));
  for (int32_t _937_i = _9613_; _937_i < _9614_; ++_937_i)
  {
    {
      ((*cons)(_937_i)) = nullptr;
    }
  }
  int32_t _9615_ = (int)0;
  int32_t _9616_ = (int)((acons)->size(0));
  for (int32_t _938_i = _9615_; _938_i < _9616_; ++_938_i)
  {
    {
      ((*acons)(_938_i)) = nullptr;
    }
  }
  int32_t _9617_ = (int)0;
  int32_t _9618_ = (int)((barvars)->size(0));
  for (int32_t _939_i = _9617_; _939_i < _9618_; ++_939_i)
  {
    {
      ((*barvars)(_939_i)) = nullptr;
    }
  }
  if ((NULL != parameters.get()))
  {
    {
      int32_t _9619_ = (int)0;
      int32_t _9620_ = (int)((parameters)->size(0));
      for (int32_t _940_i = _9619_; _940_i < _9620_; ++_940_i)
      {
        {
          ((*parameters)(_940_i)) = nullptr;
        }
      }
    }
  }
  {}
  ::mosek::fusion::p_BaseModel::dispose();
}
// End mosek.fusion.Model.dispose

// Begin mosek.fusion.Model.getTask
// Method mosek.fusion.Model.getTask @ bld/grindsted/final/default/src/fusion/Model.mbi:4298:6-64
MSKtask_t mosek::fusion::Model :: __mosek_2fusion_2Model__getTask() { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__getTask(); }
MSKtask_t mosek::fusion::Model::getTask() { return __mosek_2fusion_2Model__getTask(); }
MSKtask_t mosek::fusion::p_Model::__mosek_2fusion_2Model__getTask()
{
  return __mosek_2fusion_2BaseModel__task_get();
}
// End mosek.fusion.Model.getTask

// Begin mosek.fusion.Model.getConstraintDuals
// Method mosek.fusion.Model.getConstraintDuals @ bld/grindsted/final/default/src/fusion/Model.mbi:4272:6-4287:7
void mosek::fusion::Model :: getConstraintDuals(bool _941_lower,std::shared_ptr< monty::ndarray< int32_t,1 > > _942_nativeidxs,std::shared_ptr< monty::ndarray< double,1 > > _943_res,int32_t _944_offset) { mosek::fusion::p_Model::_get_impl(this)->getConstraintDuals(_941_lower,_942_nativeidxs,_943_res,_944_offset); }
void mosek::fusion::p_Model::getConstraintDuals(bool _941_lower,std::shared_ptr< monty::ndarray< int32_t,1 > > _942_nativeidxs,std::shared_ptr< monty::ndarray< double,1 > > _943_res,int32_t _944_offset)
{
  _checked_ptr_1<int32_t> _ptr__942_nativeidxs(_942_nativeidxs ? _942_nativeidxs->raw() : nullptr, _942_nativeidxs ? _942_nativeidxs->size(0) : 0);
  _checked_ptr_1<double> _ptr__943_res(_943_res ? _943_res->raw() : nullptr, _943_res ? _943_res->size(0) : 0);
  int32_t _945_n = (int)((_942_nativeidxs)->size(0));
  std::shared_ptr< monty::ndarray< double,1 > > _946_slc = getSolution_slc(::mosek::fusion::SolutionType::Default);
  _checked_ptr_1<double> _ptr__946_slc(_946_slc ? _946_slc->raw() : nullptr,_946_slc ? _946_slc->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _947_suc = getSolution_suc(::mosek::fusion::SolutionType::Default);
  _checked_ptr_1<double> _ptr__947_suc(_947_suc ? _947_suc->raw() : nullptr,_947_suc ? _947_suc->size(0) : 0);
  int32_t _9621_ = (int)0;
  int32_t _9622_ = _945_n;
  for (int32_t _948_p = _9621_; _948_p < _9622_; ++_948_p)
  {
    {
      if ((_ptr__942_nativeidxs[_948_p] >= (int)0))
      {
        {
          if (_941_lower)
          {
            {
              _ptr__943_res[safe_add( _944_offset,_948_p )] = _ptr__946_slc[_ptr__942_nativeidxs[_948_p]];
            }
          }
          else
          {
            {
              _ptr__943_res[safe_add( _944_offset,_948_p )] = (-_ptr__947_suc[_ptr__942_nativeidxs[_948_p]]);
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::SolutionError(std::string ("Requested invalid solution item"));
        }
      }
    }
  }
}
// End mosek.fusion.Model.getConstraintDuals

// Begin mosek.fusion.Model.getConstraintValues
// Method mosek.fusion.Model.getConstraintValues @ bld/grindsted/final/default/src/fusion/Model.mbi:4238:6-4269:7
void mosek::fusion::Model :: getConstraintValues(bool _949_primal,std::shared_ptr< monty::ndarray< int32_t,1 > > _950_nativeidxs,std::shared_ptr< monty::ndarray< double,1 > > _951_res,int32_t _952_offset) { mosek::fusion::p_Model::_get_impl(this)->getConstraintValues(_949_primal,_950_nativeidxs,_951_res,_952_offset); }
void mosek::fusion::p_Model::getConstraintValues(bool _949_primal,std::shared_ptr< monty::ndarray< int32_t,1 > > _950_nativeidxs,std::shared_ptr< monty::ndarray< double,1 > > _951_res,int32_t _952_offset)
{
  _checked_ptr_1<int32_t> _ptr__950_nativeidxs(_950_nativeidxs ? _950_nativeidxs->raw() : nullptr, _950_nativeidxs ? _950_nativeidxs->size(0) : 0);
  _checked_ptr_1<double> _ptr__951_res(_951_res ? _951_res->raw() : nullptr, _951_res ? _951_res->size(0) : 0);
  int32_t _953_n = (int)((_950_nativeidxs)->size(0));
  if (_949_primal)
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _954_xc = getSolution_xc(::mosek::fusion::SolutionType::Default);
      _checked_ptr_1<double> _ptr__954_xc(_954_xc ? _954_xc->raw() : nullptr,_954_xc ? _954_xc->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _955_accx = getSolution_accx(::mosek::fusion::SolutionType::Default);
      _checked_ptr_1<double> _ptr__955_accx(_955_accx ? _955_accx->raw() : nullptr,_955_accx ? _955_accx->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _956_accptr = getSolution_accptr(::mosek::fusion::SolutionType::Default);
      _checked_ptr_1<int32_t> _ptr__956_accptr(_956_accptr ? _956_accptr->raw() : nullptr,_956_accptr ? _956_accptr->size(0) : 0);
      int32_t _9623_ = (int)0;
      int32_t _9624_ = _953_n;
      for (int32_t _957_p = _9623_; _957_p < _9624_; ++_957_p)
      {
        {
          if ((_ptr__950_nativeidxs[_957_p] >= (int)0))
          {
            {
              _ptr__951_res[safe_add( _952_offset,_957_p )] = _ptr__954_xc[_ptr__950_nativeidxs[_957_p]];
            }
          }
          else
          {
            {
              int32_t _958_i = (-safe_add( (int)1,_ptr__950_nativeidxs[_957_p] ));
              _ptr__951_res[safe_add( _952_offset,_957_p )] = (_ptr__955_accx[safe_add( _ptr__956_accptr[((*acon_elm_accid)(_958_i))],((*acon_elm_ofs)(_958_i)) )] * ((*acon_elm_scale)(_958_i)));
            }
          }
        }
      }
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _959_y = getSolution_y(::mosek::fusion::SolutionType::Default);
      _checked_ptr_1<double> _ptr__959_y(_959_y ? _959_y->raw() : nullptr,_959_y ? _959_y->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _960_accy = getSolution_accy(::mosek::fusion::SolutionType::Default);
      _checked_ptr_1<double> _ptr__960_accy(_960_accy ? _960_accy->raw() : nullptr,_960_accy ? _960_accy->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _961_accptr = getSolution_accptr(::mosek::fusion::SolutionType::Default);
      _checked_ptr_1<int32_t> _ptr__961_accptr(_961_accptr ? _961_accptr->raw() : nullptr,_961_accptr ? _961_accptr->size(0) : 0);
      int32_t _9625_ = (int)0;
      int32_t _9626_ = _953_n;
      for (int32_t _962_p = _9625_; _962_p < _9626_; ++_962_p)
      {
        {
          if ((_ptr__950_nativeidxs[_962_p] >= (int)0))
          {
            {
              _ptr__951_res[safe_add( _952_offset,_962_p )] = _ptr__959_y[_ptr__950_nativeidxs[_962_p]];
            }
          }
          else
          {
            {
              int32_t _963_i = (-safe_add( (int)1,_ptr__950_nativeidxs[_962_p] ));
              _ptr__951_res[safe_add( _952_offset,_962_p )] = (_ptr__960_accy[safe_add( _ptr__961_accptr[((*acon_elm_accid)(_963_i))],((*acon_elm_ofs)(_963_i)) )] * ((*acon_elm_scale)(_963_i)));
            }
          }
        }
      }
    }
  }
}
// End mosek.fusion.Model.getConstraintValues

// Begin mosek.fusion.Model.getVariableDuals
// Method mosek.fusion.Model.getVariableDuals @ bld/grindsted/final/default/src/fusion/Model.mbi:4208:6-4235:7
void mosek::fusion::Model :: getVariableDuals(bool _964_lower,std::shared_ptr< monty::ndarray< int64_t,1 > > _965_nativeidxs,std::shared_ptr< monty::ndarray< double,1 > > _966_res,int32_t _967_offset) { mosek::fusion::p_Model::_get_impl(this)->getVariableDuals(_964_lower,_965_nativeidxs,_966_res,_967_offset); }
void mosek::fusion::p_Model::getVariableDuals(bool _964_lower,std::shared_ptr< monty::ndarray< int64_t,1 > > _965_nativeidxs,std::shared_ptr< monty::ndarray< double,1 > > _966_res,int32_t _967_offset)
{
  _checked_ptr_1<int64_t> _ptr__965_nativeidxs(_965_nativeidxs ? _965_nativeidxs->raw() : nullptr, _965_nativeidxs ? _965_nativeidxs->size(0) : 0);
  _checked_ptr_1<double> _ptr__966_res(_966_res ? _966_res->raw() : nullptr, _966_res ? _966_res->size(0) : 0);
  int32_t _968_n = (int)((_965_nativeidxs)->size(0));
  if (_964_lower)
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _969_xx = getSolution_slx(::mosek::fusion::SolutionType::Default);
      _checked_ptr_1<double> _ptr__969_xx(_969_xx ? _969_xx->raw() : nullptr,_969_xx ? _969_xx->size(0) : 0);
      int32_t _9627_ = (int)0;
      int32_t _9628_ = _968_n;
      for (int32_t _970_p = _9627_; _970_p < _9628_; ++_970_p)
      {
        {
          if ((_ptr__965_nativeidxs[_970_p] > (int)0))
          {
            {
              _ptr__966_res[safe_add( _967_offset,_970_p )] = _ptr__969_xx[_ptr__965_nativeidxs[_970_p]];
            }
          }
          else
          {
            {
              _ptr__966_res[safe_add( _967_offset,_970_p )] = (int)0;
            }
          }
        }
      }
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _971_xx = getSolution_sux(::mosek::fusion::SolutionType::Default);
      _checked_ptr_1<double> _ptr__971_xx(_971_xx ? _971_xx->raw() : nullptr,_971_xx ? _971_xx->size(0) : 0);
      int32_t _9629_ = (int)0;
      int32_t _9630_ = _968_n;
      for (int32_t _972_p = _9629_; _972_p < _9630_; ++_972_p)
      {
        {
          if ((_ptr__965_nativeidxs[_972_p] > (int)0))
          {
            {
              _ptr__966_res[safe_add( _967_offset,_972_p )] = (-_ptr__971_xx[_ptr__965_nativeidxs[_972_p]]);
            }
          }
          else
          {
            {
              _ptr__966_res[safe_add( _967_offset,_972_p )] = (int)0;
            }
          }
        }
      }
    }
  }
}
// End mosek.fusion.Model.getVariableDuals

// Begin mosek.fusion.Model.getVariableValues
// Method mosek.fusion.Model.getVariableValues @ bld/grindsted/final/default/src/fusion/Model.mbi:4167:6-4204:7
void mosek::fusion::Model :: getVariableValues(bool _973_primal,std::shared_ptr< monty::ndarray< int64_t,1 > > _974_nativeidxs,std::shared_ptr< monty::ndarray< double,1 > > _975_res,int32_t _976_offset) { mosek::fusion::p_Model::_get_impl(this)->getVariableValues(_973_primal,_974_nativeidxs,_975_res,_976_offset); }
void mosek::fusion::p_Model::getVariableValues(bool _973_primal,std::shared_ptr< monty::ndarray< int64_t,1 > > _974_nativeidxs,std::shared_ptr< monty::ndarray< double,1 > > _975_res,int32_t _976_offset)
{
  _checked_ptr_1<int64_t> _ptr__974_nativeidxs(_974_nativeidxs ? _974_nativeidxs->raw() : nullptr, _974_nativeidxs ? _974_nativeidxs->size(0) : 0);
  _checked_ptr_1<double> _ptr__975_res(_975_res ? _975_res->raw() : nullptr, _975_res ? _975_res->size(0) : 0);
  int32_t _977_n = (int)((_974_nativeidxs)->size(0));
  barvar_num = task_numbarvar();
  if (_973_primal)
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _978_xx = getSolution_xx(::mosek::fusion::SolutionType::Default);
      _checked_ptr_1<double> _ptr__978_xx(_978_xx ? _978_xx->raw() : nullptr,_978_xx ? _978_xx->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _9631_;
      bool _9632_ = (barvar_num > (int)0);
      if (_9632_)
      {
        _9631_ = getSolution_barx(::mosek::fusion::SolutionType::Default);
      }
      else
      {
        _9631_ = nullptr;
      }
      std::shared_ptr< monty::ndarray< double,1 > > _979_barx = _9631_;
      _checked_ptr_1<double> _ptr__979_barx(_979_barx ? _979_barx->raw() : nullptr,_979_barx ? _979_barx->size(0) : 0);
      int32_t _9633_ = (int)0;
      int32_t _9634_ = _977_n;
      for (int32_t _980_p = _9633_; _980_p < _9634_; ++_980_p)
      {
        {
          if ((_ptr__974_nativeidxs[_980_p] > (int)0))
          {
            {
              _ptr__975_res[safe_add( _976_offset,_980_p )] = _ptr__978_xx[_ptr__974_nativeidxs[_980_p]];
            }
          }
          else if((_ptr__974_nativeidxs[_980_p] < (int)0))
          {
            {
              int64_t _981_idx = (-safe_add( _ptr__974_nativeidxs[_980_p],(int)1 ));
              _ptr__975_res[safe_add( _976_offset,_980_p )] = _ptr__979_barx[_981_idx];
            }
          }
          else
          {
            {
              _ptr__975_res[safe_add( _976_offset,_980_p )] = (int)0;
            }
          }
        }
      }
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _982_yx = getSolution_yx(::mosek::fusion::SolutionType::Default);
      _checked_ptr_1<double> _ptr__982_yx(_982_yx ? _982_yx->raw() : nullptr,_982_yx ? _982_yx->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _9635_;
      bool _9636_ = (barvar_num > (int)0);
      if (_9636_)
      {
        _9635_ = getSolution_bars(::mosek::fusion::SolutionType::Default);
      }
      else
      {
        _9635_ = nullptr;
      }
      std::shared_ptr< monty::ndarray< double,1 > > _983_bars = _9635_;
      _checked_ptr_1<double> _ptr__983_bars(_983_bars ? _983_bars->raw() : nullptr,_983_bars ? _983_bars->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _984_accy = getSolution_accy(::mosek::fusion::SolutionType::Default);
      _checked_ptr_1<double> _ptr__984_accy(_984_accy ? _984_accy->raw() : nullptr,_984_accy ? _984_accy->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _985_accptr = getSolution_accptr(::mosek::fusion::SolutionType::Default);
      _checked_ptr_1<int32_t> _ptr__985_accptr(_985_accptr ? _985_accptr->raw() : nullptr,_985_accptr ? _985_accptr->size(0) : 0);
      int32_t _9637_ = (int)0;
      int32_t _9638_ = _977_n;
      for (int32_t _986_p = _9637_; _986_p < _9638_; ++_986_p)
      {
        {
          if ((_ptr__974_nativeidxs[_986_p] < (int)0))
          {
            {
              int64_t _987_idx = (-safe_add( _ptr__974_nativeidxs[_986_p],(int)1 ));
              _ptr__975_res[safe_add( _976_offset,_986_p )] = _ptr__983_bars[_987_idx];
            }
          }
          else if((_ptr__974_nativeidxs[_986_p] == (int)0))
          {
            {
              _ptr__975_res[safe_add( _976_offset,_986_p )] = (int)0;
            }
          }
          else if((((*var_elm_acc_idx)(_ptr__974_nativeidxs[_986_p])) >= (int)0))
          {
            {
              _ptr__975_res[safe_add( _976_offset,_986_p )] = _ptr__984_accy[safe_add( _ptr__985_accptr[((*var_elm_acc_idx)(_ptr__974_nativeidxs[_986_p]))],((*var_elm_acc_ofs)(_ptr__974_nativeidxs[_986_p])) )];
            }
          }
          else
          {
            {
              _ptr__975_res[safe_add( _976_offset,_986_p )] = _ptr__982_yx[_ptr__974_nativeidxs[_986_p]];
            }
          }
        }
      }
    }
  }
}
// End mosek.fusion.Model.getVariableValues

// Begin mosek.fusion.Model.setVariableValues
// Method mosek.fusion.Model.setVariableValues @ bld/grindsted/final/default/src/fusion/Model.mbi:4144:6-4164:7
void mosek::fusion::Model :: setVariableValues(bool _988_primal,std::shared_ptr< monty::ndarray< int64_t,1 > > _989_nativeidxs,std::shared_ptr< monty::ndarray< double,1 > > _990_values) { mosek::fusion::p_Model::_get_impl(this)->setVariableValues(_988_primal,_989_nativeidxs,_990_values); }
void mosek::fusion::p_Model::setVariableValues(bool _988_primal,std::shared_ptr< monty::ndarray< int64_t,1 > > _989_nativeidxs,std::shared_ptr< monty::ndarray< double,1 > > _990_values)
{
  _checked_ptr_1<int64_t> _ptr__989_nativeidxs(_989_nativeidxs ? _989_nativeidxs->raw() : nullptr, _989_nativeidxs ? _989_nativeidxs->size(0) : 0);
  _checked_ptr_1<double> _ptr__990_values(_990_values ? _990_values->raw() : nullptr, _990_values ? _990_values->size(0) : 0);
  if (_988_primal)
  {
    {
      int32_t _991_numnz = (int)0;
      int32_t _9639_ = (int)0;
      int32_t _9640_ = (int)((_989_nativeidxs)->size(0));
      for (int32_t _992_i = _9639_; _992_i < _9640_; ++_992_i)
      {
        {
          if ((_ptr__989_nativeidxs[_992_i] >= (int)0))
          {
            {
              ++ _991_numnz;
            }
          }
          {}
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _993_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_991_numnz)));
      _checked_ptr_1<int32_t> _ptr__993_subj(_993_subj ? _993_subj->raw() : nullptr,_993_subj ? _993_subj->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _994_val = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_991_numnz)));
      _checked_ptr_1<double> _ptr__994_val(_994_val ? _994_val->raw() : nullptr,_994_val ? _994_val->size(0) : 0);
      int32_t _995_k = (int)0;
      int32_t _9641_ = (int)0;
      int32_t _9642_ = (int)((_989_nativeidxs)->size(0));
      for (int32_t _996_i = _9641_; _996_i < _9642_; ++_996_i)
      {
        {
          if ((_ptr__989_nativeidxs[_996_i] >= (int)0))
          {
            {
              _ptr__993_subj[_995_k] = (int32_t)_ptr__989_nativeidxs[_996_i];
              _ptr__994_val[_995_k] = _ptr__990_values[_996_i];
              ++ _995_k;
            }
          }
          {}
        }
      }
      setSolution_xx(_993_subj,_994_val);
    }
  }
  else
  {
    {
    }
  }
}
// End mosek.fusion.Model.setVariableValues

// Begin mosek.fusion.Model.writeTaskNoFlush
// Method mosek.fusion.Model.writeTaskNoFlush @ bld/grindsted/final/default/src/fusion/Model.mbi:4133:6-4136:7
void mosek::fusion::Model :: writeTaskNoFlush(const std::string & _997_filename) { mosek::fusion::p_Model::_get_impl(this)->writeTaskNoFlush(_997_filename); }
void mosek::fusion::p_Model::writeTaskNoFlush(const std::string & _997_filename)
{
  task_write(_997_filename);
}
// End mosek.fusion.Model.writeTaskNoFlush

// Begin mosek.fusion.Model.writeTaskStream
// Method mosek.fusion.Model.writeTaskStream @ bld/grindsted/final/default/src/fusion/Model.mbi:4126:6-4130:7
void mosek::fusion::Model :: writeTaskStream(const std::string & _998_ext,std::ostream& _999_stream) { mosek::fusion::p_Model::_get_impl(this)->writeTaskStream(_998_ext,_999_stream); }
void mosek::fusion::p_Model::writeTaskStream(const std::string & _998_ext,std::ostream& _999_stream)
{
  flush_parameters();
  task_write_stream(_998_ext,_999_stream);
}
// End mosek.fusion.Model.writeTaskStream

// Begin mosek.fusion.Model.expressionCache
// Method mosek.fusion.Model.expressionCache @ bld/grindsted/final/default/src/fusion/Model.mbi:4093:6-4096:7
void mosek::fusion::Model :: expressionCache(bool _1000_cache) { mosek::fusion::p_Model::_get_impl(this)->expressionCache(_1000_cache); }
void mosek::fusion::p_Model::expressionCache(bool _1000_cache)
{
  cache_evaluations = _1000_cache;
}
// End mosek.fusion.Model.expressionCache

// Begin mosek.fusion.Model.dataReport
// Method mosek.fusion.Model.dataReport @ bld/grindsted/final/default/src/fusion/Model.mbi:4091:6-58
void mosek::fusion::Model :: dataReport() { mosek::fusion::p_Model::_get_impl(this)->dataReport(); }
void mosek::fusion::p_Model::dataReport()
{
  _pubthis->dataReport((int)10);
}
// End mosek.fusion.Model.dataReport

// Begin mosek.fusion.Model.dataReport
// Method mosek.fusion.Model.dataReport @ bld/grindsted/final/default/src/fusion/Model.mbi:4086:6-4090:7
void mosek::fusion::Model :: dataReport(int32_t _1001_detail) { mosek::fusion::p_Model::_get_impl(this)->dataReport(_1001_detail); }
void mosek::fusion::p_Model::dataReport(int32_t _1001_detail)
{
  flush_parameters();
  task_analyze_problem(_1001_detail);
}
// End mosek.fusion.Model.dataReport

// Begin mosek.fusion.Model.writeTask
// Method mosek.fusion.Model.writeTask @ bld/grindsted/final/default/src/fusion/Model.mbi:4080:6-4084:7
void mosek::fusion::Model :: writeTask(const std::string & _1002_filename) { mosek::fusion::p_Model::_get_impl(this)->writeTask(_1002_filename); }
void mosek::fusion::p_Model::writeTask(const std::string & _1002_filename)
{
  flush_parameters();
  task_write(_1002_filename);
}
// End mosek.fusion.Model.writeTask

// Begin mosek.fusion.Model.getSolverLIntInfo
// Method mosek.fusion.Model.getSolverLIntInfo @ bld/grindsted/final/default/src/fusion/Model.mbi:4072:6-93
int64_t mosek::fusion::Model :: getSolverLIntInfo(const std::string & _1003_name) { return mosek::fusion::p_Model::_get_impl(this)->getSolverLIntInfo(_1003_name); }
int64_t mosek::fusion::p_Model::getSolverLIntInfo(const std::string & _1003_name)
{
  return task_get_liinf(_1003_name);
}
// End mosek.fusion.Model.getSolverLIntInfo

// Begin mosek.fusion.Model.getSolverIntInfo
// Method mosek.fusion.Model.getSolverIntInfo @ bld/grindsted/final/default/src/fusion/Model.mbi:4062:6-92
int32_t mosek::fusion::Model :: getSolverIntInfo(const std::string & _1004_name) { return mosek::fusion::p_Model::_get_impl(this)->getSolverIntInfo(_1004_name); }
int32_t mosek::fusion::p_Model::getSolverIntInfo(const std::string & _1004_name)
{
  return task_get_iinf(_1004_name);
}
// End mosek.fusion.Model.getSolverIntInfo

// Begin mosek.fusion.Model.getSolverDoubleInfo
// Method mosek.fusion.Model.getSolverDoubleInfo @ bld/grindsted/final/default/src/fusion/Model.mbi:4052:6-92
double mosek::fusion::Model :: getSolverDoubleInfo(const std::string & _1005_name) { return mosek::fusion::p_Model::_get_impl(this)->getSolverDoubleInfo(_1005_name); }
double mosek::fusion::p_Model::getSolverDoubleInfo(const std::string & _1005_name)
{
  return task_get_dinf(_1005_name);
}
// End mosek.fusion.Model.getSolverDoubleInfo

// Begin mosek.fusion.Model.setCallbackHandler
// Method mosek.fusion.Model.setCallbackHandler @ bld/grindsted/final/default/src/fusion/Model.mbi:4042:6-110
void mosek::fusion::Model :: setCallbackHandler(mosek::cbhandler_t _1006_h) { mosek::fusion::p_Model::_get_impl(this)->setCallbackHandler(_1006_h); }
void mosek::fusion::p_Model::setCallbackHandler(mosek::cbhandler_t _1006_h)
{
  task_setCallbackHandler(_1006_h);
}
// End mosek.fusion.Model.setCallbackHandler

// Begin mosek.fusion.Model.setDataCallbackHandler
// Method mosek.fusion.Model.setDataCallbackHandler @ bld/grindsted/final/default/src/fusion/Model.mbi:4021:6-114
void mosek::fusion::Model :: setDataCallbackHandler(mosek::datacbhandler_t _1007_h) { mosek::fusion::p_Model::_get_impl(this)->setDataCallbackHandler(_1007_h); }
void mosek::fusion::p_Model::setDataCallbackHandler(mosek::datacbhandler_t _1007_h)
{
  task_setDataCallbackHandler(_1007_h);
}
// End mosek.fusion.Model.setDataCallbackHandler

// Begin mosek.fusion.Model.setLogHandler
// Method mosek.fusion.Model.setLogHandler @ bld/grindsted/final/default/src/fusion/Model.mbi:3999:6-89
void mosek::fusion::Model :: setLogHandler(mosek::msghandler_t _1008_h) { mosek::fusion::p_Model::_get_impl(this)->setLogHandler(_1008_h); }
void mosek::fusion::p_Model::setLogHandler(mosek::msghandler_t _1008_h)
{
  task_setLogHandler(_1008_h);
}
// End mosek.fusion.Model.setLogHandler

// Begin mosek.fusion.Model.setSolverParam
// Method mosek.fusion.Model.setSolverParam @ bld/grindsted/final/default/src/fusion/Model.mbi:3972:6-132
void mosek::fusion::Model :: setSolverParam(const std::string & _1009_name,double _1010_floatval) { mosek::fusion::p_Model::_get_impl(this)->setSolverParam(_1009_name,_1010_floatval); }
void mosek::fusion::p_Model::setSolverParam(const std::string & _1009_name,double _1010_floatval)
{
  ::mosek::fusion::p_Parameters::setParameter(::mosek::fusion::Model::t(_pubthis),_1009_name,_1010_floatval);
}
// End mosek.fusion.Model.setSolverParam

// Begin mosek.fusion.Model.setSolverParam
// Method mosek.fusion.Model.setSolverParam @ bld/grindsted/final/default/src/fusion/Model.mbi:3960:6-128
void mosek::fusion::Model :: setSolverParam(const std::string & _1011_name,int32_t _1012_intval) { mosek::fusion::p_Model::_get_impl(this)->setSolverParam(_1011_name,_1012_intval); }
void mosek::fusion::p_Model::setSolverParam(const std::string & _1011_name,int32_t _1012_intval)
{
  ::mosek::fusion::p_Parameters::setParameter(::mosek::fusion::Model::t(_pubthis),_1011_name,_1012_intval);
}
// End mosek.fusion.Model.setSolverParam

// Begin mosek.fusion.Model.setSolverParam
// Method mosek.fusion.Model.setSolverParam @ bld/grindsted/final/default/src/fusion/Model.mbi:3948:6-128
void mosek::fusion::Model :: setSolverParam(const std::string & _1013_name,const std::string & _1014_strval) { mosek::fusion::p_Model::_get_impl(this)->setSolverParam(_1013_name,_1014_strval); }
void mosek::fusion::p_Model::setSolverParam(const std::string & _1013_name,const std::string & _1014_strval)
{
  ::mosek::fusion::p_Parameters::setParameter(::mosek::fusion::Model::t(_pubthis),_1013_name,_1014_strval);
}
// End mosek.fusion.Model.setSolverParam

// Begin mosek.fusion.Model.breakSolver
// Method mosek.fusion.Model.breakSolver @ bld/grindsted/final/default/src/fusion/Model.mbi:3932:6-3935:7
void mosek::fusion::Model :: breakSolver() { mosek::fusion::p_Model::_get_impl(this)->breakSolver(); }
void mosek::fusion::p_Model::breakSolver()
{
  task_break_solve();
}
// End mosek.fusion.Model.breakSolver

// Begin mosek.fusion.Model.optserverHost
// Method mosek.fusion.Model.optserverHost @ bld/grindsted/final/default/src/fusion/Model.mbi:3918:6-3921:7
void mosek::fusion::Model :: optserverHost(const std::string & _1015_addr) { mosek::fusion::p_Model::_get_impl(this)->optserverHost(_1015_addr); }
void mosek::fusion::p_Model::optserverHost(const std::string & _1015_addr)
{
  task_putoptserver_host(_1015_addr);
}
// End mosek.fusion.Model.optserverHost

// Begin mosek.fusion.Model.report_solution
// Method mosek.fusion.Model.report_solution @ bld/grindsted/final/default/src/fusion/Model.mbi:3837:6-3913:7
void mosek::fusion::p_Model::report_solution(mosek::fusion::SolutionType _1016_soltype,mosek::fusion::ProblemStatus _1017_prosta,mosek::fusion::SolutionStatus _1018_psolsta,mosek::fusion::SolutionStatus _1019_dsolsta,double _1020_pobj,double _1021_dobj,int32_t _1022_numvar,int32_t _1023_numcon,int32_t _1024_numbarelm,int32_t _1025_numacc,int32_t _1026_numaccelm,bool _1027_hasprimal,bool _1028_hasdual)
{
  monty::rc_ptr< ::mosek::fusion::SolutionStruct > _1029_sol;
  if ((_1016_soltype == ::mosek::fusion::SolutionType::Interior))
  {
    {
      _1029_sol = sol_itr;
    }
  }
  else if((_1016_soltype == ::mosek::fusion::SolutionType::Basic))
  {
    {
      _1029_sol = sol_bas;
    }
  }
  else if((_1016_soltype == ::mosek::fusion::SolutionType::Integer))
  {
    {
      _1029_sol = sol_itg;
    }
  }
  else
  {
    {
      _1029_sol = nullptr;
    }
  }
  if ((NULL == _1029_sol.get()))
  {
    {
      _1029_sol = ::mosek::fusion::p_SolutionStruct::_new_SolutionStruct(_1022_numvar,_1023_numcon,_1024_numbarelm,_1025_numacc,_1026_numaccelm);
    }
  }
  else
  {
    {
      _1029_sol->resize(_1022_numvar,_1023_numcon,_1024_numbarelm,_1025_numacc,_1026_numaccelm);
    }
  }
  mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->pobj = _1020_pobj;
  mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->dobj = _1021_dobj;
  mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->pstatus = _1018_psolsta;
  mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->dstatus = _1019_dsolsta;
  mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->probstatus = _1017_prosta;
  if ((_1022_numvar > (int)0))
  {
    {
      if (_1027_hasprimal)
      {
        {
          report_solution_get_xx(mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->xx);
        }
      }
      {}
      if (_1028_hasdual)
      {
        {
          report_solution_get_slx(mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->slx);
          report_solution_get_sux(mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->sux);
          std::shared_ptr< monty::ndarray< double,1 > > _1030_yx = mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->yx;
          _checked_ptr_1<double> _ptr__1030_yx(_1030_yx ? _1030_yx->raw() : nullptr,_1030_yx ? _1030_yx->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _1031_slx = mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->slx;
          _checked_ptr_1<double> _ptr__1031_slx(_1031_slx ? _1031_slx->raw() : nullptr,_1031_slx ? _1031_slx->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _1032_sux = mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->sux;
          _checked_ptr_1<double> _ptr__1032_sux(_1032_sux ? _1032_sux->raw() : nullptr,_1032_sux ? _1032_sux->size(0) : 0);
          int32_t _9643_ = (int)0;
          int32_t _9644_ = _1022_numvar;
          for (int32_t _1033_i = _9643_; _1033_i < _9644_; ++_1033_i)
          {
            {
              _ptr__1030_yx[_1033_i] = (_ptr__1031_slx[_1033_i] - _ptr__1032_sux[_1033_i]);
            }
          }
        }
      }
      {}
    }
  }
  {}
  if ((_1023_numcon > (int)0))
  {
    {
      if (_1027_hasprimal)
      {
        {
          report_solution_get_xc(mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->xc);
        }
      }
      {}
      if (_1028_hasdual)
      {
        {
          report_solution_get_slc(mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->slc);
          report_solution_get_suc(mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->suc);
          std::shared_ptr< monty::ndarray< double,1 > > _1034_y = mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->y;
          _checked_ptr_1<double> _ptr__1034_y(_1034_y ? _1034_y->raw() : nullptr,_1034_y ? _1034_y->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _1035_slc = mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->slc;
          _checked_ptr_1<double> _ptr__1035_slc(_1035_slc ? _1035_slc->raw() : nullptr,_1035_slc ? _1035_slc->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _1036_suc = mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->suc;
          _checked_ptr_1<double> _ptr__1036_suc(_1036_suc ? _1036_suc->raw() : nullptr,_1036_suc ? _1036_suc->size(0) : 0);
          int32_t _9645_ = (int)0;
          int32_t _9646_ = _1023_numcon;
          for (int32_t _1037_i = _9645_; _1037_i < _9646_; ++_1037_i)
          {
            {
              _ptr__1034_y[_1037_i] = (_ptr__1035_slc[_1037_i] - _ptr__1036_suc[_1037_i]);
            }
          }
        }
      }
      {}
    }
  }
  {}
  if ((_1024_numbarelm > (int)0))
  {
    {
      if (_1027_hasprimal)
      {
        {
          report_solution_get_barx(mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->barx);
        }
      }
      {}
      if (_1028_hasdual)
      {
        {
          report_solution_get_bars(mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->bars);
        }
      }
      {}
    }
  }
  {}
  if ((task_numacc() > (int)0))
  {
    {
      report_solution_get_accptr(mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->accptr);
      if (_1027_hasprimal)
      {
        {
          report_solution_get_accx(mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->accx);
        }
      }
      {}
      if (_1028_hasdual)
      {
        {
          report_solution_get_accy(mosek::fusion::p_SolutionStruct::_get_impl(_1029_sol)->accy);
        }
      }
      {}
    }
  }
  {}
  if ((_1016_soltype == ::mosek::fusion::SolutionType::Interior))
  {
    {
      sol_itr = _1029_sol;
    }
  }
  else if((_1016_soltype == ::mosek::fusion::SolutionType::Basic))
  {
    {
      sol_bas = _1029_sol;
    }
  }
  else if((_1016_soltype == ::mosek::fusion::SolutionType::Integer))
  {
    {
      sol_itg = _1029_sol;
    }
  }
  {}
}
// End mosek.fusion.Model.report_solution

// Begin mosek.fusion.Model.clear_solutions
// Method mosek.fusion.Model.clear_solutions @ bld/grindsted/final/default/src/fusion/Model.mbi:3831:6-3835:7
void mosek::fusion::p_Model::clear_solutions()
{
  sol_itr = nullptr;
  sol_itg = nullptr;
  sol_bas = nullptr;
}
// End mosek.fusion.Model.clear_solutions

// Begin mosek.fusion.Model.solveBatch
// Method mosek.fusion.Model.solveBatch @ bld/grindsted/final/default/src/fusion/Model.mbi:3806:6-3829:7
std::shared_ptr< monty::ndarray< mosek::fusion::SolverStatus,1 > > mosek::fusion::Model::solveBatch
  ( bool _1038_israce,
    double _1039_maxtime,
    int32_t _1040_numthreads,
    std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Model >,1 > > _1041_models) { return mosek::fusion::p_Model::solveBatch(_1038_israce,_1039_maxtime,_1040_numthreads,_1041_models); }
std::shared_ptr< monty::ndarray< mosek::fusion::SolverStatus,1 > > mosek::fusion::p_Model::solveBatch(bool _1038_israce,double _1039_maxtime,int32_t _1040_numthreads,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Model >,1 > > _1041_models)
{
  int32_t _1042_n = (int)((_1041_models)->size(0));
  int32_t _9647_ = (int)0;
  int32_t _9648_ = _1042_n;
  for (int32_t _1043_i = _9647_; _1043_i < _9648_; ++_1043_i)
  {
    {
      if ((NULL == ((*_1041_models)(_1043_i)).get()))
      {
        {
          throw ::mosek::fusion::OptimizeError(std::string ("One of the models is a null object"));
        }
      }
      {}
    }
  }
  int32_t _9649_ = (int)0;
  int32_t _9650_ = _1042_n;
  for (int32_t _1044_i = _9649_; _1044_i < _9650_; ++_1044_i)
  {
    {
      ((*_1041_models)(_1044_i))->flushSolutions();
      mosek::fusion::p_Model::_get_impl(((*_1041_models)(_1044_i)).get())->flush_parameters();
    }
  }
  std::shared_ptr< monty::ndarray< mosek::fusion::SolverStatus,1 > > _1045_wasOK = ::mosek::fusion::p_BaseModel::env_solve_batch(_1038_israce,_1039_maxtime,_1040_numthreads,_1041_models);
  int32_t _9651_ = (int)0;
  int32_t _9652_ = _1042_n;
  for (int32_t _1046_i = _9651_; _1046_i < _9652_; ++_1046_i)
  {
    {
      mosek::fusion::p_Model::_get_impl(((*_1041_models)(_1046_i)).get())->task_post_solve();
    }
  }
  return _1045_wasOK;
}
// End mosek.fusion.Model.solveBatch

// Begin mosek.fusion.Model.solve
// Method mosek.fusion.Model.solve @ bld/grindsted/final/default/src/fusion/Model.mbi:3797:6-3804:7
void mosek::fusion::Model :: solve(const std::string & _1047_addr,const std::string & _1048_accesstoken) { mosek::fusion::p_Model::_get_impl(this)->solve(_1047_addr,_1048_accesstoken); }
void mosek::fusion::p_Model::solve(const std::string & _1047_addr,const std::string & _1048_accesstoken)
{
  _pubthis->flushSolutions();
  flush_parameters();
  task_solve(true,_1047_addr,_1048_accesstoken);
  task_post_solve();
}
// End mosek.fusion.Model.solve

// Begin mosek.fusion.Model.solve
// Method mosek.fusion.Model.solve @ bld/grindsted/final/default/src/fusion/Model.mbi:3788:6-3795:7
void mosek::fusion::Model :: solve() { mosek::fusion::p_Model::_get_impl(this)->solve(); }
void mosek::fusion::p_Model::solve()
{
  _pubthis->flushSolutions();
  flush_parameters();
  task_solve(false,std::string (""),std::string (""));
  task_post_solve();
}
// End mosek.fusion.Model.solve

// Begin mosek.fusion.Model.flush_parameters
// Method mosek.fusion.Model.flush_parameters @ bld/grindsted/final/default/src/fusion/Model.mbi:3709:6-3756:7
void mosek::fusion::p_Model::flush_parameters()
{
  int32_t _1049_num_con_param_nz = con_blocks->num_parameterized();
  int32_t _1050_num_afe_param_nz = afe_blocks->num_parameterized();
  int32_t _1051_num_obj_param_nz = obj_blocks->num_parameterized();
  if ((_1049_num_con_param_nz > (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1052_subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1049_num_con_param_nz)));
      _checked_ptr_1<int32_t> _ptr__1052_subi(_1052_subi ? _1052_subi->raw() : nullptr,_1052_subi ? _1052_subi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1053_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1049_num_con_param_nz)));
      _checked_ptr_1<int32_t> _ptr__1053_subj(_1053_subj ? _1053_subj->raw() : nullptr,_1053_subj ? _1053_subj->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _1054_val = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1049_num_con_param_nz)));
      _checked_ptr_1<double> _ptr__1054_val(_1054_val ? _1054_val->raw() : nullptr,_1054_val ? _1054_val->size(0) : 0);
      con_blocks->evaluate(xs,param_value,_1052_subi,_1053_subj,_1054_val);
      task_putaijlist(_1052_subi,_1053_subj,_1054_val,(int64_t)(_1049_num_con_param_nz));
    }
  }
  {}
  if ((_1050_num_afe_param_nz > (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1055_subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1050_num_afe_param_nz)));
      _checked_ptr_1<int32_t> _ptr__1055_subi(_1055_subi ? _1055_subi->raw() : nullptr,_1055_subi ? _1055_subi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1056_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1050_num_afe_param_nz)));
      _checked_ptr_1<int32_t> _ptr__1056_subj(_1056_subj ? _1056_subj->raw() : nullptr,_1056_subj ? _1056_subj->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _1057_val = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1050_num_afe_param_nz)));
      _checked_ptr_1<double> _ptr__1057_val(_1057_val ? _1057_val->raw() : nullptr,_1057_val ? _1057_val->size(0) : 0);
      afe_blocks->evaluate(xs,param_value,_1055_subi,_1056_subj,_1057_val);
      task_putafefijlist(_1055_subi,_1056_subj,_1057_val);
    }
  }
  {}
  if ((_1051_num_obj_param_nz > (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1058_subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1051_num_obj_param_nz)));
      _checked_ptr_1<int32_t> _ptr__1058_subi(_1058_subi ? _1058_subi->raw() : nullptr,_1058_subi ? _1058_subi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1059_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1051_num_obj_param_nz)));
      _checked_ptr_1<int32_t> _ptr__1059_subj(_1059_subj ? _1059_subj->raw() : nullptr,_1059_subj ? _1059_subj->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _1060_val = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1051_num_obj_param_nz)));
      _checked_ptr_1<double> _ptr__1060_val(_1060_val ? _1060_val->raw() : nullptr,_1060_val ? _1060_val->size(0) : 0);
      obj_blocks->evaluate(xs,param_value,_1058_subi,_1059_subj,_1060_val);
      task_putclist(_1059_subj,_1060_val);
    }
  }
  {}
}
// End mosek.fusion.Model.flush_parameters

// Begin mosek.fusion.Model.flushParameters
// Method mosek.fusion.Model.flushParameters @ bld/grindsted/final/default/src/fusion/Model.mbi:3707:6-61
void mosek::fusion::Model :: flushParameters() { mosek::fusion::p_Model::_get_impl(this)->flushParameters(); }
void mosek::fusion::p_Model::flushParameters()
{
  flush_parameters();
}
// End mosek.fusion.Model.flushParameters

// Begin mosek.fusion.Model.evaluate_parameterized
// Method mosek.fusion.Model.evaluate_parameterized @ bld/grindsted/final/default/src/fusion/Model.mbi:3638:6-3701:7
void mosek::fusion::p_Model::evaluate_parameterized(monty::rc_ptr< ::mosek::fusion::WorkStack > _1061_xs,int32_t _1062_numrow,std::shared_ptr< monty::ndarray< int32_t,1 > > _1063_rowptrb,std::shared_ptr< monty::ndarray< int32_t,1 > > _1064_rowptre,std::shared_ptr< monty::ndarray< int64_t,1 > > _1065_codenidx,std::shared_ptr< monty::ndarray< int32_t,1 > > _1066_codeptr,std::shared_ptr< monty::ndarray< int32_t,1 > > _1067_codesizes,std::shared_ptr< monty::ndarray< int32_t,1 > > _1068_code,std::shared_ptr< monty::ndarray< double,1 > > _1069_cconst,std::shared_ptr< monty::ndarray< int32_t,1 > > _1070_subj,std::shared_ptr< monty::ndarray< double,1 > > _1071_val)
{
  _checked_ptr_1<int32_t> _ptr__1063_rowptrb(_1063_rowptrb ? _1063_rowptrb->raw() : nullptr, _1063_rowptrb ? _1063_rowptrb->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__1064_rowptre(_1064_rowptre ? _1064_rowptre->raw() : nullptr, _1064_rowptre ? _1064_rowptre->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__1065_codenidx(_1065_codenidx ? _1065_codenidx->raw() : nullptr, _1065_codenidx ? _1065_codenidx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__1066_codeptr(_1066_codeptr ? _1066_codeptr->raw() : nullptr, _1066_codeptr ? _1066_codeptr->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__1067_codesizes(_1067_codesizes ? _1067_codesizes->raw() : nullptr, _1067_codesizes ? _1067_codesizes->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__1068_code(_1068_code ? _1068_code->raw() : nullptr, _1068_code ? _1068_code->size(0) : 0);
  _checked_ptr_1<double> _ptr__1069_cconst(_1069_cconst ? _1069_cconst->raw() : nullptr, _1069_cconst ? _1069_cconst->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__1070_subj(_1070_subj ? _1070_subj->raw() : nullptr, _1070_subj ? _1070_subj->size(0) : 0);
  _checked_ptr_1<double> _ptr__1071_val(_1071_val ? _1071_val->raw() : nullptr, _1071_val ? _1071_val->size(0) : 0);
  int32_t _1072_stack = _1061_xs->allocf64((int)((_1068_code)->size(0)));
  int32_t _1073_stackp = (int)0;
  std::shared_ptr< monty::ndarray< double,1 > > _1074_xf64 = mosek::fusion::p_WorkStack::_get_impl(_1061_xs)->f64;
  _checked_ptr_1<double> _ptr__1074_xf64(_1074_xf64 ? _1074_xf64->raw() : nullptr,_1074_xf64 ? _1074_xf64->size(0) : 0);
  int32_t _1075_idx = (int)0;
  int32_t _9653_ = (int)0;
  int32_t _9654_ = _1062_numrow;
  for (int32_t _1076_i = _9653_; _1076_i < _9654_; ++_1076_i)
  {
    {
      int32_t _1077_k = _ptr__1066_codeptr[_1076_i];
      int32_t _9655_ = _ptr__1063_rowptrb[_1076_i];
      int32_t _9656_ = _ptr__1064_rowptre[_1076_i];
      for (int32_t _1078_j = _9655_; _1078_j < _9656_; ++_1078_j)
      {
        {
          int32_t _9657_ = (int)0;
          int32_t _9658_ = _ptr__1067_codesizes[_1078_j];
          for (int32_t _1079_l = _9657_; _1079_l < _9658_; ++_1079_l)
          {
            {
              if ((_ptr__1068_code[_1077_k] == 0))
              {
                {
                }
              }
              else
              {
                {
                  if ((_ptr__1068_code[_1077_k] == 1))
                  {
                    {
                      _ptr__1074_xf64[safe_add( _1072_stack,_1073_stackp )] = ((*param_value)((int32_t)_ptr__1069_cconst[_1077_k]));
                      ++ _1073_stackp;
                    }
                  }
                  else
                  {
                    {
                      if ((_ptr__1068_code[_1077_k] == 2))
                      {
                        {
                          _ptr__1074_xf64[safe_add( _1072_stack,_1073_stackp )] = _ptr__1069_cconst[_1077_k];
                          ++ _1073_stackp;
                        }
                      }
                      else
                      {
                        {
                          if ((_ptr__1068_code[_1077_k] == 3))
                          {
                            {
                              _ptr__1074_xf64[(safe_add( _1072_stack,_1073_stackp ) - (int)2)] += _ptr__1074_xf64[(safe_add( _1072_stack,_1073_stackp ) - (int)1)];
                              -- _1073_stackp;
                            }
                          }
                          else
                          {
                            {
                              if ((_ptr__1068_code[_1077_k] == 4))
                              {
                                {
                                  _ptr__1074_xf64[(safe_add( _1072_stack,_1073_stackp ) - (int)1)] = (-_ptr__1074_xf64[(safe_add( _1072_stack,_1073_stackp ) - (int)1)]);
                                }
                              }
                              else
                              {
                                {
                                  if ((_ptr__1068_code[_1077_k] == 5))
                                  {
                                    {
                                      _ptr__1074_xf64[(safe_add( _1072_stack,_1073_stackp ) - (int)2)] *= _ptr__1074_xf64[(safe_add( _1072_stack,_1073_stackp ) - (int)1)];
                                      -- _1073_stackp;
                                    }
                                  }
                                  else
                                  {
                                    {
                                      if ((_ptr__1068_code[_1077_k] == 6))
                                      {
                                        {
                                          _ptr__1074_xf64[(safe_add( _1072_stack,_1073_stackp ) - (int)1)] = (1.0 / _ptr__1074_xf64[(safe_add( _1072_stack,_1073_stackp ) - (int)1)]);
                                        }
                                      }
                                      else
                                      {
                                        {
                                          if ((_ptr__1068_code[_1077_k] == 8))
                                          {
                                            {
                                              double _1080_v = 0.0;
                                              int32_t _9659_ = (int)0;
                                              int32_t _9660_ = (int32_t)_ptr__1069_cconst[_1077_k];
                                              for (int32_t _1081_i = _9659_; _1081_i < _9660_; ++_1081_i)
                                              {
                                                {
                                                  _1080_v += _ptr__1074_xf64[(safe_add( _1072_stack,_1073_stackp ) - (int)1)];
                                                  -- _1073_stackp;
                                                }
                                              }
                                              _ptr__1074_xf64[safe_add( _1072_stack,_1073_stackp )] = _1080_v;
                                              ++ _1073_stackp;
                                            }
                                          }
                                          else
                                          {
                                            {
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
              ++ _1077_k;
            }
          }
          _ptr__1070_subj[_1075_idx] = (int32_t)_ptr__1065_codenidx[_1078_j];
          _ptr__1071_val[_1075_idx] = _ptr__1074_xf64[_1072_stack];
          _1073_stackp = (int)0;
          ++ _1075_idx;
        }
      }
    }
  }
  _1061_xs->popf64((int)((_1068_code)->size(0)));
}
// End mosek.fusion.Model.evaluate_parameterized

// Begin mosek.fusion.Model.flushSolutions
// Method mosek.fusion.Model.flushSolutions @ bld/grindsted/final/default/src/fusion/Model.mbi:3631:6-3636:7
void mosek::fusion::Model :: flushSolutions() { mosek::fusion::p_Model::_get_impl(this)->flushSolutions(); }
void mosek::fusion::p_Model::flushSolutions()
{
  flush_initsol(::mosek::fusion::SolutionType::Interior);
  flush_initsol(::mosek::fusion::SolutionType::Integer);
  flush_initsol(::mosek::fusion::SolutionType::Basic);
}
// End mosek.fusion.Model.flushSolutions

// Begin mosek.fusion.Model.flush_initsol
// Method mosek.fusion.Model.flush_initsol @ bld/grindsted/final/default/src/fusion/Model.mbi:3605:6-3627:7
void mosek::fusion::p_Model::flush_initsol(mosek::fusion::SolutionType _1082_which)
{
  if ((NULL != initsol_xx.get()))
  {
    {
      int32_t _1083_numvar = task_numvar();
      std::shared_ptr< monty::ndarray< double,1 > > _1084_xx = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1083_numvar)));
      _checked_ptr_1<double> _ptr__1084_xx(_1084_xx ? _1084_xx->raw() : nullptr,_1084_xx ? _1084_xx->size(0) : 0);
      /* Try @ bld/grindsted/final/default/src/fusion/Model.mbi:3610:10-3616:11 */
      try
      {
        {
          monty::rc_ptr< ::mosek::fusion::SolutionStruct > _1086_sol = __mosek_2fusion_2Model__get_sol_cache(_1082_which,true);
          if ((NULL != mosek::fusion::p_SolutionStruct::_get_impl(_1086_sol)->xx.get()))
          {
            {
              int32_t _9661_;
              bool _9662_ = ((int)((mosek::fusion::p_SolutionStruct::_get_impl(_1086_sol)->xx)->size(0)) <= _1083_numvar);
              if (_9662_)
              {
                _9661_ = (int)((mosek::fusion::p_SolutionStruct::_get_impl(_1086_sol)->xx)->size(0));
              }
              else
              {
                _9661_ = _1083_numvar;
              }
              ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SolutionStruct::_get_impl(_1086_sol)->xx,(int)0,_1084_xx,(int)0,_9661_);
            }
          }
          {}
        }
      }
      catch (mosek::fusion::SolutionError _1085_e)
      {
        {
        }
      }
      int32_t _9663_;
      bool _9664_ = ((int)((initsol_xx)->size(0)) <= _1083_numvar);
      if (_9664_)
      {
        _9663_ = (int)((initsol_xx)->size(0));
      }
      else
      {
        _9663_ = _1083_numvar;
      }
      int32_t _1087_n = _9663_;
      int32_t _9665_ = (int)0;
      int32_t _9666_ = _1087_n;
      for (int32_t _1088_i = _9665_; _1088_i < _9666_; ++_1088_i)
      {
        {
          if (((*initsol_xx_flag)(_1088_i)))
          {
            {
              _ptr__1084_xx[_1088_i] = ((*initsol_xx)(_1088_i));
            }
          }
          {}
        }
      }
      _ptr__1084_xx[bfixidx] = 1.0;
      task_putxx_slice(_1082_which,(int)0,_1083_numvar,_1084_xx);
    }
  }
  {}
}
// End mosek.fusion.Model.flush_initsol

// Begin mosek.fusion.Model.getDualSolutionStatus
// Method mosek.fusion.Model.getDualSolutionStatus @ bld/grindsted/final/default/src/fusion/Model.mbi:3600:6-3603:7
mosek::fusion::SolutionStatus mosek::fusion::Model :: getDualSolutionStatus() { return mosek::fusion::p_Model::_get_impl(this)->getDualSolutionStatus(); }
mosek::fusion::SolutionStatus mosek::fusion::p_Model::getDualSolutionStatus()
{
  return _pubthis->getDualSolutionStatus(solutionptr);
}
// End mosek.fusion.Model.getDualSolutionStatus

// Begin mosek.fusion.Model.getProblemStatus
// Method mosek.fusion.Model.getProblemStatus @ bld/grindsted/final/default/src/fusion/Model.mbi:3594:6-3597:7
mosek::fusion::ProblemStatus mosek::fusion::Model :: getProblemStatus() { return mosek::fusion::p_Model::_get_impl(this)->getProblemStatus(); }
mosek::fusion::ProblemStatus mosek::fusion::p_Model::getProblemStatus()
{
  return _pubthis->getProblemStatus(solutionptr);
}
// End mosek.fusion.Model.getProblemStatus

// Begin mosek.fusion.Model.getPrimalSolutionStatus
// Method mosek.fusion.Model.getPrimalSolutionStatus @ bld/grindsted/final/default/src/fusion/Model.mbi:3587:6-3590:7
mosek::fusion::SolutionStatus mosek::fusion::Model :: getPrimalSolutionStatus() { return mosek::fusion::p_Model::_get_impl(this)->getPrimalSolutionStatus(); }
mosek::fusion::SolutionStatus mosek::fusion::p_Model::getPrimalSolutionStatus()
{
  return getPrimalSolutionStatus(solutionptr);
}
// End mosek.fusion.Model.getPrimalSolutionStatus

// Begin mosek.fusion.Model.dualObjValue
// Method mosek.fusion.Model.dualObjValue @ bld/grindsted/final/default/src/fusion/Model.mbi:3580:6-3583:7
double mosek::fusion::Model :: dualObjValue() { return mosek::fusion::p_Model::_get_impl(this)->dualObjValue(); }
double mosek::fusion::p_Model::dualObjValue()
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(::mosek::fusion::SolutionType::Default,false))->dobj;
}
// End mosek.fusion.Model.dualObjValue

// Begin mosek.fusion.Model.primalObjValue
// Method mosek.fusion.Model.primalObjValue @ bld/grindsted/final/default/src/fusion/Model.mbi:3574:6-3577:7
double mosek::fusion::Model :: primalObjValue() { return mosek::fusion::p_Model::_get_impl(this)->primalObjValue(); }
double mosek::fusion::p_Model::primalObjValue()
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(::mosek::fusion::SolutionType::Default,true))->pobj;
}
// End mosek.fusion.Model.primalObjValue

// Begin mosek.fusion.Model.get_sol_cache
// Method mosek.fusion.Model.get_sol_cache @ bld/grindsted/final/default/src/fusion/Model.mbi:3500:6-3571:7
monty::rc_ptr< ::mosek::fusion::SolutionStruct > mosek::fusion::p_Model::__mosek_2fusion_2Model__get_sol_cache(mosek::fusion::SolutionType _1089_which_,bool _1090_primal,bool _1091_nothrow)
{
  monty::rc_ptr< ::mosek::fusion::SolutionStruct > _1092_res = nullptr;
  mosek::fusion::SolutionType _1093_which = _1089_which_;
  if ((_1093_which == ::mosek::fusion::SolutionType::Default))
  {
    {
      _1093_which = solutionptr;
    }
  }
  {}
  if ((_1093_which == ::mosek::fusion::SolutionType::Default))
  {
    {
      if ((NULL != sol_itg.get()))
      {
        {
          _1092_res = sol_itg;
        }
      }
      else if((NULL != sol_bas.get()))
      {
        {
          _1092_res = sol_bas;
        }
      }
      else
      {
        {
          _1092_res = sol_itr;
        }
      }
    }
  }
  else if((_1093_which == ::mosek::fusion::SolutionType::Interior))
  {
    {
      _1092_res = sol_itr;
    }
  }
  else if((_1093_which == ::mosek::fusion::SolutionType::Basic))
  {
    {
      _1092_res = sol_bas;
    }
  }
  else if((_1093_which == ::mosek::fusion::SolutionType::Integer))
  {
    {
      _1092_res = sol_itg;
    }
  }
  {}
  if ((NULL == _1092_res.get()))
  {
    {
      throw ::mosek::fusion::SolutionError(std::string ("Solution not available"));
    }
  }
  else
  {
    {
      if ((_1091_nothrow || ((_1090_primal && _1092_res->isPrimalAcceptable(acceptable_sol)) || ((!_1090_primal) && _1092_res->isDualAcceptable(acceptable_sol)))))
      {
        {
          return _1092_res;
        }
      }
      else if(((_1092_res == sol_itg) && (!_1090_primal)))
      {
        {
          throw ::mosek::fusion::SolutionError(std::string ("Dual solution does not exists for mixed-integer problems."));
        }
      }
      else
      {
        {
          monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1094_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
          mosek::fusion::SolutionStatus _1095_solsta = mosek::fusion::p_SolutionStruct::_get_impl(_1092_res)->pstatus;
          mosek::fusion::ProblemStatus _1096_probsta = mosek::fusion::p_SolutionStruct::_get_impl(_1092_res)->probstatus;
          if ((!_1090_primal))
          {
            {
              _1095_solsta = mosek::fusion::p_SolutionStruct::_get_impl(_1092_res)->dstatus;
            }
          }
          {}
          _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Solution status is "));
          if ((_1095_solsta == ::mosek::fusion::SolutionStatus::Undefined))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Undefined"));
            }
          }
          else if((_1095_solsta == ::mosek::fusion::SolutionStatus::Unknown))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Unknown"));
            }
          }
          else if((_1095_solsta == ::mosek::fusion::SolutionStatus::Optimal))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Optimal"));
            }
          }
          else if((_1095_solsta == ::mosek::fusion::SolutionStatus::Feasible))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Feasible"));
            }
          }
          else if((_1095_solsta == ::mosek::fusion::SolutionStatus::Certificate))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Certificate"));
            }
          }
          else if((_1095_solsta == ::mosek::fusion::SolutionStatus::IllposedCert))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("IllposedCert"));
            }
          }
          {}
          _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (" but "));
          if ((acceptable_sol == ::mosek::fusion::AccSolutionStatus::Anything))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Anything"));
            }
          }
          else if((acceptable_sol == ::mosek::fusion::AccSolutionStatus::Optimal))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Optimal"));
            }
          }
          else if((acceptable_sol == ::mosek::fusion::AccSolutionStatus::Feasible))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("at least Feasible"));
            }
          }
          else if((acceptable_sol == ::mosek::fusion::AccSolutionStatus::Certificate))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Certificate"));
            }
          }
          {}
          _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (" is expected. Reason: Accessing "));
          if ((_1092_res == sol_itr))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("interior-point solution"));
            }
          }
          else if((_1092_res == sol_bas))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("basic solution"));
            }
          }
          else if((_1092_res == sol_itg))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("integer solution"));
            }
          }
          {}
          _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (" whose problem status is "));
          if ((_1096_probsta == ::mosek::fusion::ProblemStatus::Unknown))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Unknown"));
            }
          }
          else if((_1096_probsta == ::mosek::fusion::ProblemStatus::PrimalAndDualFeasible))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("PrimalAndDualFeasible"));
            }
          }
          else if((_1096_probsta == ::mosek::fusion::ProblemStatus::PrimalFeasible))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("PrimalFeasible"));
            }
          }
          else if((_1096_probsta == ::mosek::fusion::ProblemStatus::DualFeasible))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("DualFeasible"));
            }
          }
          else if((_1096_probsta == ::mosek::fusion::ProblemStatus::PrimalInfeasible))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("PrimalInfeasible"));
            }
          }
          else if((_1096_probsta == ::mosek::fusion::ProblemStatus::DualInfeasible))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("DualInfeasible"));
            }
          }
          else if((_1096_probsta == ::mosek::fusion::ProblemStatus::PrimalAndDualInfeasible))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("PrimalAndDualInfeasible"));
            }
          }
          else if((_1096_probsta == ::mosek::fusion::ProblemStatus::IllPosed))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("IllPosed"));
            }
          }
          else if((_1096_probsta == ::mosek::fusion::ProblemStatus::PrimalInfeasibleOrUnbounded))
          {
            {
              _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("PrimalInfeasibleOrUnbounded"));
            }
          }
          {}
          _1094_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("."));
          throw ::mosek::fusion::SolutionError(_1094_sb->toString());
        }
      }
    }
  }
}
// End mosek.fusion.Model.get_sol_cache

// Begin mosek.fusion.Model.get_sol_cache
// Method mosek.fusion.Model.get_sol_cache @ bld/grindsted/final/default/src/fusion/Model.mbi:3493:6-3498:7
monty::rc_ptr< ::mosek::fusion::SolutionStruct > mosek::fusion::p_Model::__mosek_2fusion_2Model__get_sol_cache(mosek::fusion::SolutionType _1097_which_,bool _1098_primal)
{
  return __mosek_2fusion_2Model__get_sol_cache(_1097_which_,_1098_primal,false);
}
// End mosek.fusion.Model.get_sol_cache

// Begin mosek.fusion.Model.setSolution_xx
// Method mosek.fusion.Model.setSolution_xx @ bld/grindsted/final/default/src/fusion/Model.mbi:3478:6-3486:7
void mosek::fusion::p_Model::setSolution_xx(std::shared_ptr< monty::ndarray< int32_t,1 > > _1099_subj,std::shared_ptr< monty::ndarray< double,1 > > _1100_val)
{
  _checked_ptr_1<int32_t> _ptr__1099_subj(_1099_subj ? _1099_subj->raw() : nullptr, _1099_subj ? _1099_subj->size(0) : 0);
  _checked_ptr_1<double> _ptr__1100_val(_1100_val ? _1100_val->raw() : nullptr, _1100_val ? _1100_val->size(0) : 0);
  ensure_initsol_xx();
  int32_t _9667_ = (int)0;
  int32_t _9668_ = (int)((_1099_subj)->size(0));
  for (int32_t _1101_i = _9667_; _1101_i < _9668_; ++_1101_i)
  {
    {
      ((*initsol_xx)(_ptr__1099_subj[_1101_i])) = _ptr__1100_val[_1101_i];
      ((*initsol_xx_flag)(_ptr__1099_subj[_1101_i])) = true;
    }
  }
}
// End mosek.fusion.Model.setSolution_xx

// Begin mosek.fusion.Model.ensure_initsol_xx
// Method mosek.fusion.Model.ensure_initsol_xx @ bld/grindsted/final/default/src/fusion/Model.mbi:3461:6-3476:7
void mosek::fusion::p_Model::ensure_initsol_xx()
{
  int32_t _1102_natvarmap_num = task_numvar();
  if ((NULL == initsol_xx.get()))
  {
    {
      initsol_xx = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1102_natvarmap_num)));
      std::vector<bool> _9669_;
      for (int32_t _1103_i = (int)0, _9670_ = _1102_natvarmap_num; _1103_i < _9670_ ; ++_1103_i)
      {
        _9669_.push_back(false);
      }
      auto _9671_ = std::shared_ptr< monty::ndarray< bool,1 > >(new monty::ndarray< bool,1 >(monty::shape(_9669_.size()),_9669_.begin(),_9669_.end()));
      initsol_xx_flag = _9671_;
    }
  }
  else if(((int)((initsol_xx)->size(0)) < _1102_natvarmap_num))
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _1104_tmp = initsol_xx;
      _checked_ptr_1<double> _ptr__1104_tmp(_1104_tmp ? _1104_tmp->raw() : nullptr,_1104_tmp ? _1104_tmp->size(0) : 0);
      std::shared_ptr< monty::ndarray< bool,1 > > _1105_tmp_flag = initsol_xx_flag;
      initsol_xx = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1102_natvarmap_num)));
      initsol_xx_flag = std::shared_ptr< monty::ndarray< bool,1 > >(new monty::ndarray< bool,1 >(monty::shape(_1102_natvarmap_num)));
      ::mosek::fusion::Utils::Tools::arraycopy(_1104_tmp,(int)0,initsol_xx,(int)0,(int)((_1104_tmp)->size(0)));
      int32_t _9672_ = (int)0;
      int32_t _9673_ = (int)((_1104_tmp)->size(0));
      for (int32_t _1106_i = _9672_; _1106_i < _9673_; ++_1106_i)
      {
        {
          ((*initsol_xx_flag)(_1106_i)) = ((*_1105_tmp_flag)(_1106_i));
        }
      }
    }
  }
  {}
}
// End mosek.fusion.Model.ensure_initsol_xx

// Begin mosek.fusion.Model.getSolution_accptr
// Method mosek.fusion.Model.getSolution_accptr @ bld/grindsted/final/default/src/fusion/Model.mbi:3454:6-3458:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_Model::getSolution_accptr(mosek::fusion::SolutionType _1107_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1107_which,true,true))->accptr;
}
// End mosek.fusion.Model.getSolution_accptr

// Begin mosek.fusion.Model.getSolution_accy
// Method mosek.fusion.Model.getSolution_accy @ bld/grindsted/final/default/src/fusion/Model.mbi:3448:6-3452:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getSolution_accy(mosek::fusion::SolutionType _1108_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1108_which,false))->accy;
}
// End mosek.fusion.Model.getSolution_accy

// Begin mosek.fusion.Model.getSolution_accx
// Method mosek.fusion.Model.getSolution_accx @ bld/grindsted/final/default/src/fusion/Model.mbi:3442:6-3446:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getSolution_accx(mosek::fusion::SolutionType _1109_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1109_which,true))->accx;
}
// End mosek.fusion.Model.getSolution_accx

// Begin mosek.fusion.Model.getSolution_bars
// Method mosek.fusion.Model.getSolution_bars @ bld/grindsted/final/default/src/fusion/Model.mbi:3435:6-3439:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getSolution_bars(mosek::fusion::SolutionType _1110_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1110_which,false))->bars;
}
// End mosek.fusion.Model.getSolution_bars

// Begin mosek.fusion.Model.getSolution_barx
// Method mosek.fusion.Model.getSolution_barx @ bld/grindsted/final/default/src/fusion/Model.mbi:3429:6-3433:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getSolution_barx(mosek::fusion::SolutionType _1111_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1111_which,true))->barx;
}
// End mosek.fusion.Model.getSolution_barx

// Begin mosek.fusion.Model.getSolution_y
// Method mosek.fusion.Model.getSolution_y @ bld/grindsted/final/default/src/fusion/Model.mbi:3423:6-3427:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getSolution_y(mosek::fusion::SolutionType _1112_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1112_which,false))->y;
}
// End mosek.fusion.Model.getSolution_y

// Begin mosek.fusion.Model.getSolution_xc
// Method mosek.fusion.Model.getSolution_xc @ bld/grindsted/final/default/src/fusion/Model.mbi:3417:6-3421:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getSolution_xc(mosek::fusion::SolutionType _1113_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1113_which,true))->xc;
}
// End mosek.fusion.Model.getSolution_xc

// Begin mosek.fusion.Model.getSolution_suc
// Method mosek.fusion.Model.getSolution_suc @ bld/grindsted/final/default/src/fusion/Model.mbi:3411:6-3415:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getSolution_suc(mosek::fusion::SolutionType _1114_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1114_which,false))->suc;
}
// End mosek.fusion.Model.getSolution_suc

// Begin mosek.fusion.Model.getSolution_slc
// Method mosek.fusion.Model.getSolution_slc @ bld/grindsted/final/default/src/fusion/Model.mbi:3405:6-3409:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getSolution_slc(mosek::fusion::SolutionType _1115_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1115_which,false))->slc;
}
// End mosek.fusion.Model.getSolution_slc

// Begin mosek.fusion.Model.getSolution_sux
// Method mosek.fusion.Model.getSolution_sux @ bld/grindsted/final/default/src/fusion/Model.mbi:3399:6-3403:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getSolution_sux(mosek::fusion::SolutionType _1116_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1116_which,false))->sux;
}
// End mosek.fusion.Model.getSolution_sux

// Begin mosek.fusion.Model.getSolution_slx
// Method mosek.fusion.Model.getSolution_slx @ bld/grindsted/final/default/src/fusion/Model.mbi:3393:6-3397:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getSolution_slx(mosek::fusion::SolutionType _1117_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1117_which,false))->slx;
}
// End mosek.fusion.Model.getSolution_slx

// Begin mosek.fusion.Model.getSolution_yx
// Method mosek.fusion.Model.getSolution_yx @ bld/grindsted/final/default/src/fusion/Model.mbi:3387:6-3391:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getSolution_yx(mosek::fusion::SolutionType _1118_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1118_which,false))->yx;
}
// End mosek.fusion.Model.getSolution_yx

// Begin mosek.fusion.Model.getSolution_xx
// Method mosek.fusion.Model.getSolution_xx @ bld/grindsted/final/default/src/fusion/Model.mbi:3382:6-3386:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getSolution_xx(mosek::fusion::SolutionType _1119_which)
{
  return mosek::fusion::p_SolutionStruct::_get_impl(__mosek_2fusion_2Model__get_sol_cache(_1119_which,true))->xx;
}
// End mosek.fusion.Model.getSolution_xx

// Begin mosek.fusion.Model.selectedSolution
// Method mosek.fusion.Model.selectedSolution @ bld/grindsted/final/default/src/fusion/Model.mbi:3377:6-3380:7
void mosek::fusion::Model :: selectedSolution(mosek::fusion::SolutionType _1120_soltype) { mosek::fusion::p_Model::_get_impl(this)->selectedSolution(_1120_soltype); }
void mosek::fusion::p_Model::selectedSolution(mosek::fusion::SolutionType _1120_soltype)
{
  solutionptr = _1120_soltype;
}
// End mosek.fusion.Model.selectedSolution

// Begin mosek.fusion.Model.getAcceptedSolutionStatus
// Method mosek.fusion.Model.getAcceptedSolutionStatus @ bld/grindsted/final/default/src/fusion/Model.mbi:3364:6-3367:7
mosek::fusion::AccSolutionStatus mosek::fusion::Model :: getAcceptedSolutionStatus() { return mosek::fusion::p_Model::_get_impl(this)->getAcceptedSolutionStatus(); }
mosek::fusion::AccSolutionStatus mosek::fusion::p_Model::getAcceptedSolutionStatus()
{
  return acceptable_sol;
}
// End mosek.fusion.Model.getAcceptedSolutionStatus

// Begin mosek.fusion.Model.acceptedSolutionStatus
// Method mosek.fusion.Model.acceptedSolutionStatus @ bld/grindsted/final/default/src/fusion/Model.mbi:3358:6-3361:7
void mosek::fusion::Model :: acceptedSolutionStatus(mosek::fusion::AccSolutionStatus _1121_what) { mosek::fusion::p_Model::_get_impl(this)->acceptedSolutionStatus(_1121_what); }
void mosek::fusion::p_Model::acceptedSolutionStatus(mosek::fusion::AccSolutionStatus _1121_what)
{
  acceptable_sol = _1121_what;
}
// End mosek.fusion.Model.acceptedSolutionStatus

// Begin mosek.fusion.Model.getProblemStatus
// Method mosek.fusion.Model.getProblemStatus @ bld/grindsted/final/default/src/fusion/Model.mbi:3327:6-3345:7
mosek::fusion::ProblemStatus mosek::fusion::Model :: getProblemStatus(mosek::fusion::SolutionType _1122_which) { return mosek::fusion::p_Model::_get_impl(this)->getProblemStatus(_1122_which); }
mosek::fusion::ProblemStatus mosek::fusion::p_Model::getProblemStatus(mosek::fusion::SolutionType _1122_which)
{
  monty::rc_ptr< ::mosek::fusion::SolutionStruct > _1123_res = nullptr;
  if ((_1122_which == ::mosek::fusion::SolutionType::Default))
  {
    {
      if ((NULL != sol_itg.get()))
      {
        {
          _1123_res = sol_itg;
        }
      }
      else if((NULL != sol_bas.get()))
      {
        {
          _1123_res = sol_bas;
        }
      }
      else
      {
        {
          _1123_res = sol_itr;
        }
      }
    }
  }
  else if((_1122_which == ::mosek::fusion::SolutionType::Interior))
  {
    {
      _1123_res = sol_itr;
    }
  }
  else if((_1122_which == ::mosek::fusion::SolutionType::Basic))
  {
    {
      _1123_res = sol_bas;
    }
  }
  else if((_1122_which == ::mosek::fusion::SolutionType::Integer))
  {
    {
      _1123_res = sol_itg;
    }
  }
  {}
  if ((NULL == _1123_res.get()))
  {
    {
      return ::mosek::fusion::ProblemStatus::Unknown;
    }
  }
  else
  {
    {
      return mosek::fusion::p_SolutionStruct::_get_impl(_1123_res)->probstatus;
    }
  }
}
// End mosek.fusion.Model.getProblemStatus

// Begin mosek.fusion.Model.getDualSolutionStatus
// Method mosek.fusion.Model.getDualSolutionStatus @ bld/grindsted/final/default/src/fusion/Model.mbi:3321:6-122
mosek::fusion::SolutionStatus mosek::fusion::Model :: getDualSolutionStatus(mosek::fusion::SolutionType _1124_which) { return mosek::fusion::p_Model::_get_impl(this)->getDualSolutionStatus(_1124_which); }
mosek::fusion::SolutionStatus mosek::fusion::p_Model::getDualSolutionStatus(mosek::fusion::SolutionType _1124_which)
{
  return getSolutionStatus(_1124_which,false);
}
// End mosek.fusion.Model.getDualSolutionStatus

// Begin mosek.fusion.Model.getPrimalSolutionStatus
// Method mosek.fusion.Model.getPrimalSolutionStatus @ bld/grindsted/final/default/src/fusion/Model.mbi:3315:6-128
mosek::fusion::SolutionStatus mosek::fusion::Model :: getPrimalSolutionStatus(mosek::fusion::SolutionType _1125_which) { return mosek::fusion::p_Model::_get_impl(this)->getPrimalSolutionStatus(_1125_which); }
mosek::fusion::SolutionStatus mosek::fusion::p_Model::getPrimalSolutionStatus(mosek::fusion::SolutionType _1125_which)
{
  return getSolutionStatus(_1125_which,true);
}
// End mosek.fusion.Model.getPrimalSolutionStatus

// Begin mosek.fusion.Model.getSolutionStatus
// Method mosek.fusion.Model.getSolutionStatus @ bld/grindsted/final/default/src/fusion/Model.mbi:3298:6-3309:7
mosek::fusion::SolutionStatus mosek::fusion::p_Model::getSolutionStatus(mosek::fusion::SolutionType _1126_which,bool _1127_primal)
{
  /* Try @ bld/grindsted/final/default/src/fusion/Model.mbi:3299:8-3308:9 */
  try
  {
    {
      monty::rc_ptr< ::mosek::fusion::SolutionStruct > _1129_sol = __mosek_2fusion_2Model__get_sol_cache(_1126_which,_1127_primal,true);
      if (_1127_primal)
      {
        {
          return mosek::fusion::p_SolutionStruct::_get_impl(_1129_sol)->pstatus;
        }
      }
      else
      {
        {
          return mosek::fusion::p_SolutionStruct::_get_impl(_1129_sol)->dstatus;
        }
      }
    }
  }
  catch (mosek::fusion::SolutionError _1128_e)
  {
    {
      return ::mosek::fusion::SolutionStatus::Undefined;
    }
  }
}
// End mosek.fusion.Model.getSolutionStatus

// Begin mosek.fusion.Model.update
// Method mosek.fusion.Model.update @ bld/grindsted/final/default/src/fusion/Model.mbi:3160:6-3294:7
void mosek::fusion::p_Model::update(std::shared_ptr< monty::ndarray< int32_t,1 > > _1130_conidxs,monty::rc_ptr< ::mosek::fusion::Expression > _1131_expr)
{
  _checked_ptr_1<int32_t> _ptr__1130_conidxs(_1130_conidxs ? _1130_conidxs->raw() : nullptr, _1130_conidxs ? _1130_conidxs->size(0) : 0);
  ::mosek::fusion::p_ExprDense::_new_ExprDense((::mosek::fusion::p_ExprOptimizeCode::_new_ExprOptimizeCode((::mosek::fusion::p_ExprCompress::_new_ExprCompress(_1131_expr)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>())->recursive_eval(ws,rs,xs,cache_evaluations);
  ws->pop_expr();
  int32_t _1132_nd = mosek::fusion::p_WorkStack::_get_impl(ws)->nd;
  int32_t _1133_shape_base = mosek::fusion::p_WorkStack::_get_impl(ws)->shape_base;
  int32_t _1134_nelem = mosek::fusion::p_WorkStack::_get_impl(ws)->nelem;
  int32_t _1135_nnz = mosek::fusion::p_WorkStack::_get_impl(ws)->nnz;
  bool _1136_hassp = mosek::fusion::p_WorkStack::_get_impl(ws)->hassp;
  int32_t _1137_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(ws)->ncodeatom;
  int32_t _1138_ptr_base = mosek::fusion::p_WorkStack::_get_impl(ws)->ptr_base;
  int32_t _1139_sp_base = mosek::fusion::p_WorkStack::_get_impl(ws)->sp_base;
  int32_t _1140_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(ws)->nidxs_base;
  int32_t _1141_cof_base = mosek::fusion::p_WorkStack::_get_impl(ws)->cof_base;
  int32_t _1142_code = mosek::fusion::p_WorkStack::_get_impl(ws)->code_base;
  int32_t _1143_codeptr = mosek::fusion::p_WorkStack::_get_impl(ws)->codeptr_base;
  int32_t _1144_cconst = mosek::fusion::p_WorkStack::_get_impl(ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1145_wi32 = mosek::fusion::p_WorkStack::_get_impl(ws)->i32;
  _checked_ptr_1<int32_t> _ptr__1145_wi32(_1145_wi32 ? _1145_wi32->raw() : nullptr,_1145_wi32 ? _1145_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1146_wi64 = mosek::fusion::p_WorkStack::_get_impl(ws)->i64;
  _checked_ptr_1<int64_t> _ptr__1146_wi64(_1146_wi64 ? _1146_wi64->raw() : nullptr,_1146_wi64 ? _1146_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1147_wf64 = mosek::fusion::p_WorkStack::_get_impl(ws)->f64;
  _checked_ptr_1<double> _ptr__1147_wf64(_1147_wf64 ? _1147_wf64->raw() : nullptr,_1147_wf64 ? _1147_wf64->size(0) : 0);
  int32_t _1148_num_lincon = (int)0;
  int32_t _9674_ = (int)0;
  int32_t _9675_ = _1134_nelem;
  for (int32_t _1149_i = _9674_; _1149_i < _9675_; ++_1149_i)
  {
    {
      if ((_ptr__1130_conidxs[_1149_i] >= (int)0))
      {
        {
          ++ _1148_num_lincon;
        }
      }
      {}
    }
  }
  int32_t _1150_num_concon = (_1134_nelem - _1148_num_lincon);
  if ((_1148_num_lincon == _1134_nelem))
  {
    {
      putarows(_1130_conidxs,ws,_1134_nelem,_1135_nnz,_1138_ptr_base,_1140_nidxs_base,_1141_cof_base);
      if ((_1137_ncodeatom > (int)0))
      {
        {
          con_blocks->replace_row_code(rs,_1130_conidxs,_1138_ptr_base,_1140_nidxs_base,_1143_codeptr,_1142_code,_1144_cconst);
        }
      }
      else
      {
        {
          con_blocks->clear_row_code(_1130_conidxs);
        }
      }
    }
  }
  else if((_1150_num_concon == _1134_nelem))
  {
    {
      std::vector<int32_t> _9676_;
      for (int32_t _1151_i = (int)0, _9677_ = _1134_nelem; _1151_i < _9677_ ; ++_1151_i)
      {
        _9676_.push_back((-safe_add( (int)1,_ptr__1130_conidxs[_1151_i] )));
      }
      auto _9678_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9676_.size()),_9676_.begin(),_9676_.end()));
      putfrows(_9678_,(int)0,ws,_1134_nelem,_1135_nnz,_1138_ptr_base,_1140_nidxs_base,_1141_cof_base);
      if ((_1137_ncodeatom > (int)0))
      {
        {
          std::vector<int32_t> _9679_;
          for (int32_t _1152_i = (int)0, _9680_ = _1134_nelem; _1152_i < _9680_ ; ++_1152_i)
          {
            _9679_.push_back((-safe_add( (int)1,_ptr__1130_conidxs[_1152_i] )));
          }
          auto _9681_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9679_.size()),_9679_.begin(),_9679_.end()));
          afe_blocks->replace_row_code(rs,_9681_,_1138_ptr_base,_1140_nidxs_base,_1143_codeptr,_1142_code,_1144_cconst);
        }
      }
      else
      {
        {
          std::vector<int32_t> _9682_;
          for (int32_t _1153_i = (int)0, _9683_ = _1134_nelem; _1153_i < _9683_ ; ++_1153_i)
          {
            _9682_.push_back((-safe_add( (int)1,_ptr__1130_conidxs[_1153_i] )));
          }
          auto _9684_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9682_.size()),_9682_.begin(),_9682_.end()));
          afe_blocks->clear_row_code(_9684_);
        }
      }
    }
  }
  else
  {
    {
      int32_t _1154_cncodeelm = (int)0;
      int32_t _1155_lncodeelm = (int)0;
      int32_t _1156_cnnz = (int)0;
      int32_t _1157_lnnz = (int)0;
      int32_t _9685_ = (int)0;
      int32_t _9686_ = _1134_nelem;
      for (int32_t _1158_i = _9685_; _1158_i < _9686_; ++_1158_i)
      {
        {
          if ((_ptr__1130_conidxs[_1158_i] >= (int)0))
          {
            {
              _1157_lnnz += (_ptr__1145_wi32[safe_add( safe_add( _1138_ptr_base,_1158_i ),(int)1 )] - _ptr__1145_wi32[safe_add( _1138_ptr_base,_1158_i )]);
            }
          }
          else
          {
            {
              _1156_cnnz += (_ptr__1145_wi32[safe_add( safe_add( _1138_ptr_base,_1158_i ),(int)1 )] - _ptr__1145_wi32[safe_add( _1138_ptr_base,_1158_i )]);
            }
          }
        }
      }
      int32_t _1159_lrowidx = xs->alloci32(_1148_num_lincon);
      int32_t _1160_crowidx = xs->alloci32(_1150_num_concon);
      int32_t _1161_lptr = xs->alloci32(safe_add( _1148_num_lincon,(int)1 ));
      int32_t _1162_cptr = xs->alloci32(safe_add( _1150_num_concon,(int)1 ));
      int32_t _1163_lnidxs = xs->alloci64(_1157_lnnz);
      int32_t _1164_cnidxs = xs->alloci64(_1156_cnnz);
      int32_t _1165_lcof = xs->allocf64(_1157_lnnz);
      int32_t _1166_ccof = xs->allocf64(_1156_cnnz);
      std::shared_ptr< monty::ndarray< double,1 > > _1167_xf64 = mosek::fusion::p_WorkStack::_get_impl(xs)->f64;
      _checked_ptr_1<double> _ptr__1167_xf64(_1167_xf64 ? _1167_xf64->raw() : nullptr,_1167_xf64 ? _1167_xf64->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _1168_xi64 = mosek::fusion::p_WorkStack::_get_impl(xs)->i64;
      _checked_ptr_1<int64_t> _ptr__1168_xi64(_1168_xi64 ? _1168_xi64->raw() : nullptr,_1168_xi64 ? _1168_xi64->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1169_xi32 = mosek::fusion::p_WorkStack::_get_impl(xs)->i32;
      _checked_ptr_1<int32_t> _ptr__1169_xi32(_1169_xi32 ? _1169_xi32->raw() : nullptr,_1169_xi32 ? _1169_xi32->size(0) : 0);
      _ptr__1169_xi32[_1161_lptr] = (int)0;
      _ptr__1169_xi32[_1162_cptr] = (int)0;
      int32_t _1170_ci = (int)0;
      int32_t _1171_li = (int)0;
      int32_t _1172_cnzi = (int)0;
      int32_t _1173_lnzi = (int)0;
      int32_t _9687_ = (int)0;
      int32_t _9688_ = _1134_nelem;
      for (int32_t _1174_i = _9687_; _1174_i < _9688_; ++_1174_i)
      {
        {
          int32_t _1175_pb = _ptr__1145_wi32[safe_add( _1138_ptr_base,_1174_i )];
          int32_t _1176_pe = _ptr__1145_wi32[safe_add( safe_add( _1138_ptr_base,_1174_i ),(int)1 )];
          if ((_ptr__1130_conidxs[_1174_i] >= (int)0))
          {
            {
              ::mosek::fusion::Utils::Tools::arraycopy(_1146_wi64,safe_add( _1140_nidxs_base,_1175_pb ),_1168_xi64,safe_add( _1163_lnidxs,_1173_lnzi ),(_1176_pe - _1175_pb));
              ::mosek::fusion::Utils::Tools::arraycopy(_1147_wf64,safe_add( _1141_cof_base,_1175_pb ),_1167_xf64,safe_add( _1165_lcof,_1173_lnzi ),(_1176_pe - _1175_pb));
              _1173_lnzi += (_1176_pe - _1175_pb);
              _ptr__1169_xi32[safe_add( _1159_lrowidx,_1171_li )] = _ptr__1130_conidxs[_1174_i];
              _ptr__1169_xi32[safe_add( safe_add( _1161_lptr,_1171_li ),(int)1 )] = _1173_lnzi;
              ++ _1171_li;
            }
          }
          else
          {
            {
              ::mosek::fusion::Utils::Tools::arraycopy(_1146_wi64,safe_add( _1140_nidxs_base,_1175_pb ),_1168_xi64,safe_add( _1164_cnidxs,_1172_cnzi ),(_1176_pe - _1175_pb));
              ::mosek::fusion::Utils::Tools::arraycopy(_1147_wf64,safe_add( _1141_cof_base,_1175_pb ),_1167_xf64,safe_add( _1166_ccof,_1172_cnzi ),(_1176_pe - _1175_pb));
              _1172_cnzi += (_1176_pe - _1175_pb);
              _ptr__1169_xi32[safe_add( _1160_crowidx,_1170_ci )] = (-safe_add( (int)1,_ptr__1130_conidxs[_1174_i] ));
              _ptr__1169_xi32[safe_add( safe_add( _1162_cptr,_1170_ci ),(int)1 )] = _1172_cnzi;
              ++ _1170_ci;
            }
          }
        }
      }
      std::vector<int32_t> _9689_;
      for (int32_t _1177_i = (int)0, _9690_ = _1148_num_lincon; _1177_i < _9690_ ; ++_1177_i)
      {
        _9689_.push_back(_ptr__1169_xi32[safe_add( _1159_lrowidx,_1177_i )]);
      }
      auto _9691_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9689_.size()),_9689_.begin(),_9689_.end()));
      putarows(_9691_,xs,_1148_num_lincon,_1157_lnnz,_1161_lptr,_1163_lnidxs,_1165_lcof);
      putfrows(_1169_xi32,_1160_crowidx,xs,_1150_num_concon,_1156_cnnz,_1162_cptr,_1164_cnidxs,_1166_ccof);
      if ((_1137_ncodeatom > (int)0))
      {
        {
          int32_t _9692_ = (int)0;
          int32_t _9693_ = _1134_nelem;
          for (int32_t _1178_i = _9692_; _1178_i < _9693_; ++_1178_i)
          {
            {
              if ((_ptr__1130_conidxs[_1178_i] >= (int)0))
              {
                {
                  _1155_lncodeelm += (_ptr__1145_wi32[safe_add( _1143_codeptr,_ptr__1145_wi32[safe_add( safe_add( _1138_ptr_base,_1178_i ),(int)1 )] )] - _ptr__1145_wi32[safe_add( _1143_codeptr,_ptr__1145_wi32[safe_add( _1138_ptr_base,_1178_i )] )]);
                }
              }
              else
              {
                {
                  _1154_cncodeelm += (_ptr__1145_wi32[safe_add( _1143_codeptr,_ptr__1145_wi32[safe_add( safe_add( _1138_ptr_base,_1178_i ),(int)1 )] )] - _ptr__1145_wi32[safe_add( _1143_codeptr,_ptr__1145_wi32[safe_add( _1138_ptr_base,_1178_i )] )]);
                }
              }
            }
          }
          int32_t _1179_lcodeptr = xs->alloci32(safe_add( _1157_lnnz,(int)1 ));
          int32_t _1180_ccodeptr = xs->alloci32(safe_add( _1156_cnnz,(int)1 ));
          int32_t _1181_lcode = xs->alloci32(_1155_lncodeelm);
          int32_t _1182_ccode = xs->alloci32(_1154_cncodeelm);
          int32_t _1183_lcconst = xs->allocf64(_1155_lncodeelm);
          int32_t _1184_ccconst = xs->allocf64(_1154_cncodeelm);
          _ptr__1169_xi32[_1179_lcodeptr] = (int)0;
          _ptr__1169_xi32[_1180_ccodeptr] = (int)0;
          int32_t _1185_ccodei = (int)0;
          int32_t _1186_lcodei = (int)0;
          int32_t _1187_rnzi = (int)0;
          int32_t _1188_lnzi = (int)0;
          int32_t _9694_ = (int)0;
          int32_t _9695_ = _1134_nelem;
          for (int32_t _1189_i = _9694_; _1189_i < _9695_; ++_1189_i)
          {
            {
              int32_t _1190_pb = _ptr__1145_wi32[safe_add( _1138_ptr_base,_1189_i )];
              int32_t _1191_pe = _ptr__1145_wi32[safe_add( safe_add( _1138_ptr_base,_1189_i ),(int)1 )];
              if ((_ptr__1130_conidxs[_1189_i] >= (int)0))
              {
                {
                  ::mosek::fusion::Utils::Tools::arraycopy(_1145_wi32,safe_add( _1142_code,_ptr__1145_wi32[safe_add( _1143_codeptr,_1190_pb )] ),_1169_xi32,safe_add( _1181_lcode,_1186_lcodei ),(_ptr__1145_wi32[safe_add( _1143_codeptr,_1191_pe )] - _ptr__1145_wi32[safe_add( _1143_codeptr,_1190_pb )]));
                  ::mosek::fusion::Utils::Tools::arraycopy(_1147_wf64,safe_add( _1144_cconst,_ptr__1145_wi32[safe_add( _1143_codeptr,_1190_pb )] ),_1167_xf64,safe_add( _1183_lcconst,_1186_lcodei ),(_ptr__1145_wi32[safe_add( _1143_codeptr,_1191_pe )] - _ptr__1145_wi32[safe_add( _1143_codeptr,_1190_pb )]));
                  int32_t _9696_ = _1190_pb;
                  int32_t _9697_ = _1191_pe;
                  for (int32_t _1192_j = _9696_; _1192_j < _9697_; ++_1192_j)
                  {
                    {
                      _1186_lcodei += (_ptr__1145_wi32[safe_add( safe_add( _1143_codeptr,_1192_j ),(int)1 )] - _ptr__1145_wi32[safe_add( _1143_codeptr,_1192_j )]);
                      _ptr__1169_xi32[safe_add( safe_add( _1179_lcodeptr,_1188_lnzi ),(int)1 )] = _1186_lcodei;
                      ++ _1188_lnzi;
                    }
                  }
                }
              }
              else
              {
                {
                  ::mosek::fusion::Utils::Tools::arraycopy(_1145_wi32,safe_add( _1142_code,_ptr__1145_wi32[safe_add( _1143_codeptr,_1190_pb )] ),_1169_xi32,safe_add( _1182_ccode,_1185_ccodei ),(_ptr__1145_wi32[safe_add( _1143_codeptr,_1191_pe )] - _ptr__1145_wi32[safe_add( _1143_codeptr,_1190_pb )]));
                  ::mosek::fusion::Utils::Tools::arraycopy(_1147_wf64,safe_add( _1144_cconst,_ptr__1145_wi32[safe_add( _1143_codeptr,_1190_pb )] ),_1167_xf64,safe_add( _1184_ccconst,_1185_ccodei ),(_ptr__1145_wi32[safe_add( _1143_codeptr,_1191_pe )] - _ptr__1145_wi32[safe_add( _1143_codeptr,_1190_pb )]));
                  int32_t _9698_ = _1190_pb;
                  int32_t _9699_ = _1191_pe;
                  for (int32_t _1193_j = _9698_; _1193_j < _9699_; ++_1193_j)
                  {
                    {
                      _1185_ccodei += (_ptr__1145_wi32[safe_add( safe_add( _1143_codeptr,_1193_j ),(int)1 )] - _ptr__1145_wi32[safe_add( _1143_codeptr,_1193_j )]);
                      _ptr__1169_xi32[safe_add( safe_add( _1180_ccodeptr,_1172_cnzi ),(int)1 )] = _1185_ccodei;
                      ++ _1172_cnzi;
                    }
                  }
                }
              }
            }
          }
          std::vector<int32_t> _9700_;
          for (int32_t _1194_i = (int)0, _9701_ = _1148_num_lincon; _1194_i < _9701_ ; ++_1194_i)
          {
            _9700_.push_back(_ptr__1169_xi32[safe_add( _1159_lrowidx,_1194_i )]);
          }
          auto _9702_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9700_.size()),_9700_.begin(),_9700_.end()));
          con_blocks->replace_row_code(xs,_9702_,_1161_lptr,_1163_lnidxs,_1179_lcodeptr,_1181_lcode,_1183_lcconst);
          std::vector<int32_t> _9703_;
          for (int32_t _1195_i = (int)0, _9704_ = _1150_num_concon; _1195_i < _9704_ ; ++_1195_i)
          {
            _9703_.push_back((int32_t)_ptr__1168_xi64[safe_add( _1160_crowidx,_1195_i )]);
          }
          auto _9705_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9703_.size()),_9703_.begin(),_9703_.end()));
          afe_blocks->replace_row_code(xs,_9705_,_1162_cptr,_1164_cnidxs,_1180_ccodeptr,_1182_ccode,_1184_ccconst);
        }
      }
      else
      {
        {
          std::vector<int32_t> _9706_;
          for (int32_t _1196_i = (int)0, _9707_ = _1148_num_lincon; _1196_i < _9707_ ; ++_1196_i)
          {
            _9706_.push_back(_ptr__1169_xi32[safe_add( _1159_lrowidx,_1196_i )]);
          }
          auto _9708_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9706_.size()),_9706_.begin(),_9706_.end()));
          con_blocks->clear_row_code(_9708_);
          std::vector<int32_t> _9709_;
          for (int32_t _1197_i = (int)0, _9710_ = _1150_num_concon; _1197_i < _9710_ ; ++_1197_i)
          {
            _9709_.push_back((int32_t)_ptr__1168_xi64[safe_add( _1160_crowidx,_1197_i )]);
          }
          auto _9711_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9709_.size()),_9709_.begin(),_9709_.end()));
          afe_blocks->clear_row_code(_9711_);
        }
      }
    }
  }
  xs->clear();
}
// End mosek.fusion.Model.update

// Begin mosek.fusion.Model.update
// Method mosek.fusion.Model.update @ bld/grindsted/final/default/src/fusion/Model.mbi:2945:6-3156:7
void mosek::fusion::p_Model::update(std::shared_ptr< monty::ndarray< int32_t,1 > > _1198_conidxs,monty::rc_ptr< ::mosek::fusion::Expression > _1199_expr,std::shared_ptr< monty::ndarray< int32_t,1 > > _1200_varidxs)
{
  _checked_ptr_1<int32_t> _ptr__1198_conidxs(_1198_conidxs ? _1198_conidxs->raw() : nullptr, _1198_conidxs ? _1198_conidxs->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__1200_varidxs(_1200_varidxs ? _1200_varidxs->raw() : nullptr, _1200_varidxs ? _1200_varidxs->size(0) : 0);
  int32_t _9712_ = (int)0;
  int32_t _9713_ = (int)((_1198_conidxs)->size(0));
  for (int32_t _1201_i = _9712_; _1201_i < _9713_; ++_1201_i)
  {
    {
      if (((_ptr__1198_conidxs[_1201_i] >= (int)0) && con_blocks->row_is_parameterized(_1201_i)))
      {
        {
          throw ::mosek::fusion::UpdateError(std::string ("Cannot update parameterized constraint"));
        }
      }
      else if(((_ptr__1198_conidxs[_1201_i] < (int)0) && con_blocks->row_is_parameterized((-safe_add( _1201_i,(int)1 )))))
      {
        {
          throw ::mosek::fusion::UpdateError(std::string ("Cannot update parameterized constraint"));
        }
      }
      {}
    }
  }
  ::mosek::fusion::p_ExprDense::_new_ExprDense((::mosek::fusion::p_ExprCompress::_new_ExprCompress(_1199_expr)).as<::mosek::fusion::Expression>())->recursive_eval(ws,rs,xs,cache_evaluations);
  ws->pop_expr();
  int32_t _1202_nd = mosek::fusion::p_WorkStack::_get_impl(ws)->nd;
  int32_t _1203_nelem = mosek::fusion::p_WorkStack::_get_impl(ws)->nelem;
  int32_t _1204_nnz = mosek::fusion::p_WorkStack::_get_impl(ws)->nnz;
  bool _1205_hassp = mosek::fusion::p_WorkStack::_get_impl(ws)->hassp;
  int32_t _1206_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(ws)->ncodeatom;
  int32_t _1207_shape_base = mosek::fusion::p_WorkStack::_get_impl(ws)->shape_base;
  int32_t _1208_ptr_base = mosek::fusion::p_WorkStack::_get_impl(ws)->ptr_base;
  int32_t _1209_sp_base = mosek::fusion::p_WorkStack::_get_impl(ws)->sp_base;
  int32_t _1210_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(ws)->nidxs_base;
  int32_t _1211_cof_base = mosek::fusion::p_WorkStack::_get_impl(ws)->cof_base;
  int32_t _1212_code = mosek::fusion::p_WorkStack::_get_impl(ws)->code_base;
  int32_t _1213_codeptr = mosek::fusion::p_WorkStack::_get_impl(ws)->codeptr_base;
  int32_t _1214_cconst = mosek::fusion::p_WorkStack::_get_impl(ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1215_wi32 = mosek::fusion::p_WorkStack::_get_impl(ws)->i32;
  _checked_ptr_1<int32_t> _ptr__1215_wi32(_1215_wi32 ? _1215_wi32->raw() : nullptr,_1215_wi32 ? _1215_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1216_wi64 = mosek::fusion::p_WorkStack::_get_impl(ws)->i64;
  _checked_ptr_1<int64_t> _ptr__1216_wi64(_1216_wi64 ? _1216_wi64->raw() : nullptr,_1216_wi64 ? _1216_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1217_wf64 = mosek::fusion::p_WorkStack::_get_impl(ws)->f64;
  _checked_ptr_1<double> _ptr__1217_wf64(_1217_wf64 ? _1217_wf64->raw() : nullptr,_1217_wf64 ? _1217_wf64->size(0) : 0);
  int32_t _1218_num_lincon = (int)0;
  int32_t _9714_ = (int)0;
  int32_t _9715_ = _1203_nelem;
  for (int32_t _1219_i = _9714_; _1219_i < _9715_; ++_1219_i)
  {
    {
      if ((_ptr__1198_conidxs[_1219_i] >= (int)0))
      {
        {
          ++ _1218_num_lincon;
        }
      }
      {}
    }
  }
  int32_t _1220_num_concon = (_1203_nelem - _1218_num_lincon);
  if (((_1218_num_lincon == _1203_nelem) || (_1220_num_concon == _1203_nelem)))
  {
    {
      int32_t _1221_N = safe_mul( (int)((_1198_conidxs)->size(0)),(int)((_1200_varidxs)->size(0)) );
      std::shared_ptr< monty::ndarray< double,1 > > _1222_cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1221_N)));
      _checked_ptr_1<double> _ptr__1222_cof(_1222_cof ? _1222_cof->raw() : nullptr,_1222_cof ? _1222_cof->size(0) : 0);
      int32_t _1223_nzi = (int)0;
      int32_t _9716_ = (int)0;
      int32_t _9717_ = _1203_nelem;
      for (int32_t _1224_i = _9716_; _1224_i < _9717_; ++_1224_i)
      {
        {
          int32_t _1225_p0 = _ptr__1215_wi32[safe_add( _1208_ptr_base,_1224_i )];
          int32_t _1226_p1 = _ptr__1215_wi32[safe_add( safe_add( _1208_ptr_base,_1224_i ),(int)1 )];
          int32_t _1227_p = _1225_p0;
          int32_t _1228_l = (int)0;
          while ( ((_1228_l < (int)((_1200_varidxs)->size(0))) && (_1227_p < _1226_p1)) )
          {
            {
              if ((_ptr__1200_varidxs[_1228_l] < _ptr__1216_wi64[safe_add( _1210_nidxs_base,_1227_p )]))
              {
                {
                  ++ _1228_l;
                }
              }
              else if((_ptr__1200_varidxs[_1228_l] > _ptr__1216_wi64[safe_add( _1210_nidxs_base,_1227_p )]))
              {
                {
                  ++ _1227_p;
                }
              }
              else
              {
                {
                  _ptr__1222_cof[safe_add( _1223_nzi,_1228_l )] = _ptr__1217_wf64[safe_add( _1211_cof_base,_1227_p )];
                  ++ _1228_l;
                  ++ _1227_p;
                }
              }
            }
          }
          _1223_nzi += (int)((_1200_varidxs)->size(0));
        }
      }
      std::vector<int32_t> _9718_;
      for (int32_t _1230_i = (int)0, _9719_ = _1203_nelem; _1230_i < _9719_ ; ++_1230_i)
      {
        for (int32_t _1231_j = (int)0, _9720_ = (int)((_1200_varidxs)->size(0)); _1231_j < _9720_ ; ++_1231_j)
        {
          _9718_.push_back(_ptr__1200_varidxs[_1231_j]);
        }
      }
      auto _9721_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9718_.size()),_9718_.begin(),_9718_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1229_subj = _9721_;
      _checked_ptr_1<int32_t> _ptr__1229_subj(_1229_subj ? _1229_subj->raw() : nullptr,_1229_subj ? _1229_subj->size(0) : 0);
      if ((_1218_num_lincon == _1203_nelem))
      {
        {
          std::vector<int32_t> _9722_;
          for (int32_t _1233_i = (int)0, _9723_ = _1203_nelem; _1233_i < _9723_ ; ++_1233_i)
          {
            for (int32_t _1234_j = (int)0, _9724_ = (int)((_1200_varidxs)->size(0)); _1234_j < _9724_ ; ++_1234_j)
            {
              _9722_.push_back(_ptr__1198_conidxs[_1233_i]);
            }
          }
          auto _9725_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9722_.size()),_9722_.begin(),_9722_.end()));
          std::shared_ptr< monty::ndarray< int32_t,1 > > _1232_subi = _9725_;
          _checked_ptr_1<int32_t> _ptr__1232_subi(_1232_subi ? _1232_subi->raw() : nullptr,_1232_subi ? _1232_subi->size(0) : 0);
          task_putaijlist(_1232_subi,_1229_subj,_1222_cof,(int64_t)(_1223_nzi));
          if ((_1206_ncodeatom > (int)0))
          {
            {
              con_blocks->replace_row_code(rs,_1198_conidxs,_1208_ptr_base,_1210_nidxs_base,_1213_codeptr,_1212_code,_1214_cconst);
            }
          }
          {}
        }
      }
      else
      {
        {
          std::vector<int32_t> _9726_;
          for (int32_t _1236_i = (int)0, _9727_ = _1203_nelem; _1236_i < _9727_ ; ++_1236_i)
          {
            for (int32_t _1237_j = (int)0, _9728_ = (int)((_1200_varidxs)->size(0)); _1237_j < _9728_ ; ++_1237_j)
            {
              _9726_.push_back((-safe_add( _ptr__1198_conidxs[_1236_i],(int)1 )));
            }
          }
          auto _9729_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9726_.size()),_9726_.begin(),_9726_.end()));
          std::shared_ptr< monty::ndarray< int32_t,1 > > _1235_subi = _9729_;
          _checked_ptr_1<int32_t> _ptr__1235_subi(_1235_subi ? _1235_subi->raw() : nullptr,_1235_subi ? _1235_subi->size(0) : 0);
          task_putafefijlist(_1235_subi,_1229_subj,_1222_cof);
          if ((_1206_ncodeatom > (int)0))
          {
            {
              std::vector<int32_t> _9730_;
              for (int32_t _1238_i = (int)0, _9731_ = _1203_nelem; _1238_i < _9731_ ; ++_1238_i)
              {
                _9730_.push_back((-safe_add( (int)1,_ptr__1198_conidxs[_1238_i] )));
              }
              auto _9732_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9730_.size()),_9730_.begin(),_9730_.end()));
              afe_blocks->replace_row_code(rs,_9732_,_1208_ptr_base,_1210_nidxs_base,_1213_codeptr,_1212_code,_1214_cconst);
            }
          }
          {}
        }
      }
    }
  }
  else
  {
    {
      int32_t _1239_cN = safe_mul( _1220_num_concon,(int)((_1200_varidxs)->size(0)) );
      int32_t _1240_lN = safe_mul( _1218_num_lincon,(int)((_1200_varidxs)->size(0)) );
      std::shared_ptr< monty::ndarray< double,1 > > _1241_lcof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1240_lN)));
      _checked_ptr_1<double> _ptr__1241_lcof(_1241_lcof ? _1241_lcof->raw() : nullptr,_1241_lcof ? _1241_lcof->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _1242_ccof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1239_cN)));
      _checked_ptr_1<double> _ptr__1242_ccof(_1242_ccof ? _1242_ccof->raw() : nullptr,_1242_ccof ? _1242_ccof->size(0) : 0);
      std::vector<int32_t> _9733_;
      for (int32_t _1244_i = (int)0, _9734_ = _1218_num_lincon; _1244_i < _9734_ ; ++_1244_i)
      {
        for (int32_t _1245_j = (int)0, _9735_ = (int)((_1200_varidxs)->size(0)); _1245_j < _9735_ ; ++_1245_j)
        {
          _9733_.push_back(_ptr__1200_varidxs[_1245_j]);
        }
      }
      auto _9736_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9733_.size()),_9733_.begin(),_9733_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1243_lsubj = _9736_;
      _checked_ptr_1<int32_t> _ptr__1243_lsubj(_1243_lsubj ? _1243_lsubj->raw() : nullptr,_1243_lsubj ? _1243_lsubj->size(0) : 0);
      std::vector<int32_t> _9737_;
      for (int32_t _1247_i = (int)0, _9738_ = _1220_num_concon; _1247_i < _9738_ ; ++_1247_i)
      {
        for (int32_t _1248_j = (int)0, _9739_ = (int)((_1200_varidxs)->size(0)); _1248_j < _9739_ ; ++_1248_j)
        {
          _9737_.push_back(_ptr__1200_varidxs[_1248_j]);
        }
      }
      auto _9740_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9737_.size()),_9737_.begin(),_9737_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1246_csubj = _9740_;
      _checked_ptr_1<int32_t> _ptr__1246_csubj(_1246_csubj ? _1246_csubj->raw() : nullptr,_1246_csubj ? _1246_csubj->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1249_lsubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1218_num_lincon)));
      _checked_ptr_1<int32_t> _ptr__1249_lsubi(_1249_lsubi ? _1249_lsubi->raw() : nullptr,_1249_lsubi ? _1249_lsubi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1250_csubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1220_num_concon)));
      _checked_ptr_1<int32_t> _ptr__1250_csubi(_1250_csubi ? _1250_csubi->raw() : nullptr,_1250_csubi ? _1250_csubi->size(0) : 0);
      int32_t _1251_crowi = (int)0;
      int32_t _1252_lrowi = (int)0;
      int32_t _1253_cncodeelm = (int)0;
      int32_t _1254_lncodeelm = (int)0;
      int32_t _1255_cnnz = (int)0;
      int32_t _1256_lnnz = (int)0;
      int32_t _9741_ = (int)0;
      int32_t _9742_ = _1203_nelem;
      for (int32_t _1257_i = _9741_; _1257_i < _9742_; ++_1257_i)
      {
        {
          int32_t _1258_p0 = _ptr__1215_wi32[safe_add( _1208_ptr_base,_1257_i )];
          int32_t _1259_p1 = _ptr__1215_wi32[safe_add( safe_add( _1208_ptr_base,_1257_i ),(int)1 )];
          int32_t _1260_p = _1258_p0;
          int32_t _1261_l = (int)0;
          if ((_ptr__1198_conidxs[_1257_i] >= (int)0))
          {
            {
              while ( ((_1261_l < (int)((_1200_varidxs)->size(0))) && (_1260_p < _1259_p1)) )
              {
                {
                  if ((_ptr__1200_varidxs[_1261_l] < _ptr__1216_wi64[safe_add( _1210_nidxs_base,_1260_p )]))
                  {
                    {
                      ++ _1261_l;
                    }
                  }
                  else if((_ptr__1200_varidxs[_1261_l] > _ptr__1216_wi64[safe_add( _1210_nidxs_base,_1260_p )]))
                  {
                    {
                      ++ _1260_p;
                    }
                  }
                  else
                  {
                    {
                      _ptr__1241_lcof[safe_add( _1256_lnnz,_1261_l )] = _ptr__1217_wf64[safe_add( _1211_cof_base,_1260_p )];
                      ++ _1261_l;
                      ++ _1260_p;
                    }
                  }
                }
              }
              int32_t _9743_ = (int)0;
              int32_t _9744_ = (int)((_1200_varidxs)->size(0));
              for (int32_t _1262_j = _9743_; _1262_j < _9744_; ++_1262_j)
              {
                {
                  _ptr__1249_lsubi[safe_add( _1256_lnnz,_1262_j )] = _ptr__1198_conidxs[_1257_i];
                }
              }
              _1256_lnnz += (int)((_1200_varidxs)->size(0));
            }
          }
          else
          {
            {
              while ( ((_1261_l < (int)((_1200_varidxs)->size(0))) && (_1260_p < _1259_p1)) )
              {
                {
                  if ((_ptr__1200_varidxs[_1261_l] < _ptr__1216_wi64[safe_add( _1210_nidxs_base,_1260_p )]))
                  {
                    {
                      ++ _1261_l;
                    }
                  }
                  else if((_ptr__1200_varidxs[_1261_l] > _ptr__1216_wi64[safe_add( _1210_nidxs_base,_1260_p )]))
                  {
                    {
                      ++ _1260_p;
                    }
                  }
                  else
                  {
                    {
                      _ptr__1242_ccof[safe_add( _1255_cnnz,_1261_l )] = _ptr__1217_wf64[safe_add( _1211_cof_base,_1260_p )];
                      ++ _1261_l;
                      ++ _1260_p;
                    }
                  }
                }
              }
              int32_t _9745_ = (int)0;
              int32_t _9746_ = (int)((_1200_varidxs)->size(0));
              for (int32_t _1263_j = _9745_; _1263_j < _9746_; ++_1263_j)
              {
                {
                  _ptr__1250_csubi[safe_add( _1255_cnnz,_1263_j )] = (-safe_add( (int)1,_ptr__1198_conidxs[_1257_i] ));
                }
              }
              _1255_cnnz += (int)((_1200_varidxs)->size(0));
            }
          }
        }
      }
      task_putaijlist(_1249_lsubi,_1243_lsubj,_1241_lcof,(int64_t)(_1256_lnnz));
      task_putafefijlist(_1250_csubi,_1246_csubj,_1242_ccof);
      if ((_1206_ncodeatom > (int)0))
      {
        {
          int32_t _9747_ = (int)0;
          int32_t _9748_ = _1203_nelem;
          for (int32_t _1264_i = _9747_; _1264_i < _9748_; ++_1264_i)
          {
            {
              if ((_ptr__1198_conidxs[_1264_i] >= (int)0))
              {
                {
                  _1256_lnnz += (_ptr__1215_wi32[safe_add( safe_add( _1208_ptr_base,_1264_i ),(int)1 )] - _ptr__1215_wi32[safe_add( _1208_ptr_base,_1264_i )]);
                }
              }
              else
              {
                {
                  _1255_cnnz += (_ptr__1215_wi32[safe_add( safe_add( _1208_ptr_base,_1264_i ),(int)1 )] - _ptr__1215_wi32[safe_add( _1208_ptr_base,_1264_i )]);
                }
              }
            }
          }
          std::shared_ptr< monty::ndarray< int32_t,1 > > _1265_lrowidx = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1218_num_lincon)));
          _checked_ptr_1<int32_t> _ptr__1265_lrowidx(_1265_lrowidx ? _1265_lrowidx->raw() : nullptr,_1265_lrowidx ? _1265_lrowidx->size(0) : 0);
          std::shared_ptr< monty::ndarray< int32_t,1 > > _1266_crowidx = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1220_num_concon)));
          _checked_ptr_1<int32_t> _ptr__1266_crowidx(_1266_crowidx ? _1266_crowidx->raw() : nullptr,_1266_crowidx ? _1266_crowidx->size(0) : 0);
          int32_t _1267_lptr = xs->alloci32(safe_add( _1218_num_lincon,(int)1 ));
          int32_t _1268_cptr = xs->alloci32(safe_add( _1220_num_concon,(int)1 ));
          int32_t _1269_lnidxs = xs->alloci64(_1256_lnnz);
          int32_t _1270_cnidxs = xs->alloci64(_1255_cnnz);
          std::shared_ptr< monty::ndarray< double,1 > > _1271_xf64 = mosek::fusion::p_WorkStack::_get_impl(xs)->f64;
          _checked_ptr_1<double> _ptr__1271_xf64(_1271_xf64 ? _1271_xf64->raw() : nullptr,_1271_xf64 ? _1271_xf64->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _1272_xi64 = mosek::fusion::p_WorkStack::_get_impl(xs)->i64;
          _checked_ptr_1<int64_t> _ptr__1272_xi64(_1272_xi64 ? _1272_xi64->raw() : nullptr,_1272_xi64 ? _1272_xi64->size(0) : 0);
          std::shared_ptr< monty::ndarray< int32_t,1 > > _1273_xi32 = mosek::fusion::p_WorkStack::_get_impl(xs)->i32;
          _checked_ptr_1<int32_t> _ptr__1273_xi32(_1273_xi32 ? _1273_xi32->raw() : nullptr,_1273_xi32 ? _1273_xi32->size(0) : 0);
          _ptr__1273_xi32[_1267_lptr] = (int)0;
          _ptr__1273_xi32[_1268_cptr] = (int)0;
          int32_t _1274_ci = (int)0;
          int32_t _1275_li = (int)0;
          int32_t _1276_cnzi = (int)0;
          int32_t _1277_lnzi = (int)0;
          int32_t _9749_ = (int)0;
          int32_t _9750_ = _1203_nelem;
          for (int32_t _1278_i = _9749_; _1278_i < _9750_; ++_1278_i)
          {
            {
              int32_t _1279_pb = _ptr__1215_wi32[safe_add( _1208_ptr_base,_1278_i )];
              int32_t _1280_pe = _ptr__1215_wi32[safe_add( safe_add( _1208_ptr_base,_1278_i ),(int)1 )];
              if ((_ptr__1198_conidxs[_1278_i] >= (int)0))
              {
                {
                  _1277_lnzi += (_1280_pe - _1279_pb);
                  _ptr__1265_lrowidx[_1275_li] = _ptr__1198_conidxs[_1278_i];
                  _ptr__1273_xi32[safe_add( safe_add( _1267_lptr,_1275_li ),(int)1 )] = _1277_lnzi;
                  ++ _1275_li;
                }
              }
              else
              {
                {
                  _1276_cnzi += (_1280_pe - _1279_pb);
                  _ptr__1266_crowidx[_1274_ci] = (-safe_add( (int)1,_ptr__1198_conidxs[_1278_i] ));
                  _ptr__1273_xi32[safe_add( safe_add( _1268_cptr,_1274_ci ),(int)1 )] = _1276_cnzi;
                  ++ _1274_ci;
                }
              }
            }
          }
          int32_t _9751_ = (int)0;
          int32_t _9752_ = _1203_nelem;
          for (int32_t _1281_i = _9751_; _1281_i < _9752_; ++_1281_i)
          {
            {
              if ((_ptr__1198_conidxs[_1281_i] >= (int)0))
              {
                {
                  _1254_lncodeelm += (_ptr__1215_wi32[safe_add( _1213_codeptr,_ptr__1215_wi32[safe_add( safe_add( _1208_ptr_base,_1281_i ),(int)1 )] )] - _ptr__1215_wi32[safe_add( _1213_codeptr,_ptr__1215_wi32[safe_add( _1208_ptr_base,_1281_i )] )]);
                }
              }
              else
              {
                {
                  _1253_cncodeelm += (_ptr__1215_wi32[safe_add( _1213_codeptr,_ptr__1215_wi32[safe_add( safe_add( _1208_ptr_base,_1281_i ),(int)1 )] )] - _ptr__1215_wi32[safe_add( _1213_codeptr,_ptr__1215_wi32[safe_add( _1208_ptr_base,_1281_i )] )]);
                }
              }
            }
          }
          int32_t _1282_lcodeptr = xs->alloci32(safe_add( _1256_lnnz,(int)1 ));
          int32_t _1283_ccodeptr = xs->alloci32(safe_add( _1255_cnnz,(int)1 ));
          int32_t _1284_lcode = xs->alloci32(_1254_lncodeelm);
          int32_t _1285_ccode = xs->alloci32(_1253_cncodeelm);
          int32_t _1286_lcconst = xs->allocf64(_1254_lncodeelm);
          int32_t _1287_ccconst = xs->allocf64(_1253_cncodeelm);
          _ptr__1273_xi32[_1282_lcodeptr] = (int)0;
          _ptr__1273_xi32[_1283_ccodeptr] = (int)0;
          int32_t _1288_ccodei = (int)0;
          int32_t _1289_lcodei = (int)0;
          int32_t _1290_rnzi = (int)0;
          int32_t _1291_lnzi = (int)0;
          int32_t _9753_ = (int)0;
          int32_t _9754_ = _1203_nelem;
          for (int32_t _1292_i = _9753_; _1292_i < _9754_; ++_1292_i)
          {
            {
              int32_t _1293_pb = _ptr__1215_wi32[safe_add( _1208_ptr_base,_1292_i )];
              int32_t _1294_pe = _ptr__1215_wi32[safe_add( safe_add( _1208_ptr_base,_1292_i ),(int)1 )];
              if ((_ptr__1198_conidxs[_1292_i] >= (int)0))
              {
                {
                  ::mosek::fusion::Utils::Tools::arraycopy(_1215_wi32,safe_add( _1212_code,_ptr__1215_wi32[safe_add( _1213_codeptr,_1293_pb )] ),_1273_xi32,safe_add( _1284_lcode,_1289_lcodei ),(_ptr__1215_wi32[safe_add( _1213_codeptr,_1294_pe )] - _ptr__1215_wi32[safe_add( _1213_codeptr,_1293_pb )]));
                  ::mosek::fusion::Utils::Tools::arraycopy(_1217_wf64,safe_add( _1214_cconst,_ptr__1215_wi32[safe_add( _1213_codeptr,_1293_pb )] ),_1271_xf64,safe_add( _1286_lcconst,_1289_lcodei ),(_ptr__1215_wi32[safe_add( _1213_codeptr,_1294_pe )] - _ptr__1215_wi32[safe_add( _1213_codeptr,_1293_pb )]));
                  int32_t _9755_ = _1293_pb;
                  int32_t _9756_ = _1294_pe;
                  for (int32_t _1295_j = _9755_; _1295_j < _9756_; ++_1295_j)
                  {
                    {
                      _1289_lcodei += (_ptr__1215_wi32[safe_add( safe_add( _1213_codeptr,_1295_j ),(int)1 )] - _ptr__1215_wi32[safe_add( _1213_codeptr,_1295_j )]);
                      _ptr__1273_xi32[safe_add( safe_add( _1282_lcodeptr,_1291_lnzi ),(int)1 )] = _1289_lcodei;
                      ++ _1291_lnzi;
                    }
                  }
                }
              }
              else
              {
                {
                  ::mosek::fusion::Utils::Tools::arraycopy(_1215_wi32,safe_add( _1212_code,_ptr__1215_wi32[safe_add( _1213_codeptr,_1293_pb )] ),_1273_xi32,safe_add( _1285_ccode,_1288_ccodei ),(_ptr__1215_wi32[safe_add( _1213_codeptr,_1294_pe )] - _ptr__1215_wi32[safe_add( _1213_codeptr,_1293_pb )]));
                  ::mosek::fusion::Utils::Tools::arraycopy(_1217_wf64,safe_add( _1214_cconst,_ptr__1215_wi32[safe_add( _1213_codeptr,_1293_pb )] ),_1271_xf64,safe_add( _1287_ccconst,_1288_ccodei ),(_ptr__1215_wi32[safe_add( _1213_codeptr,_1294_pe )] - _ptr__1215_wi32[safe_add( _1213_codeptr,_1293_pb )]));
                  int32_t _9757_ = _1293_pb;
                  int32_t _9758_ = _1294_pe;
                  for (int32_t _1296_j = _9757_; _1296_j < _9758_; ++_1296_j)
                  {
                    {
                      _1288_ccodei += (_ptr__1215_wi32[safe_add( safe_add( _1213_codeptr,_1296_j ),(int)1 )] - _ptr__1215_wi32[safe_add( _1213_codeptr,_1296_j )]);
                      _ptr__1273_xi32[safe_add( safe_add( _1283_ccodeptr,_1276_cnzi ),(int)1 )] = _1288_ccodei;
                      ++ _1276_cnzi;
                    }
                  }
                }
              }
            }
          }
          con_blocks->replace_row_code(xs,_1265_lrowidx,_1267_lptr,_1269_lnidxs,_1282_lcodeptr,_1284_lcode,_1286_lcconst);
          afe_blocks->replace_row_code(xs,_1266_crowidx,_1268_cptr,_1270_cnidxs,_1283_ccodeptr,_1285_ccode,_1287_ccconst);
        }
      }
      else
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _1297_lrowidx = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1218_num_lincon)));
          _checked_ptr_1<int32_t> _ptr__1297_lrowidx(_1297_lrowidx ? _1297_lrowidx->raw() : nullptr,_1297_lrowidx ? _1297_lrowidx->size(0) : 0);
          std::shared_ptr< monty::ndarray< int32_t,1 > > _1298_crowidx = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1220_num_concon)));
          _checked_ptr_1<int32_t> _ptr__1298_crowidx(_1298_crowidx ? _1298_crowidx->raw() : nullptr,_1298_crowidx ? _1298_crowidx->size(0) : 0);
          int32_t _1299_ci = (int)0;
          int32_t _1300_li = (int)0;
          int32_t _9759_ = (int)0;
          int32_t _9760_ = _1203_nelem;
          for (int32_t _1301_i = _9759_; _1301_i < _9760_; ++_1301_i)
          {
            {
              if ((_ptr__1198_conidxs[_1301_i] >= (int)0))
              {
                {
                  _ptr__1297_lrowidx[_1300_li] = _ptr__1198_conidxs[_1301_i];
                  ++ _1300_li;
                }
              }
              else
              {
                {
                  _ptr__1298_crowidx[_1299_ci] = (-safe_add( (int)1,_ptr__1198_conidxs[_1301_i] ));
                  ++ _1299_ci;
                }
              }
            }
          }
          con_blocks->clear_row_code(_1297_lrowidx);
          afe_blocks->clear_row_code(_1298_crowidx);
        }
      }
    }
  }
  xs->clear();
}
// End mosek.fusion.Model.update

// Begin mosek.fusion.Model.updateObjective
// Method mosek.fusion.Model.updateObjective @ bld/grindsted/final/default/src/fusion/Model.mbi:2857:6-2940:7
void mosek::fusion::Model :: updateObjective(monty::rc_ptr< ::mosek::fusion::Expression > _1302_expr,monty::rc_ptr< ::mosek::fusion::Variable > _1303_x) { mosek::fusion::p_Model::_get_impl(this)->updateObjective(_1302_expr,_1303_x); }
void mosek::fusion::p_Model::updateObjective(monty::rc_ptr< ::mosek::fusion::Expression > _1302_expr,monty::rc_ptr< ::mosek::fusion::Variable > _1303_x)
{
  if ((_1302_expr->getSize() != (int)1))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid expression size for objective"));
    }
  }
  {}
  if ((mosek::fusion::p_RowBlockManager::_get_impl(obj_blocks)->code_used > (int)0))
  {
    {
      throw ::mosek::fusion::UpdateError(std::string ("Cannot update parameterized constraint"));
    }
  }
  {}
  int32_t _1304_ni = _1303_x->numInst();
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1305_varidxs_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_1304_ni)));
  _checked_ptr_1<int64_t> _ptr__1305_varidxs_(_1305_varidxs_ ? _1305_varidxs_->raw() : nullptr,_1305_varidxs_ ? _1305_varidxs_->size(0) : 0);
  if ((_1304_ni < _1303_x->getSize()))
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _1306_sp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_1304_ni)));
      _checked_ptr_1<int64_t> _ptr__1306_sp(_1306_sp ? _1306_sp->raw() : nullptr,_1306_sp ? _1306_sp->size(0) : 0);
      _1303_x->inst((int)0,_1306_sp,(int)0,_1305_varidxs_);
    }
  }
  else
  {
    {
      _1303_x->inst((int)0,_1305_varidxs_);
    }
  }
  int32_t _9761_ = (int)0;
  int32_t _9762_ = _1304_ni;
  for (int32_t _1307_i = _9761_; _1307_i < _9762_; ++_1307_i)
  {
    {
      if ((_ptr__1305_varidxs_[_1307_i] < (int)0))
      {
        {
          throw ::mosek::fusion::UpdateError(std::string ("Updating semidefinite terms is currently not possible"));
        }
      }
      {}
    }
  }
  bool _1308_varidxs_issorted = true;
  int32_t _9763_ = (int)0;
  int32_t _9764_ = (_1304_ni - (int)1);
  for (int32_t _1309_i = _9763_; _1309_i < _9764_; ++_1309_i)
  {
    {
      _1308_varidxs_issorted = (_1308_varidxs_issorted && (_ptr__1305_varidxs_[_1309_i] < _ptr__1305_varidxs_[(_1309_i - (int)1)]));
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1310_varidxs = nullptr;
  _checked_ptr_1<int32_t> _ptr__1310_varidxs(_1310_varidxs ? _1310_varidxs->raw() : nullptr,_1310_varidxs ? _1310_varidxs->size(0) : 0);
  if (_1308_varidxs_issorted)
  {
    {
      std::vector<int32_t> _9765_;
      for (int32_t _1311_i = (int)0, _9766_ = _1304_ni; _1311_i < _9766_ ; ++_1311_i)
      {
        _9765_.push_back((int32_t)_ptr__1305_varidxs_[_1311_i]);
      }
      auto _9767_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9765_.size()),_9765_.begin(),_9765_.end()));
      _1310_varidxs = _9767_;
      _ptr__1310_varidxs.update(_1310_varidxs ? _1310_varidxs->raw() : nullptr, _1310_varidxs ? _1310_varidxs->size(0) : 0);
    }
  }
  else
  {
    {
      std::vector<int64_t> _9768_;
      for (int32_t _1313_i = (-(int)1), _9769_ = _1304_ni; _1313_i < _9769_ ; ++_1313_i)
      {
        _9768_.push_back(_1313_i);
      }
      auto _9770_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9768_.size()),_9768_.begin(),_9768_.end()));
      std::shared_ptr< monty::ndarray< int64_t,1 > > _1312_perm = _9770_;
      _checked_ptr_1<int64_t> _ptr__1312_perm(_1312_perm ? _1312_perm->raw() : nullptr,_1312_perm ? _1312_perm->size(0) : 0);
      ::mosek::fusion::p_CommonTools::argQsort(_1312_perm,_1305_varidxs_,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),(int64_t)((int)0),(int64_t)(_1304_ni));
      std::vector<int32_t> _9771_;
      for (int32_t _1314_i = (int)0, _9772_ = _1304_ni; _1314_i < _9772_ ; ++_1314_i)
      {
        _9771_.push_back((int32_t)_ptr__1305_varidxs_[_ptr__1312_perm[_1314_i]]);
      }
      auto _9773_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9771_.size()),_9771_.begin(),_9771_.end()));
      _1310_varidxs = _9773_;
      _ptr__1310_varidxs.update(_1310_varidxs ? _1310_varidxs->raw() : nullptr, _1310_varidxs ? _1310_varidxs->size(0) : 0);
    }
  }
  int32_t _1315_N = (int)((_1310_varidxs)->size(0));
  std::shared_ptr< monty::ndarray< double,1 > > _1316_cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1315_N)));
  _checked_ptr_1<double> _ptr__1316_cof(_1316_cof ? _1316_cof->raw() : nullptr,_1316_cof ? _1316_cof->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1317_subj = _1310_varidxs;
  _checked_ptr_1<int32_t> _ptr__1317_subj(_1317_subj ? _1317_subj->raw() : nullptr,_1317_subj ? _1317_subj->size(0) : 0);
  ::mosek::fusion::p_ExprDense::_new_ExprDense((::mosek::fusion::p_ExprCompress::_new_ExprCompress(_1302_expr)).as<::mosek::fusion::Expression>())->recursive_eval(ws,rs,xs,cache_evaluations);
  ws->pop_expr();
  {
  }
  int32_t _1318_nd = mosek::fusion::p_WorkStack::_get_impl(ws)->nd;
  int32_t _1319_nelem = mosek::fusion::p_WorkStack::_get_impl(ws)->nelem;
  int32_t _1320_nnz = mosek::fusion::p_WorkStack::_get_impl(ws)->nnz;
  bool _1321_hassp = mosek::fusion::p_WorkStack::_get_impl(ws)->hassp;
  int32_t _1322_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(ws)->ncodeatom;
  int32_t _1323_shape_base = mosek::fusion::p_WorkStack::_get_impl(ws)->shape_base;
  int32_t _1324_ptr_base = mosek::fusion::p_WorkStack::_get_impl(ws)->ptr_base;
  int32_t _1325_sp_base = mosek::fusion::p_WorkStack::_get_impl(ws)->sp_base;
  int32_t _1326_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(ws)->nidxs_base;
  int32_t _1327_cof_base = mosek::fusion::p_WorkStack::_get_impl(ws)->cof_base;
  int32_t _1328_code_base = mosek::fusion::p_WorkStack::_get_impl(ws)->code_base;
  int32_t _1329_codeptr_base = mosek::fusion::p_WorkStack::_get_impl(ws)->codeptr_base;
  int32_t _1330_cconst_base = mosek::fusion::p_WorkStack::_get_impl(ws)->cconst_base;
  {
  }
  if ((_1322_ncodeatom > (int)0))
  {
    {
      throw ::mosek::fusion::UpdateError(std::string ("Cannot update parameterized objective"));
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1331_wi32 = mosek::fusion::p_WorkStack::_get_impl(ws)->i32;
  _checked_ptr_1<int32_t> _ptr__1331_wi32(_1331_wi32 ? _1331_wi32->raw() : nullptr,_1331_wi32 ? _1331_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1332_wi64 = mosek::fusion::p_WorkStack::_get_impl(ws)->i64;
  _checked_ptr_1<int64_t> _ptr__1332_wi64(_1332_wi64 ? _1332_wi64->raw() : nullptr,_1332_wi64 ? _1332_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1333_wf64 = mosek::fusion::p_WorkStack::_get_impl(ws)->f64;
  _checked_ptr_1<double> _ptr__1333_wf64(_1333_wf64 ? _1333_wf64->raw() : nullptr,_1333_wf64 ? _1333_wf64->size(0) : 0);
  int32_t _1334_k = (int)0;
  int32_t _9774_ = (int)0;
  int32_t _9775_ = _1319_nelem;
  for (int32_t _1335_i = _9774_; _1335_i < _9775_; ++_1335_i)
  {
    {
      int32_t _1336_p0 = _ptr__1331_wi32[safe_add( _1324_ptr_base,_1335_i )];
      int32_t _1337_p1 = _ptr__1331_wi32[safe_add( safe_add( _1324_ptr_base,_1335_i ),(int)1 )];
      int32_t _1338_p = _1336_p0;
      int32_t _1339_l = (int)0;
      while ( ((_1339_l < (int)((_1310_varidxs)->size(0))) && (_1338_p < _1337_p1)) )
      {
        {
          if ((_ptr__1310_varidxs[_1339_l] < _ptr__1332_wi64[safe_add( _1326_nidxs_base,_1338_p )]))
          {
            {
              ++ _1339_l;
            }
          }
          else if((_ptr__1310_varidxs[_1339_l] > _ptr__1332_wi64[safe_add( _1326_nidxs_base,_1338_p )]))
          {
            {
              ++ _1338_p;
            }
          }
          else
          {
            {
              _ptr__1316_cof[safe_add( _1334_k,_1339_l )] = _ptr__1333_wf64[safe_add( _1327_cof_base,_1338_p )];
              ++ _1339_l;
              ++ _1338_p;
            }
          }
        }
      }
      _1334_k += (int)((_1310_varidxs)->size(0));
    }
  }
  task_putclist(_1317_subj,_1316_cof);
  if ((_1322_ncodeatom > (int)0))
  {
    {
      obj_blocks->replace_row_code(rs,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)0)}),_1324_ptr_base,_1326_nidxs_base,_1329_codeptr_base,_1328_code_base,_1330_cconst_base);
    }
  }
  {}
}
// End mosek.fusion.Model.updateObjective

// Begin mosek.fusion.Model.parameter_unchecked
// Method mosek.fusion.Model.parameter_unchecked @ bld/grindsted/final/default/src/fusion/Model.mbi:2809:6-2842:7
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter_unchecked(const std::string & _1340_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1341_shape,std::shared_ptr< monty::ndarray< int64_t,1 > > _1342_sp)
{
  _checked_ptr_1<int32_t> _ptr__1341_shape(_1341_shape ? _1341_shape->raw() : nullptr, _1341_shape ? _1341_shape->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__1342_sp(_1342_sp ? _1342_sp->raw() : nullptr, _1342_sp ? _1342_sp->size(0) : 0);
  if ((((int)((_1340_name).size()) > (int)0) && par_map->hasItem(_1340_name)))
  {
    {
      throw ::mosek::fusion::NameError(std::string ("Duplicate parameter name"));
    }
  }
  {}
  int64_t _1343_sz = ::mosek::fusion::p_Set::size(_1341_shape);
  int32_t _9776_;
  bool _9777_ = (NULL != _1342_sp.get());
  if (_9777_)
  {
    _9776_ = (int)((_1342_sp)->size(0));
  }
  else
  {
    _9776_ = (int32_t)_1343_sz;
  }
  int32_t _1344_nelem = _9776_;
  if ((NULL == param_value.get()))
  {
    {
      param_value = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1344_nelem)));
    }
  }
  else
  {
    {
      if ((safe_add( param_num,_1344_nelem ) > (int)((param_value)->size(0))))
      {
        {
          std::shared_ptr< monty::ndarray< double,1 > > _1345_old_param_value = param_value;
          _checked_ptr_1<double> _ptr__1345_old_param_value(_1345_old_param_value ? _1345_old_param_value->raw() : nullptr,_1345_old_param_value ? _1345_old_param_value->size(0) : 0);
          int32_t _9778_;
          bool _9779_ = (safe_mul( (int)2,(int)((_1345_old_param_value)->size(0)) ) > safe_add( (int)((_1345_old_param_value)->size(0)),_1344_nelem ));
          if (_9779_)
          {
            _9778_ = safe_mul( (int)2,(int)((_1345_old_param_value)->size(0)) );
          }
          else
          {
            _9778_ = safe_add( (int)((_1345_old_param_value)->size(0)),_1344_nelem );
          }
          int32_t _1346_new_len = _9778_;
          param_value = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1346_new_len)));
          if ((param_num > (int)0))
          {
            {
              ::mosek::fusion::Utils::Tools::arraycopy(_1345_old_param_value,(int)0,param_value,(int)0,param_num);
            }
          }
          {}
        }
      }
      {}
    }
  }
  std::vector<int32_t> _9780_;
  for (int32_t _1348_i = (int)0, _9781_ = (int32_t)_1344_nelem; _1348_i < _9781_ ; ++_1348_i)
  {
    _9780_.push_back(safe_add( param_num,_1348_i ));
  }
  auto _9782_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9780_.size()),_9780_.begin(),_9780_.end()));
  monty::rc_ptr< ::mosek::fusion::ParameterImpl > _1347_r = ::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(::mosek::fusion::Model::t(_pubthis),_1341_shape,_1342_sp,_9782_);
  param_num += _1344_nelem;
  if (((int)((_1340_name).size()) > (int)0))
  {
    {
      if (((NULL == parameters.get()) || (numparameter == (int)((parameters)->size(0)))))
      {
        {
          std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > > _1349_tmppar = parameters;
          std::vector<monty::rc_ptr< ::mosek::fusion::Parameter >> _9783_;
          for (int32_t _1350_i = (int)0, _9784_ = safe_add( safe_mul( numparameter,(int)2 ),(int)64 ); _1350_i < _9784_ ; ++_1350_i)
          {
            _9783_.push_back(nullptr);
          }
          auto _9785_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 >(monty::shape(_9783_.size()),_9783_.begin(),_9783_.end()));
          parameters = _9785_;
          int32_t _9786_ = (int)0;
          int32_t _9787_ = numparameter;
          for (int32_t _1351_i = _9786_; _1351_i < _9787_; ++_1351_i)
          {
            {
              ((*parameters)(_1351_i)) = ((*_1349_tmppar)(_1351_i));
            }
          }
        }
      }
      {}
      ((*parameters)(numparameter)) = (_1347_r).as<::mosek::fusion::Parameter>();
      par_map->setItem(_1340_name,numparameter);
      numparameter += (int)1;
    }
  }
  {}
  return (_1347_r).as<::mosek::fusion::Parameter>();
}
// End mosek.fusion.Model.parameter_unchecked

// Begin mosek.fusion.Model.parameter_
// Method mosek.fusion.Model.parameter_ @ bld/grindsted/final/default/src/fusion/Model.mbi:2793:6-2807:7
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter_(const std::string & _1352_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1353_shape,std::shared_ptr< monty::ndarray< int64_t,1 > > _1354_sp)
{
  _checked_ptr_1<int32_t> _ptr__1353_shape(_1353_shape ? _1353_shape->raw() : nullptr, _1353_shape ? _1353_shape->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__1354_sp(_1354_sp ? _1354_sp->raw() : nullptr, _1354_sp ? _1354_sp->size(0) : 0);
  bool _1355_sorted = true;
  int32_t _1356_nd = (int)((_1353_shape)->size(0));
  if (((NULL != _1354_sp.get()) && ((int)((_1354_sp)->size(0)) > (int)0)))
  {
    {
      bool _1357_ok = (_ptr__1354_sp[((int)((_1354_sp)->size(0)) - (int)1)] < ::mosek::fusion::p_Set::size(_1353_shape));
      int32_t _9788_ = (int)1;
      int32_t _9789_ = (int)((_1354_sp)->size(0));
      for (int32_t _1358_i = _9788_; _1358_i < _9789_; ++_1358_i)
      {
        {
          _1357_ok = (_1357_ok && (_ptr__1354_sp[(_1358_i - (int)1)] < _ptr__1354_sp[_1358_i]));
        }
      }
      if ((!_1357_ok))
      {
        {
          throw ::mosek::fusion::IndexError(std::string ("Unordered sparsity pattern"));
        }
      }
      {}
    }
  }
  {}
  return __mosek_2fusion_2Model__parameter_unchecked(_1352_name,_1353_shape,_1354_sp);
}
// End mosek.fusion.Model.parameter_

// Begin mosek.fusion.Model.parameter_
// Method mosek.fusion.Model.parameter_ @ bld/grindsted/final/default/src/fusion/Model.mbi:2770:6-2791:7
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter_(const std::string & _1359_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1360_shape,std::shared_ptr< monty::ndarray< int32_t,2 > > _1361_sparsity)
{
  _checked_ptr_1<int32_t> _ptr__1360_shape(_1360_shape ? _1360_shape->raw() : nullptr, _1360_shape ? _1360_shape->size(0) : 0);
  int32_t _1362_n = (int)((_1361_sparsity)->size(0));
  int32_t _1363_m = (int)((_1361_sparsity)->size(1));
  if (((int)((_1360_shape)->size(0)) != _1363_m))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Invalid sparsity"));
    }
  }
  {}
  if ((NULL == _1361_sparsity.get()))
  {
    {
      return __mosek_2fusion_2Model__parameter_unchecked(_1359_name,_1360_shape,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr));
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _1364_sp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_1362_n)));
      _checked_ptr_1<int64_t> _ptr__1364_sp(_1364_sp ? _1364_sp->raw() : nullptr,_1364_sp ? _1364_sp->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _1365_strides = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_1363_m)));
      _checked_ptr_1<int64_t> _ptr__1365_strides(_1365_strides ? _1365_strides->raw() : nullptr,_1365_strides ? _1365_strides->size(0) : 0);
      _ptr__1365_strides[(_1363_m - (int)1)] = (int)1;
      int32_t _9790_ = (int)1;
      int32_t _9791_ = _1363_m;
      for (int32_t _1366_i = _9790_; _1366_i < _9791_; ++_1366_i)
      {
        {
          _ptr__1365_strides[((_1363_m - (int)1) - _1366_i)] = safe_mul( _ptr__1365_strides[(_1363_m - _1366_i)],_ptr__1360_shape[(_1363_m - _1366_i)] );
        }
      }
      int32_t _9792_ = (int)0;
      int32_t _9793_ = _1362_n;
      for (int32_t _1367_i = _9792_; _1367_i < _9793_; ++_1367_i)
      {
        {
          _ptr__1364_sp[_1367_i] = (int)0;
          int32_t _9794_ = (int)0;
          int32_t _9795_ = _1363_m;
          for (int32_t _1368_j = _9794_; _1368_j < _9795_; ++_1368_j)
          {
            {
              _ptr__1364_sp[_1367_i] += safe_mul( ((*_1361_sparsity)(_1367_i,_1368_j)),_ptr__1365_strides[_1368_j] );
            }
          }
        }
      }
      return __mosek_2fusion_2Model__parameter_(_1359_name,_1360_shape,_1364_sp);
    }
  }
}
// End mosek.fusion.Model.parameter_

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2768:6-139
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(const std::string & _1369_name) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1369_name); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(const std::string &  _1369_name) { return __mosek_2fusion_2Model__parameter(_1369_name); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(const std::string & _1369_name)
{
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1370_sp = nullptr;
  _checked_ptr_1<int64_t> _ptr__1370_sp(_1370_sp ? _1370_sp->raw() : nullptr,_1370_sp ? _1370_sp->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(_1369_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),_1370_sp);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2767:6-159
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(const std::string & _1371_name,int32_t _1372_d1,int32_t _1373_d2,int32_t _1374_d3) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1371_name,_1372_d1,_1373_d2,_1374_d3); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(const std::string &  _1371_name,int32_t _1372_d1,int32_t _1373_d2,int32_t _1374_d3) { return __mosek_2fusion_2Model__parameter(_1371_name,_1372_d1,_1373_d2,_1374_d3); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(const std::string & _1371_name,int32_t _1372_d1,int32_t _1373_d2,int32_t _1374_d3)
{
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1375_sp = nullptr;
  _checked_ptr_1<int64_t> _ptr__1375_sp(_1375_sp ? _1375_sp->raw() : nullptr,_1375_sp ? _1375_sp->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(_1371_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1372_d1),(int32_t)(_1373_d2),(int32_t)(_1374_d3)}),_1375_sp);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2766:6-146
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(const std::string & _1376_name,int32_t _1377_d1,int32_t _1378_d2) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1376_name,_1377_d1,_1378_d2); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(const std::string &  _1376_name,int32_t _1377_d1,int32_t _1378_d2) { return __mosek_2fusion_2Model__parameter(_1376_name,_1377_d1,_1378_d2); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(const std::string & _1376_name,int32_t _1377_d1,int32_t _1378_d2)
{
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1379_sp = nullptr;
  _checked_ptr_1<int64_t> _ptr__1379_sp(_1379_sp ? _1379_sp->raw() : nullptr,_1379_sp ? _1379_sp->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(_1376_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1377_d1),(int32_t)(_1378_d2)}),_1379_sp);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2765:6-143
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(const std::string & _1380_name,int32_t _1381_d1) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1380_name,_1381_d1); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(const std::string &  _1380_name,int32_t _1381_d1) { return __mosek_2fusion_2Model__parameter(_1380_name,_1381_d1); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(const std::string & _1380_name,int32_t _1381_d1)
{
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1382_sp = nullptr;
  _checked_ptr_1<int64_t> _ptr__1382_sp(_1382_sp ? _1382_sp->raw() : nullptr,_1382_sp ? _1382_sp->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(_1380_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1381_d1)}),_1382_sp);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2764:6-134
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(const std::string & _1383_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1384_shape) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1383_name,_1384_shape); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(const std::string &  _1383_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1384_shape) { return __mosek_2fusion_2Model__parameter(_1383_name,_1384_shape); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(const std::string & _1383_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1384_shape)
{
  _checked_ptr_1<int32_t> _ptr__1384_shape(_1384_shape ? _1384_shape->raw() : nullptr, _1384_shape ? _1384_shape->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1385_sp = nullptr;
  _checked_ptr_1<int64_t> _ptr__1385_sp(_1385_sp ? _1385_sp->raw() : nullptr,_1385_sp ? _1385_sp->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(_1383_name,_1384_shape,_1385_sp);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2763:6-123
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(const std::string & _1386_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1387_shape,std::shared_ptr< monty::ndarray< int64_t,1 > > _1388_sp) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1386_name,_1387_shape,_1388_sp); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(const std::string &  _1386_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1387_shape,std::shared_ptr< monty::ndarray< int64_t,1 > > _1388_sp) { return __mosek_2fusion_2Model__parameter(_1386_name,_1387_shape,_1388_sp); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(const std::string & _1386_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1387_shape,std::shared_ptr< monty::ndarray< int64_t,1 > > _1388_sp)
{
  _checked_ptr_1<int32_t> _ptr__1387_shape(_1387_shape ? _1387_shape->raw() : nullptr, _1387_shape ? _1387_shape->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__1388_sp(_1388_sp ? _1388_sp->raw() : nullptr, _1388_sp ? _1388_sp->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(_1386_name,_1387_shape,_1388_sp);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2762:6-136
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(const std::string & _1389_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1390_shape,std::shared_ptr< monty::ndarray< int32_t,2 > > _1391_sparsity) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1389_name,_1390_shape,_1391_sparsity); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(const std::string &  _1389_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1390_shape,std::shared_ptr< monty::ndarray< int32_t,2 > > _1391_sparsity) { return __mosek_2fusion_2Model__parameter(_1389_name,_1390_shape,_1391_sparsity); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(const std::string & _1389_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1390_shape,std::shared_ptr< monty::ndarray< int32_t,2 > > _1391_sparsity)
{
  _checked_ptr_1<int32_t> _ptr__1390_shape(_1390_shape ? _1390_shape->raw() : nullptr, _1390_shape ? _1390_shape->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(_1389_name,_1390_shape,_1391_sparsity);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2760:6-126
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter() { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter() { return __mosek_2fusion_2Model__parameter(); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter()
{
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1392_sp = nullptr;
  _checked_ptr_1<int64_t> _ptr__1392_sp(_1392_sp ? _1392_sp->raw() : nullptr,_1392_sp ? _1392_sp->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),_1392_sp);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2759:6-145
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(int32_t _1393_d1,int32_t _1394_d2,int32_t _1395_d3) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1393_d1,_1394_d2,_1395_d3); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(int32_t _1393_d1,int32_t _1394_d2,int32_t _1395_d3) { return __mosek_2fusion_2Model__parameter(_1393_d1,_1394_d2,_1395_d3); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(int32_t _1393_d1,int32_t _1394_d2,int32_t _1395_d3)
{
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1396_sp = nullptr;
  _checked_ptr_1<int64_t> _ptr__1396_sp(_1396_sp ? _1396_sp->raw() : nullptr,_1396_sp ? _1396_sp->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1393_d1),(int32_t)(_1394_d2),(int32_t)(_1395_d3)}),_1396_sp);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2758:6-132
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(int32_t _1397_d1,int32_t _1398_d2) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1397_d1,_1398_d2); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(int32_t _1397_d1,int32_t _1398_d2) { return __mosek_2fusion_2Model__parameter(_1397_d1,_1398_d2); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(int32_t _1397_d1,int32_t _1398_d2)
{
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1399_sp = nullptr;
  _checked_ptr_1<int64_t> _ptr__1399_sp(_1399_sp ? _1399_sp->raw() : nullptr,_1399_sp ? _1399_sp->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1397_d1),(int32_t)(_1398_d2)}),_1399_sp);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2757:6-129
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(int32_t _1400_d1) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1400_d1); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(int32_t _1400_d1) { return __mosek_2fusion_2Model__parameter(_1400_d1); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(int32_t _1400_d1)
{
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1401_sp = nullptr;
  _checked_ptr_1<int64_t> _ptr__1401_sp(_1401_sp ? _1401_sp->raw() : nullptr,_1401_sp ? _1401_sp->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1400_d1)}),_1401_sp);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2756:6-120
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(std::shared_ptr< monty::ndarray< int32_t,1 > > _1402_shape) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1402_shape); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(std::shared_ptr< monty::ndarray< int32_t,1 > > _1402_shape) { return __mosek_2fusion_2Model__parameter(_1402_shape); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(std::shared_ptr< monty::ndarray< int32_t,1 > > _1402_shape)
{
  _checked_ptr_1<int32_t> _ptr__1402_shape(_1402_shape ? _1402_shape->raw() : nullptr, _1402_shape ? _1402_shape->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1403_sp = nullptr;
  _checked_ptr_1<int64_t> _ptr__1403_sp(_1403_sp ? _1403_sp->raw() : nullptr,_1403_sp ? _1403_sp->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(std::string (""),_1402_shape,_1403_sp);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2755:6-109
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(std::shared_ptr< monty::ndarray< int32_t,1 > > _1404_shape,std::shared_ptr< monty::ndarray< int64_t,1 > > _1405_sp) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1404_shape,_1405_sp); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(std::shared_ptr< monty::ndarray< int32_t,1 > > _1404_shape,std::shared_ptr< monty::ndarray< int64_t,1 > > _1405_sp) { return __mosek_2fusion_2Model__parameter(_1404_shape,_1405_sp); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(std::shared_ptr< monty::ndarray< int32_t,1 > > _1404_shape,std::shared_ptr< monty::ndarray< int64_t,1 > > _1405_sp)
{
  _checked_ptr_1<int32_t> _ptr__1404_shape(_1404_shape ? _1404_shape->raw() : nullptr, _1404_shape ? _1404_shape->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__1405_sp(_1405_sp ? _1405_sp->raw() : nullptr, _1405_sp ? _1405_sp->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(std::string (""),_1404_shape,_1405_sp);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.parameter
// Method mosek.fusion.Model.parameter @ bld/grindsted/final/default/src/fusion/Model.mbi:2754:6-122
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__parameter(std::shared_ptr< monty::ndarray< int32_t,1 > > _1406_shape,std::shared_ptr< monty::ndarray< int32_t,2 > > _1407_sparsity) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__parameter(_1406_shape,_1407_sparsity); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::parameter(std::shared_ptr< monty::ndarray< int32_t,1 > > _1406_shape,std::shared_ptr< monty::ndarray< int32_t,2 > > _1407_sparsity) { return __mosek_2fusion_2Model__parameter(_1406_shape,_1407_sparsity); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__parameter(std::shared_ptr< monty::ndarray< int32_t,1 > > _1406_shape,std::shared_ptr< monty::ndarray< int32_t,2 > > _1407_sparsity)
{
  _checked_ptr_1<int32_t> _ptr__1406_shape(_1406_shape ? _1406_shape->raw() : nullptr, _1406_shape ? _1406_shape->size(0) : 0);
  return __mosek_2fusion_2Model__parameter_(std::string (""),_1406_shape,_1407_sparsity);
}
// End mosek.fusion.Model.parameter

// Begin mosek.fusion.Model.objective_
// Method mosek.fusion.Model.objective_ @ bld/grindsted/final/default/src/fusion/Model.mbi:2658:6-2747:7
void mosek::fusion::p_Model::objective_(const std::string & _1408_name,mosek::fusion::ObjectiveSense _1409_sense,monty::rc_ptr< ::mosek::fusion::Expression > _1410_expr)
{
  task_putobjectivename(_1408_name);
  monty::rc_ptr< ::mosek::fusion::WorkStack > _1411_rs = ::mosek::fusion::p_WorkStack::_new_WorkStack();
  monty::rc_ptr< ::mosek::fusion::WorkStack > _1412_ws = ::mosek::fusion::p_WorkStack::_new_WorkStack();
  monty::rc_ptr< ::mosek::fusion::ExprDense > _1413_obje = ::mosek::fusion::p_ExprDense::_new_ExprDense((::mosek::fusion::p_ExprOptimizeCode::_new_ExprOptimizeCode((::mosek::fusion::p_ExprCompress::_new_ExprCompress(_1410_expr)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>());
  _1413_obje->recursive_eval(_1411_rs,_1412_ws,xs,cache_evaluations);
  _1411_rs->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1414_ri32 = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__1414_ri32(_1414_ri32 ? _1414_ri32->raw() : nullptr,_1414_ri32 ? _1414_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1415_ri64 = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__1415_ri64(_1415_ri64 ? _1415_ri64->raw() : nullptr,_1415_ri64 ? _1415_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1416_rf64 = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->f64;
  _checked_ptr_1<double> _ptr__1416_rf64(_1416_rf64 ? _1416_rf64->raw() : nullptr,_1416_rf64 ? _1416_rf64->size(0) : 0);
  int32_t _1417_nd = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->nd;
  int32_t _1418_nelem = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->nelem;
  int32_t _1419_nnz = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->nnz;
  bool _1420_hassp = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->hassp;
  int32_t _1421_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->ncodeatom;
  int32_t _1422_ptr_base = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->ptr_base;
  int32_t _1423_shape_base = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->shape_base;
  int32_t _1424_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->nidxs_base;
  int32_t _1425_cof_base = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->cof_base;
  int32_t _1426_code_base = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->code_base;
  int32_t _1427_codeptr_base = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->codeptr_base;
  int32_t _1428_cconst_base = mosek::fusion::p_WorkStack::_get_impl(_1411_rs)->cconst_base;
  int64_t _1429_totalsize = (int64_t)1;
  int32_t _9796_ = (int)0;
  int32_t _9797_ = _1417_nd;
  for (int32_t _1430_i = _9796_; _1430_i < _9797_; ++_1430_i)
  {
    {
      _1417_nd *= _ptr__1414_ri32[safe_add( _1423_shape_base,_1430_i )];
    }
  }
  if ((_1429_totalsize != (int)1))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Invalid expression size for objective"));
    }
  }
  {}
  if ((_1418_nelem != (int)1))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Invalid expression for objective"));
    }
  }
  {}
  int32_t _1431_linnz = (int)0;
  int32_t _1432_psdnz = (int)0;
  int32_t _9798_ = (int)0;
  int32_t _9799_ = _1419_nnz;
  for (int32_t _1433_i = _9798_; _1433_i < _9799_; ++_1433_i)
  {
    {
      if ((_ptr__1415_ri64[safe_add( _1424_nidxs_base,_1433_i )] < (int)0))
      {
        {
          ++ _1432_psdnz;
        }
      }
      else if((_ptr__1415_ri64[safe_add( _1424_nidxs_base,_1433_i )] >= (int)0))
      {
        {
          ++ _1431_linnz;
        }
      }
      {}
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1434_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1431_linnz)));
  _checked_ptr_1<int32_t> _ptr__1434_subj(_1434_subj ? _1434_subj->raw() : nullptr,_1434_subj ? _1434_subj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1435_cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1431_linnz)));
  _checked_ptr_1<double> _ptr__1435_cof(_1435_cof ? _1435_cof->raw() : nullptr,_1435_cof ? _1435_cof->size(0) : 0);
  {
    int32_t _1436_k = (int)0;
    int32_t _9800_ = (int)0;
    int32_t _9801_ = _1419_nnz;
    for (int32_t _1437_j = _9800_; _1437_j < _9801_; ++_1437_j)
    {
      {
        if ((_ptr__1415_ri64[safe_add( _1424_nidxs_base,_1437_j )] >= (int)0))
        {
          {
            _ptr__1434_subj[_1436_k] = (int32_t)_ptr__1415_ri64[safe_add( _1424_nidxs_base,_1437_j )];
            _ptr__1435_cof[_1436_k] = _ptr__1416_rf64[safe_add( _1425_cof_base,_1437_j )];
            ++ _1436_k;
          }
        }
        {}
      }
    }
  }
  task_putobjective((_1409_sense == ::mosek::fusion::ObjectiveSense::Maximize),_1434_subj,_1435_cof,0.0);
  if ((_1432_psdnz > (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1438_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1432_psdnz)));
      _checked_ptr_1<int32_t> _ptr__1438_subj(_1438_subj ? _1438_subj->raw() : nullptr,_1438_subj ? _1438_subj->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1439_subk = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1432_psdnz)));
      _checked_ptr_1<int32_t> _ptr__1439_subk(_1439_subk ? _1439_subk->raw() : nullptr,_1439_subk ? _1439_subk->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1440_subl = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1432_psdnz)));
      _checked_ptr_1<int32_t> _ptr__1440_subl(_1440_subl ? _1440_subl->raw() : nullptr,_1440_subl ? _1440_subl->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _1441_val = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1432_psdnz)));
      _checked_ptr_1<double> _ptr__1441_val(_1441_val ? _1441_val->raw() : nullptr,_1441_val ? _1441_val->size(0) : 0);
      int32_t _9802_ = (int)0;
      int32_t _9803_ = _1432_psdnz;
      for (int32_t _1442_i = _9802_; _1442_i < _9803_; ++_1442_i)
      {
        {
          int64_t _1443_varidx = (-safe_add( _ptr__1415_ri64[safe_add( _1424_nidxs_base,_1442_i )],(int)1 ));
          _ptr__1438_subj[_1442_i] = ((*barvar_block_elm_barj)(_1443_varidx));
          _ptr__1439_subk[_1442_i] = ((*barvar_block_elm_i)(_1443_varidx));
          _ptr__1440_subl[_1442_i] = ((*barvar_block_elm_j)(_1443_varidx));
          double _9804_;
          bool _9805_ = (_ptr__1439_subk[_1442_i] == _ptr__1440_subl[_1442_i]);
          if (_9805_)
          {
            _9804_ = _ptr__1416_rf64[safe_add( _1425_cof_base,_1442_i )];
          }
          else
          {
            _9804_ = (0.5 * _ptr__1416_rf64[safe_add( _1425_cof_base,_1442_i )]);
          }
          _ptr__1441_val[_1442_i] = _9804_;
        }
      }
      task_putbarc(_1438_subj,_1439_subk,_1440_subl,_1441_val);
    }
  }
  {}
  if ((_1421_ncodeatom > (int)0))
  {
    {
      obj_blocks->replace_row_code(_1411_rs,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)0)}),_1422_ptr_base,_1424_nidxs_base,_1427_codeptr_base,_1426_code_base,_1428_cconst_base);
    }
  }
  {}
}
// End mosek.fusion.Model.objective_

// Begin mosek.fusion.Model.objective
// Method mosek.fusion.Model.objective @ bld/grindsted/final/default/src/fusion/Model.mbi:2655:6-163
void mosek::fusion::Model :: objective(double _1444_c) { mosek::fusion::p_Model::_get_impl(this)->objective(_1444_c); }
void mosek::fusion::p_Model::objective(double _1444_c)
{
  objective_(std::string (""),::mosek::fusion::ObjectiveSense::Minimize,::mosek::fusion::p_Expr::constTerm(_1444_c));
}
// End mosek.fusion.Model.objective

// Begin mosek.fusion.Model.objective
// Method mosek.fusion.Model.objective @ bld/grindsted/final/default/src/fusion/Model.mbi:2654:6-145
void mosek::fusion::Model :: objective(mosek::fusion::ObjectiveSense _1445_sense,double _1446_c) { mosek::fusion::p_Model::_get_impl(this)->objective(_1445_sense,_1446_c); }
void mosek::fusion::p_Model::objective(mosek::fusion::ObjectiveSense _1445_sense,double _1446_c)
{
  objective_(std::string (""),_1445_sense,::mosek::fusion::p_Expr::constTerm(_1446_c));
}
// End mosek.fusion.Model.objective

// Begin mosek.fusion.Model.objective
// Method mosek.fusion.Model.objective @ bld/grindsted/final/default/src/fusion/Model.mbi:2653:6-132
void mosek::fusion::Model :: objective(mosek::fusion::ObjectiveSense _1447_sense,monty::rc_ptr< ::mosek::fusion::Expression > _1448_expr) { mosek::fusion::p_Model::_get_impl(this)->objective(_1447_sense,_1448_expr); }
void mosek::fusion::p_Model::objective(mosek::fusion::ObjectiveSense _1447_sense,monty::rc_ptr< ::mosek::fusion::Expression > _1448_expr)
{
  objective_(std::string (""),_1447_sense,_1448_expr);
}
// End mosek.fusion.Model.objective

// Begin mosek.fusion.Model.objective
// Method mosek.fusion.Model.objective @ bld/grindsted/final/default/src/fusion/Model.mbi:2652:6-165
void mosek::fusion::Model :: objective(const std::string & _1449_name,double _1450_c) { mosek::fusion::p_Model::_get_impl(this)->objective(_1449_name,_1450_c); }
void mosek::fusion::p_Model::objective(const std::string & _1449_name,double _1450_c)
{
  objective_(_1449_name,::mosek::fusion::ObjectiveSense::Minimize,::mosek::fusion::p_Expr::constTerm(_1450_c));
}
// End mosek.fusion.Model.objective

// Begin mosek.fusion.Model.objective
// Method mosek.fusion.Model.objective @ bld/grindsted/final/default/src/fusion/Model.mbi:2651:6-147
void mosek::fusion::Model :: objective(const std::string & _1451_name,mosek::fusion::ObjectiveSense _1452_sense,double _1453_c) { mosek::fusion::p_Model::_get_impl(this)->objective(_1451_name,_1452_sense,_1453_c); }
void mosek::fusion::p_Model::objective(const std::string & _1451_name,mosek::fusion::ObjectiveSense _1452_sense,double _1453_c)
{
  objective_(_1451_name,_1452_sense,::mosek::fusion::p_Expr::constTerm(_1453_c));
}
// End mosek.fusion.Model.objective

// Begin mosek.fusion.Model.objective
// Method mosek.fusion.Model.objective @ bld/grindsted/final/default/src/fusion/Model.mbi:2650:6-134
void mosek::fusion::Model :: objective(const std::string & _1454_name,mosek::fusion::ObjectiveSense _1455_sense,monty::rc_ptr< ::mosek::fusion::Expression > _1456_expr) { mosek::fusion::p_Model::_get_impl(this)->objective(_1454_name,_1455_sense,_1456_expr); }
void mosek::fusion::p_Model::objective(const std::string & _1454_name,mosek::fusion::ObjectiveSense _1455_sense,monty::rc_ptr< ::mosek::fusion::Expression > _1456_expr)
{
  objective_(_1454_name,_1455_sense,_1456_expr);
}
// End mosek.fusion.Model.objective

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2648:6-159
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _1457_exprdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1457_exprdom); }
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::Model::constraint(monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _1457_exprdom) { return __mosek_2fusion_2Model__constraint(_1457_exprdom); }
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _1457_exprdom)
{
  return __mosek_2fusion_2Model__constraint_(std::string (""),mosek::fusion::p_ExprRangeDomain::_get_impl(_1457_exprdom)->expr,mosek::fusion::p_ExprRangeDomain::_get_impl(_1457_exprdom)->dom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2646:6-159
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(const std::string & _1458_name,monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _1459_exprdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1458_name,_1459_exprdom); }
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::Model::constraint(const std::string &  _1458_name,monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _1459_exprdom) { return __mosek_2fusion_2Model__constraint(_1458_name,_1459_exprdom); }
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(const std::string & _1458_name,monty::rc_ptr< ::mosek::fusion::ExprRangeDomain > _1459_exprdom)
{
  return __mosek_2fusion_2Model__constraint_(_1458_name,mosek::fusion::p_ExprRangeDomain::_get_impl(_1459_exprdom)->expr,mosek::fusion::p_ExprRangeDomain::_get_impl(_1459_exprdom)->dom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2644:6-144
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::Expression > _1460_expr,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1461_rdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1460_expr,_1461_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::Model::constraint(monty::rc_ptr< ::mosek::fusion::Expression > _1460_expr,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1461_rdom) { return __mosek_2fusion_2Model__constraint(_1460_expr,_1461_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::Expression > _1460_expr,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1461_rdom)
{
  return __mosek_2fusion_2Model__constraint_(std::string (""),_1460_expr,_1461_rdom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2643:6-144
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(const std::string & _1462_name,monty::rc_ptr< ::mosek::fusion::Expression > _1463_expr,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1464_rdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1462_name,_1463_expr,_1464_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::Model::constraint(const std::string &  _1462_name,monty::rc_ptr< ::mosek::fusion::Expression > _1463_expr,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1464_rdom) { return __mosek_2fusion_2Model__constraint(_1462_name,_1463_expr,_1464_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(const std::string & _1462_name,monty::rc_ptr< ::mosek::fusion::Expression > _1463_expr,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1464_rdom)
{
  return __mosek_2fusion_2Model__constraint_(_1462_name,_1463_expr,_1464_rdom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2641:6-154
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::ExprConicDomain > _1465_exprdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1465_exprdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::constraint(monty::rc_ptr< ::mosek::fusion::ExprConicDomain > _1465_exprdom) { return __mosek_2fusion_2Model__constraint(_1465_exprdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::ExprConicDomain > _1465_exprdom)
{
  return __mosek_2fusion_2Model__constraint_(std::string (""),mosek::fusion::p_ExprConicDomain::_get_impl(_1465_exprdom)->expr,mosek::fusion::p_ExprConicDomain::_get_impl(_1465_exprdom)->dom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2639:6-154
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(const std::string & _1466_name,monty::rc_ptr< ::mosek::fusion::ExprConicDomain > _1467_exprdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1466_name,_1467_exprdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::constraint(const std::string &  _1466_name,monty::rc_ptr< ::mosek::fusion::ExprConicDomain > _1467_exprdom) { return __mosek_2fusion_2Model__constraint(_1466_name,_1467_exprdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(const std::string & _1466_name,monty::rc_ptr< ::mosek::fusion::ExprConicDomain > _1467_exprdom)
{
  return __mosek_2fusion_2Model__constraint_(_1466_name,mosek::fusion::p_ExprConicDomain::_get_impl(_1467_exprdom)->expr,mosek::fusion::p_ExprConicDomain::_get_impl(_1467_exprdom)->dom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2637:6-139
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::Expression > _1468_expr,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1469_qdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1468_expr,_1469_qdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::constraint(monty::rc_ptr< ::mosek::fusion::Expression > _1468_expr,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1469_qdom) { return __mosek_2fusion_2Model__constraint(_1468_expr,_1469_qdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::Expression > _1468_expr,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1469_qdom)
{
  return __mosek_2fusion_2Model__constraint_(std::string (""),_1468_expr,_1469_qdom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2636:6-139
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(const std::string & _1470_name,monty::rc_ptr< ::mosek::fusion::Expression > _1471_expr,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1472_qdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1470_name,_1471_expr,_1472_qdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::constraint(const std::string &  _1470_name,monty::rc_ptr< ::mosek::fusion::Expression > _1471_expr,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1472_qdom) { return __mosek_2fusion_2Model__constraint(_1470_name,_1471_expr,_1472_qdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(const std::string & _1470_name,monty::rc_ptr< ::mosek::fusion::Expression > _1471_expr,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1472_qdom)
{
  return __mosek_2fusion_2Model__constraint_(_1470_name,_1471_expr,_1472_qdom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2634:6-154
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _1473_exprdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1473_exprdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::constraint(monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _1473_exprdom) { return __mosek_2fusion_2Model__constraint(_1473_exprdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _1473_exprdom)
{
  return __mosek_2fusion_2Model__constraint_(std::string (""),mosek::fusion::p_ExprLinearDomain::_get_impl(_1473_exprdom)->expr,mosek::fusion::p_ExprLinearDomain::_get_impl(_1473_exprdom)->dom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2632:6-154
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(const std::string & _1474_name,monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _1475_exprdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1474_name,_1475_exprdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::constraint(const std::string &  _1474_name,monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _1475_exprdom) { return __mosek_2fusion_2Model__constraint(_1474_name,_1475_exprdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(const std::string & _1474_name,monty::rc_ptr< ::mosek::fusion::ExprLinearDomain > _1475_exprdom)
{
  return __mosek_2fusion_2Model__constraint_(_1474_name,mosek::fusion::p_ExprLinearDomain::_get_impl(_1475_exprdom)->expr,mosek::fusion::p_ExprLinearDomain::_get_impl(_1475_exprdom)->dom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2630:6-139
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::Expression > _1476_expr,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1477_ldom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1476_expr,_1477_ldom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::constraint(monty::rc_ptr< ::mosek::fusion::Expression > _1476_expr,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1477_ldom) { return __mosek_2fusion_2Model__constraint(_1476_expr,_1477_ldom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::Expression > _1476_expr,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1477_ldom)
{
  return __mosek_2fusion_2Model__constraint_(std::string (""),_1476_expr,_1477_ldom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2629:6-139
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(const std::string & _1478_name,monty::rc_ptr< ::mosek::fusion::Expression > _1479_expr,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1480_ldom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1478_name,_1479_expr,_1480_ldom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::constraint(const std::string &  _1478_name,monty::rc_ptr< ::mosek::fusion::Expression > _1479_expr,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1480_ldom) { return __mosek_2fusion_2Model__constraint(_1478_name,_1479_expr,_1480_ldom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(const std::string & _1478_name,monty::rc_ptr< ::mosek::fusion::Expression > _1479_expr,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1480_ldom)
{
  return __mosek_2fusion_2Model__constraint_(_1478_name,_1479_expr,_1480_ldom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2627:6-154
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::ExprPSDDomain > _1481_exprdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1481_exprdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::constraint(monty::rc_ptr< ::mosek::fusion::ExprPSDDomain > _1481_exprdom) { return __mosek_2fusion_2Model__constraint(_1481_exprdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::ExprPSDDomain > _1481_exprdom)
{
  return __mosek_2fusion_2Model__constraint_(std::string (""),mosek::fusion::p_ExprPSDDomain::_get_impl(_1481_exprdom)->expr,mosek::fusion::p_ExprPSDDomain::_get_impl(_1481_exprdom)->dom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2625:6-154
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(const std::string & _1482_name,monty::rc_ptr< ::mosek::fusion::ExprPSDDomain > _1483_exprdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1482_name,_1483_exprdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::constraint(const std::string &  _1482_name,monty::rc_ptr< ::mosek::fusion::ExprPSDDomain > _1483_exprdom) { return __mosek_2fusion_2Model__constraint(_1482_name,_1483_exprdom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(const std::string & _1482_name,monty::rc_ptr< ::mosek::fusion::ExprPSDDomain > _1483_exprdom)
{
  return __mosek_2fusion_2Model__constraint_(_1482_name,mosek::fusion::p_ExprPSDDomain::_get_impl(_1483_exprdom)->expr,mosek::fusion::p_ExprPSDDomain::_get_impl(_1483_exprdom)->dom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2623:6-141
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::Expression > _1484_expr,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1485_psddom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1484_expr,_1485_psddom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::constraint(monty::rc_ptr< ::mosek::fusion::Expression > _1484_expr,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1485_psddom) { return __mosek_2fusion_2Model__constraint(_1484_expr,_1485_psddom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(monty::rc_ptr< ::mosek::fusion::Expression > _1484_expr,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1485_psddom)
{
  return __mosek_2fusion_2Model__constraint_(std::string (""),_1484_expr,_1485_psddom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.constraint
// Method mosek.fusion.Model.constraint @ bld/grindsted/final/default/src/fusion/Model.mbi:2622:6-141
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__constraint(const std::string & _1486_name,monty::rc_ptr< ::mosek::fusion::Expression > _1487_expr,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1488_psddom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__constraint(_1486_name,_1487_expr,_1488_psddom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::constraint(const std::string &  _1486_name,monty::rc_ptr< ::mosek::fusion::Expression > _1487_expr,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1488_psddom) { return __mosek_2fusion_2Model__constraint(_1486_name,_1487_expr,_1488_psddom); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint(const std::string & _1486_name,monty::rc_ptr< ::mosek::fusion::Expression > _1487_expr,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1488_psddom)
{
  return __mosek_2fusion_2Model__constraint_(_1486_name,_1487_expr,_1488_psddom);
}
// End mosek.fusion.Model.constraint

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2611:6-170
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(monty::rc_ptr< ::mosek::fusion::PSDDomain > _1489_psddom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1489_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(monty::rc_ptr< ::mosek::fusion::PSDDomain > _1489_psddom) { return __mosek_2fusion_2Model__variable(_1489_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(monty::rc_ptr< ::mosek::fusion::PSDDomain > _1489_psddom)
{
  return __mosek_2fusion_2Model__variable_(std::string (""),mosek::fusion::p_PSDDomain::_get_impl(_1489_psddom)->shape,_1489_psddom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2610:6-172
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(int32_t _1490_n,int32_t _1491_m,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1492_psddom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1490_n,_1491_m,_1492_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(int32_t _1490_n,int32_t _1491_m,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1492_psddom) { return __mosek_2fusion_2Model__variable(_1490_n,_1491_m,_1492_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(int32_t _1490_n,int32_t _1491_m,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1492_psddom)
{
  return __mosek_2fusion_2Model__variable_(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1491_m),(int32_t)(_1490_n),(int32_t)(_1490_n)}),_1492_psddom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2609:6-172
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(int32_t _1493_n,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1494_psddom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1493_n,_1494_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(int32_t _1493_n,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1494_psddom) { return __mosek_2fusion_2Model__variable(_1493_n,_1494_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(int32_t _1493_n,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1494_psddom)
{
  return __mosek_2fusion_2Model__variable_(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1493_n),(int32_t)(_1493_n)}),_1494_psddom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2608:6-170
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1495_name,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1496_psddom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1495_name,_1496_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1495_name,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1496_psddom) { return __mosek_2fusion_2Model__variable(_1495_name,_1496_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1495_name,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1496_psddom)
{
  return __mosek_2fusion_2Model__variable_(_1495_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(nullptr),_1496_psddom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2607:6-172
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1497_name,int32_t _1498_n,int32_t _1499_m,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1500_psddom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1497_name,_1498_n,_1499_m,_1500_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1497_name,int32_t _1498_n,int32_t _1499_m,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1500_psddom) { return __mosek_2fusion_2Model__variable(_1497_name,_1498_n,_1499_m,_1500_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1497_name,int32_t _1498_n,int32_t _1499_m,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1500_psddom)
{
  return __mosek_2fusion_2Model__variable_(_1497_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1499_m),(int32_t)(_1498_n),(int32_t)(_1498_n)}),_1500_psddom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2606:6-172
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1501_name,int32_t _1502_n,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1503_psddom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1501_name,_1502_n,_1503_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1501_name,int32_t _1502_n,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1503_psddom) { return __mosek_2fusion_2Model__variable(_1501_name,_1502_n,_1503_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1501_name,int32_t _1502_n,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1503_psddom)
{
  return __mosek_2fusion_2Model__variable_(_1501_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1502_n),(int32_t)(_1502_n)}),_1503_psddom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2605:6-157
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1504_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1505_shp,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1506_psddom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1504_name,_1505_shp,_1506_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1504_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1505_shp,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1506_psddom) { return __mosek_2fusion_2Model__variable(_1504_name,_1505_shp,_1506_psddom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1504_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1505_shp,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1506_psddom)
{
  _checked_ptr_1<int32_t> _ptr__1505_shp(_1505_shp ? _1505_shp->raw() : nullptr, _1505_shp ? _1505_shp->size(0) : 0);
  return __mosek_2fusion_2Model__variable_(_1504_name,_1505_shp,_1506_psddom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2603:6-159
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(monty::rc_ptr< ::mosek::fusion::ConeDomain > _1507_qdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1507_qdom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(monty::rc_ptr< ::mosek::fusion::ConeDomain > _1507_qdom) { return __mosek_2fusion_2Model__variable(_1507_qdom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(monty::rc_ptr< ::mosek::fusion::ConeDomain > _1507_qdom)
{
  return __mosek_2fusion_2Model__variable_(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(nullptr),_1507_qdom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2602:6-159
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(monty::rc_ptr< ::mosek::fusion::RangeDomain > _1508_rdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1508_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::Model::variable(monty::rc_ptr< ::mosek::fusion::RangeDomain > _1508_rdom) { return __mosek_2fusion_2Model__variable(_1508_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(monty::rc_ptr< ::mosek::fusion::RangeDomain > _1508_rdom)
{
  return __mosek_2fusion_2Model__ranged_variable(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(nullptr),_1508_rdom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2601:6-159
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(monty::rc_ptr< ::mosek::fusion::LinearDomain > _1509_ldom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1509_ldom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(monty::rc_ptr< ::mosek::fusion::LinearDomain > _1509_ldom) { return __mosek_2fusion_2Model__variable(_1509_ldom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(monty::rc_ptr< ::mosek::fusion::LinearDomain > _1509_ldom)
{
  return __mosek_2fusion_2Model__variable_(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(nullptr),_1509_ldom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2600:6-159
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(std::shared_ptr< monty::ndarray< int32_t,1 > > _1510_shp,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1511_qdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1510_shp,_1511_qdom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(std::shared_ptr< monty::ndarray< int32_t,1 > > _1510_shp,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1511_qdom) { return __mosek_2fusion_2Model__variable(_1510_shp,_1511_qdom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(std::shared_ptr< monty::ndarray< int32_t,1 > > _1510_shp,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1511_qdom)
{
  _checked_ptr_1<int32_t> _ptr__1510_shp(_1510_shp ? _1510_shp->raw() : nullptr, _1510_shp ? _1510_shp->size(0) : 0);
  return __mosek_2fusion_2Model__variable_(std::string (""),_1510_shp,_1511_qdom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2599:6-159
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(std::shared_ptr< monty::ndarray< int32_t,1 > > _1512_shp,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1513_rdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1512_shp,_1513_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::Model::variable(std::shared_ptr< monty::ndarray< int32_t,1 > > _1512_shp,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1513_rdom) { return __mosek_2fusion_2Model__variable(_1512_shp,_1513_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(std::shared_ptr< monty::ndarray< int32_t,1 > > _1512_shp,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1513_rdom)
{
  _checked_ptr_1<int32_t> _ptr__1512_shp(_1512_shp ? _1512_shp->raw() : nullptr, _1512_shp ? _1512_shp->size(0) : 0);
  return __mosek_2fusion_2Model__ranged_variable(std::string (""),_1512_shp,_1513_rdom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2598:6-159
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(std::shared_ptr< monty::ndarray< int32_t,1 > > _1514_shp,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1515_ldom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1514_shp,_1515_ldom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(std::shared_ptr< monty::ndarray< int32_t,1 > > _1514_shp,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1515_ldom) { return __mosek_2fusion_2Model__variable(_1514_shp,_1515_ldom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(std::shared_ptr< monty::ndarray< int32_t,1 > > _1514_shp,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1515_ldom)
{
  _checked_ptr_1<int32_t> _ptr__1514_shp(_1514_shp ? _1514_shp->raw() : nullptr, _1514_shp ? _1514_shp->size(0) : 0);
  return __mosek_2fusion_2Model__variable_(std::string (""),_1514_shp,_1515_ldom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2597:6-162
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(std::shared_ptr< monty::ndarray< int32_t,1 > > _1516_shp) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1516_shp); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(std::shared_ptr< monty::ndarray< int32_t,1 > > _1516_shp) { return __mosek_2fusion_2Model__variable(_1516_shp); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(std::shared_ptr< monty::ndarray< int32_t,1 > > _1516_shp)
{
  _checked_ptr_1<int32_t> _ptr__1516_shp(_1516_shp ? _1516_shp->raw() : nullptr, _1516_shp ? _1516_shp->size(0) : 0);
  return __mosek_2fusion_2Model__variable_(std::string (""),_1516_shp,::mosek::fusion::p_Domain::unbounded());
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2596:6-161
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(int32_t _1517_size,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1518_qdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1517_size,_1518_qdom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(int32_t _1517_size,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1518_qdom) { return __mosek_2fusion_2Model__variable(_1517_size,_1518_qdom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(int32_t _1517_size,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1518_qdom)
{
  return __mosek_2fusion_2Model__variable_(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1517_size)}),_1518_qdom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2595:6-161
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(int32_t _1519_size,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1520_rdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1519_size,_1520_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::Model::variable(int32_t _1519_size,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1520_rdom) { return __mosek_2fusion_2Model__variable(_1519_size,_1520_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(int32_t _1519_size,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1520_rdom)
{
  return __mosek_2fusion_2Model__ranged_variable(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1519_size)}),_1520_rdom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2594:6-161
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(int32_t _1521_size,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1522_ldom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1521_size,_1522_ldom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(int32_t _1521_size,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1522_ldom) { return __mosek_2fusion_2Model__variable(_1521_size,_1522_ldom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(int32_t _1521_size,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1522_ldom)
{
  return __mosek_2fusion_2Model__variable_(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1521_size)}),_1522_ldom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2593:6-175
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(int32_t _1523_size) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1523_size); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(int32_t _1523_size) { return __mosek_2fusion_2Model__variable(_1523_size); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(int32_t _1523_size)
{
  return __mosek_2fusion_2Model__variable_(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1523_size)}),::mosek::fusion::p_Domain::unbounded());
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2592:6-175
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable() { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable() { return __mosek_2fusion_2Model__variable(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable()
{
  return __mosek_2fusion_2Model__variable_(std::string (""),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),::mosek::fusion::p_Domain::unbounded());
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2590:6-159
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1524_name,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1525_qdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1524_name,_1525_qdom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1524_name,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1525_qdom) { return __mosek_2fusion_2Model__variable(_1524_name,_1525_qdom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1524_name,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1525_qdom)
{
  return __mosek_2fusion_2Model__variable_(_1524_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(nullptr),_1525_qdom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2589:6-159
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1526_name,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1527_rdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1526_name,_1527_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::Model::variable(const std::string &  _1526_name,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1527_rdom) { return __mosek_2fusion_2Model__variable(_1526_name,_1527_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1526_name,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1527_rdom)
{
  return __mosek_2fusion_2Model__ranged_variable(_1526_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(nullptr),_1527_rdom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2588:6-159
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1528_name,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1529_ldom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1528_name,_1529_ldom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1528_name,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1529_ldom) { return __mosek_2fusion_2Model__variable(_1528_name,_1529_ldom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1528_name,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1529_ldom)
{
  return __mosek_2fusion_2Model__variable_(_1528_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(nullptr),_1529_ldom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2587:6-159
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1530_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1531_shp,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1532_qdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1530_name,_1531_shp,_1532_qdom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1530_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1531_shp,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1532_qdom) { return __mosek_2fusion_2Model__variable(_1530_name,_1531_shp,_1532_qdom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1530_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1531_shp,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1532_qdom)
{
  _checked_ptr_1<int32_t> _ptr__1531_shp(_1531_shp ? _1531_shp->raw() : nullptr, _1531_shp ? _1531_shp->size(0) : 0);
  return __mosek_2fusion_2Model__variable_(_1530_name,_1531_shp,_1532_qdom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2586:6-159
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1533_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1534_shp,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1535_rdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1533_name,_1534_shp,_1535_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::Model::variable(const std::string &  _1533_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1534_shp,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1535_rdom) { return __mosek_2fusion_2Model__variable(_1533_name,_1534_shp,_1535_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1533_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1534_shp,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1535_rdom)
{
  _checked_ptr_1<int32_t> _ptr__1534_shp(_1534_shp ? _1534_shp->raw() : nullptr, _1534_shp ? _1534_shp->size(0) : 0);
  return __mosek_2fusion_2Model__ranged_variable(_1533_name,_1534_shp,_1535_rdom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2585:6-159
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1536_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1537_shp,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1538_ldom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1536_name,_1537_shp,_1538_ldom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1536_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1537_shp,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1538_ldom) { return __mosek_2fusion_2Model__variable(_1536_name,_1537_shp,_1538_ldom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1536_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1537_shp,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1538_ldom)
{
  _checked_ptr_1<int32_t> _ptr__1537_shp(_1537_shp ? _1537_shp->raw() : nullptr, _1537_shp ? _1537_shp->size(0) : 0);
  return __mosek_2fusion_2Model__variable_(_1536_name,_1537_shp,_1538_ldom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2584:6-162
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1539_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1540_shp) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1539_name,_1540_shp); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1539_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1540_shp) { return __mosek_2fusion_2Model__variable(_1539_name,_1540_shp); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1539_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1540_shp)
{
  _checked_ptr_1<int32_t> _ptr__1540_shp(_1540_shp ? _1540_shp->raw() : nullptr, _1540_shp ? _1540_shp->size(0) : 0);
  return __mosek_2fusion_2Model__variable_(_1539_name,_1540_shp,::mosek::fusion::p_Domain::unbounded());
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2583:6-161
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1541_name,int32_t _1542_size,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1543_qdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1541_name,_1542_size,_1543_qdom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1541_name,int32_t _1542_size,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1543_qdom) { return __mosek_2fusion_2Model__variable(_1541_name,_1542_size,_1543_qdom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1541_name,int32_t _1542_size,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1543_qdom)
{
  return __mosek_2fusion_2Model__variable_(_1541_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1542_size)}),_1543_qdom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2582:6-161
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1544_name,int32_t _1545_size,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1546_rdom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1544_name,_1545_size,_1546_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::Model::variable(const std::string &  _1544_name,int32_t _1545_size,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1546_rdom) { return __mosek_2fusion_2Model__variable(_1544_name,_1545_size,_1546_rdom); }
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1544_name,int32_t _1545_size,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1546_rdom)
{
  return __mosek_2fusion_2Model__ranged_variable(_1544_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1545_size)}),_1546_rdom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2581:6-161
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1547_name,int32_t _1548_size,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1549_ldom) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1547_name,_1548_size,_1549_ldom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1547_name,int32_t _1548_size,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1549_ldom) { return __mosek_2fusion_2Model__variable(_1547_name,_1548_size,_1549_ldom); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1547_name,int32_t _1548_size,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1549_ldom)
{
  return __mosek_2fusion_2Model__variable_(_1547_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1548_size)}),_1549_ldom);
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2580:6-175
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1550_name,int32_t _1551_size) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1550_name,_1551_size); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1550_name,int32_t _1551_size) { return __mosek_2fusion_2Model__variable(_1550_name,_1551_size); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1550_name,int32_t _1551_size)
{
  return __mosek_2fusion_2Model__variable_(_1550_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_1551_size)}),::mosek::fusion::p_Domain::unbounded());
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.variable
// Method mosek.fusion.Model.variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2579:6-175
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__variable(const std::string & _1552_name) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__variable(_1552_name); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::variable(const std::string &  _1552_name) { return __mosek_2fusion_2Model__variable(_1552_name); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable(const std::string & _1552_name)
{
  return __mosek_2fusion_2Model__variable_(_1552_name,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),::mosek::fusion::p_Domain::unbounded());
}
// End mosek.fusion.Model.variable

// Begin mosek.fusion.Model.removeConstraintBlock
// Method mosek.fusion.Model.removeConstraintBlock @ bld/grindsted/final/default/src/fusion/Model.mbi:2570:6-2577:7
void mosek::fusion::p_Model::removeConstraintBlock(int32_t _1553_conid)
{
  if ((_1553_conid >= (int)0))
  {
    {
      con_release(_1553_conid);
    }
  }
  else
  {
    {
      acon_release((-safe_add( (int)1,_1553_conid )));
    }
  }
}
// End mosek.fusion.Model.removeConstraintBlock

// Begin mosek.fusion.Model.removeVariableBlock
// Method mosek.fusion.Model.removeVariableBlock @ bld/grindsted/final/default/src/fusion/Model.mbi:2542:6-2567:7
void mosek::fusion::p_Model::removeVariableBlock(int64_t _1554_varid64)
{
  if ((con_blocks->is_parameterized() || afe_blocks->is_parameterized()))
  {
    {
      throw ::mosek::fusion::DeletionError(std::string ("Cannot remove variables in parameterized model"));
    }
  }
  {}
  if ((_1554_varid64 < (int)0))
  {
    {
      throw ::mosek::fusion::DeletionError(std::string ("PSD variables cannot be removed"));
    }
  }
  else
  {
    {
      int32_t _1555_varid = (int32_t)_1554_varid64;
      int32_t _1556_sz = var_block_map->blocksize(_1555_varid);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1557_nidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1556_sz)));
      _checked_ptr_1<int32_t> _ptr__1557_nidxs(_1557_nidxs ? _1557_nidxs->raw() : nullptr,_1557_nidxs ? _1557_nidxs->size(0) : 0);
      var_block_map->get(_1555_varid,_1557_nidxs,(int)0);
      var_block_map->free(_1555_varid);
      int32_t _1558_conid = ((*var_block_acc_id)(_1555_varid));
      if ((_1558_conid >= (int)0))
      {
        {
          removeConstraintBlock(_1558_conid);
        }
      }
      {}
      task_var_putboundlist_fr(_1557_nidxs);
      task_clearacollist(_1557_nidxs);
    }
  }
}
// End mosek.fusion.Model.removeVariableBlock

// Begin mosek.fusion.Model.ranged_variable
// Method mosek.fusion.Model.ranged_variable @ bld/grindsted/final/default/src/fusion/Model.mbi:2313:6-2539:7
monty::rc_ptr< ::mosek::fusion::RangedVariable > mosek::fusion::p_Model::__mosek_2fusion_2Model__ranged_variable(const std::string & _1559_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1560_shp,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1561_dom_)
{
  _checked_ptr_1<int32_t> _ptr__1560_shp(_1560_shp ? _1560_shp->raw() : nullptr, _1560_shp ? _1560_shp->size(0) : 0);
  if ((((int)((_1559_name).size()) > (int)0) && hasVariable(_1559_name)))
  {
    {
      throw ::mosek::fusion::NameError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Duplicate variable name '"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1559_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"))->toString());
    }
  }
  {}
  monty::rc_ptr< ::mosek::fusion::RangeDomain > _1562_dom = mosek::fusion::p_RangeDomain::_get_impl(_1561_dom_.get())->__mosek_2fusion_2RangeDomain__finalize_and_validate(_1560_shp);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1563_shape = mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->shape;
  _checked_ptr_1<int32_t> _ptr__1563_shape(_1563_shape ? _1563_shape->raw() : nullptr,_1563_shape ? _1563_shape->size(0) : 0);
  int32_t _1564_nd = (int)((_1563_shape)->size(0));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1565_strides = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1564_nd)));
  _checked_ptr_1<int32_t> _ptr__1565_strides(_1565_strides ? _1565_strides->raw() : nullptr,_1565_strides ? _1565_strides->size(0) : 0);
  if ((_1564_nd > (int)0))
  {
    {
      _ptr__1565_strides[(_1564_nd - (int)1)] = (int)1;
      int32_t _9806_ = (int)1;
      int32_t _9807_ = _1564_nd;
      for (int32_t _1566_i = _9806_; _1566_i < _9807_; ++_1566_i)
      {
        {
          _ptr__1565_strides[((_1564_nd - _1566_i) - (int)1)] = safe_mul( _ptr__1565_strides[(_1564_nd - _1566_i)],_ptr__1563_shape[(_1564_nd - _1566_i)] );
        }
      }
    }
  }
  {}
  int32_t _1567_domsize = (int)1;
  int32_t _9808_ = (int)0;
  int32_t _9809_ = (int)((_1563_shape)->size(0));
  for (int32_t _1568_i = _9808_; _1568_i < _9809_; ++_1568_i)
  {
    {
      _1567_domsize *= _ptr__1563_shape[_1568_i];
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1569_axisptr = nullptr;
  _checked_ptr_1<int32_t> _ptr__1569_axisptr(_1569_axisptr ? _1569_axisptr->raw() : nullptr,_1569_axisptr ? _1569_axisptr->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1570_nameptr = nullptr;
  _checked_ptr_1<int64_t> _ptr__1570_nameptr(_1570_nameptr ? _1570_nameptr->raw() : nullptr,_1570_nameptr ? _1570_nameptr->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1571_axisnames = nullptr;
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1572_accaxisptr = nullptr;
  _checked_ptr_1<int64_t> _ptr__1572_accaxisptr(_1572_accaxisptr ? _1572_accaxisptr->raw() : nullptr,_1572_accaxisptr ? _1572_accaxisptr->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1573_accnameptr = nullptr;
  _checked_ptr_1<int64_t> _ptr__1573_accnameptr(_1573_accnameptr ? _1573_accnameptr->raw() : nullptr,_1573_accnameptr ? _1573_accnameptr->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1574_accaxisnames = nullptr;
  if ((((int)((_1559_name).size()) > (int)0) && (NULL != mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->indexnames.get())))
  {
    {
      monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1575_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
      monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1576_accsb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
      int32_t _1577_axisp = (int)0;
      int64_t _1578_namep = (int)0;
      int64_t _1579_numnames = (int)0;
      if (((int)((mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->indexnames)->size(0)) != _1564_nd))
      {
        {
          throw ::mosek::fusion::DomainError(std::string ("Invalid index name definition"));
        }
      }
      {}
      int32_t _9810_ = (int)0;
      int32_t _9811_ = (int)((mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->indexnames)->size(0));
      for (int32_t _1580_i = _9810_; _1580_i < _9811_; ++_1580_i)
      {
        {
          if ((NULL != ((*mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->indexnames)(_1580_i)).get()))
          {
            {
              if ((_ptr__1563_shape[_1580_i] != (int)((((*mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->indexnames)(_1580_i)))->size(0))))
              {
                {
                  throw ::mosek::fusion::DomainError(std::string ("Invalid index name definition"));
                }
              }
              {}
              _1579_numnames += _ptr__1563_shape[_1580_i];
            }
          }
          {}
        }
      }
      _1570_nameptr = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( _1579_numnames,(int)1 ))));
      _ptr__1570_nameptr.update(_1570_nameptr ? _1570_nameptr->raw() : nullptr, _1570_nameptr ? _1570_nameptr->size(0) : 0);
      std::vector<int32_t> _9812_;
      for (int32_t _1581_i = (int)0, _9813_ = _1564_nd; _1581_i < _9813_ ; ++_1581_i)
      {
        _9812_.push_back((-(int)1));
      }
      auto _9814_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9812_.size()),_9812_.begin(),_9812_.end()));
      _1569_axisptr = _9814_;
      _ptr__1569_axisptr.update(_1569_axisptr ? _1569_axisptr->raw() : nullptr, _1569_axisptr ? _1569_axisptr->size(0) : 0);
      int32_t _9815_ = (int)0;
      int32_t _9816_ = (int)((mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->indexnames)->size(0));
      for (int32_t _1582_i = _9815_; _1582_i < _9816_; ++_1582_i)
      {
        {
          if ((NULL != ((*mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->indexnames)(_1582_i)).get()))
          {
            {
              _ptr__1569_axisptr[_1582_i] = _1577_axisp;
              int32_t _9817_ = (int)0;
              int32_t _9818_ = _ptr__1563_shape[_1582_i];
              for (int32_t _1583_j = _9817_; _1583_j < _9818_; ++_1583_j)
              {
                {
                  _1575_sb->__mosek_2fusion_2Utils_2StringBuffer__a(((*((*mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->indexnames)(_1582_i)))(_1583_j)));
                  ++ _1577_axisp;
                  _1578_namep += (int)((((*((*mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->indexnames)(_1582_i)))(_1583_j))).size());
                  _ptr__1570_nameptr[_1577_axisp] = _1578_namep;
                }
              }
            }
          }
          {}
        }
      }
      _1571_axisnames = _1575_sb;
      _1574_accaxisnames = _1576_accsb;
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1584_sparsity = nullptr;
  _checked_ptr_1<int64_t> _ptr__1584_sparsity(_1584_sparsity ? _1584_sparsity->raw() : nullptr,_1584_sparsity ? _1584_sparsity->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1585_perm = nullptr;
  _checked_ptr_1<int32_t> _ptr__1585_perm(_1585_perm ? _1585_perm->raw() : nullptr,_1585_perm ? _1585_perm->size(0) : 0);
  if (mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->empty)
  {
    {
      _1584_sparsity = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)0)));
      _ptr__1584_sparsity.update(_1584_sparsity ? _1584_sparsity->raw() : nullptr, _1584_sparsity ? _1584_sparsity->size(0) : 0);
    }
  }
  else if((NULL != mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->sparsity.get()))
  {
    {
      if (((int)((mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->sparsity)->size(1)) != _1564_nd))
      {
        {
          throw ::mosek::fusion::SparseFormatError(std::string ("Sparsity pattern is not correct"));
        }
      }
      {}
      int32_t _1586_n = (int)((mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->sparsity)->size(0));
      _1584_sparsity = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_1586_n)));
      _ptr__1584_sparsity.update(_1584_sparsity ? _1584_sparsity->raw() : nullptr, _1584_sparsity ? _1584_sparsity->size(0) : 0);
      {
        bool _1587_err = false;
        std::shared_ptr< monty::ndarray< int32_t,2 > > _1588_sp = mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->sparsity;
        int32_t _9819_ = (int)0;
        int32_t _9820_ = _1586_n;
        for (int32_t _1589_i = _9819_; _1589_i < _9820_; ++_1589_i)
        {
          {
            int32_t _9821_ = (int)0;
            int32_t _9822_ = (int)((_1588_sp)->size(1));
            for (int32_t _1590_j = _9821_; _1590_j < _9822_; ++_1590_j)
            {
              {
                _1587_err = (_1587_err || ((((*_1588_sp)(_1589_i,_1590_j)) < (int)0) || (((*_1588_sp)(_1589_i,_1590_j)) >= _ptr__1563_shape[_1590_j])));
              }
            }
            if ((!_1587_err))
            {
              {
                int64_t _1591_linidx = (int)0;
                int32_t _9823_ = (int)0;
                int32_t _9824_ = (int)((_1588_sp)->size(1));
                for (int32_t _1592_j = _9823_; _1592_j < _9824_; ++_1592_j)
                {
                  {
                    _1591_linidx += safe_mul( _ptr__1565_strides[_1592_j],((*_1588_sp)(_1589_i,_1592_j)) );
                  }
                }
                _ptr__1584_sparsity[_1589_i] = _1591_linidx;
              }
            }
            {}
          }
        }
        if (_1587_err)
        {
          {
            throw ::mosek::fusion::SparseFormatError(std::string ("Sparsity pattern is out of bounds"));
          }
        }
        {}
      }
      std::shared_ptr< monty::ndarray< int32_t,2 > > _1593_midxs = mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->sparsity;
      int32_t _1594_maxdim = (int)0;
      int32_t _9825_ = (int)0;
      int32_t _9826_ = _1564_nd;
      for (int32_t _1595_i = _9825_; _1595_i < _9826_; ++_1595_i)
      {
        {
          if ((_1594_maxdim < _ptr__1563_shape[_1595_i]))
          {
            {
              _1594_maxdim = _ptr__1563_shape[_1595_i];
            }
          }
          {}
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1596_curperm = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1586_n)));
      _checked_ptr_1<int32_t> _ptr__1596_curperm(_1596_curperm ? _1596_curperm->raw() : nullptr,_1596_curperm ? _1596_curperm->size(0) : 0);
      int32_t _9827_ = (int)0;
      int32_t _9828_ = _1586_n;
      for (int32_t _1597_i = _9827_; _1597_i < _9828_; ++_1597_i)
      {
        {
          _ptr__1596_curperm[_1597_i] = _1597_i;
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1598_tgtperm = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1586_n)));
      _checked_ptr_1<int32_t> _ptr__1598_tgtperm(_1598_tgtperm ? _1598_tgtperm->raw() : nullptr,_1598_tgtperm ? _1598_tgtperm->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1599_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _1594_maxdim,(int)1 ))));
      _checked_ptr_1<int32_t> _ptr__1599_ptr(_1599_ptr ? _1599_ptr->raw() : nullptr,_1599_ptr ? _1599_ptr->size(0) : 0);
      int32_t _9829_ = (int)0;
      int32_t _9830_ = _1564_nd;
      for (int32_t _1600_dd = _9829_; _1600_dd < _9830_; ++_1600_dd)
      {
        {
          {
            int32_t _1601_d = ((_1564_nd - _1600_dd) - (int)1);
            int32_t _9831_ = (int)0;
            int32_t _9832_ = safe_add( _ptr__1563_shape[_1601_d],(int)1 );
            for (int32_t _1602_i = _9831_; _1602_i < _9832_; ++_1602_i)
            {
              {
                _ptr__1599_ptr[_1602_i] = (int)0;
              }
            }
            int32_t _9833_ = (int)0;
            int32_t _9834_ = _1586_n;
            for (int32_t _1603_i = _9833_; _1603_i < _9834_; ++_1603_i)
            {
              {
                ++ _ptr__1599_ptr[safe_add( ((*_1593_midxs)(_1603_i,_1601_d)),(int)1 )];
              }
            }
            int32_t _9835_ = (int)0;
            int32_t _9836_ = _ptr__1563_shape[_1601_d];
            for (int32_t _1604_i = _9835_; _1604_i < _9836_; ++_1604_i)
            {
              {
                _ptr__1599_ptr[safe_add( _1604_i,(int)1 )] += _ptr__1599_ptr[_1604_i];
              }
            }
            int32_t _9837_ = (int)0;
            int32_t _9838_ = _1586_n;
            for (int32_t _1605_ii = _9837_; _1605_ii < _9838_; ++_1605_ii)
            {
              {
                int32_t _1606_i = _ptr__1596_curperm[_1605_ii];
                _ptr__1598_tgtperm[_ptr__1599_ptr[((*_1593_midxs)(_1606_i,_1601_d))]] = _1606_i;
                ++ _ptr__1599_ptr[((*_1593_midxs)(_1606_i,_1601_d))];
              }
            }
          }
          std::shared_ptr< monty::ndarray< int32_t,1 > > _1607_tmp = _1596_curperm;
          _checked_ptr_1<int32_t> _ptr__1607_tmp(_1607_tmp ? _1607_tmp->raw() : nullptr,_1607_tmp ? _1607_tmp->size(0) : 0);
          _1596_curperm = _1598_tgtperm;
          _ptr__1596_curperm.update(_1596_curperm ? _1596_curperm->raw() : nullptr, _1596_curperm ? _1596_curperm->size(0) : 0);
          _1598_tgtperm = _1607_tmp;
          _ptr__1598_tgtperm.update(_1598_tgtperm ? _1598_tgtperm->raw() : nullptr, _1598_tgtperm ? _1598_tgtperm->size(0) : 0);
        }
      }
      int32_t _9839_ = (int)0;
      int32_t _9840_ = _1586_n;
      for (int32_t _1608_ii = _9839_; _1608_ii < _9840_; ++_1608_ii)
      {
        {
          int32_t _1609_i = _ptr__1596_curperm[_1608_ii];
          int64_t _1610_k = (int)0;
          int32_t _9841_ = (int)0;
          int32_t _9842_ = _1564_nd;
          for (int32_t _1611_j = _9841_; _1611_j < _9842_; ++_1611_j)
          {
            {
              _1610_k += safe_mul( _ptr__1565_strides[_1611_j],((*_1593_midxs)(_1609_i,_1611_j)) );
            }
          }
          _ptr__1584_sparsity[_1608_ii] = _1610_k;
        }
      }
    }
  }
  {}
  int32_t _9843_;
  bool _9844_ = (NULL != _1584_sparsity.get());
  if (_9844_)
  {
    _9843_ = (int)((_1584_sparsity)->size(0));
  }
  else
  {
    _9843_ = _1567_domsize;
  }
  int32_t _1612_nvaritems = _9843_;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1613_nativeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1612_nvaritems)));
  _checked_ptr_1<int32_t> _ptr__1613_nativeidxs(_1613_nativeidxs ? _1613_nativeidxs->raw() : nullptr,_1613_nativeidxs ? _1613_nativeidxs->size(0) : 0);
  int32_t _1614_varblockid = linearvar_alloc(_1612_nvaritems,_1613_nativeidxs);
  if (((int)((_1559_name).size()) > (int)0))
  {
    {
      var_map->setItem(_1559_name,_1614_varblockid);
      monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1615_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
      _1615_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_1559_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("["));
      if ((_1564_nd > (int)0))
      {
        {
          _1615_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("%0"));
          int32_t _9845_ = (int)1;
          int32_t _9846_ = _1564_nd;
          for (int32_t _1616_i = _9845_; _1616_i < _9846_; ++_1616_i)
          {
            {
              _1615_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",%"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1616_i);
            }
          }
        }
      }
      {}
      _1615_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("]"));
      if ((NULL != mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->indexnames.get()))
      {
        {
          task_format_var_names(_1613_nativeidxs,_1615_sb->toString(),_1563_shape,_1584_sparsity,mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->indexnames);
        }
      }
      else
      {
        {
          task_format_var_names(_1613_nativeidxs,_1615_sb->toString(),_1563_shape,_1584_sparsity,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(nullptr));
        }
      }
    }
  }
  {}
  std::shared_ptr< monty::ndarray< double,1 > > _1617_bl;
  _checked_ptr_1<double> _ptr__1617_bl(_1617_bl ? _1617_bl->raw() : nullptr,_1617_bl ? _1617_bl->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1618_bu;
  _checked_ptr_1<double> _ptr__1618_bu(_1618_bu ? _1618_bu->raw() : nullptr,_1618_bu ? _1618_bu->size(0) : 0);
  if (mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->scalable)
  {
    {
      std::vector<double> _9847_;
      for (int32_t _1619_i = (int)0, _9848_ = _1612_nvaritems; _1619_i < _9848_ ; ++_1619_i)
      {
        _9847_.push_back(((*mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->lb)((int)0)));
      }
      auto _9849_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_9847_.size()),_9847_.begin(),_9847_.end()));
      _1617_bl = _9849_;
      _ptr__1617_bl.update(_1617_bl ? _1617_bl->raw() : nullptr, _1617_bl ? _1617_bl->size(0) : 0);
      std::vector<double> _9850_;
      for (int32_t _1620_i = (int)0, _9851_ = _1612_nvaritems; _1620_i < _9851_ ; ++_1620_i)
      {
        _9850_.push_back(((*mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->ub)((int)0)));
      }
      auto _9852_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_9850_.size()),_9850_.begin(),_9850_.end()));
      _1618_bu = _9852_;
      _ptr__1618_bu.update(_1618_bu ? _1618_bu->raw() : nullptr, _1618_bu ? _1618_bu->size(0) : 0);
    }
  }
  else
  {
    {
      _1617_bl = mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->lb;
      _ptr__1617_bl.update(_1617_bl ? _1617_bl->raw() : nullptr, _1617_bl ? _1617_bl->size(0) : 0);
      _1618_bu = mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->ub;
      _ptr__1618_bu.update(_1618_bu ? _1618_bu->raw() : nullptr, _1618_bu ? _1618_bu->size(0) : 0);
    }
  }
  task_var_putboundlist_ra(_1613_nativeidxs,_1617_bl,_1618_bu);
  monty::rc_ptr< ::mosek::fusion::RangedVariable > _1621_res = ::mosek::fusion::p_RangedVariable::_new_RangedVariable(::mosek::fusion::Model::t(_pubthis),_1559_name,(int64_t)(_1614_varblockid),_1563_shape,_1584_sparsity,_1613_nativeidxs);
  if (mosek::fusion::p_RangeDomain::_get_impl(_1562_dom)->cardinal_flag)
  {
    {
      task_var_putintlist(_1613_nativeidxs);
    }
  }
  {}
  ((*vars)(_1614_varblockid)) = (_1621_res).as<::mosek::fusion::ModelVariable>();
  return _1621_res;
}
// End mosek.fusion.Model.ranged_variable

// Begin mosek.fusion.Model.variable_
// Method mosek.fusion.Model.variable_ @ bld/grindsted/final/default/src/fusion/Model.mbi:2040:6-2307:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable_(const std::string & _1622_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1623_shp,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1624_dom_)
{
  _checked_ptr_1<int32_t> _ptr__1623_shp(_1623_shp ? _1623_shp->raw() : nullptr, _1623_shp ? _1623_shp->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::ConeDomain > _1625_dom = mosek::fusion::p_ConeDomain::_get_impl(_1624_dom_.get())->__mosek_2fusion_2ConeDomain__finalize_and_validate(_1623_shp);
  if ((((int)((_1622_name).size()) > (int)0) && hasVariable(_1622_name)))
  {
    {
      throw ::mosek::fusion::NameError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Duplicate variable name '"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1622_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"))->toString());
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1626_shape = mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->shape;
  _checked_ptr_1<int32_t> _ptr__1626_shape(_1626_shape ? _1626_shape->raw() : nullptr,_1626_shape ? _1626_shape->size(0) : 0);
  int32_t _1627_nd = (int)((_1626_shape)->size(0));
  int32_t _1628_coneaxis = _1625_dom->getAxis();
  int32_t _1629_conesize = _ptr__1626_shape[_1628_coneaxis];
  int32_t _1630_d1 = (int)1;
  int32_t _1631_d0 = (int)1;
  int32_t _1632_domsize = (int)1;
  int32_t _9853_ = (int)0;
  int32_t _9854_ = _1627_nd;
  for (int32_t _1633_i = _9853_; _1633_i < _9854_; ++_1633_i)
  {
    {
      _1632_domsize *= _ptr__1626_shape[_1633_i];
    }
  }
  int32_t _9855_ = (int)0;
  int32_t _9856_ = _1628_coneaxis;
  for (int32_t _1634_i = _9855_; _1634_i < _9856_; ++_1634_i)
  {
    {
      _1631_d0 *= _ptr__1626_shape[_1634_i];
    }
  }
  int32_t _9857_ = safe_add( _1628_coneaxis,(int)1 );
  int32_t _9858_ = _1627_nd;
  for (int32_t _1635_i = _9857_; _1635_i < _9858_; ++_1635_i)
  {
    {
      _1630_d1 *= _ptr__1626_shape[_1635_i];
    }
  }
  int32_t _1636_numcone = safe_mul( _1631_d0,_1630_d1 );
  int64_t _1637_domainidx = (-(int)1);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1638_domainidxlist = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)0)));
  _checked_ptr_1<int64_t> _ptr__1638_domainidxlist(_1638_domainidxlist ? _1638_domainidxlist->raw() : nullptr,_1638_domainidxlist ? _1638_domainidxlist->size(0) : 0);
  if ((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InQCone))
  {
    {
      if ((_1629_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_1629_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for quadratic cone"))->toString());
        }
      }
      {}
      _1637_domainidx = task_append_domain_quad(_1629_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InRotatedQCone))
  {
    {
      if ((_1629_conesize < (int)3))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_1629_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for rotated quadratic cone"))->toString());
        }
      }
      {}
      _1637_domainidx = task_append_domain_rquad(_1629_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InPExpCone))
  {
    {
      if ((_1629_conesize != (int)3))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_1629_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for exponential cone"))->toString());
        }
      }
      {}
      _1637_domainidx = task_append_domain_pexp();
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InPPowCone))
  {
    {
      if ((_1629_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_1629_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for power cone"))->toString());
        }
      }
      {}
      _1637_domainidx = task_append_domain_ppow(_1629_conesize,mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->alpha);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InPPowConeSeq))
  {
    {
      _1638_domainidxlist = task_append_domain_ppow_seq(_1629_conesize,((int)((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->alpha)->size(0)) / _1636_numcone),mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->alpha);
      _ptr__1638_domainidxlist.update(_1638_domainidxlist ? _1638_domainidxlist->raw() : nullptr, _1638_domainidxlist ? _1638_domainidxlist->size(0) : 0);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InDExpCone))
  {
    {
      if ((_1629_conesize != (int)3))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_1629_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for dual exponential cone"))->toString());
        }
      }
      {}
      _1637_domainidx = task_append_domain_dexp();
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InDPowCone))
  {
    {
      if ((_1629_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_1629_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for dual power cone"))->toString());
        }
      }
      {}
      _1637_domainidx = task_append_domain_dpow(_1629_conesize,mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->alpha);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InDPowConeSeq))
  {
    {
      _1638_domainidxlist = task_append_domain_dpow_seq(_1629_conesize,((int)((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->alpha)->size(0)) / _1636_numcone),mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->alpha);
      _ptr__1638_domainidxlist.update(_1638_domainidxlist ? _1638_domainidxlist->raw() : nullptr, _1638_domainidxlist ? _1638_domainidxlist->size(0) : 0);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InPGeoMeanCone))
  {
    {
      if ((_1629_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_1629_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for primal geometric mean cone"))->toString());
        }
      }
      {}
      _1637_domainidx = task_append_domain_pgeomean(_1629_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InDGeoMeanCone))
  {
    {
      if ((_1629_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_1629_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for dual geometric mean cone"))->toString());
        }
      }
      {}
      _1637_domainidx = task_append_domain_dgeomean(_1629_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::Positive))
  {
    {
      _1637_domainidx = task_append_domain_rpos(_1629_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InSVecPSDCone))
  {
    {
      int32_t _1639_d = (int32_t)((::mosek::fusion::Utils::Tools::sqrt((double)(safe_add( (int)1,safe_mul( (int)8,_1629_conesize ) ))) - (int)1) / (int)2);
      if (((safe_mul( _1639_d,safe_add( _1639_d,(int)1 ) ) / (int)2) != _1629_conesize))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_1629_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for vector positive semidefinite cone"))->toString());
        }
      }
      {}
      _1637_domainidx = task_append_domain_svec_psd(_1629_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::Negative))
  {
    {
      _1637_domainidx = task_append_domain_rneg(_1629_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::Unbounded))
  {
    {
      _1637_domainidx = task_append_domain_r(_1629_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::Zero))
  {
    {
      _1637_domainidx = task_append_domain_rzero(_1629_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InPSDCone))
  {
    {
      if ((_1629_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_1629_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for positive semidefinite cone"))->toString());
        }
      }
      else
      {
        {
          int32_t _1640_d = (int32_t)((::mosek::fusion::Utils::Tools::sqrt((double)(safe_add( (int)1,safe_mul( (int)8,_1629_conesize ) ))) - (int)1) / (int)2);
          if (((safe_mul( _1640_d,safe_add( _1640_d,(int)1 ) ) / (int)2) != _1629_conesize))
          {
            {
              throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_1629_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for positive semidefinite cone"))->toString());
            }
          }
          {}
        }
      }
      _1637_domainidx = task_append_domain_svec_psd(_1629_conesize);
    }
  }
  else
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal error: Invalid cone type"));
    }
  }
  if (((mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InPPowConeSeq) || (mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->key == ::mosek::fusion::QConeKey::InDPowConeSeq)))
  {
    {
    }
  }
  else
  {
    {
      std::vector<int64_t> _9859_;
      for (int32_t _1641_i = (int)0, _9860_ = _1636_numcone; _1641_i < _9860_ ; ++_1641_i)
      {
        _9859_.push_back(_1637_domainidx);
      }
      auto _9861_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9859_.size()),_9859_.begin(),_9859_.end()));
      _1638_domainidxlist = _9861_;
      _ptr__1638_domainidxlist.update(_1638_domainidxlist ? _1638_domainidxlist->raw() : nullptr, _1638_domainidxlist ? _1638_domainidxlist->size(0) : 0);
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1642_nativeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_mul( _1636_numcone,_1629_conesize ))));
  _checked_ptr_1<int32_t> _ptr__1642_nativeidxs(_1642_nativeidxs ? _1642_nativeidxs->raw() : nullptr,_1642_nativeidxs ? _1642_nativeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1643_accidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1636_numcone)));
  _checked_ptr_1<int32_t> _ptr__1643_accidxs(_1643_accidxs ? _1643_accidxs->raw() : nullptr,_1643_accidxs ? _1643_accidxs->size(0) : 0);
  int32_t _1644_varid = conicvar_alloc(_1638_domainidxlist,_1629_conesize,_1636_numcone,_1643_accidxs,_1642_nativeidxs);
  task_var_putboundlist_fr(_1642_nativeidxs);
  if (mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->int_flag)
  {
    {
      task_var_putintlist(_1642_nativeidxs);
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1645_permidxs = _1642_nativeidxs;
  _checked_ptr_1<int32_t> _ptr__1645_permidxs(_1645_permidxs ? _1645_permidxs->raw() : nullptr,_1645_permidxs ? _1645_permidxs->size(0) : 0);
  if ((_1628_coneaxis < ((int)((_1626_shape)->size(0)) - (int)1)))
  {
    {
      _1645_permidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)((_1642_nativeidxs)->size(0)))));
      _ptr__1645_permidxs.update(_1645_permidxs ? _1645_permidxs->raw() : nullptr, _1645_permidxs ? _1645_permidxs->size(0) : 0);
      int32_t _1646_p = (int)0;
      int32_t _9862_ = (int)0;
      int32_t _9863_ = _1631_d0;
      for (int32_t _1647_i0 = _9862_; _1647_i0 < _9863_; ++_1647_i0)
      {
        {
          int32_t _9864_ = (int)0;
          int32_t _9865_ = _1630_d1;
          for (int32_t _1648_i1 = _9864_; _1648_i1 < _9865_; ++_1648_i1)
          {
            {
              int32_t _9866_ = (int)0;
              int32_t _9867_ = _1629_conesize;
              for (int32_t _1649_k = _9866_; _1649_k < _9867_; ++_1649_k)
              {
                {
                  _ptr__1645_permidxs[_1646_p] = _ptr__1642_nativeidxs[safe_add( safe_mul( safe_add( safe_mul( _1647_i0,_1629_conesize ),_1649_k ),_1630_d1 ),_1648_i1 )];
                  ++ _1646_p;
                }
              }
            }
          }
        }
      }
    }
  }
  {}
  monty::rc_ptr< ::mosek::fusion::ConicVariable > _1650_res = ::mosek::fusion::p_ConicVariable::_new_ConicVariable(::mosek::fusion::Model::t(_pubthis),_1622_name,_1644_varid,_1626_shape,_1642_nativeidxs);
  ((*vars)(_1644_varid)) = (_1650_res).as<::mosek::fusion::ModelVariable>();
  if (((int)((_1622_name).size()) > (int)0))
  {
    {
      monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1651_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
      {
        _1651_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_1622_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("["));
        if ((_1627_nd > (int)0))
        {
          {
            _1651_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("%0"));
            int32_t _9868_ = (int)1;
            int32_t _9869_ = _1627_nd;
            for (int32_t _1652_i = _9868_; _1652_i < _9869_; ++_1652_i)
            {
              {
                _1651_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",%"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1652_i);
              }
            }
          }
        }
        {}
        _1651_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("]"));
        if ((NULL != mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->indexnames.get()))
        {
          {
            task_format_var_names(_1645_permidxs,_1651_sb->toString(),_1626_shape,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->indexnames);
          }
        }
        else
        {
          {
            task_format_var_names(_1645_permidxs,_1651_sb->toString(),_1626_shape,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(nullptr));
          }
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1653_accidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1636_numcone)));
      _checked_ptr_1<int32_t> _ptr__1653_accidxs(_1653_accidxs ? _1653_accidxs->raw() : nullptr,_1653_accidxs ? _1653_accidxs->size(0) : 0);
      acc_block_map->get(((*var_block_acc_id)(_1644_varid)),_1653_accidxs,(int)0);
      {
        std::shared_ptr< monty::ndarray< int32_t,1 > > _1654_accshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(((int)((_1626_shape)->size(0)) - (int)1))));
        _checked_ptr_1<int32_t> _ptr__1654_accshape(_1654_accshape ? _1654_accshape->raw() : nullptr,_1654_accshape ? _1654_accshape->size(0) : 0);
        int32_t _9870_ = (int)0;
        int32_t _9871_ = _1628_coneaxis;
        for (int32_t _1655_i = _9870_; _1655_i < _9871_; ++_1655_i)
        {
          {
            _ptr__1654_accshape[_1655_i] = _ptr__1626_shape[_1655_i];
          }
        }
        int32_t _9872_ = safe_add( _1628_coneaxis,(int)1 );
        int32_t _9873_ = _1627_nd;
        for (int32_t _1656_i = _9872_; _1656_i < _9873_; ++_1656_i)
        {
          {
            _ptr__1654_accshape[(_1656_i - (int)1)] = _ptr__1626_shape[_1656_i];
          }
        }
        monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1657_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
        _1657_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_1622_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("["));
        if (((_1627_nd - (int)1) > (int)0))
        {
          {
            _1657_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("%0"));
            int32_t _9874_ = (int)1;
            int32_t _9875_ = (_1627_nd - (int)1);
            for (int32_t _1658_i = _9874_; _1658_i < _9875_; ++_1658_i)
            {
              {
                _1657_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",%"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1658_i);
              }
            }
          }
        }
        {}
        _1657_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("]"));
        if ((NULL != mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->indexnames.get()))
        {
          {
            std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _1659_indexnames = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape((_1627_nd - (int)1))));
            int32_t _9876_ = (int)0;
            int32_t _9877_ = _1628_coneaxis;
            for (int32_t _1660_i = _9876_; _1660_i < _9877_; ++_1660_i)
            {
              {
                ((*_1659_indexnames)(_1660_i)) = ((*mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->indexnames)(_1660_i));
              }
            }
            int32_t _9878_ = safe_add( _1628_coneaxis,(int)1 );
            int32_t _9879_ = _1627_nd;
            for (int32_t _1661_i = _9878_; _1661_i < _9879_; ++_1661_i)
            {
              {
                ((*_1659_indexnames)((_1661_i - (int)1))) = ((*mosek::fusion::p_ConeDomain::_get_impl(_1625_dom)->indexnames)(_1661_i));
              }
            }
            std::vector<int64_t> _9880_;
            for (int32_t _1662_i = (int)0, _9881_ = _1636_numcone; _1662_i < _9881_ ; ++_1662_i)
            {
              _9880_.push_back((int64_t)_ptr__1653_accidxs[_1662_i]);
            }
            auto _9882_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9880_.size()),_9880_.begin(),_9880_.end()));
            task_format_acc_names(_9882_,_1657_sb->toString(),_1654_accshape,_1659_indexnames);
          }
        }
        else
        {
          {
            std::vector<int64_t> _9883_;
            for (int32_t _1663_i = (int)0, _9884_ = _1636_numcone; _1663_i < _9884_ ; ++_1663_i)
            {
              _9883_.push_back((int64_t)_ptr__1653_accidxs[_1663_i]);
            }
            auto _9885_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9883_.size()),_9883_.begin(),_9883_.end()));
            task_format_acc_names(_9885_,_1657_sb->toString(),_1654_accshape,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(nullptr));
          }
        }
      }
      var_map->setItem(_1622_name,_1644_varid);
    }
  }
  {}
  return (_1650_res).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.Model.variable_

// Begin mosek.fusion.Model.variable_
// Method mosek.fusion.Model.variable_ @ bld/grindsted/final/default/src/fusion/Model.mbi:1849:6-2035:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable_(const std::string & _1664_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1665_shp,monty::rc_ptr< ::mosek::fusion::LinearDomain > _1666_dom_)
{
  _checked_ptr_1<int32_t> _ptr__1665_shp(_1665_shp ? _1665_shp->raw() : nullptr, _1665_shp ? _1665_shp->size(0) : 0);
  if ((((int)((_1664_name).size()) > (int)0) && hasVariable(_1664_name)))
  {
    {
      throw ::mosek::fusion::NameError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Duplicate variable name '"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1664_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"))->toString());
    }
  }
  {}
  monty::rc_ptr< ::mosek::fusion::LinearDomain > _1667_dom = mosek::fusion::p_LinearDomain::_get_impl(_1666_dom_.get())->__mosek_2fusion_2LinearDomain__finalize_and_validate(_1665_shp);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1668_shape = mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->shape;
  _checked_ptr_1<int32_t> _ptr__1668_shape(_1668_shape ? _1668_shape->raw() : nullptr,_1668_shape ? _1668_shape->size(0) : 0);
  int32_t _1669_nd = (int)((_1668_shape)->size(0));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1670_strides = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1669_nd)));
  _checked_ptr_1<int32_t> _ptr__1670_strides(_1670_strides ? _1670_strides->raw() : nullptr,_1670_strides ? _1670_strides->size(0) : 0);
  if ((_1669_nd > (int)0))
  {
    {
      _ptr__1670_strides[(_1669_nd - (int)1)] = (int)1;
      int32_t _9886_ = (int)1;
      int32_t _9887_ = _1669_nd;
      for (int32_t _1671_i = _9886_; _1671_i < _9887_; ++_1671_i)
      {
        {
          _ptr__1670_strides[((_1669_nd - _1671_i) - (int)1)] = safe_mul( _ptr__1670_strides[(_1669_nd - _1671_i)],_ptr__1668_shape[(_1669_nd - _1671_i)] );
        }
      }
    }
  }
  {}
  int32_t _1672_domsize = (int)1;
  int32_t _9888_ = (int)0;
  int32_t _9889_ = (int)((_1668_shape)->size(0));
  for (int32_t _1673_i = _9888_; _1673_i < _9889_; ++_1673_i)
  {
    {
      _1672_domsize *= _ptr__1668_shape[_1673_i];
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1674_axisptr = nullptr;
  _checked_ptr_1<int32_t> _ptr__1674_axisptr(_1674_axisptr ? _1674_axisptr->raw() : nullptr,_1674_axisptr ? _1674_axisptr->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1675_nameptr = nullptr;
  _checked_ptr_1<int64_t> _ptr__1675_nameptr(_1675_nameptr ? _1675_nameptr->raw() : nullptr,_1675_nameptr ? _1675_nameptr->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1676_axisnames = nullptr;
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1677_accaxisptr = nullptr;
  _checked_ptr_1<int64_t> _ptr__1677_accaxisptr(_1677_accaxisptr ? _1677_accaxisptr->raw() : nullptr,_1677_accaxisptr ? _1677_accaxisptr->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1678_accnameptr = nullptr;
  _checked_ptr_1<int64_t> _ptr__1678_accnameptr(_1678_accnameptr ? _1678_accnameptr->raw() : nullptr,_1678_accnameptr ? _1678_accnameptr->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1679_accaxisnames = nullptr;
  if ((((int)((_1664_name).size()) > (int)0) && (NULL != mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->indexnames.get())))
  {
    {
      monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1680_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
      monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1681_accsb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
      int32_t _1682_axisp = (int)0;
      int64_t _1683_namep = (int)0;
      int64_t _1684_numnames = (int)0;
      if (((int)((mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->indexnames)->size(0)) != _1669_nd))
      {
        {
          throw ::mosek::fusion::DomainError(std::string ("Invalid index name definition"));
        }
      }
      {}
      int32_t _9890_ = (int)0;
      int32_t _9891_ = (int)((mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->indexnames)->size(0));
      for (int32_t _1685_i = _9890_; _1685_i < _9891_; ++_1685_i)
      {
        {
          if ((NULL != ((*mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->indexnames)(_1685_i)).get()))
          {
            {
              if ((_ptr__1668_shape[_1685_i] != (int)((((*mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->indexnames)(_1685_i)))->size(0))))
              {
                {
                  throw ::mosek::fusion::DomainError(std::string ("Invalid index name definition"));
                }
              }
              {}
              _1684_numnames += _ptr__1668_shape[_1685_i];
            }
          }
          {}
        }
      }
      _1675_nameptr = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( _1684_numnames,(int)1 ))));
      _ptr__1675_nameptr.update(_1675_nameptr ? _1675_nameptr->raw() : nullptr, _1675_nameptr ? _1675_nameptr->size(0) : 0);
      std::vector<int32_t> _9892_;
      for (int32_t _1686_i = (int)0, _9893_ = _1669_nd; _1686_i < _9893_ ; ++_1686_i)
      {
        _9892_.push_back((-(int)1));
      }
      auto _9894_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9892_.size()),_9892_.begin(),_9892_.end()));
      _1674_axisptr = _9894_;
      _ptr__1674_axisptr.update(_1674_axisptr ? _1674_axisptr->raw() : nullptr, _1674_axisptr ? _1674_axisptr->size(0) : 0);
      int32_t _9895_ = (int)0;
      int32_t _9896_ = (int)((mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->indexnames)->size(0));
      for (int32_t _1687_i = _9895_; _1687_i < _9896_; ++_1687_i)
      {
        {
          if ((NULL != ((*mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->indexnames)(_1687_i)).get()))
          {
            {
              _ptr__1674_axisptr[_1687_i] = _1682_axisp;
              int32_t _9897_ = (int)0;
              int32_t _9898_ = _ptr__1668_shape[_1687_i];
              for (int32_t _1688_j = _9897_; _1688_j < _9898_; ++_1688_j)
              {
                {
                  _1680_sb->__mosek_2fusion_2Utils_2StringBuffer__a(((*((*mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->indexnames)(_1687_i)))(_1688_j)));
                  ++ _1682_axisp;
                  _1683_namep += (int)((((*((*mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->indexnames)(_1687_i)))(_1688_j))).size());
                  _ptr__1675_nameptr[_1682_axisp] = _1683_namep;
                }
              }
            }
          }
          {}
        }
      }
      _1676_axisnames = _1680_sb;
      _1679_accaxisnames = _1681_accsb;
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1689_sparsity = nullptr;
  _checked_ptr_1<int64_t> _ptr__1689_sparsity(_1689_sparsity ? _1689_sparsity->raw() : nullptr,_1689_sparsity ? _1689_sparsity->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1690_perm = nullptr;
  _checked_ptr_1<int32_t> _ptr__1690_perm(_1690_perm ? _1690_perm->raw() : nullptr,_1690_perm ? _1690_perm->size(0) : 0);
  if (mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->empty)
  {
    {
      _1689_sparsity = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)0)));
      _ptr__1689_sparsity.update(_1689_sparsity ? _1689_sparsity->raw() : nullptr, _1689_sparsity ? _1689_sparsity->size(0) : 0);
    }
  }
  else if((NULL != mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->sparsity.get()))
  {
    {
      if (((int)((mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->sparsity)->size(1)) != _1669_nd))
      {
        {
          throw ::mosek::fusion::SparseFormatError(std::string ("Sparsity pattern is not correct"));
        }
      }
      {}
      int32_t _1691_n = (int)((mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->sparsity)->size(0));
      _1689_sparsity = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_1691_n)));
      _ptr__1689_sparsity.update(_1689_sparsity ? _1689_sparsity->raw() : nullptr, _1689_sparsity ? _1689_sparsity->size(0) : 0);
      {
        bool _1692_err = false;
        std::shared_ptr< monty::ndarray< int32_t,2 > > _1693_sp = mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->sparsity;
        int32_t _9899_ = (int)0;
        int32_t _9900_ = _1691_n;
        for (int32_t _1694_i = _9899_; _1694_i < _9900_; ++_1694_i)
        {
          {
            int32_t _9901_ = (int)0;
            int32_t _9902_ = (int)((_1693_sp)->size(1));
            for (int32_t _1695_j = _9901_; _1695_j < _9902_; ++_1695_j)
            {
              {
                _1692_err = (_1692_err || ((((*_1693_sp)(_1694_i,_1695_j)) < (int)0) || (((*_1693_sp)(_1694_i,_1695_j)) >= _ptr__1668_shape[_1695_j])));
              }
            }
            if ((!_1692_err))
            {
              {
                int64_t _1696_linidx = (int)0;
                int32_t _9903_ = (int)0;
                int32_t _9904_ = (int)((_1693_sp)->size(1));
                for (int32_t _1697_j = _9903_; _1697_j < _9904_; ++_1697_j)
                {
                  {
                    _1696_linidx += safe_mul( _ptr__1670_strides[_1697_j],((*_1693_sp)(_1694_i,_1697_j)) );
                  }
                }
                _ptr__1689_sparsity[_1694_i] = _1696_linidx;
              }
            }
            {}
          }
        }
        if (_1692_err)
        {
          {
            throw ::mosek::fusion::SparseFormatError(std::string ("Sparsity pattern is out of bounds"));
          }
        }
        {}
      }
      std::shared_ptr< monty::ndarray< int32_t,2 > > _1698_midxs = mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->sparsity;
      int32_t _1699_maxdim = (int)0;
      int32_t _9905_ = (int)0;
      int32_t _9906_ = _1669_nd;
      for (int32_t _1700_i = _9905_; _1700_i < _9906_; ++_1700_i)
      {
        {
          if ((_1699_maxdim < _ptr__1668_shape[_1700_i]))
          {
            {
              _1699_maxdim = _ptr__1668_shape[_1700_i];
            }
          }
          {}
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1701_curperm = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1691_n)));
      _checked_ptr_1<int32_t> _ptr__1701_curperm(_1701_curperm ? _1701_curperm->raw() : nullptr,_1701_curperm ? _1701_curperm->size(0) : 0);
      int32_t _9907_ = (int)0;
      int32_t _9908_ = _1691_n;
      for (int32_t _1702_i = _9907_; _1702_i < _9908_; ++_1702_i)
      {
        {
          _ptr__1701_curperm[_1702_i] = _1702_i;
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1703_tgtperm = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1691_n)));
      _checked_ptr_1<int32_t> _ptr__1703_tgtperm(_1703_tgtperm ? _1703_tgtperm->raw() : nullptr,_1703_tgtperm ? _1703_tgtperm->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1704_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _1699_maxdim,(int)1 ))));
      _checked_ptr_1<int32_t> _ptr__1704_ptr(_1704_ptr ? _1704_ptr->raw() : nullptr,_1704_ptr ? _1704_ptr->size(0) : 0);
      int32_t _9909_ = (int)0;
      int32_t _9910_ = _1669_nd;
      for (int32_t _1705_dd = _9909_; _1705_dd < _9910_; ++_1705_dd)
      {
        {
          {
            int32_t _1706_d = ((_1669_nd - _1705_dd) - (int)1);
            int32_t _9911_ = (int)0;
            int32_t _9912_ = safe_add( _ptr__1668_shape[_1706_d],(int)1 );
            for (int32_t _1707_i = _9911_; _1707_i < _9912_; ++_1707_i)
            {
              {
                _ptr__1704_ptr[_1707_i] = (int)0;
              }
            }
            int32_t _9913_ = (int)0;
            int32_t _9914_ = _1691_n;
            for (int32_t _1708_i = _9913_; _1708_i < _9914_; ++_1708_i)
            {
              {
                ++ _ptr__1704_ptr[safe_add( ((*_1698_midxs)(_1708_i,_1706_d)),(int)1 )];
              }
            }
            int32_t _9915_ = (int)0;
            int32_t _9916_ = _ptr__1668_shape[_1706_d];
            for (int32_t _1709_i = _9915_; _1709_i < _9916_; ++_1709_i)
            {
              {
                _ptr__1704_ptr[safe_add( _1709_i,(int)1 )] += _ptr__1704_ptr[_1709_i];
              }
            }
            int32_t _9917_ = (int)0;
            int32_t _9918_ = _1691_n;
            for (int32_t _1710_ii = _9917_; _1710_ii < _9918_; ++_1710_ii)
            {
              {
                int32_t _1711_i = _ptr__1701_curperm[_1710_ii];
                _ptr__1703_tgtperm[_ptr__1704_ptr[((*_1698_midxs)(_1711_i,_1706_d))]] = _1711_i;
                ++ _ptr__1704_ptr[((*_1698_midxs)(_1711_i,_1706_d))];
              }
            }
          }
          std::shared_ptr< monty::ndarray< int32_t,1 > > _1712_tmp = _1701_curperm;
          _checked_ptr_1<int32_t> _ptr__1712_tmp(_1712_tmp ? _1712_tmp->raw() : nullptr,_1712_tmp ? _1712_tmp->size(0) : 0);
          _1701_curperm = _1703_tgtperm;
          _ptr__1701_curperm.update(_1701_curperm ? _1701_curperm->raw() : nullptr, _1701_curperm ? _1701_curperm->size(0) : 0);
          _1703_tgtperm = _1712_tmp;
          _ptr__1703_tgtperm.update(_1703_tgtperm ? _1703_tgtperm->raw() : nullptr, _1703_tgtperm ? _1703_tgtperm->size(0) : 0);
        }
      }
      int32_t _9919_ = (int)0;
      int32_t _9920_ = _1691_n;
      for (int32_t _1713_ii = _9919_; _1713_ii < _9920_; ++_1713_ii)
      {
        {
          int32_t _1714_i = _ptr__1701_curperm[_1713_ii];
          int64_t _1715_k = (int)0;
          int32_t _9921_ = (int)0;
          int32_t _9922_ = _1669_nd;
          for (int32_t _1716_j = _9921_; _1716_j < _9922_; ++_1716_j)
          {
            {
              _1715_k += safe_mul( _ptr__1670_strides[_1716_j],((*_1698_midxs)(_1714_i,_1716_j)) );
            }
          }
          _ptr__1689_sparsity[_1713_ii] = _1715_k;
        }
      }
    }
  }
  {}
  int32_t _9923_;
  bool _9924_ = (NULL != _1689_sparsity.get());
  if (_9924_)
  {
    _9923_ = (int)((_1689_sparsity)->size(0));
  }
  else
  {
    _9923_ = _1672_domsize;
  }
  int32_t _1717_nvaritems = _9923_;
  std::shared_ptr< monty::ndarray< double,1 > > _1718_bnds = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1717_nvaritems)));
  _checked_ptr_1<double> _ptr__1718_bnds(_1718_bnds ? _1718_bnds->raw() : nullptr,_1718_bnds ? _1718_bnds->size(0) : 0);
  if ((NULL != mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->bnd.get()))
  {
    {
      if (((int)((mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->bnd)->size(0)) == (int)1))
      {
        {
          int32_t _9925_ = (int)0;
          int32_t _9926_ = _1717_nvaritems;
          for (int32_t _1719_i = _9925_; _1719_i < _9926_; ++_1719_i)
          {
            {
              _ptr__1718_bnds[_1719_i] = ((*mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->bnd)((int)0));
            }
          }
        }
      }
      else if(((int)((mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->bnd)->size(0)) == _1717_nvaritems))
      {
        {
          ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->bnd,(int)0,_1718_bnds,(int)0,_1717_nvaritems);
        }
      }
      else
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Invalid right hand side shape in domain"));
        }
      }
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1720_nativeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1717_nvaritems)));
  _checked_ptr_1<int32_t> _ptr__1720_nativeidxs(_1720_nativeidxs ? _1720_nativeidxs->raw() : nullptr,_1720_nativeidxs ? _1720_nativeidxs->size(0) : 0);
  int32_t _1721_varblockid = linearvar_alloc(_1717_nvaritems,_1720_nativeidxs);
  if ((mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->key == ::mosek::fusion::RelationKey::IsFree))
  {
    {
      task_var_putboundlist_fr(_1720_nativeidxs);
    }
  }
  {}
  if ((mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->key == ::mosek::fusion::RelationKey::LessThan))
  {
    {
      task_var_putboundlist_up(_1720_nativeidxs,_1718_bnds);
    }
  }
  else if((mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->key == ::mosek::fusion::RelationKey::GreaterThan))
  {
    {
      task_var_putboundlist_lo(_1720_nativeidxs,_1718_bnds);
    }
  }
  else if((mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->key == ::mosek::fusion::RelationKey::EqualsTo))
  {
    {
      task_var_putboundlist_fx(_1720_nativeidxs,_1718_bnds);
    }
  }
  {}
  monty::rc_ptr< ::mosek::fusion::LinearVariable > _1722_res = ::mosek::fusion::p_LinearVariable::_new_LinearVariable(::mosek::fusion::Model::t(_pubthis),_1664_name,(int64_t)(_1721_varblockid),_1668_shape,_1689_sparsity,_1720_nativeidxs);
  ((*vars)(_1721_varblockid)) = (_1722_res).as<::mosek::fusion::ModelVariable>();
  if (((int)((_1664_name).size()) > (int)0))
  {
    {
      monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1723_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
      _1723_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_1664_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("["));
      if ((_1669_nd > (int)0))
      {
        {
          _1723_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("%0"));
          int32_t _9927_ = (int)1;
          int32_t _9928_ = _1669_nd;
          for (int32_t _1724_i = _9927_; _1724_i < _9928_; ++_1724_i)
          {
            {
              _1723_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",%"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1724_i);
            }
          }
        }
      }
      {}
      _1723_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("]"));
      if ((NULL != mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->indexnames.get()))
      {
        {
          task_format_var_names(_1720_nativeidxs,_1723_sb->toString(),_1668_shape,_1689_sparsity,mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->indexnames);
        }
      }
      else
      {
        {
          task_format_var_names(_1720_nativeidxs,_1723_sb->toString(),_1668_shape,_1689_sparsity,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(nullptr));
        }
      }
      var_map->setItem(_1664_name,_1721_varblockid);
    }
  }
  {}
  if (mosek::fusion::p_LinearDomain::_get_impl(_1667_dom)->cardinal_flag)
  {
    {
      task_var_putintlist(_1720_nativeidxs);
    }
  }
  {}
  return (_1722_res).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.Model.variable_

// Begin mosek.fusion.Model.variable_
// Method mosek.fusion.Model.variable_ @ bld/grindsted/final/default/src/fusion/Model.mbi:1665:6-1787:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__variable_(const std::string & _1725_name,std::shared_ptr< monty::ndarray< int32_t,1 > > _1726_shp,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1727_dom_)
{
  _checked_ptr_1<int32_t> _ptr__1726_shp(_1726_shp ? _1726_shp->raw() : nullptr, _1726_shp ? _1726_shp->size(0) : 0);
  if ((((int)((_1725_name).size()) > (int)0) && hasVariable(_1725_name)))
  {
    {
      throw ::mosek::fusion::NameError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Duplicate variable name '"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1725_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"))->toString());
    }
  }
  {}
  monty::rc_ptr< ::mosek::fusion::PSDDomain > _1728_dom = mosek::fusion::p_PSDDomain::_get_impl(_1727_dom_.get())->__mosek_2fusion_2PSDDomain__finalize_and_validate(_1726_shp);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1729_shape = mosek::fusion::p_PSDDomain::_get_impl(_1728_dom)->shape;
  _checked_ptr_1<int32_t> _ptr__1729_shape(_1729_shape ? _1729_shape->raw() : nullptr,_1729_shape ? _1729_shape->size(0) : 0);
  int32_t _1730_conedim1 = mosek::fusion::p_PSDDomain::_get_impl(_1728_dom)->conedim1;
  int32_t _1731_conedim2 = mosek::fusion::p_PSDDomain::_get_impl(_1728_dom)->conedim2;
  int32_t _1732_nd = (int)((_1729_shape)->size(0));
  int32_t _1733_d = _ptr__1729_shape[_1730_conedim1];
  if ((_1730_conedim1 > _1731_conedim2))
  {
    {
      int32_t _1734_tmp = _1730_conedim1;
      _1730_conedim1 = _1731_conedim2;
      _1731_conedim2 = _1734_tmp;
    }
  }
  {}
  if (((_1730_conedim1 == _1731_conedim2) || ((_1730_conedim1 < (int)0) || (_1731_conedim2 >= _1732_nd))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid cone order dimensions for semidefinite variables"));
    }
  }
  {}
  if ((_ptr__1729_shape[_1730_conedim1] != _ptr__1729_shape[_1731_conedim2]))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching shape in cone order dimensions"));
    }
  }
  {}
  int32_t _1735_numcone = (int)1;
  int32_t _9929_ = (int)0;
  int32_t _9930_ = _1730_conedim1;
  for (int32_t _1736_i = _9929_; _1736_i < _9930_; ++_1736_i)
  {
    {
      _1735_numcone *= _ptr__1729_shape[_1736_i];
    }
  }
  int32_t _9931_ = safe_add( _1730_conedim1,(int)1 );
  int32_t _9932_ = _1731_conedim2;
  for (int32_t _1737_i = _9931_; _1737_i < _9932_; ++_1737_i)
  {
    {
      _1735_numcone *= _ptr__1729_shape[_1737_i];
    }
  }
  int32_t _9933_ = safe_add( _1731_conedim2,(int)1 );
  int32_t _9934_ = _1732_nd;
  for (int32_t _1738_i = _9933_; _1738_i < _9934_; ++_1738_i)
  {
    {
      _1735_numcone *= _ptr__1729_shape[_1738_i];
    }
  }
  int32_t _1739_numelm = (safe_mul( safe_mul( _1735_numcone,_1733_d ),safe_add( _1733_d,(int)1 ) ) / (int)2);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1740_nativeidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_1739_numelm)));
  _checked_ptr_1<int64_t> _ptr__1740_nativeidxs(_1740_nativeidxs ? _1740_nativeidxs->raw() : nullptr,_1740_nativeidxs ? _1740_nativeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1741_barvaridxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1735_numcone)));
  _checked_ptr_1<int32_t> _ptr__1741_barvaridxs(_1741_barvaridxs ? _1741_barvaridxs->raw() : nullptr,_1741_barvaridxs ? _1741_barvaridxs->size(0) : 0);
  int32_t _1742_varid = barvar_alloc(_1733_d,_1735_numcone,_1741_barvaridxs,_1740_nativeidxs);
  monty::rc_ptr< ::mosek::fusion::PSDVariable > _1743_res = ::mosek::fusion::p_PSDVariable::_new_PSDVariable(::mosek::fusion::Model::t(_pubthis),_1725_name,_1742_varid,_1729_shape,mosek::fusion::p_PSDDomain::_get_impl(_1728_dom)->conedim1,mosek::fusion::p_PSDDomain::_get_impl(_1728_dom)->conedim2,_1741_barvaridxs,_1740_nativeidxs);
  if (((int)((_1725_name).size()) > (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1744_coneshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((_1732_nd - (int)2))));
      _checked_ptr_1<int32_t> _ptr__1744_coneshape(_1744_coneshape ? _1744_coneshape->raw() : nullptr,_1744_coneshape ? _1744_coneshape->size(0) : 0);
      int32_t _9935_;
      bool _9936_ = (_1730_conedim1 < _1731_conedim2);
      if (_9936_)
      {
        _9935_ = _1730_conedim1;
      }
      else
      {
        _9935_ = _1731_conedim2;
      }
      int32_t _1745_cdim1 = _9935_;
      int32_t _9937_;
      bool _9938_ = (_1730_conedim1 < _1731_conedim2);
      if (_9938_)
      {
        _9937_ = _1731_conedim2;
      }
      else
      {
        _9937_ = _1730_conedim1;
      }
      int32_t _1746_cdim2 = _9937_;
      int32_t _9939_ = (int)0;
      int32_t _9940_ = _1745_cdim1;
      for (int32_t _1747_i = _9939_; _1747_i < _9940_; ++_1747_i)
      {
        {
          _ptr__1744_coneshape[_1747_i] = _ptr__1729_shape[_1747_i];
        }
      }
      int32_t _9941_ = safe_add( _1745_cdim1,(int)1 );
      int32_t _9942_ = _1746_cdim2;
      for (int32_t _1748_i = _9941_; _1748_i < _9942_; ++_1748_i)
      {
        {
          _ptr__1744_coneshape[(_1748_i - (int)1)] = _ptr__1729_shape[_1748_i];
        }
      }
      int32_t _9943_ = safe_add( _1746_cdim2,(int)1 );
      int32_t _9944_ = _1732_nd;
      for (int32_t _1749_i = _9943_; _1749_i < _9944_; ++_1749_i)
      {
        {
          _ptr__1744_coneshape[(_1749_i - (int)2)] = _ptr__1729_shape[_1749_i];
        }
      }
      monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1750_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
      _1750_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_1725_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("["));
      if (((_1732_nd - (int)2) > (int)0))
      {
        {
          _1750_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("%0"));
          int32_t _9945_ = (int)1;
          int32_t _9946_ = (_1732_nd - (int)2);
          for (int32_t _1751_i = _9945_; _1751_i < _9946_; ++_1751_i)
          {
            {
              _1750_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",%"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1751_i);
            }
          }
        }
      }
      {}
      _1750_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("]"));
      if ((NULL != mosek::fusion::p_PSDDomain::_get_impl(_1728_dom)->indexnames.get()))
      {
        {
          std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _1752_indexnames = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape((_1732_nd - (int)2))));
          int32_t _9947_ = (int)0;
          int32_t _9948_ = _1745_cdim1;
          for (int32_t _1753_i = _9947_; _1753_i < _9948_; ++_1753_i)
          {
            {
              ((*_1752_indexnames)(_1753_i)) = ((*mosek::fusion::p_PSDDomain::_get_impl(_1728_dom)->indexnames)(_1753_i));
            }
          }
          int32_t _9949_ = safe_add( _1745_cdim1,(int)1 );
          int32_t _9950_ = _1746_cdim2;
          for (int32_t _1754_i = _9949_; _1754_i < _9950_; ++_1754_i)
          {
            {
              ((*_1752_indexnames)((_1754_i - (int)1))) = ((*mosek::fusion::p_PSDDomain::_get_impl(_1728_dom)->indexnames)(_1754_i));
            }
          }
          int32_t _9951_ = safe_add( _1746_cdim2,(int)1 );
          int32_t _9952_ = _1732_nd;
          for (int32_t _1755_i = _9951_; _1755_i < _9952_; ++_1755_i)
          {
            {
              ((*_1752_indexnames)((_1755_i - (int)2))) = ((*mosek::fusion::p_PSDDomain::_get_impl(_1728_dom)->indexnames)(_1755_i));
            }
          }
          task_format_barvar_names(_1741_barvaridxs,_1750_sb->toString(),_1744_coneshape,_1752_indexnames);
        }
      }
      else
      {
        {
          task_format_barvar_names(_1741_barvaridxs,_1750_sb->toString(),_1744_coneshape,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(nullptr));
        }
      }
    }
  }
  {}
  ((*barvars)(_1742_varid)) = (_1743_res).as<::mosek::fusion::ModelVariable>();
  if (((int)((_1725_name).size()) > (int)0))
  {
    {
      var_map->setItem(_1725_name,(-safe_add( _1742_varid,(int)1 )));
    }
  }
  {}
  return (_1743_res).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.Model.variable_

// Begin mosek.fusion.Model.putfrows
// Method mosek.fusion.Model.putfrows @ bld/grindsted/final/default/src/fusion/Model.mbi:1534:6-1658:7
void mosek::fusion::p_Model::putfrows(std::shared_ptr< monty::ndarray< int32_t,1 > > _1756_nativeidxs,int32_t _1757_nativebaseptr,monty::rc_ptr< ::mosek::fusion::WorkStack > _1758_rs,int32_t _1759_nelem,int32_t _1760_nnz,int32_t _1761_ptr_base,int32_t _1762_nidxs_base,int32_t _1763_cof_base)
{
  _checked_ptr_1<int32_t> _ptr__1756_nativeidxs(_1756_nativeidxs ? _1756_nativeidxs->raw() : nullptr, _1756_nativeidxs ? _1756_nativeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1764_ri32 = mosek::fusion::p_WorkStack::_get_impl(_1758_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__1764_ri32(_1764_ri32 ? _1764_ri32->raw() : nullptr,_1764_ri32 ? _1764_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1765_ri64 = mosek::fusion::p_WorkStack::_get_impl(_1758_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__1765_ri64(_1765_ri64 ? _1765_ri64->raw() : nullptr,_1765_ri64 ? _1765_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1766_rf64 = mosek::fusion::p_WorkStack::_get_impl(_1758_rs)->f64;
  _checked_ptr_1<double> _ptr__1766_rf64(_1766_rf64 ? _1766_rf64->raw() : nullptr,_1766_rf64 ? _1766_rf64->size(0) : 0);
  int32_t _1767_linnz = (int)0;
  int32_t _1768_barnnz = (int)0;
  int32_t _1769_totalpsdelm = (int)0;
  int32_t _9953_ = (int)0;
  int32_t _9954_ = _1759_nelem;
  for (int32_t _1770_i = _9953_; _1770_i < _9954_; ++_1770_i)
  {
    {
      int32_t _1771_ps = _ptr__1764_ri32[safe_add( _1761_ptr_base,_1770_i )];
      int32_t _1772_pe = _ptr__1764_ri32[safe_add( safe_add( _1761_ptr_base,_1770_i ),(int)1 )];
      int32_t _1773_p = _1771_ps;
      while ( ((_1773_p < _1772_pe) && (_ptr__1765_ri64[safe_add( _1762_nidxs_base,_1773_p )] < (int)0)) )
      {
        {
          int32_t _1774_barj = ((*barvar_block_elm_barj)((-safe_add( _ptr__1765_ri64[safe_add( _1762_nidxs_base,_1773_p )],(int)1 ))));
          int32_t _1775_p0 = _1773_p;
          ++ _1773_p;
          while ( ((_1773_p < _1772_pe) && ((_ptr__1765_ri64[safe_add( _1762_nidxs_base,_1773_p )] < (int)0) && (_1774_barj == ((*barvar_block_elm_barj)((-safe_add( _ptr__1765_ri64[safe_add( _1762_nidxs_base,_1773_p )],(int)1 ))))))) )
          {
            {
              ++ _1773_p;
            }
          }
          ++ _1768_barnnz;
        }
      }
      _1769_totalpsdelm += (_1773_p - _1771_ps);
      while ( ((_1773_p < _1772_pe) && (_ptr__1765_ri64[safe_add( _1762_nidxs_base,_1773_p )] == (int)0)) )
      {
        {
          ++ _1773_p;
        }
      }
      _1767_linnz += (_1772_pe - _1773_p);
    }
  }
  if ((_1759_nelem > ((int)((_1756_nativeidxs)->size(0)) - _1757_nativebaseptr)))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Mismatching sizes"));
    }
  }
  {}
  int32_t _1776_numcon = _1759_nelem;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1777_ptrb = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _1776_numcon,(int)1 ))));
  _checked_ptr_1<int32_t> _ptr__1777_ptrb(_1777_ptrb ? _1777_ptrb->raw() : nullptr,_1777_ptrb ? _1777_ptrb->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1778_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1767_linnz)));
  _checked_ptr_1<int32_t> _ptr__1778_subj(_1778_subj ? _1778_subj->raw() : nullptr,_1778_subj ? _1778_subj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1779_cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1767_linnz)));
  _checked_ptr_1<double> _ptr__1779_cof(_1779_cof ? _1779_cof->raw() : nullptr,_1779_cof ? _1779_cof->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1780_bfix = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1759_nelem)));
  _checked_ptr_1<double> _ptr__1780_bfix(_1780_bfix ? _1780_bfix->raw() : nullptr,_1780_bfix ? _1780_bfix->size(0) : 0);
  {
    int32_t _1781_k = (int)0;
    int32_t _9955_ = (int)0;
    int32_t _9956_ = _1759_nelem;
    for (int32_t _1782_i = _9955_; _1782_i < _9956_; ++_1782_i)
    {
      {
        int32_t _1783_knz = (int)0;
        int32_t _9957_ = _ptr__1764_ri32[safe_add( _1761_ptr_base,_1782_i )];
        int32_t _9958_ = _ptr__1764_ri32[safe_add( safe_add( _1761_ptr_base,_1782_i ),(int)1 )];
        for (int32_t _1784_j = _9957_; _1784_j < _9958_; ++_1784_j)
        {
          {
            if ((_ptr__1765_ri64[safe_add( _1762_nidxs_base,_1784_j )] == (int)0))
            {
              {
                _ptr__1780_bfix[_1782_i] += _ptr__1766_rf64[safe_add( _1763_cof_base,_1784_j )];
              }
            }
            else if((_ptr__1765_ri64[safe_add( _1762_nidxs_base,_1784_j )] > (int)0))
            {
              {
                _ptr__1778_subj[safe_add( _1781_k,_1783_knz )] = (int32_t)_ptr__1765_ri64[safe_add( _1762_nidxs_base,_1784_j )];
                _ptr__1779_cof[safe_add( _1781_k,_1783_knz )] = _ptr__1766_rf64[safe_add( _1763_cof_base,_1784_j )];
                ++ _1783_knz;
              }
            }
            {}
          }
        }
        _ptr__1777_ptrb[safe_add( _1782_i,(int)1 )] = safe_add( _ptr__1777_ptrb[_1782_i],_1783_knz );
        _1781_k += _1783_knz;
      }
    }
  }
  std::vector<int64_t> _9959_;
  for (int32_t _1785_i = (int)0, _9960_ = _1759_nelem; _1785_i < _9960_ ; ++_1785_i)
  {
    _9959_.push_back(_ptr__1756_nativeidxs[safe_add( _1785_i,_1757_nativebaseptr )]);
  }
  auto _9961_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_9959_.size()),_9959_.begin(),_9959_.end()));
  task_putafeflist(_9961_,_1777_ptrb,_1778_subj,_1779_cof,_1780_bfix);
  if ((_1768_barnnz > (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1786_subi = _1756_nativeidxs;
      _checked_ptr_1<int32_t> _ptr__1786_subi(_1786_subi ? _1786_subi->raw() : nullptr,_1786_subi ? _1786_subi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1787_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _1776_numcon,(int)1 ))));
      _checked_ptr_1<int32_t> _ptr__1787_ptr(_1787_ptr ? _1787_ptr->raw() : nullptr,_1787_ptr ? _1787_ptr->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1788_barsubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1768_barnnz)));
      _checked_ptr_1<int32_t> _ptr__1788_barsubj(_1788_barsubj ? _1788_barsubj->raw() : nullptr,_1788_barsubj ? _1788_barsubj->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1789_matdim = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1768_barnnz)));
      _checked_ptr_1<int32_t> _ptr__1789_matdim(_1789_matdim ? _1789_matdim->raw() : nullptr,_1789_matdim ? _1789_matdim->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _1790_matnnz = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_1768_barnnz)));
      _checked_ptr_1<int64_t> _ptr__1790_matnnz(_1790_matnnz ? _1790_matnnz->raw() : nullptr,_1790_matnnz ? _1790_matnnz->size(0) : 0);
      std::vector<int32_t> _9962_;
      for (int32_t _1792_i = (int)0, _9963_ = _1769_totalpsdelm; _1792_i < _9963_ ; ++_1792_i)
      {
        _9962_.push_back((-(int)1));
      }
      auto _9964_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9962_.size()),_9962_.begin(),_9962_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1791_matsubi = _9964_;
      _checked_ptr_1<int32_t> _ptr__1791_matsubi(_1791_matsubi ? _1791_matsubi->raw() : nullptr,_1791_matsubi ? _1791_matsubi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1793_matsubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1769_totalpsdelm)));
      _checked_ptr_1<int32_t> _ptr__1793_matsubj(_1793_matsubj ? _1793_matsubj->raw() : nullptr,_1793_matsubj ? _1793_matsubj->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _1794_matcof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1769_totalpsdelm)));
      _checked_ptr_1<double> _ptr__1794_matcof(_1794_matcof ? _1794_matcof->raw() : nullptr,_1794_matcof ? _1794_matcof->size(0) : 0);
      int32_t _1795_barnzi = (int)0;
      int32_t _1796_barmatnzi = (int)0;
      int32_t _9965_ = (int)0;
      int32_t _9966_ = _1776_numcon;
      for (int32_t _1797_i = _9965_; _1797_i < _9966_; ++_1797_i)
      {
        {
          int32_t _1798_p = _ptr__1764_ri32[safe_add( _1761_ptr_base,_1797_i )];
          int32_t _1799_pe = _ptr__1764_ri32[safe_add( safe_add( _1761_ptr_base,_1797_i ),(int)1 )];
          while ( ((_1798_p < _1799_pe) && (_ptr__1765_ri64[safe_add( _1762_nidxs_base,_1798_p )] < (int)0)) )
          {
            {
              int32_t _1800_p0 = _1798_p;
              int32_t _1801_barj = ((*barvar_block_elm_barj)((-safe_add( _ptr__1765_ri64[safe_add( _1762_nidxs_base,_1798_p )],(int)1 ))));
              while ( ((_1798_p < _1799_pe) && ((_ptr__1765_ri64[safe_add( _1762_nidxs_base,_1798_p )] < (int)0) && (((*barvar_block_elm_barj)((-safe_add( _ptr__1765_ri64[safe_add( _1762_nidxs_base,_1798_p )],(int)1 )))) == _1801_barj))) )
              {
                {
                  _ptr__1791_matsubi[_1796_barmatnzi] = ((*barvar_block_elm_i)((-safe_add( _ptr__1765_ri64[safe_add( _1762_nidxs_base,_1798_p )],(int)1 ))));
                  _ptr__1793_matsubj[_1796_barmatnzi] = ((*barvar_block_elm_j)((-safe_add( _ptr__1765_ri64[safe_add( _1762_nidxs_base,_1798_p )],(int)1 ))));
                  if ((_ptr__1791_matsubi[_1796_barmatnzi] == _ptr__1793_matsubj[_1796_barmatnzi]))
                  {
                    {
                      _ptr__1794_matcof[_1796_barmatnzi] = _ptr__1766_rf64[safe_add( _1763_cof_base,_1798_p )];
                    }
                  }
                  else
                  {
                    {
                      _ptr__1794_matcof[_1796_barmatnzi] = (0.5 * _ptr__1766_rf64[safe_add( _1763_cof_base,_1798_p )]);
                    }
                  }
                  ++ _1796_barmatnzi;
                  ++ _1798_p;
                }
              }
              _ptr__1788_barsubj[_1795_barnzi] = _1801_barj;
              _ptr__1789_matdim[_1795_barnzi] = ((*barvar_dim)(_1801_barj));
              _ptr__1790_matnnz[_1795_barnzi] = (_1798_p - _1800_p0);
              ++ _1795_barnzi;
            }
          }
          _1798_p = _1799_pe;
          _ptr__1787_ptr[safe_add( _1797_i,(int)1 )] = _1795_barnzi;
        }
      }
      std::shared_ptr< monty::ndarray< int64_t,1 > > _1802_symmatidx = task_appendsymmatlist(_1789_matdim,_1790_matnnz,_1791_matsubi,_1793_matsubj,_1794_matcof);
      _checked_ptr_1<int64_t> _ptr__1802_symmatidx(_1802_symmatidx ? _1802_symmatidx->raw() : nullptr,_1802_symmatidx ? _1802_symmatidx->size(0) : 0);
      task_putafebarfrowlist(_1786_subi,_1787_ptr,_1788_barsubj,_1802_symmatidx);
    }
  }
  {}
}
// End mosek.fusion.Model.putfrows

// Begin mosek.fusion.Model.putarows
// Method mosek.fusion.Model.putarows @ bld/grindsted/final/default/src/fusion/Model.mbi:1417:6-1531:7
void mosek::fusion::p_Model::putarows(std::shared_ptr< monty::ndarray< int32_t,1 > > _1803_nativeidxs,monty::rc_ptr< ::mosek::fusion::WorkStack > _1804_rs,int32_t _1805_nelem,int32_t _1806_nnz,int32_t _1807_ptr_base,int32_t _1808_nidxs_base,int32_t _1809_cof_base)
{
  _checked_ptr_1<int32_t> _ptr__1803_nativeidxs(_1803_nativeidxs ? _1803_nativeidxs->raw() : nullptr, _1803_nativeidxs ? _1803_nativeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1810_ri32 = mosek::fusion::p_WorkStack::_get_impl(_1804_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__1810_ri32(_1810_ri32 ? _1810_ri32->raw() : nullptr,_1810_ri32 ? _1810_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1811_ri64 = mosek::fusion::p_WorkStack::_get_impl(_1804_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__1811_ri64(_1811_ri64 ? _1811_ri64->raw() : nullptr,_1811_ri64 ? _1811_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1812_rf64 = mosek::fusion::p_WorkStack::_get_impl(_1804_rs)->f64;
  _checked_ptr_1<double> _ptr__1812_rf64(_1812_rf64 ? _1812_rf64->raw() : nullptr,_1812_rf64 ? _1812_rf64->size(0) : 0);
  int32_t _1813_linnz = (int)0;
  int32_t _1814_barnnz = (int)0;
  int32_t _1815_totalpsdelm = (int)0;
  int32_t _9967_ = (int)0;
  int32_t _9968_ = _1805_nelem;
  for (int32_t _1816_i = _9967_; _1816_i < _9968_; ++_1816_i)
  {
    {
      int32_t _1817_ps = _ptr__1810_ri32[safe_add( _1807_ptr_base,_1816_i )];
      int32_t _1818_pe = _ptr__1810_ri32[safe_add( safe_add( _1807_ptr_base,_1816_i ),(int)1 )];
      int32_t _1819_p = _1817_ps;
      while ( ((_1819_p < _1818_pe) && (_ptr__1811_ri64[safe_add( _1808_nidxs_base,_1819_p )] < (int)0)) )
      {
        {
          int32_t _1820_barj = ((*barvar_block_elm_barj)((-safe_add( _ptr__1811_ri64[safe_add( _1808_nidxs_base,_1819_p )],(int)1 ))));
          int32_t _1821_p0 = _1819_p;
          ++ _1819_p;
          while ( ((_1819_p < _1818_pe) && ((_ptr__1811_ri64[safe_add( _1808_nidxs_base,_1819_p )] < (int)0) && (_1820_barj == ((*barvar_block_elm_barj)((-safe_add( _ptr__1811_ri64[safe_add( _1808_nidxs_base,_1819_p )],(int)1 ))))))) )
          {
            {
              ++ _1819_p;
            }
          }
          ++ _1814_barnnz;
        }
      }
      _1815_totalpsdelm += (_1819_p - _1817_ps);
      while ( (_1819_p < _1818_pe) )
      {
        {
          if ((0.0 != _ptr__1812_rf64[safe_add( _1809_cof_base,_1819_p )]))
          {
            {
              _1813_linnz += (int)1;
            }
          }
          {}
          ++ _1819_p;
        }
      }
    }
  }
  int32_t _1822_numcon = (int)((_1803_nativeidxs)->size(0));
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1823_ptrb = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( _1822_numcon,(int)1 ))));
  _checked_ptr_1<int64_t> _ptr__1823_ptrb(_1823_ptrb ? _1823_ptrb->raw() : nullptr,_1823_ptrb ? _1823_ptrb->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1824_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1813_linnz)));
  _checked_ptr_1<int32_t> _ptr__1824_subj(_1824_subj ? _1824_subj->raw() : nullptr,_1824_subj ? _1824_subj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1825_cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1813_linnz)));
  _checked_ptr_1<double> _ptr__1825_cof(_1825_cof ? _1825_cof->raw() : nullptr,_1825_cof ? _1825_cof->size(0) : 0);
  {
    int32_t _1826_k = (int)0;
    int32_t _9969_ = (int)0;
    int32_t _9970_ = _1805_nelem;
    for (int32_t _1827_i = _9969_; _1827_i < _9970_; ++_1827_i)
    {
      {
        int32_t _1828_knz = (int)0;
        int32_t _9971_ = _ptr__1810_ri32[safe_add( _1807_ptr_base,_1827_i )];
        int32_t _9972_ = _ptr__1810_ri32[safe_add( safe_add( _1807_ptr_base,_1827_i ),(int)1 )];
        for (int32_t _1829_j = _9971_; _1829_j < _9972_; ++_1829_j)
        {
          {
            if (((_ptr__1811_ri64[safe_add( _1808_nidxs_base,_1829_j )] >= (int)0) && ((int)0 != _ptr__1812_rf64[safe_add( _1809_cof_base,_1829_j )])))
            {
              {
                _ptr__1824_subj[safe_add( _1826_k,_1828_knz )] = (int32_t)_ptr__1811_ri64[safe_add( _1808_nidxs_base,_1829_j )];
                _ptr__1825_cof[safe_add( _1826_k,_1828_knz )] = _ptr__1812_rf64[safe_add( _1809_cof_base,_1829_j )];
                ++ _1828_knz;
              }
            }
            {}
          }
        }
        _ptr__1823_ptrb[safe_add( _1827_i,(int)1 )] = safe_add( _ptr__1823_ptrb[_1827_i],_1828_knz );
        _1826_k += _1828_knz;
      }
    }
  }
  task_putarowlist(_1803_nativeidxs,_1823_ptrb,_1824_subj,_1825_cof);
  if ((_1814_barnnz > (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1830_subi = _1803_nativeidxs;
      _checked_ptr_1<int32_t> _ptr__1830_subi(_1830_subi ? _1830_subi->raw() : nullptr,_1830_subi ? _1830_subi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _1831_ptr = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( _1822_numcon,(int)1 ))));
      _checked_ptr_1<int64_t> _ptr__1831_ptr(_1831_ptr ? _1831_ptr->raw() : nullptr,_1831_ptr ? _1831_ptr->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1832_barsubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1814_barnnz)));
      _checked_ptr_1<int32_t> _ptr__1832_barsubj(_1832_barsubj ? _1832_barsubj->raw() : nullptr,_1832_barsubj ? _1832_barsubj->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1833_matdim = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1814_barnnz)));
      _checked_ptr_1<int32_t> _ptr__1833_matdim(_1833_matdim ? _1833_matdim->raw() : nullptr,_1833_matdim ? _1833_matdim->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _1834_matnnz = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_1814_barnnz)));
      _checked_ptr_1<int64_t> _ptr__1834_matnnz(_1834_matnnz ? _1834_matnnz->raw() : nullptr,_1834_matnnz ? _1834_matnnz->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1835_matsubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1815_totalpsdelm)));
      _checked_ptr_1<int32_t> _ptr__1835_matsubi(_1835_matsubi ? _1835_matsubi->raw() : nullptr,_1835_matsubi ? _1835_matsubi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1836_matsubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1815_totalpsdelm)));
      _checked_ptr_1<int32_t> _ptr__1836_matsubj(_1836_matsubj ? _1836_matsubj->raw() : nullptr,_1836_matsubj ? _1836_matsubj->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _1837_matcof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1815_totalpsdelm)));
      _checked_ptr_1<double> _ptr__1837_matcof(_1837_matcof ? _1837_matcof->raw() : nullptr,_1837_matcof ? _1837_matcof->size(0) : 0);
      int32_t _1838_barnzi = (int)0;
      int32_t _1839_barmatnzi = (int)0;
      int32_t _9973_ = (int)0;
      int32_t _9974_ = _1822_numcon;
      for (int32_t _1840_i = _9973_; _1840_i < _9974_; ++_1840_i)
      {
        {
          int32_t _1841_p = _ptr__1810_ri32[safe_add( _1807_ptr_base,_1840_i )];
          int32_t _1842_pe = _ptr__1810_ri32[safe_add( safe_add( _1807_ptr_base,_1840_i ),(int)1 )];
          while ( ((_1841_p < _1842_pe) && (_ptr__1811_ri64[safe_add( _1808_nidxs_base,_1841_p )] < (int)0)) )
          {
            {
              int32_t _1843_p0 = _1841_p;
              int32_t _1844_barj = ((*barvar_block_elm_barj)((-safe_add( _ptr__1811_ri64[safe_add( _1808_nidxs_base,_1841_p )],(int)1 ))));
              while ( ((_1841_p < _1842_pe) && ((_ptr__1811_ri64[safe_add( _1808_nidxs_base,_1841_p )] < (int)0) && (((*barvar_block_elm_barj)((-safe_add( _ptr__1811_ri64[safe_add( _1808_nidxs_base,_1841_p )],(int)1 )))) == _1844_barj))) )
              {
                {
                  _ptr__1835_matsubi[_1839_barmatnzi] = ((*barvar_block_elm_i)((-safe_add( _ptr__1811_ri64[safe_add( _1808_nidxs_base,_1841_p )],(int)1 ))));
                  _ptr__1836_matsubj[_1839_barmatnzi] = ((*barvar_block_elm_j)((-safe_add( _ptr__1811_ri64[safe_add( _1808_nidxs_base,_1841_p )],(int)1 ))));
                  if ((_ptr__1835_matsubi[_1839_barmatnzi] == _ptr__1836_matsubj[_1839_barmatnzi]))
                  {
                    {
                      _ptr__1837_matcof[_1839_barmatnzi] = _ptr__1812_rf64[safe_add( _1809_cof_base,_1841_p )];
                    }
                  }
                  else
                  {
                    {
                      _ptr__1837_matcof[_1839_barmatnzi] = (0.5 * _ptr__1812_rf64[safe_add( _1809_cof_base,_1841_p )]);
                    }
                  }
                  ++ _1839_barmatnzi;
                  ++ _1841_p;
                }
              }
              _ptr__1832_barsubj[_1838_barnzi] = _1844_barj;
              _ptr__1833_matdim[_1838_barnzi] = ((*barvar_dim)(_1844_barj));
              _ptr__1834_matnnz[_1838_barnzi] = (_1841_p - _1843_p0);
              ++ _1838_barnzi;
            }
          }
          _1841_p = _1842_pe;
          _ptr__1831_ptr[safe_add( _1840_i,(int)1 )] = _1838_barnzi;
        }
      }
      std::shared_ptr< monty::ndarray< int64_t,1 > > _1845_symmatidx = task_appendsymmatlist(_1833_matdim,_1834_matnnz,_1835_matsubi,_1836_matsubj,_1837_matcof);
      _checked_ptr_1<int64_t> _ptr__1845_symmatidx(_1845_symmatidx ? _1845_symmatidx->raw() : nullptr,_1845_symmatidx ? _1845_symmatidx->size(0) : 0);
      task_putbararowlist(_1830_subi,_1831_ptr,_1832_barsubj,_1845_symmatidx);
    }
  }
  {}
}
// End mosek.fusion.Model.putarows

// Begin mosek.fusion.Model.constraint_
// Method mosek.fusion.Model.constraint_ @ bld/grindsted/final/default/src/fusion/Model.mbi:1285:6-1401:7
monty::rc_ptr< ::mosek::fusion::RangedConstraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint_(const std::string & _1846_name,monty::rc_ptr< ::mosek::fusion::Expression > _1847_expr,monty::rc_ptr< ::mosek::fusion::RangeDomain > _1848_dom_)
{
  if (((mosek::fusion::p_WorkStack::_get_impl(rs)->pi32 != (int)0) || ((mosek::fusion::p_WorkStack::_get_impl(rs)->pi64 != (int)0) || (mosek::fusion::p_WorkStack::_get_impl(rs)->pf64 != (int)0))))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Stack rs not clean"));
    }
  }
  {}
  if (((mosek::fusion::p_WorkStack::_get_impl(ws)->pi32 != (int)0) || ((mosek::fusion::p_WorkStack::_get_impl(ws)->pi64 != (int)0) || (mosek::fusion::p_WorkStack::_get_impl(ws)->pf64 != (int)0))))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Stack ws not clean"));
    }
  }
  {}
  xs->clear();
  if ((((int)((_1846_name).size()) > (int)0) && hasConstraint(_1846_name)))
  {
    {
      throw ::mosek::fusion::NameError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Duplicate constraint name '"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1846_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"))->toString());
    }
  }
  {}
  if (mosek::fusion::p_RangeDomain::_get_impl(_1848_dom_)->cardinal_flag)
  {
    {
      throw ::mosek::fusion::DomainError(std::string ("Integer domain not allowed in a constraint"));
    }
  }
  {}
  monty::rc_ptr< ::mosek::fusion::ExprDense > _1849_e = ::mosek::fusion::p_ExprDense::_new_ExprDense((::mosek::fusion::p_ExprOptimizeCode::_new_ExprOptimizeCode((::mosek::fusion::p_ExprCompress::_new_ExprCompress(_1847_expr)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>());
  _1849_e->recursive_eval(rs,ws,xs,cache_evaluations);
  rs->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1850_ri32 = mosek::fusion::p_WorkStack::_get_impl(rs)->i32;
  _checked_ptr_1<int32_t> _ptr__1850_ri32(_1850_ri32 ? _1850_ri32->raw() : nullptr,_1850_ri32 ? _1850_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1851_ri64 = mosek::fusion::p_WorkStack::_get_impl(rs)->i64;
  _checked_ptr_1<int64_t> _ptr__1851_ri64(_1851_ri64 ? _1851_ri64->raw() : nullptr,_1851_ri64 ? _1851_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1852_rf64 = mosek::fusion::p_WorkStack::_get_impl(rs)->f64;
  _checked_ptr_1<double> _ptr__1852_rf64(_1852_rf64 ? _1852_rf64->raw() : nullptr,_1852_rf64 ? _1852_rf64->size(0) : 0);
  int32_t _1853_nd = mosek::fusion::p_WorkStack::_get_impl(rs)->nd;
  int32_t _1854_shape_base = mosek::fusion::p_WorkStack::_get_impl(rs)->shape_base;
  int32_t _1855_nelem = mosek::fusion::p_WorkStack::_get_impl(rs)->nelem;
  int32_t _1856_nnz = mosek::fusion::p_WorkStack::_get_impl(rs)->nnz;
  int32_t _1857_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(rs)->ncodeatom;
  bool _1858_hassp = mosek::fusion::p_WorkStack::_get_impl(rs)->hassp;
  int32_t _1859_ptr_base = mosek::fusion::p_WorkStack::_get_impl(rs)->ptr_base;
  int32_t _1860_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(rs)->nidxs_base;
  int32_t _1861_cof_base = mosek::fusion::p_WorkStack::_get_impl(rs)->cof_base;
  int32_t _1862_codeptr = mosek::fusion::p_WorkStack::_get_impl(rs)->codeptr_base;
  int32_t _1863_code = mosek::fusion::p_WorkStack::_get_impl(rs)->code_base;
  int32_t _1864_cconst = mosek::fusion::p_WorkStack::_get_impl(rs)->cconst_base;
  std::vector<int32_t> _9975_;
  for (int32_t _1866_i = (int)0, _9976_ = _1853_nd; _1866_i < _9976_ ; ++_1866_i)
  {
    _9975_.push_back(_ptr__1850_ri32[safe_add( _1854_shape_base,_1866_i )]);
  }
  auto _9977_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9975_.size()),_9975_.begin(),_9975_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1865_shape = _9977_;
  _checked_ptr_1<int32_t> _ptr__1865_shape(_1865_shape ? _1865_shape->raw() : nullptr,_1865_shape ? _1865_shape->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::RangeDomain > _1867_dom = mosek::fusion::p_RangeDomain::_get_impl(_1848_dom_.get())->__mosek_2fusion_2RangeDomain__finalize_and_validate(_1865_shape);
  if ((NULL != mosek::fusion::p_RangeDomain::_get_impl(_1867_dom)->shape.get()))
  {
    {
      if (((int)((mosek::fusion::p_RangeDomain::_get_impl(_1867_dom)->shape)->size(0)) != _1853_nd))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Mismatching expression and domain"));
        }
      }
      else
      {
        {
          int32_t _9978_ = (int)0;
          int32_t _9979_ = _1853_nd;
          for (int32_t _1868_i = _9978_; _1868_i < _9979_; ++_1868_i)
          {
            {
              if ((((*mosek::fusion::p_RangeDomain::_get_impl(_1867_dom)->shape)(_1868_i)) != _ptr__1850_ri32[safe_add( _1854_shape_base,_1868_i )]))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("Mismatching expression and domain"));
                }
              }
              {}
            }
          }
        }
      }
    }
  }
  {}
  int32_t _1869_numcon = (int)1;
  int32_t _9980_ = (int)0;
  int32_t _9981_ = _1853_nd;
  for (int32_t _1870_i = _9980_; _1870_i < _9981_; ++_1870_i)
  {
    {
      _1869_numcon *= _ptr__1850_ri32[safe_add( _1854_shape_base,_1870_i )];
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1871_nativeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1869_numcon)));
  _checked_ptr_1<int32_t> _ptr__1871_nativeidxs(_1871_nativeidxs ? _1871_nativeidxs->raw() : nullptr,_1871_nativeidxs ? _1871_nativeidxs->size(0) : 0);
  int32_t _1872_conid = con_allocate(_1871_nativeidxs);
  putarows(_1871_nativeidxs,rs,_1855_nelem,_1856_nnz,_1859_ptr_base,_1860_nidxs_base,_1861_cof_base);
  xs->clear();
  std::shared_ptr< monty::ndarray< double,1 > > _1873_bl = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1869_numcon)));
  _checked_ptr_1<double> _ptr__1873_bl(_1873_bl ? _1873_bl->raw() : nullptr,_1873_bl ? _1873_bl->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1874_bu = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1869_numcon)));
  _checked_ptr_1<double> _ptr__1874_bu(_1874_bu ? _1874_bu->raw() : nullptr,_1874_bu ? _1874_bu->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1875_domlb = mosek::fusion::p_RangeDomain::_get_impl(_1867_dom)->lb;
  _checked_ptr_1<double> _ptr__1875_domlb(_1875_domlb ? _1875_domlb->raw() : nullptr,_1875_domlb ? _1875_domlb->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1876_domub = mosek::fusion::p_RangeDomain::_get_impl(_1867_dom)->ub;
  _checked_ptr_1<double> _ptr__1876_domub(_1876_domub ? _1876_domub->raw() : nullptr,_1876_domub ? _1876_domub->size(0) : 0);
  bool _1877_domempty = mosek::fusion::p_RangeDomain::_get_impl(_1867_dom)->empty;
  bool _1878_domsc = mosek::fusion::p_RangeDomain::_get_impl(_1867_dom)->scalable;
  std::shared_ptr< monty::ndarray< int32_t,2 > > _1879_domsp = mosek::fusion::p_RangeDomain::_get_impl(_1867_dom)->sparsity;
  {
    if (_1878_domsc)
    {
      {
        int32_t _9982_ = (int)0;
        int32_t _9983_ = _1869_numcon;
        for (int32_t _1880_i = _9982_; _1880_i < _9983_; ++_1880_i)
        {
          {
            _ptr__1873_bl[_1880_i] = _ptr__1875_domlb[(int)0];
            _ptr__1874_bu[_1880_i] = _ptr__1876_domub[(int)0];
          }
        }
      }
    }
    else if(_1877_domempty)
    {
      {
      }
    }
    else if((NULL != _1879_domsp.get()))
    {
      {
        std::shared_ptr< monty::ndarray< int32_t,1 > > _1881_stride = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1853_nd)));
        _checked_ptr_1<int32_t> _ptr__1881_stride(_1881_stride ? _1881_stride->raw() : nullptr,_1881_stride ? _1881_stride->size(0) : 0);
        _ptr__1881_stride[(_1853_nd - (int)1)] = (int)1;
        int32_t _9984_ = (int)1;
        int32_t _9985_ = _1853_nd;
        for (int32_t _1882_i = _9984_; _1882_i < _9985_; ++_1882_i)
        {
          {
            _ptr__1881_stride[((_1853_nd - _1882_i) - (int)1)] = safe_mul( _ptr__1881_stride[(_1853_nd - _1882_i)],_ptr__1850_ri32[(safe_add( _1854_shape_base,_1853_nd ) - _1882_i)] );
          }
        }
        int32_t _9986_ = (int)0;
        int32_t _9987_ = (int)((_1875_domlb)->size(0));
        for (int32_t _1883_i = _9986_; _1883_i < _9987_; ++_1883_i)
        {
          {
            int32_t _1884_idx = (int)0;
            int32_t _9988_ = (int)0;
            int32_t _9989_ = _1853_nd;
            for (int32_t _1885_j = _9988_; _1885_j < _9989_; ++_1885_j)
            {
              {
                _1884_idx += safe_mul( _ptr__1881_stride[_1885_j],((*_1879_domsp)(_1883_i,_1885_j)) );
              }
            }
            _ptr__1873_bl[_1884_idx] = _ptr__1875_domlb[_1883_i];
            _ptr__1874_bu[_1884_idx] = _ptr__1876_domub[_1883_i];
          }
        }
      }
    }
    else
    {
      {
        int32_t _9990_ = (int)0;
        int32_t _9991_ = _1869_numcon;
        for (int32_t _1886_i = _9990_; _1886_i < _9991_; ++_1886_i)
        {
          {
            _ptr__1873_bl[_1886_i] = _ptr__1875_domlb[_1886_i];
            _ptr__1874_bu[_1886_i] = _ptr__1876_domub[_1886_i];
          }
        }
      }
    }
  }
  task_con_putboundlist_ra(_1871_nativeidxs,_1873_bl,_1874_bu);
  if ((_1857_ncodeatom > (int)0))
  {
    {
      con_blocks->replace_row_code(rs,_1871_nativeidxs,_1859_ptr_base,_1860_nidxs_base,_1862_codeptr,_1863_code,_1864_cconst);
    }
  }
  {}
  if (((int)((_1846_name).size()) > (int)0))
  {
    {
      monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1887_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
      _1887_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_1846_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("["));
      if (((int)((_1865_shape)->size(0)) > (int)0))
      {
        {
          _1887_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("%0"));
        }
      }
      {}
      int32_t _9992_ = (int)1;
      int32_t _9993_ = (int)((_1865_shape)->size(0));
      for (int32_t _1888_i = _9992_; _1888_i < _9993_; ++_1888_i)
      {
        {
          _1887_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",%"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1888_i);
        }
      }
      _1887_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("]"));
      if ((NULL != mosek::fusion::p_RangeDomain::_get_impl(_1867_dom)->indexnames.get()))
      {
        {
          task_format_con_names(_1871_nativeidxs,_1887_sb->toString(),_1865_shape,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),mosek::fusion::p_RangeDomain::_get_impl(_1867_dom)->indexnames);
        }
      }
      else
      {
        {
          task_format_con_names(_1871_nativeidxs,_1887_sb->toString(),_1865_shape,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(nullptr));
        }
      }
    }
  }
  {}
  std::vector<int32_t> _9994_;
  for (int32_t _1890_i = (int)0, _9995_ = _1853_nd; _1890_i < _9995_ ; ++_1890_i)
  {
    _9994_.push_back(_ptr__1850_ri32[safe_add( _1854_shape_base,_1890_i )]);
  }
  auto _9996_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_9994_.size()),_9994_.begin(),_9994_.end()));
  monty::rc_ptr< ::mosek::fusion::RangedConstraint > _1889_res = ::mosek::fusion::p_RangedConstraint::_new_RangedConstraint(::mosek::fusion::Model::t(_pubthis),_1846_name,_9996_,_1871_nativeidxs,_1872_conid);
  ((*cons)(_1872_conid)) = (_1889_res).as<::mosek::fusion::ModelConstraint>();
  if (((int)((_1846_name).size()) > (int)0))
  {
    {
      con_map->setItem(_1846_name,_1872_conid);
    }
  }
  {}
  return _1889_res;
}
// End mosek.fusion.Model.constraint_

// Begin mosek.fusion.Model.constraint_
// Method mosek.fusion.Model.constraint_ @ bld/grindsted/final/default/src/fusion/Model.mbi:1078:6-1265:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint_(const std::string & _1891_name,monty::rc_ptr< ::mosek::fusion::Expression > _1892_expr,monty::rc_ptr< ::mosek::fusion::PSDDomain > _1893_dom_)
{
  if (((mosek::fusion::p_WorkStack::_get_impl(rs)->pi32 != (int)0) || ((mosek::fusion::p_WorkStack::_get_impl(rs)->pi64 != (int)0) || (mosek::fusion::p_WorkStack::_get_impl(rs)->pf64 != (int)0))))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Stack rs not clean"));
    }
  }
  {}
  if (((mosek::fusion::p_WorkStack::_get_impl(ws)->pi32 != (int)0) || ((mosek::fusion::p_WorkStack::_get_impl(ws)->pi64 != (int)0) || (mosek::fusion::p_WorkStack::_get_impl(ws)->pf64 != (int)0))))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Stack ws not clean"));
    }
  }
  {}
  xs->clear();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1894_shape = _1892_expr->getShape();
  _checked_ptr_1<int32_t> _ptr__1894_shape(_1894_shape ? _1894_shape->raw() : nullptr,_1894_shape ? _1894_shape->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::PSDDomain > _1895_dom = mosek::fusion::p_PSDDomain::_get_impl(_1893_dom_.get())->__mosek_2fusion_2PSDDomain__finalize_and_validate(_1894_shape);
  bool _1896_tril = (mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->conedim1 < mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->conedim2);
  int32_t _9997_;
  bool _9998_ = (mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->conedim1 < mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->conedim2);
  if (_9998_)
  {
    _9997_ = mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->conedim2;
  }
  else
  {
    _9997_ = mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->conedim1;
  }
  int32_t _1897_conedim1 = _9997_;
  int32_t _9999_;
  bool _10000_ = (mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->conedim1 < mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->conedim2);
  if (_10000_)
  {
    _9999_ = mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->conedim1;
  }
  else
  {
    _9999_ = mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->conedim2;
  }
  int32_t _1898_conedim0 = _9999_;
  monty::rc_ptr< ::mosek::fusion::Expression > _10001_;
  bool _10002_ = (mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->key == ::mosek::fusion::PSDKey::IsSymPSD);
  if (_10002_)
  {
    _10001_ = ::mosek::fusion::p_ExprSymmetrize::_new_ExprSymmetrize(_1898_conedim0,_1897_conedim1,_1892_expr).as<::mosek::fusion::Expression>();
  }
  else
  {
    _10001_ = _1892_expr;
  }
  monty::rc_ptr< ::mosek::fusion::ExprDenseTril > _1899_e = ::mosek::fusion::p_ExprDenseTril::_new_ExprDenseTril(_1898_conedim0,_1897_conedim1,(::mosek::fusion::p_ExprOptimizeCode::_new_ExprOptimizeCode((::mosek::fusion::p_ExprCompress::_new_ExprCompress((::mosek::fusion::p_ExprScaleVecPSD::_new_ExprScaleVecPSD(_1898_conedim0,_1897_conedim1,(::mosek::fusion::p_ExprDenseTril::_new_ExprDenseTril(_1898_conedim0,_1897_conedim1,_10001_)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>());
  _1899_e->recursive_eval(rs,ws,xs,cache_evaluations);
  rs->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1900_ri32 = mosek::fusion::p_WorkStack::_get_impl(rs)->i32;
  _checked_ptr_1<int32_t> _ptr__1900_ri32(_1900_ri32 ? _1900_ri32->raw() : nullptr,_1900_ri32 ? _1900_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1901_ri64 = mosek::fusion::p_WorkStack::_get_impl(rs)->i64;
  _checked_ptr_1<int64_t> _ptr__1901_ri64(_1901_ri64 ? _1901_ri64->raw() : nullptr,_1901_ri64 ? _1901_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1902_rf64 = mosek::fusion::p_WorkStack::_get_impl(rs)->f64;
  _checked_ptr_1<double> _ptr__1902_rf64(_1902_rf64 ? _1902_rf64->raw() : nullptr,_1902_rf64 ? _1902_rf64->size(0) : 0);
  int32_t _1903_nd = mosek::fusion::p_WorkStack::_get_impl(rs)->nd;
  int32_t _1904_nelem = mosek::fusion::p_WorkStack::_get_impl(rs)->nelem;
  int32_t _1905_nnz = mosek::fusion::p_WorkStack::_get_impl(rs)->nnz;
  bool _1906_hassp = mosek::fusion::p_WorkStack::_get_impl(rs)->hassp;
  int32_t _1907_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(rs)->ncodeatom;
  int32_t _1908_shape_base = mosek::fusion::p_WorkStack::_get_impl(rs)->shape_base;
  int32_t _1909_ptr_base = mosek::fusion::p_WorkStack::_get_impl(rs)->ptr_base;
  int32_t _1910_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(rs)->nidxs_base;
  int32_t _1911_sp_base = mosek::fusion::p_WorkStack::_get_impl(rs)->sp_base;
  int32_t _1912_cof_base = mosek::fusion::p_WorkStack::_get_impl(rs)->cof_base;
  int32_t _1913_codeptr = mosek::fusion::p_WorkStack::_get_impl(rs)->codeptr_base;
  int32_t _1914_code = mosek::fusion::p_WorkStack::_get_impl(rs)->code_base;
  int32_t _1915_cconst = mosek::fusion::p_WorkStack::_get_impl(rs)->cconst_base;
  int32_t _1916_conedim = _ptr__1894_shape[_1897_conedim1];
  int32_t _1917_conesize = (safe_mul( _1916_conedim,safe_add( _1916_conedim,(int)1 ) ) / (int)2);
  int32_t _1918_numcone = (int)1;
  int32_t _10003_ = (int)0;
  int32_t _10004_ = _1903_nd;
  for (int32_t _1919_i = _10003_; _1919_i < _10004_; ++_1919_i)
  {
    {
      if (((_1919_i != _1898_conedim0) && (_1919_i != _1897_conedim1)))
      {
        {
          _1918_numcone *= _ptr__1894_shape[_1919_i];
        }
      }
      {}
    }
  }
  int64_t _1920_domainidx = task_append_domain_svec_psd(_1917_conesize);
  int32_t _1921_domsize = safe_mul( _1917_conesize,_1918_numcone );
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1922_afeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1921_domsize)));
  _checked_ptr_1<int32_t> _ptr__1922_afeidxs(_1922_afeidxs ? _1922_afeidxs->raw() : nullptr,_1922_afeidxs ? _1922_afeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1923_accidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1918_numcone)));
  _checked_ptr_1<int32_t> _ptr__1923_accidxs(_1923_accidxs ? _1923_accidxs->raw() : nullptr,_1923_accidxs ? _1923_accidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1924_conelmidx = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1921_domsize)));
  _checked_ptr_1<int32_t> _ptr__1924_conelmidx(_1924_conelmidx ? _1924_conelmidx->raw() : nullptr,_1924_conelmidx ? _1924_conelmidx->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1925_g = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_1921_domsize)));
  _checked_ptr_1<double> _ptr__1925_g(_1925_g ? _1925_g->raw() : nullptr,_1925_g ? _1925_g->size(0) : 0);
  std::vector<int64_t> _10005_;
  for (int32_t _1927_i = (int)0, _10006_ = _1918_numcone; _1927_i < _10006_ ; ++_1927_i)
  {
    _10005_.push_back(_1920_domainidx);
  }
  auto _10007_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10005_.size()),_10005_.begin(),_10005_.end()));
  int32_t _1926_conid = acon_allocate(_10007_,_1917_conesize,_1918_numcone,_1925_g,_1922_afeidxs,_1923_accidxs);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1928_aconidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1921_domsize)));
  _checked_ptr_1<int32_t> _ptr__1928_aconidxs(_1928_aconidxs ? _1928_aconidxs->raw() : nullptr,_1928_aconidxs ? _1928_aconidxs->size(0) : 0);
  acon_block_map->get(_1926_conid,_1928_aconidxs,(int)0);
  int64_t _1929_d5 = (int)1;
  int64_t _1930_d4 = _ptr__1894_shape[_1897_conedim1];
  int64_t _1931_d3 = (int)1;
  int64_t _1932_d2 = _ptr__1894_shape[_1898_conedim0];
  int64_t _1933_d1 = (int)1;
  int32_t _10008_ = (int)0;
  int32_t _10009_ = _1898_conedim0;
  for (int32_t _1934_i = _10008_; _1934_i < _10009_; ++_1934_i)
  {
    {
      _1933_d1 *= _ptr__1894_shape[_1934_i];
    }
  }
  int32_t _10010_ = safe_add( _1898_conedim0,(int)1 );
  int32_t _10011_ = _1897_conedim1;
  for (int32_t _1935_i = _10010_; _1935_i < _10011_; ++_1935_i)
  {
    {
      _1931_d3 *= _ptr__1894_shape[_1935_i];
    }
  }
  int32_t _10012_ = safe_add( _1897_conedim1,(int)1 );
  int32_t _10013_ = _1903_nd;
  for (int32_t _1936_i = _10012_; _1936_i < _10013_; ++_1936_i)
  {
    {
      _1929_d5 *= _ptr__1894_shape[_1936_i];
    }
  }
  {
    int32_t _1937_k = (int)0;
    double _1938_s = (1.0 / ::mosek::fusion::Utils::Tools::sqrt((double)((int)2)));
    int32_t _10014_ = (int)0;
    int64_t _10015_ = safe_mul( safe_mul( _1933_d1,_1931_d3 ),_1929_d5 );
    for (int64_t _1939_i1 = _10014_; _1939_i1 < _10015_; ++_1939_i1)
    {
      {
        int32_t _10016_ = (int)0;
        int64_t _10017_ = _1932_d2;
        for (int64_t _1940_i2 = _10016_; _1940_i2 < _10017_; ++_1940_i2)
        {
          {
            ++ _1937_k;
            int64_t _10018_ = safe_add( _1940_i2,(int)1 );
            int64_t _10019_ = _1930_d4;
            for (int64_t _1941_i4 = _10018_; _1941_i4 < _10019_; ++_1941_i4)
            {
              {
                ((*acon_elm_scale)(_ptr__1928_aconidxs[_1937_k])) = _1938_s;
                ++ _1937_k;
              }
            }
          }
        }
      }
    }
  }
  {
    std::shared_ptr< monty::ndarray< int32_t,1 > > _1942_afetrilperm = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_1904_nelem)));
    _checked_ptr_1<int32_t> _ptr__1942_afetrilperm(_1942_afetrilperm ? _1942_afetrilperm->raw() : nullptr,_1942_afetrilperm ? _1942_afetrilperm->size(0) : 0);
    int32_t _1943_k = (int)0;
    if (_1896_tril)
    {
      {
        int32_t _10020_ = (int)0;
        int64_t _10021_ = _1933_d1;
        for (int64_t _1944_i1 = _10020_; _1944_i1 < _10021_; ++_1944_i1)
        {
          {
            int32_t _10022_ = (int)0;
            int64_t _10023_ = _1930_d4;
            for (int64_t _1945_i4 = _10022_; _1945_i4 < _10023_; ++_1945_i4)
            {
              {
                int32_t _10024_ = (int)0;
                int64_t _10025_ = _1931_d3;
                for (int64_t _1946_i3 = _10024_; _1946_i3 < _10025_; ++_1946_i3)
                {
                  {
                    int64_t _10026_ = _1945_i4;
                    int64_t _10027_ = _1932_d2;
                    for (int64_t _1947_i2 = _10026_; _1947_i2 < _10027_; ++_1947_i2)
                    {
                      {
                        int32_t _10028_ = (int)0;
                        int64_t _10029_ = _1929_d5;
                        for (int64_t _1948_i5 = _10028_; _1948_i5 < _10029_; ++_1948_i5)
                        {
                          {
                            int64_t _1949_coneidx = safe_add( safe_add( safe_mul( safe_mul( _1944_i1,_1931_d3 ),_1929_d5 ),safe_mul( _1946_i3,_1929_d5 ) ),_1948_i5 );
                            int64_t _1950_coneofs = safe_add( (safe_mul( _1947_i2,safe_add( _1947_i2,(int)1 ) ) / (int)2),_1945_i4 );
                            _ptr__1942_afetrilperm[safe_add( safe_mul( _1949_coneidx,_1917_conesize ),_1950_coneofs )] = _ptr__1922_afeidxs[_1943_k];
                            ++ _1943_k;
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    else
    {
      {
        int32_t _10030_ = (int)0;
        int64_t _10031_ = _1933_d1;
        for (int64_t _1951_i1 = _10030_; _1951_i1 < _10031_; ++_1951_i1)
        {
          {
            int32_t _10032_ = (int)0;
            int64_t _10033_ = _1930_d4;
            for (int64_t _1952_i4 = _10032_; _1952_i4 < _10033_; ++_1952_i4)
            {
              {
                int32_t _10034_ = (int)0;
                int64_t _10035_ = _1931_d3;
                for (int64_t _1953_i3 = _10034_; _1953_i3 < _10035_; ++_1953_i3)
                {
                  {
                    int32_t _10036_ = (int)0;
                    int64_t _10037_ = safe_add( _1952_i4,(int)1 );
                    for (int64_t _1954_i2 = _10036_; _1954_i2 < _10037_; ++_1954_i2)
                    {
                      {
                        int32_t _10038_ = (int)0;
                        int64_t _10039_ = _1929_d5;
                        for (int64_t _1955_i5 = _10038_; _1955_i5 < _10039_; ++_1955_i5)
                        {
                          {
                            int64_t _1956_coneidx = safe_add( safe_add( safe_mul( safe_mul( _1951_i1,_1931_d3 ),_1929_d5 ),safe_mul( _1953_i3,_1929_d5 ) ),_1955_i5 );
                            int64_t _1957_coneofs = safe_add( (safe_mul( _1954_i2,((safe_mul( (int)2,_1932_d2 ) - _1954_i2) - (int)1) ) / (int)2),_1952_i4 );
                            _ptr__1942_afetrilperm[safe_add( safe_mul( _1956_coneidx,_1917_conesize ),_1957_coneofs )] = _ptr__1922_afeidxs[_1943_k];
                            ++ _1943_k;
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    putfrows(_1942_afetrilperm,(int)0,rs,_1904_nelem,_1905_nnz,_1909_ptr_base,_1910_nidxs_base,_1912_cof_base);
    if ((_1907_ncodeatom > (int)0))
    {
      {
        afe_blocks->replace_row_code(rs,_1942_afetrilperm,_1909_ptr_base,_1910_nidxs_base,_1913_codeptr,_1914_code,_1915_cconst);
      }
    }
    else
    {
      {
      }
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1958_pafeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_mul( safe_mul( _1918_numcone,_1932_d2 ),_1932_d2 ))));
  _checked_ptr_1<int32_t> _ptr__1958_pafeidxs(_1958_pafeidxs ? _1958_pafeidxs->raw() : nullptr,_1958_pafeidxs ? _1958_pafeidxs->size(0) : 0);
  {
    int32_t _1959_k = (int)0;
    if (_1896_tril)
    {
      {
        int32_t _10040_ = (int)0;
        int64_t _10041_ = _1933_d1;
        for (int64_t _1960_i1 = _10040_; _1960_i1 < _10041_; ++_1960_i1)
        {
          {
            int32_t _10042_ = (int)0;
            int64_t _10043_ = _1932_d2;
            for (int64_t _1961_i2 = _10042_; _1961_i2 < _10043_; ++_1961_i2)
            {
              {
                int32_t _10044_ = (int)0;
                int64_t _10045_ = _1931_d3;
                for (int64_t _1962_i3 = _10044_; _1962_i3 < _10045_; ++_1962_i3)
                {
                  {
                    int32_t _10046_ = (int)0;
                    int64_t _10047_ = _1930_d4;
                    for (int64_t _1963_i4 = _10046_; _1963_i4 < _10047_; ++_1963_i4)
                    {
                      {
                        int32_t _10048_ = (int)0;
                        int64_t _10049_ = _1929_d5;
                        for (int64_t _1964_i5 = _10048_; _1964_i5 < _10049_; ++_1964_i5)
                        {
                          {
                            int64_t _1965_coneidx = safe_add( safe_add( safe_mul( safe_mul( _1960_i1,_1931_d3 ),_1929_d5 ),safe_mul( _1962_i3,_1929_d5 ) ),_1964_i5 );
                            int64_t _10050_;
                            bool _10051_ = (_1961_i2 >= _1963_i4);
                            if (_10051_)
                            {
                              _10050_ = safe_add( (safe_mul( _1963_i4,((safe_mul( (int)2,_1932_d2 ) - _1963_i4) - (int)1) ) / (int)2),_1961_i2 );
                            }
                            else
                            {
                              _10050_ = safe_add( (safe_mul( _1961_i2,((safe_mul( (int)2,_1932_d2 ) - _1961_i2) - (int)1) ) / (int)2),_1963_i4 );
                            }
                            int64_t _1966_coneofs = _10050_;
                            _ptr__1958_pafeidxs[_1959_k] = _ptr__1922_afeidxs[safe_add( safe_mul( _1965_coneidx,_1917_conesize ),_1966_coneofs )];
                            ++ _1959_k;
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    else
    {
      {
        int32_t _10052_ = (int)0;
        int64_t _10053_ = _1933_d1;
        for (int64_t _1967_i1 = _10052_; _1967_i1 < _10053_; ++_1967_i1)
        {
          {
            int32_t _10054_ = (int)0;
            int64_t _10055_ = _1932_d2;
            for (int64_t _1968_i2 = _10054_; _1968_i2 < _10055_; ++_1968_i2)
            {
              {
                int32_t _10056_ = (int)0;
                int64_t _10057_ = _1931_d3;
                for (int64_t _1969_i3 = _10056_; _1969_i3 < _10057_; ++_1969_i3)
                {
                  {
                    int32_t _10058_ = (int)0;
                    int64_t _10059_ = _1930_d4;
                    for (int64_t _1970_i4 = _10058_; _1970_i4 < _10059_; ++_1970_i4)
                    {
                      {
                        int32_t _10060_ = (int)0;
                        int64_t _10061_ = _1929_d5;
                        for (int64_t _1971_i5 = _10060_; _1971_i5 < _10061_; ++_1971_i5)
                        {
                          {
                            int64_t _1972_coneidx = safe_add( safe_add( safe_mul( safe_mul( _1967_i1,_1931_d3 ),_1929_d5 ),safe_mul( _1969_i3,_1929_d5 ) ),_1971_i5 );
                            int64_t _10062_;
                            bool _10063_ = (_1968_i2 >= _1970_i4);
                            if (_10063_)
                            {
                              _10062_ = safe_add( (safe_mul( _1970_i4,((safe_mul( (int)2,_1932_d2 ) - _1970_i4) - (int)1) ) / (int)2),_1968_i2 );
                            }
                            else
                            {
                              _10062_ = safe_add( (safe_mul( _1968_i2,((safe_mul( (int)2,_1932_d2 ) - _1968_i2) - (int)1) ) / (int)2),_1970_i4 );
                            }
                            int64_t _1973_coneofs = _10062_;
                            _ptr__1958_pafeidxs[_1959_k] = _ptr__1922_afeidxs[safe_add( safe_mul( _1972_coneidx,_1917_conesize ),_1973_coneofs )];
                            ++ _1959_k;
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  if (((int)((_1891_name).size()) > (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _1974_coneshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(((int)((_1894_shape)->size(0)) - (int)2))));
      _checked_ptr_1<int32_t> _ptr__1974_coneshape(_1974_coneshape ? _1974_coneshape->raw() : nullptr,_1974_coneshape ? _1974_coneshape->size(0) : 0);
      int32_t _10064_ = (int)0;
      int32_t _10065_ = _1898_conedim0;
      for (int32_t _1975_i = _10064_; _1975_i < _10065_; ++_1975_i)
      {
        {
          _ptr__1974_coneshape[_1975_i] = _ptr__1894_shape[_1975_i];
        }
      }
      int32_t _10066_ = safe_add( _1898_conedim0,(int)1 );
      int32_t _10067_ = _1897_conedim1;
      for (int32_t _1976_i = _10066_; _1976_i < _10067_; ++_1976_i)
      {
        {
          _ptr__1974_coneshape[(_1976_i - (int)1)] = _ptr__1894_shape[_1976_i];
        }
      }
      int32_t _10068_ = safe_add( _1897_conedim1,(int)1 );
      int32_t _10069_ = _1903_nd;
      for (int32_t _1977_i = _10068_; _1977_i < _10069_; ++_1977_i)
      {
        {
          _ptr__1974_coneshape[(_1977_i - (int)2)] = _ptr__1894_shape[_1977_i];
        }
      }
      monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _1978_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
      _1978_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_1891_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("["));
      if ((_1903_nd > (int)2))
      {
        {
          _1978_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("%0"));
          int32_t _10070_ = (int)1;
          int32_t _10071_ = (_1903_nd - (int)2);
          for (int32_t _1979_i = _10070_; _1979_i < _10071_; ++_1979_i)
          {
            {
              _1978_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",%"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1979_i);
            }
          }
        }
      }
      {}
      _1978_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("]"));
      if ((NULL != mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->indexnames.get()))
      {
        {
          std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _1980_dindexnames = mosek::fusion::p_PSDDomain::_get_impl(_1895_dom)->indexnames;
          std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _1981_indexnames = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape((_1903_nd - (int)2))));
          int32_t _10072_ = (int)0;
          int32_t _10073_ = _1898_conedim0;
          for (int32_t _1982_i = _10072_; _1982_i < _10073_; ++_1982_i)
          {
            {
              ((*_1981_indexnames)(_1982_i)) = ((*_1980_dindexnames)(_1982_i));
            }
          }
          int32_t _10074_ = safe_add( _1898_conedim0,(int)1 );
          int32_t _10075_ = _1897_conedim1;
          for (int32_t _1983_i = _10074_; _1983_i < _10075_; ++_1983_i)
          {
            {
              ((*_1981_indexnames)((_1983_i - (int)1))) = ((*_1980_dindexnames)(_1983_i));
            }
          }
          int32_t _10076_ = safe_add( _1897_conedim1,(int)1 );
          int32_t _10077_ = _1903_nd;
          for (int32_t _1984_i = _10076_; _1984_i < _10077_; ++_1984_i)
          {
            {
              ((*_1981_indexnames)((_1984_i - (int)2))) = ((*_1980_dindexnames)(_1984_i));
            }
          }
          std::vector<int64_t> _10078_;
          for (int32_t _1985_i = (int)0, _10079_ = (int)((_1923_accidxs)->size(0)); _1985_i < _10079_ ; ++_1985_i)
          {
            _10078_.push_back(_ptr__1923_accidxs[_1985_i]);
          }
          auto _10080_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10078_.size()),_10078_.begin(),_10078_.end()));
          task_format_acc_names(_10080_,_1978_sb->toString(),_1974_coneshape,_1981_indexnames);
        }
      }
      else
      {
        {
          std::vector<int64_t> _10081_;
          for (int32_t _1986_i = (int)0, _10082_ = (int)((_1923_accidxs)->size(0)); _1986_i < _10082_ ; ++_1986_i)
          {
            _10081_.push_back(_ptr__1923_accidxs[_1986_i]);
          }
          auto _10083_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10081_.size()),_10081_.begin(),_10081_.end()));
          task_format_acc_names(_10083_,_1978_sb->toString(),_1974_coneshape,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(nullptr));
        }
      }
    }
  }
  {}
  monty::rc_ptr< ::mosek::fusion::ConicConstraint > _1987_res = ::mosek::fusion::p_ConicConstraint::_new_ConicConstraint(::mosek::fusion::Model::t(_pubthis),_1891_name,nullptr,_1894_shape,_1926_conid,_1958_pafeidxs,nullptr);
  ((*acons)(_1926_conid)) = (_1987_res).as<::mosek::fusion::ModelConstraint>();
  if (((int)((_1891_name).size()) > (int)0))
  {
    {
      con_map->setItem(_1891_name,(-safe_add( (int)1,_1926_conid )));
    }
  }
  {}
  return (_1987_res).as<::mosek::fusion::Constraint>();
}
// End mosek.fusion.Model.constraint_

// Begin mosek.fusion.Model.constraint_
// Method mosek.fusion.Model.constraint_ @ bld/grindsted/final/default/src/fusion/Model.mbi:850:6-1075:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint_(const std::string & _1988_name,monty::rc_ptr< ::mosek::fusion::Expression > _1989_expr,monty::rc_ptr< ::mosek::fusion::ConeDomain > _1990_dom_)
{
  if (((mosek::fusion::p_WorkStack::_get_impl(rs)->pi32 != (int)0) || ((mosek::fusion::p_WorkStack::_get_impl(rs)->pi64 != (int)0) || (mosek::fusion::p_WorkStack::_get_impl(rs)->pf64 != (int)0))))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Stack rs not clean"));
    }
  }
  {}
  if (((mosek::fusion::p_WorkStack::_get_impl(ws)->pi32 != (int)0) || ((mosek::fusion::p_WorkStack::_get_impl(ws)->pi64 != (int)0) || (mosek::fusion::p_WorkStack::_get_impl(ws)->pf64 != (int)0))))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Stack ws not clean"));
    }
  }
  {}
  xs->clear();
  if ((((int)((_1988_name).size()) > (int)0) && hasConstraint(_1988_name)))
  {
    {
      throw ::mosek::fusion::NameError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Duplicate constraint name '"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1988_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"))->toString());
    }
  }
  {}
  if ((((int)((_1988_name).size()) > (int)0) && hasConstraint(_1988_name)))
  {
    {
      throw ::mosek::fusion::NameError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Duplicate constraint name '"))->__mosek_2fusion_2Utils_2StringBuffer__a(_1988_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"))->toString());
    }
  }
  {}
  if (mosek::fusion::p_ConeDomain::_get_impl(_1990_dom_)->int_flag)
  {
    {
      throw ::mosek::fusion::DomainError(std::string ("Integer domain not allowed in a constraint"));
    }
  }
  {}
  monty::rc_ptr< ::mosek::fusion::ExprDense > _1991_e = ::mosek::fusion::p_ExprDense::_new_ExprDense((::mosek::fusion::p_ExprOptimizeCode::_new_ExprOptimizeCode((::mosek::fusion::p_ExprCompress::_new_ExprCompress(_1989_expr)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>());
  _1991_e->recursive_eval(rs,ws,xs,cache_evaluations);
  rs->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _1992_ri32 = mosek::fusion::p_WorkStack::_get_impl(rs)->i32;
  _checked_ptr_1<int32_t> _ptr__1992_ri32(_1992_ri32 ? _1992_ri32->raw() : nullptr,_1992_ri32 ? _1992_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _1993_ri64 = mosek::fusion::p_WorkStack::_get_impl(rs)->i64;
  _checked_ptr_1<int64_t> _ptr__1993_ri64(_1993_ri64 ? _1993_ri64->raw() : nullptr,_1993_ri64 ? _1993_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _1994_rf64 = mosek::fusion::p_WorkStack::_get_impl(rs)->f64;
  _checked_ptr_1<double> _ptr__1994_rf64(_1994_rf64 ? _1994_rf64->raw() : nullptr,_1994_rf64 ? _1994_rf64->size(0) : 0);
  int32_t _1995_nd = mosek::fusion::p_WorkStack::_get_impl(rs)->nd;
  int32_t _1996_shape_base = mosek::fusion::p_WorkStack::_get_impl(rs)->shape_base;
  int32_t _1997_nelem = mosek::fusion::p_WorkStack::_get_impl(rs)->nelem;
  int32_t _1998_nnz = mosek::fusion::p_WorkStack::_get_impl(rs)->nnz;
  int32_t _1999_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(rs)->ncodeatom;
  bool _2000_hassp = mosek::fusion::p_WorkStack::_get_impl(rs)->hassp;
  int32_t _2001_ptr_base = mosek::fusion::p_WorkStack::_get_impl(rs)->ptr_base;
  int32_t _2002_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(rs)->nidxs_base;
  int32_t _2003_cof_base = mosek::fusion::p_WorkStack::_get_impl(rs)->cof_base;
  int32_t _2004_code = mosek::fusion::p_WorkStack::_get_impl(rs)->code_base;
  int32_t _2005_codeptr = mosek::fusion::p_WorkStack::_get_impl(rs)->codeptr_base;
  int32_t _2006_cconst = mosek::fusion::p_WorkStack::_get_impl(rs)->cconst_base;
  std::vector<int32_t> _10084_;
  for (int32_t _2008_i = (int)0, _10085_ = _1995_nd; _2008_i < _10085_ ; ++_2008_i)
  {
    _10084_.push_back(_ptr__1992_ri32[safe_add( _1996_shape_base,_2008_i )]);
  }
  auto _10086_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10084_.size()),_10084_.begin(),_10084_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2007_shape = _10086_;
  _checked_ptr_1<int32_t> _ptr__2007_shape(_2007_shape ? _2007_shape->raw() : nullptr,_2007_shape ? _2007_shape->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::ConeDomain > _2009_dom = mosek::fusion::p_ConeDomain::_get_impl(_1990_dom_.get())->__mosek_2fusion_2ConeDomain__finalize_and_validate(_2007_shape);
  int32_t _10087_;
  bool _10088_ = _2009_dom->axisIsSet();
  if (_10088_)
  {
    _10087_ = _2009_dom->getAxis();
  }
  else
  {
    _10087_ = (_1995_nd - (int)1);
  }
  int32_t _2010_coneaxis = _10087_;
  int32_t _2011_conesize = _ptr__2007_shape[_2010_coneaxis];
  int32_t _2012_d1 = (int)1;
  int32_t _2013_d0 = (int)1;
  int32_t _2014_domsize = (int)1;
  int32_t _10089_ = (int)0;
  int32_t _10090_ = _1995_nd;
  for (int32_t _2015_i = _10089_; _2015_i < _10090_; ++_2015_i)
  {
    {
      _2014_domsize *= _ptr__2007_shape[_2015_i];
    }
  }
  int32_t _10091_ = (int)0;
  int32_t _10092_ = _2010_coneaxis;
  for (int32_t _2016_i = _10091_; _2016_i < _10092_; ++_2016_i)
  {
    {
      _2013_d0 *= _ptr__2007_shape[_2016_i];
    }
  }
  int32_t _10093_ = safe_add( _2010_coneaxis,(int)1 );
  int32_t _10094_ = _1995_nd;
  for (int32_t _2017_i = _10093_; _2017_i < _10094_; ++_2017_i)
  {
    {
      _2012_d1 *= _ptr__2007_shape[_2017_i];
    }
  }
  int32_t _2018_numcone = safe_mul( _2013_d0,_2012_d1 );
  int64_t _2019_domainidx = (-(int)1);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2020_domainidxlist = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)0)));
  _checked_ptr_1<int64_t> _ptr__2020_domainidxlist(_2020_domainidxlist ? _2020_domainidxlist->raw() : nullptr,_2020_domainidxlist ? _2020_domainidxlist->size(0) : 0);
  if ((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InQCone))
  {
    {
      if ((_2011_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for quadratic cone"))->toString());
        }
      }
      {}
      _2019_domainidx = task_append_domain_quad(_2011_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InRotatedQCone))
  {
    {
      if ((_2011_conesize < (int)3))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for rotated quadratic cone"))->toString());
        }
      }
      {}
      _2019_domainidx = task_append_domain_rquad(_2011_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InPExpCone))
  {
    {
      if ((_2011_conesize != (int)3))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for exponential cone"))->toString());
        }
      }
      {}
      _2019_domainidx = task_append_domain_pexp();
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InPPowCone))
  {
    {
      if ((_2011_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for power cone"))->toString());
        }
      }
      {}
      if (((int)((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->alpha)->size(0)) < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Power cone requires at least two parameters"))->toString());
        }
      }
      {}
      _2019_domainidx = task_append_domain_ppow(_2011_conesize,mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->alpha);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InPPowConeSeq))
  {
    {
      if ((_2011_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for power cone"))->toString());
        }
      }
      {}
      if ((((int)((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->alpha)->size(0)) % _2018_numcone) != (int)0))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Incompatible number of cones and number of exponents alpha"))->toString());
        }
      }
      {}
      int32_t _2021_nleftcommon = ((int)((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->alpha)->size(0)) / _2018_numcone);
      if ((_2021_nleftcommon > _2011_conesize))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid number of exponents ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2021_nleftcommon)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") per power cone of dimension "))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->toString());
        }
      }
      {}
      _2020_domainidxlist = task_append_domain_ppow_seq(_2011_conesize,_2021_nleftcommon,mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->alpha);
      _ptr__2020_domainidxlist.update(_2020_domainidxlist ? _2020_domainidxlist->raw() : nullptr, _2020_domainidxlist ? _2020_domainidxlist->size(0) : 0);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InDExpCone))
  {
    {
      if ((_2011_conesize != (int)3))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for dual exponential cone"))->toString());
        }
      }
      {}
      _2019_domainidx = task_append_domain_dexp();
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InDPowCone))
  {
    {
      if ((_2011_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for dual power cone"))->toString());
        }
      }
      {}
      if (((int)((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->alpha)->size(0)) < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Power cone requires at least two parameters"))->toString());
        }
      }
      {}
      _2019_domainidx = task_append_domain_dpow(_2011_conesize,mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->alpha);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InDPowConeSeq))
  {
    {
      if ((_2011_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for power cone"))->toString());
        }
      }
      {}
      if ((((int)((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->alpha)->size(0)) % _2018_numcone) != (int)0))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Incompatible number of cones and number of exponents alpha"))->toString());
        }
      }
      {}
      int32_t _2022_nleftcommon = ((int)((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->alpha)->size(0)) / _2018_numcone);
      if ((_2022_nleftcommon > _2011_conesize))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid number of exponents ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2022_nleftcommon)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") per power cone of dimension "))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->toString());
        }
      }
      {}
      _2020_domainidxlist = task_append_domain_dpow_seq(_2011_conesize,_2022_nleftcommon,mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->alpha);
      _ptr__2020_domainidxlist.update(_2020_domainidxlist ? _2020_domainidxlist->raw() : nullptr, _2020_domainidxlist ? _2020_domainidxlist->size(0) : 0);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InPGeoMeanCone))
  {
    {
      if ((_2011_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for primal geometric mean cone"))->toString());
        }
      }
      {}
      _2019_domainidx = task_append_domain_pgeomean(_2011_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InDGeoMeanCone))
  {
    {
      if ((_2011_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for dual geometric mean cone"))->toString());
        }
      }
      {}
      _2019_domainidx = task_append_domain_dgeomean(_2011_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InSVecPSDCone))
  {
    {
      int32_t _2023_d = (int32_t)((::mosek::fusion::Utils::Tools::sqrt((double)(safe_add( (int)1,safe_mul( (int)8,_2011_conesize ) ))) - (int)1) / (int)2);
      if (((safe_mul( _2023_d,safe_add( _2023_d,(int)1 ) ) / (int)2) != _2011_conesize))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for vector positive semidefinite cone"))->toString());
        }
      }
      {}
      _2019_domainidx = task_append_domain_svec_psd(_2011_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::Positive))
  {
    {
      _2019_domainidx = task_append_domain_rpos(_2011_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::Negative))
  {
    {
      _2019_domainidx = task_append_domain_rneg(_2011_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::Unbounded))
  {
    {
      _2019_domainidx = task_append_domain_r(_2011_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::Zero))
  {
    {
      _2019_domainidx = task_append_domain_rzero(_2011_conesize);
    }
  }
  else if((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InPSDCone))
  {
    {
      if ((_2011_conesize < (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for positive semidefinite cone"))->toString());
        }
      }
      else
      {
        {
          int32_t _2024_d = (int32_t)((::mosek::fusion::Utils::Tools::sqrt((double)(safe_add( (int)1,safe_mul( (int)8,_2011_conesize ) ))) - (int)1) / (int)2);
          if (((safe_mul( _2024_d,safe_add( _2024_d,(int)1 ) ) / (int)2) != _2011_conesize))
          {
            {
              throw ::mosek::fusion::DimensionError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Invalid size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_2011_conesize)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") for positive semidefinite cone"))->toString());
            }
          }
          {}
        }
      }
      _2019_domainidx = task_append_domain_svec_psd(_2011_conesize);
    }
  }
  else
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal error: Invalid cone type"));
    }
  }
  std::shared_ptr< monty::ndarray< double,1 > > _2025_g = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_2014_domsize)));
  _checked_ptr_1<double> _ptr__2025_g(_2025_g ? _2025_g->raw() : nullptr,_2025_g ? _2025_g->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2026_afeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2014_domsize)));
  _checked_ptr_1<int32_t> _ptr__2026_afeidxs(_2026_afeidxs ? _2026_afeidxs->raw() : nullptr,_2026_afeidxs ? _2026_afeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2027_accidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2018_numcone)));
  _checked_ptr_1<int32_t> _ptr__2027_accidxs(_2027_accidxs ? _2027_accidxs->raw() : nullptr,_2027_accidxs ? _2027_accidxs->size(0) : 0);
  if (((mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InPPowConeSeq) || (mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->key == ::mosek::fusion::QConeKey::InDPowConeSeq)))
  {
    {
    }
  }
  else
  {
    {
      std::vector<int64_t> _10095_;
      for (int32_t _2028_i = (int)0, _10096_ = _2018_numcone; _2028_i < _10096_ ; ++_2028_i)
      {
        _10095_.push_back(_2019_domainidx);
      }
      auto _10097_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10095_.size()),_10095_.begin(),_10095_.end()));
      _2020_domainidxlist = _10097_;
      _ptr__2020_domainidxlist.update(_2020_domainidxlist ? _2020_domainidxlist->raw() : nullptr, _2020_domainidxlist ? _2020_domainidxlist->size(0) : 0);
    }
  }
  int32_t _2029_conid = acon_allocate(_2020_domainidxlist,_2011_conesize,_2018_numcone,_2025_g,_2026_afeidxs,_2027_accidxs);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2030_perm = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2014_domsize)));
  _checked_ptr_1<int32_t> _ptr__2030_perm(_2030_perm ? _2030_perm->raw() : nullptr,_2030_perm ? _2030_perm->size(0) : 0);
  {
    int32_t _2031_idx = (int)0;
    std::shared_ptr< monty::ndarray< double,1 > > _2032_ofs = mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->domofs;
    _checked_ptr_1<double> _ptr__2032_ofs(_2032_ofs ? _2032_ofs->raw() : nullptr,_2032_ofs ? _2032_ofs->size(0) : 0);
    {
      int32_t _10098_ = (int)0;
      int32_t _10099_ = _2013_d0;
      for (int32_t _2033_i0 = _10098_; _2033_i0 < _10099_; ++_2033_i0)
      {
        {
          int32_t _10100_ = (int)0;
          int32_t _10101_ = _2012_d1;
          for (int32_t _2034_i1 = _10100_; _2034_i1 < _10101_; ++_2034_i1)
          {
            {
              int32_t _10102_ = (int)0;
              int32_t _10103_ = _2011_conesize;
              for (int32_t _2035_ic = _10102_; _2035_ic < _10103_; ++_2035_ic)
              {
                {
                  _ptr__2030_perm[safe_add( safe_add( safe_mul( safe_mul( _2033_i0,_2012_d1 ),_2011_conesize ),safe_mul( _2035_ic,_2012_d1 ) ),_2034_i1 )] = _2031_idx;
                  ++ _2031_idx;
                }
              }
            }
          }
        }
      }
      if ((NULL != _2032_ofs.get()))
      {
        {
          int32_t _10104_ = (int)0;
          int32_t _10105_ = _2014_domsize;
          for (int32_t _2036_i = _10104_; _2036_i < _10105_; ++_2036_i)
          {
            {
              _ptr__2025_g[_ptr__2030_perm[_2036_i]] = _ptr__2032_ofs[_2036_i];
            }
          }
        }
      }
      {}
    }
  }
  std::vector<int32_t> _10106_;
  for (int32_t _2038_i = (int)0, _10107_ = _2014_domsize; _2038_i < _10107_ ; ++_2038_i)
  {
    _10106_.push_back(_ptr__2026_afeidxs[_ptr__2030_perm[_2038_i]]);
  }
  auto _10108_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10106_.size()),_10106_.begin(),_10106_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2037_pafeidxs = _10108_;
  _checked_ptr_1<int32_t> _ptr__2037_pafeidxs(_2037_pafeidxs ? _2037_pafeidxs->raw() : nullptr,_2037_pafeidxs ? _2037_pafeidxs->size(0) : 0);
  putfrows(_2037_pafeidxs,(int)0,rs,_1997_nelem,_1998_nnz,_2001_ptr_base,_2002_nidxs_base,_2003_cof_base);
  if ((_1999_ncodeatom > (int)0))
  {
    {
      afe_blocks->replace_row_code(rs,_2037_pafeidxs,_2001_ptr_base,_2002_nidxs_base,_2005_codeptr,_2004_code,_2006_cconst);
    }
  }
  {}
  if (((int)((_1988_name).size()) > (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2039_accshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(((int)((_2007_shape)->size(0)) - (int)1))));
      _checked_ptr_1<int32_t> _ptr__2039_accshape(_2039_accshape ? _2039_accshape->raw() : nullptr,_2039_accshape ? _2039_accshape->size(0) : 0);
      int32_t _10109_ = (int)0;
      int32_t _10110_ = _2010_coneaxis;
      for (int32_t _2040_i = _10109_; _2040_i < _10110_; ++_2040_i)
      {
        {
          _ptr__2039_accshape[_2040_i] = _ptr__2007_shape[_2040_i];
        }
      }
      int32_t _10111_ = safe_add( _2010_coneaxis,(int)1 );
      int32_t _10112_ = _1995_nd;
      for (int32_t _2041_i = _10111_; _2041_i < _10112_; ++_2041_i)
      {
        {
          _ptr__2039_accshape[(_2041_i - (int)1)] = _ptr__2007_shape[_2041_i];
        }
      }
      monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2042_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
      _2042_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_1988_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("["));
      if ((_1995_nd > (int)1))
      {
        {
          _2042_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("%0"));
          int32_t _10113_ = (int)1;
          int32_t _10114_ = (_1995_nd - (int)1);
          for (int32_t _2043_i = _10113_; _2043_i < _10114_; ++_2043_i)
          {
            {
              _2042_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",%"))->__mosek_2fusion_2Utils_2StringBuffer__a(_2043_i);
            }
          }
        }
      }
      {}
      _2042_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("]"));
      if ((NULL != mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->indexnames.get()))
      {
        {
          std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _2044_dindexnames = mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->indexnames;
          std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _2045_indexnames = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape((_1995_nd - (int)1))));
          int32_t _10115_ = (int)0;
          int32_t _10116_ = _2010_coneaxis;
          for (int32_t _2046_i = _10115_; _2046_i < _10116_; ++_2046_i)
          {
            {
              ((*_2045_indexnames)(_2046_i)) = ((*_2044_dindexnames)(_2046_i));
            }
          }
          int32_t _10117_ = safe_add( _2010_coneaxis,(int)1 );
          int32_t _10118_ = _1995_nd;
          for (int32_t _2047_i = _10117_; _2047_i < _10118_; ++_2047_i)
          {
            {
              ((*_2045_indexnames)((_2047_i - (int)1))) = ((*_2044_dindexnames)(_2047_i));
            }
          }
          std::vector<int64_t> _10119_;
          for (int32_t _2048_i = (int)0, _10120_ = (int)((_2027_accidxs)->size(0)); _2048_i < _10120_ ; ++_2048_i)
          {
            _10119_.push_back(_ptr__2027_accidxs[_2048_i]);
          }
          auto _10121_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10119_.size()),_10119_.begin(),_10119_.end()));
          task_format_acc_names(_10121_,_2042_sb->toString(),_2039_accshape,_2045_indexnames);
        }
      }
      else
      {
        {
          std::vector<int64_t> _10122_;
          for (int32_t _2049_i = (int)0, _10123_ = (int)((_2027_accidxs)->size(0)); _2049_i < _10123_ ; ++_2049_i)
          {
            _10122_.push_back(_ptr__2027_accidxs[_2049_i]);
          }
          auto _10124_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10122_.size()),_10122_.begin(),_10122_.end()));
          task_format_acc_names(_10124_,_2042_sb->toString(),_2039_accshape,std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(nullptr));
        }
      }
    }
  }
  {}
  monty::rc_ptr< ::mosek::fusion::ConicConstraint > _2050_res = ::mosek::fusion::p_ConicConstraint::_new_ConicConstraint(::mosek::fusion::Model::t(_pubthis),_1988_name,_2009_dom,_2007_shape,_2029_conid,_2026_afeidxs,mosek::fusion::p_ConeDomain::_get_impl(_2009_dom)->indexnames);
  ((*acons)(_2029_conid)) = (_2050_res).as<::mosek::fusion::ModelConstraint>();
  if (((int)((_1988_name).size()) > (int)0))
  {
    {
      con_map->setItem(_1988_name,(-safe_add( _2029_conid,(int)1 )));
    }
  }
  {}
  return (_2050_res).as<::mosek::fusion::Constraint>();
}
// End mosek.fusion.Model.constraint_

// Begin mosek.fusion.Model.constraint_
// Method mosek.fusion.Model.constraint_ @ bld/grindsted/final/default/src/fusion/Model.mbi:720:6-845:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__constraint_(const std::string & _2051_name,monty::rc_ptr< ::mosek::fusion::Expression > _2052_expr,monty::rc_ptr< ::mosek::fusion::LinearDomain > _2053_dom_)
{
  if (((mosek::fusion::p_WorkStack::_get_impl(rs)->pi32 != (int)0) || ((mosek::fusion::p_WorkStack::_get_impl(rs)->pi64 != (int)0) || (mosek::fusion::p_WorkStack::_get_impl(rs)->pf64 != (int)0))))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Stack rs not clean"));
    }
  }
  {}
  if (((mosek::fusion::p_WorkStack::_get_impl(ws)->pi32 != (int)0) || ((mosek::fusion::p_WorkStack::_get_impl(ws)->pi64 != (int)0) || (mosek::fusion::p_WorkStack::_get_impl(ws)->pf64 != (int)0))))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Stack ws not clean"));
    }
  }
  {}
  xs->clear();
  if ((((int)((_2051_name).size()) > (int)0) && hasConstraint(_2051_name)))
  {
    {
      throw ::mosek::fusion::NameError(::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Duplicate constraint name '"))->__mosek_2fusion_2Utils_2StringBuffer__a(_2051_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"))->toString());
    }
  }
  {}
  if (mosek::fusion::p_LinearDomain::_get_impl(_2053_dom_)->cardinal_flag)
  {
    {
      throw ::mosek::fusion::DomainError(std::string ("Integer domain not allowed in a constraint"));
    }
  }
  {}
  monty::rc_ptr< ::mosek::fusion::ExprDense > _2054_e = ::mosek::fusion::p_ExprDense::_new_ExprDense((::mosek::fusion::p_ExprOptimizeCode::_new_ExprOptimizeCode((::mosek::fusion::p_ExprCompress::_new_ExprCompress(_2052_expr)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>());
  _2054_e->recursive_eval(rs,ws,xs,cache_evaluations);
  rs->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2055_ri32 = mosek::fusion::p_WorkStack::_get_impl(rs)->i32;
  _checked_ptr_1<int32_t> _ptr__2055_ri32(_2055_ri32 ? _2055_ri32->raw() : nullptr,_2055_ri32 ? _2055_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2056_ri64 = mosek::fusion::p_WorkStack::_get_impl(rs)->i64;
  _checked_ptr_1<int64_t> _ptr__2056_ri64(_2056_ri64 ? _2056_ri64->raw() : nullptr,_2056_ri64 ? _2056_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _2057_rf64 = mosek::fusion::p_WorkStack::_get_impl(rs)->f64;
  _checked_ptr_1<double> _ptr__2057_rf64(_2057_rf64 ? _2057_rf64->raw() : nullptr,_2057_rf64 ? _2057_rf64->size(0) : 0);
  int32_t _2058_nd = mosek::fusion::p_WorkStack::_get_impl(rs)->nd;
  int32_t _2059_nelem = mosek::fusion::p_WorkStack::_get_impl(rs)->nelem;
  int32_t _2060_nnz = mosek::fusion::p_WorkStack::_get_impl(rs)->nnz;
  bool _2061_hassp = mosek::fusion::p_WorkStack::_get_impl(rs)->hassp;
  int32_t _2062_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(rs)->ncodeatom;
  int32_t _2063_shape_base = mosek::fusion::p_WorkStack::_get_impl(rs)->shape_base;
  int32_t _2064_ptr_base = mosek::fusion::p_WorkStack::_get_impl(rs)->ptr_base;
  int32_t _2065_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(rs)->nidxs_base;
  int32_t _2066_cof_base = mosek::fusion::p_WorkStack::_get_impl(rs)->cof_base;
  int32_t _2067_codeptr = mosek::fusion::p_WorkStack::_get_impl(rs)->codeptr_base;
  int32_t _2068_code = mosek::fusion::p_WorkStack::_get_impl(rs)->code_base;
  int32_t _2069_cconst = mosek::fusion::p_WorkStack::_get_impl(rs)->cconst_base;
  std::vector<int32_t> _10125_;
  for (int32_t _2071_i = (int)0, _10126_ = _2058_nd; _2071_i < _10126_ ; ++_2071_i)
  {
    _10125_.push_back(_ptr__2055_ri32[safe_add( _2063_shape_base,_2071_i )]);
  }
  auto _10127_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10125_.size()),_10125_.begin(),_10125_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2070_shape = _10127_;
  _checked_ptr_1<int32_t> _ptr__2070_shape(_2070_shape ? _2070_shape->raw() : nullptr,_2070_shape ? _2070_shape->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::LinearDomain > _2072_dom = mosek::fusion::p_LinearDomain::_get_impl(_2053_dom_.get())->__mosek_2fusion_2LinearDomain__finalize_and_validate(_2070_shape);
  int64_t _2073_domsize = mosek::fusion::p_LinearDomain::_get_impl(_2072_dom)->domsize;
  std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _2074_indexnames = mosek::fusion::p_LinearDomain::_get_impl(_2072_dom)->indexnames;
  std::shared_ptr< monty::ndarray< double,1 > > _2075_b;
  _checked_ptr_1<double> _ptr__2075_b(_2075_b ? _2075_b->raw() : nullptr,_2075_b ? _2075_b->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2076_nativeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2073_domsize)));
  _checked_ptr_1<int32_t> _ptr__2076_nativeidxs(_2076_nativeidxs ? _2076_nativeidxs->raw() : nullptr,_2076_nativeidxs ? _2076_nativeidxs->size(0) : 0);
  int32_t _2077_conid = con_allocate(_2076_nativeidxs);
  putarows(_2076_nativeidxs,rs,_2059_nelem,_2060_nnz,_2064_ptr_base,_2065_nidxs_base,_2066_cof_base);
  {
    std::shared_ptr< monty::ndarray< int32_t,2 > > _2078_domsp = mosek::fusion::p_LinearDomain::_get_impl(_2072_dom)->sparsity;
    bool _2079_domempty = mosek::fusion::p_LinearDomain::_get_impl(_2072_dom)->empty;
    std::shared_ptr< monty::ndarray< double,1 > > _2080_dombnd = mosek::fusion::p_LinearDomain::_get_impl(_2072_dom)->bnd;
    _checked_ptr_1<double> _ptr__2080_dombnd(_2080_dombnd ? _2080_dombnd->raw() : nullptr,_2080_dombnd ? _2080_dombnd->size(0) : 0);
    bool _2081_domscalable = mosek::fusion::p_LinearDomain::_get_impl(_2072_dom)->scalable;
    {
      if ((NULL == _2080_dombnd.get()))
      {
        {
          _2075_b = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)((_2076_nativeidxs)->size(0)))));
          _ptr__2075_b.update(_2075_b ? _2075_b->raw() : nullptr, _2075_b ? _2075_b->size(0) : 0);
        }
      }
      else if(_2081_domscalable)
      {
        {
          std::vector<double> _10128_;
          for (int32_t _2082_i = (int)0, _10129_ = (int)((_2076_nativeidxs)->size(0)); _2082_i < _10129_ ; ++_2082_i)
          {
            _10128_.push_back(_ptr__2080_dombnd[(int)0]);
          }
          auto _10130_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10128_.size()),_10128_.begin(),_10128_.end()));
          _2075_b = _10130_;
          _ptr__2075_b.update(_2075_b ? _2075_b->raw() : nullptr, _2075_b ? _2075_b->size(0) : 0);
        }
      }
      else if((NULL != _2078_domsp.get()))
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _2083_stride = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2058_nd)));
          _checked_ptr_1<int32_t> _ptr__2083_stride(_2083_stride ? _2083_stride->raw() : nullptr,_2083_stride ? _2083_stride->size(0) : 0);
          _ptr__2083_stride[(_2058_nd - (int)1)] = (int)1;
          int32_t _10131_ = (int)1;
          int32_t _10132_ = _2058_nd;
          for (int32_t _2084_i = _10131_; _2084_i < _10132_; ++_2084_i)
          {
            {
              _ptr__2083_stride[((_2058_nd - _2084_i) - (int)1)] = safe_mul( _ptr__2083_stride[(_2058_nd - _2084_i)],_ptr__2070_shape[(_2058_nd - _2084_i)] );
            }
          }
          _2075_b = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)((_2076_nativeidxs)->size(0)))));
          _ptr__2075_b.update(_2075_b ? _2075_b->raw() : nullptr, _2075_b ? _2075_b->size(0) : 0);
          int32_t _10133_ = (int)0;
          int32_t _10134_ = (int)((_2078_domsp)->size(0));
          for (int32_t _2085_i = _10133_; _2085_i < _10134_; ++_2085_i)
          {
            {
              int32_t _2086_idx = (int)0;
              int32_t _10135_ = (int)0;
              int32_t _10136_ = _2058_nd;
              for (int32_t _2087_j = _10135_; _2087_j < _10136_; ++_2087_j)
              {
                {
                  _2086_idx += safe_mul( _ptr__2083_stride[_2087_j],((*_2078_domsp)(_2085_i,_2087_j)) );
                }
              }
              _ptr__2075_b[_2086_idx] = _ptr__2080_dombnd[_2085_i];
            }
          }
        }
      }
      else if(_2079_domempty)
      {
        {
          _2075_b = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)((_2076_nativeidxs)->size(0)))));
          _ptr__2075_b.update(_2075_b ? _2075_b->raw() : nullptr, _2075_b ? _2075_b->size(0) : 0);
        }
      }
      else
      {
        {
          std::vector<double> _10137_;
          for (int32_t _2088_i = (int)0, _10138_ = (int)((_2076_nativeidxs)->size(0)); _2088_i < _10138_ ; ++_2088_i)
          {
            _10137_.push_back(_ptr__2080_dombnd[_2088_i]);
          }
          auto _10139_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10137_.size()),_10137_.begin(),_10137_.end()));
          _2075_b = _10139_;
          _ptr__2075_b.update(_2075_b ? _2075_b->raw() : nullptr, _2075_b ? _2075_b->size(0) : 0);
        }
      }
    }
  }
  if ((mosek::fusion::p_LinearDomain::_get_impl(_2072_dom)->key == ::mosek::fusion::RelationKey::IsFree))
  {
    {
      task_con_putboundlist_fr(_2076_nativeidxs);
    }
  }
  {}
  if ((mosek::fusion::p_LinearDomain::_get_impl(_2072_dom)->key == ::mosek::fusion::RelationKey::LessThan))
  {
    {
      task_con_putboundlist_up(_2076_nativeidxs,_2075_b);
    }
  }
  else if((mosek::fusion::p_LinearDomain::_get_impl(_2072_dom)->key == ::mosek::fusion::RelationKey::GreaterThan))
  {
    {
      task_con_putboundlist_lo(_2076_nativeidxs,_2075_b);
    }
  }
  else if((mosek::fusion::p_LinearDomain::_get_impl(_2072_dom)->key == ::mosek::fusion::RelationKey::EqualsTo))
  {
    {
      task_con_putboundlist_fx(_2076_nativeidxs,_2075_b);
    }
  }
  {}
  if ((_2062_ncodeatom > (int)0))
  {
    {
      con_blocks->replace_row_code(rs,_2076_nativeidxs,_2064_ptr_base,_2065_nidxs_base,_2067_codeptr,_2068_code,_2069_cconst);
    }
  }
  {}
  if (((int)((_2051_name).size()) > (int)0))
  {
    {
      monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2089_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
      _2089_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_2051_name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("["));
      if (((int)((_2070_shape)->size(0)) > (int)0))
      {
        {
          _2089_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("%0"));
        }
      }
      {}
      int32_t _10140_ = (int)1;
      int32_t _10141_ = (int)((_2070_shape)->size(0));
      for (int32_t _2090_i = _10140_; _2090_i < _10141_; ++_2090_i)
      {
        {
          _2089_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",%"))->__mosek_2fusion_2Utils_2StringBuffer__a(_2090_i);
        }
      }
      _2089_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("]"));
      if ((NULL != mosek::fusion::p_LinearDomain::_get_impl(_2072_dom)->indexnames.get()))
      {
        {
          task_format_con_names(_2076_nativeidxs,_2089_sb->toString(),_2070_shape,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),mosek::fusion::p_LinearDomain::_get_impl(_2072_dom)->indexnames);
        }
      }
      else
      {
        {
          task_format_con_names(_2076_nativeidxs,_2089_sb->toString(),_2070_shape,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(nullptr));
        }
      }
    }
  }
  {}
  monty::rc_ptr< ::mosek::fusion::LinearConstraint > _2091_res = ::mosek::fusion::p_LinearConstraint::_new_LinearConstraint(::mosek::fusion::Model::t(_pubthis),_2051_name,_2077_conid,_2070_shape,_2076_nativeidxs,_2074_indexnames);
  ((*cons)(_2077_conid)) = (_2091_res).as<::mosek::fusion::ModelConstraint>();
  if (((int)((_2051_name).size()) > (int)0))
  {
    {
      con_map->setItem(_2051_name,_2077_conid);
    }
  }
  {}
  return (_2091_res).as<::mosek::fusion::Constraint>();
}
// End mosek.fusion.Model.constraint_

// Begin mosek.fusion.Model.getVersion
// Method mosek.fusion.Model.getVersion @ bld/grindsted/final/default/src/fusion/Model.mbi:716:6-718:7
std::string mosek::fusion::Model::getVersion
  ( ) { return mosek::fusion::p_Model::getVersion(); }
std::string mosek::fusion::p_Model::getVersion()
{
  return ::mosek::fusion::p_BaseModel::env_getversion();
}
// End mosek.fusion.Model.getVersion

// Begin mosek.fusion.Model.hasParameter
// Method mosek.fusion.Model.hasParameter @ bld/grindsted/final/default/src/fusion/Model.mbi:711:6-93
bool mosek::fusion::Model :: hasParameter(const std::string & _2092_name) { return mosek::fusion::p_Model::_get_impl(this)->hasParameter(_2092_name); }
bool mosek::fusion::p_Model::hasParameter(const std::string & _2092_name)
{
  return par_map->hasItem(_2092_name);
}
// End mosek.fusion.Model.hasParameter

// Begin mosek.fusion.Model.hasConstraint
// Method mosek.fusion.Model.hasConstraint @ bld/grindsted/final/default/src/fusion/Model.mbi:710:6-93
bool mosek::fusion::Model :: hasConstraint(const std::string & _2093_name) { return mosek::fusion::p_Model::_get_impl(this)->hasConstraint(_2093_name); }
bool mosek::fusion::p_Model::hasConstraint(const std::string & _2093_name)
{
  return con_map->hasItem(_2093_name);
}
// End mosek.fusion.Model.hasConstraint

// Begin mosek.fusion.Model.hasVariable
// Method mosek.fusion.Model.hasVariable @ bld/grindsted/final/default/src/fusion/Model.mbi:709:6-93
bool mosek::fusion::Model :: hasVariable(const std::string & _2094_name) { return mosek::fusion::p_Model::_get_impl(this)->hasVariable(_2094_name); }
bool mosek::fusion::p_Model::hasVariable(const std::string & _2094_name)
{
  return var_map->hasItem(_2094_name);
}
// End mosek.fusion.Model.hasVariable

// Begin mosek.fusion.Model.getParameter
// Method mosek.fusion.Model.getParameter @ bld/grindsted/final/default/src/fusion/Model.mbi:707:6-149
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model :: __mosek_2fusion_2Model__getParameter(const std::string & _2095_name) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__getParameter(_2095_name); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Model::getParameter(const std::string &  _2095_name) { return __mosek_2fusion_2Model__getParameter(_2095_name); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Model::__mosek_2fusion_2Model__getParameter(const std::string & _2095_name)
{
  monty::rc_ptr< ::mosek::fusion::Parameter > _10142_;
  bool _10143_ = par_map->hasItem(_2095_name);
  if (_10143_)
  {
    _10142_ = ((*parameters)(par_map->getItem(_2095_name)));
  }
  else
  {
    _10142_ = nullptr;
  }
  return _10142_;
}
// End mosek.fusion.Model.getParameter

// Begin mosek.fusion.Model.getConstraint
// Method mosek.fusion.Model.getConstraint @ bld/grindsted/final/default/src/fusion/Model.mbi:706:6-167
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__getConstraint(int32_t _2096_index) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__getConstraint(_2096_index); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::getConstraint(int32_t _2096_index) { return __mosek_2fusion_2Model__getConstraint(_2096_index); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__getConstraint(int32_t _2096_index)
{
  monty::rc_ptr< ::mosek::fusion::Constraint > _2097_res;
  if ((_2096_index >= (int)0))
  {
    {
      _2097_res = (((*cons)(_2096_index))).as<::mosek::fusion::Constraint>();
    }
  }
  else
  {
    {
      _2097_res = (((*acons)((-safe_add( (int)1,_2096_index ))))).as<::mosek::fusion::Constraint>();
    }
  }
  return _2097_res;
}
// End mosek.fusion.Model.getConstraint

// Begin mosek.fusion.Model.getConstraint
// Method mosek.fusion.Model.getConstraint @ bld/grindsted/final/default/src/fusion/Model.mbi:696:6-705:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model :: __mosek_2fusion_2Model__getConstraint(const std::string & _2098_name) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__getConstraint(_2098_name); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Model::getConstraint(const std::string &  _2098_name) { return __mosek_2fusion_2Model__getConstraint(_2098_name); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Model::__mosek_2fusion_2Model__getConstraint(const std::string & _2098_name)
{
  monty::rc_ptr< ::mosek::fusion::Constraint > _2099_retval = nullptr;
  if (con_map->hasItem(_2098_name))
  {
    {
      int32_t _2100_idx = con_map->getItem(_2098_name);
      if ((_2100_idx >= (int)0))
      {
        {
          _2099_retval = (((*cons)(_2100_idx))).as<::mosek::fusion::Constraint>();
        }
      }
      else
      {
        {
          _2099_retval = (((*acons)((-safe_add( (int)1,_2100_idx ))))).as<::mosek::fusion::Constraint>();
        }
      }
    }
  }
  {}
  return _2099_retval;
}
// End mosek.fusion.Model.getConstraint

// Begin mosek.fusion.Model.getVariable
// Method mosek.fusion.Model.getVariable @ bld/grindsted/final/default/src/fusion/Model.mbi:694:6-86
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__getVariable(int32_t _2101_index) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__getVariable(_2101_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::getVariable(int32_t _2101_index) { return __mosek_2fusion_2Model__getVariable(_2101_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__getVariable(int32_t _2101_index)
{
  return (((*vars)(_2101_index))).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.Model.getVariable

// Begin mosek.fusion.Model.getVariable
// Method mosek.fusion.Model.getVariable @ bld/grindsted/final/default/src/fusion/Model.mbi:683:6-693:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model :: __mosek_2fusion_2Model__getVariable(const std::string & _2102_name) { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__getVariable(_2102_name); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Model::getVariable(const std::string &  _2102_name) { return __mosek_2fusion_2Model__getVariable(_2102_name); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Model::__mosek_2fusion_2Model__getVariable(const std::string & _2102_name)
{
  if (var_map->hasItem(_2102_name))
  {
    {
      int32_t _2103_varid = var_map->getItem(_2102_name);
      if ((_2103_varid < (int)0))
      {
        {
          return (((*barvars)((-safe_add( _2103_varid,(int)1 ))))).as<::mosek::fusion::Variable>();
        }
      }
      else
      {
        {
          return (((*vars)(_2103_varid))).as<::mosek::fusion::Variable>();
        }
      }
    }
  }
  else
  {
    {
      return nullptr;
    }
  }
}
// End mosek.fusion.Model.getVariable

// Begin mosek.fusion.Model.getName
// Method mosek.fusion.Model.getName @ bld/grindsted/final/default/src/fusion/Model.mbi:681:6-67
std::string mosek::fusion::Model :: getName() { return mosek::fusion::p_Model::_get_impl(this)->getName(); }
std::string mosek::fusion::p_Model::getName()
{
  return model_name;
}
// End mosek.fusion.Model.getName

// Begin mosek.fusion.Model.getParameterValue
// Method mosek.fusion.Model.getParameterValue @ bld/grindsted/final/default/src/fusion/Model.mbi:673:6-678:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Model::getParameterValue(std::shared_ptr< monty::ndarray< int32_t,1 > > _2104_idxs)
{
  _checked_ptr_1<int32_t> _ptr__2104_idxs(_2104_idxs ? _2104_idxs->raw() : nullptr, _2104_idxs ? _2104_idxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _2105_res = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)((_2104_idxs)->size(0)))));
  _checked_ptr_1<double> _ptr__2105_res(_2105_res ? _2105_res->raw() : nullptr,_2105_res ? _2105_res->size(0) : 0);
  int32_t _10144_ = (int)0;
  int32_t _10145_ = (int)((_2104_idxs)->size(0));
  for (int32_t _2106_i = _10144_; _2106_i < _10145_; ++_2106_i)
  {
    {
      _ptr__2105_res[_2106_i] = ((*param_value)(_ptr__2104_idxs[_2106_i]));
    }
  }
  return _2105_res;
}
// End mosek.fusion.Model.getParameterValue

// Begin mosek.fusion.Model.setParameterValue
// Method mosek.fusion.Model.setParameterValue @ bld/grindsted/final/default/src/fusion/Model.mbi:668:6-671:7
void mosek::fusion::p_Model::setParameterValue(std::shared_ptr< monty::ndarray< int32_t,1 > > _2107_idxs,std::shared_ptr< monty::ndarray< double,1 > > _2108_vals)
{
  _checked_ptr_1<int32_t> _ptr__2107_idxs(_2107_idxs ? _2107_idxs->raw() : nullptr, _2107_idxs ? _2107_idxs->size(0) : 0);
  _checked_ptr_1<double> _ptr__2108_vals(_2108_vals ? _2108_vals->raw() : nullptr, _2108_vals ? _2108_vals->size(0) : 0);
  int32_t _10146_ = (int)0;
  int32_t _10147_ = (int)((_2107_idxs)->size(0));
  for (int32_t _2109_i = _10146_; _2109_i < _10147_; ++_2109_i)
  {
    {
      ((*param_value)(_ptr__2107_idxs[_2109_i])) = _ptr__2108_vals[_2109_i];
    }
  }
}
// End mosek.fusion.Model.setParameterValue

// Begin mosek.fusion.Model.clone
// Method mosek.fusion.Model.clone @ bld/grindsted/final/default/src/fusion/Model.mbi:663:6-666:7
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::Model :: __mosek_2fusion_2Model__clone() { return mosek::fusion::p_Model::_get_impl(this)->__mosek_2fusion_2Model__clone(); }
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::Model::clone() { return __mosek_2fusion_2Model__clone(); }
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::p_Model::__mosek_2fusion_2Model__clone()
{
  return ::mosek::fusion::p_Model::_new_Model(::mosek::fusion::Model::t(_pubthis));
}
// End mosek.fusion.Model.clone

void mosek::fusion::p_Model::destroy()
{
  xs.reset();
  ws.reset();
  rs.reset();
  sol_itg.reset();
  sol_bas.reset();
  sol_itr.reset();
  con_map.reset();
  acons.reset();
  cons.reset();
  param_value.reset();
  par_map.reset();
  parameters.reset();
  initsol_xx_flag.reset();
  initsol_xx.reset();
  var_map.reset();
  barvars.reset();
  vars.reset();
  barvar_block_elm_j.reset();
  barvar_block_elm_i.reset();
  barvar_block_elm_barj.reset();
  barvar_block_elm_ptr.reset();
  barvar_block_dim.reset();
  barvar_block_ptr.reset();
  barvar_dim.reset();
  var_elm_acc_ofs.reset();
  var_elm_acc_idx.reset();
  var_block_acc_id.reset();
  var_block_map.reset();
  acon_elm_afe.reset();
  acon_elm_ofs.reset();
  acon_elm_scale.reset();
  acon_elm_accid.reset();
  acon_afe.reset();
  acon_acc.reset();
  acon_block_map.reset();
  acc_block_map.reset();
  obj_blocks.reset();
  afe_blocks.reset();
  con_blocks.reset();
}
void mosek::fusion::Model::destroy() { mosek::fusion::p_Model::_get_impl(this)->destroy(); }
// } class Model
// class BoundInterfaceVariable { // @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:29:4-85:5
mosek::fusion::BoundInterfaceVariable::BoundInterfaceVariable(mosek::fusion::p_BoundInterfaceVariable *_impl) : mosek::fusion::SliceVariable(_impl) { /*std::cout << "BoundInterfaceVariable()" << this << std::endl; */ }
mosek::fusion::BoundInterfaceVariable::~BoundInterfaceVariable() {  /* std::cout << "~BoundInterfaceVariable()" << this << std::endl << std::flush; */ }
mosek::fusion::p_BoundInterfaceVariable::p_BoundInterfaceVariable
  (::mosek::fusion::BoundInterfaceVariable * _pubthis) :     mosek::fusion::p_SliceVariable(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.BoundInterfaceVariable.ctor @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:41:6-50:7
mosek::fusion::BoundInterfaceVariable::t mosek::fusion::p_BoundInterfaceVariable::_new_BoundInterfaceVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2110_m,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2111_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2112_sparsity,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2113_nativeidxs,
    bool _2114_islower)
{ return new mosek::fusion::BoundInterfaceVariable(_2110_m,_2111_shape,_2112_sparsity,_2113_nativeidxs,_2114_islower); }
mosek::fusion::BoundInterfaceVariable::BoundInterfaceVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2110_m,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2111_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2112_sparsity,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2113_nativeidxs,
    bool _2114_islower) : 
   BoundInterfaceVariable(new mosek::fusion::p_BoundInterfaceVariable(this))
{ mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->_initialize(_2110_m,_2111_shape,_2112_sparsity,_2113_nativeidxs,_2114_islower); }
void mosek::fusion::p_BoundInterfaceVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2110_m,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2111_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2112_sparsity,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2113_nativeidxs,
    bool _2114_islower)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2111_shape(_2111_shape ? _2111_shape->raw() : nullptr, _2111_shape ? _2111_shape->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2112_sparsity(_2112_sparsity ? _2112_sparsity->raw() : nullptr, _2112_sparsity ? _2112_sparsity->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2113_nativeidxs(_2113_nativeidxs ? _2113_nativeidxs->raw() : nullptr, _2113_nativeidxs ? _2113_nativeidxs->size(0) : 0);
    mosek::fusion::p_SliceVariable::_initialize(_2110_m,_2111_shape,_2112_sparsity,_2113_nativeidxs);
    mosek::fusion::p_BoundInterfaceVariable::_get_impl(::mosek::fusion::BoundInterfaceVariable::t(_pubthis))->islower = _2114_islower;
  }
}
// mosek.fusion.BoundInterfaceVariable.ctor

// mosek.fusion.BoundInterfaceVariable.ctor @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:33:6-39:7
mosek::fusion::BoundInterfaceVariable::t mosek::fusion::p_BoundInterfaceVariable::_new_BoundInterfaceVariable
  (monty::rc_ptr< ::mosek::fusion::SliceVariable > _2115_v,
    bool _2116_islower)
{ return new mosek::fusion::BoundInterfaceVariable(_2115_v,_2116_islower); }
mosek::fusion::BoundInterfaceVariable::BoundInterfaceVariable
  (monty::rc_ptr< ::mosek::fusion::SliceVariable > _2115_v,
    bool _2116_islower) : 
   BoundInterfaceVariable(new mosek::fusion::p_BoundInterfaceVariable(this))
{ mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->_initialize(_2115_v,_2116_islower); }
void mosek::fusion::p_BoundInterfaceVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::SliceVariable > _2115_v,
    bool _2116_islower)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_SliceVariable::_initialize(_2115_v);
    mosek::fusion::p_BoundInterfaceVariable::_get_impl(::mosek::fusion::BoundInterfaceVariable::t(_pubthis))->islower = _2116_islower;
  }
}
// mosek.fusion.BoundInterfaceVariable.ctor

// Begin mosek.fusion.BoundInterfaceVariable.dual
// Method mosek.fusion.BoundInterfaceVariable.dual @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:80:6-84:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::BoundInterfaceVariable :: dual() { return mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->dual(); }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_BoundInterfaceVariable::dual()
{
  std::shared_ptr< monty::ndarray< double,1 > > _2117_target = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_pubthis->getSize())));
  _checked_ptr_1<double> _ptr__2117_target(_2117_target ? _2117_target->raw() : nullptr,_2117_target ? _2117_target->size(0) : 0);
  dual_lu((int)0,_2117_target,islower);
  return _2117_target;
}
// End mosek.fusion.BoundInterfaceVariable.dual

// Begin mosek.fusion.BoundInterfaceVariable.transpose
// Method mosek.fusion.BoundInterfaceVariable.transpose @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:78:6-78
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable :: __mosek_2fusion_2BoundInterfaceVariable__transpose() { return mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->__mosek_2fusion_2BoundInterfaceVariable__transpose(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::transpose() { return __mosek_2fusion_2BoundInterfaceVariable__transpose(); }
/* override: mosek.fusion.BaseVariable.transpose*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::__mosek_2fusion_2BaseVariable__transpose() { return __mosek_2fusion_2BoundInterfaceVariable__transpose(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BoundInterfaceVariable::__mosek_2fusion_2BoundInterfaceVariable__transpose()
{
  return (__mosek_2fusion_2BoundInterfaceVariable__from_(::mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__transpose())).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BoundInterfaceVariable.transpose

// Begin mosek.fusion.BoundInterfaceVariable.pick
// Method mosek.fusion.BoundInterfaceVariable.pick @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:77:6-112
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable :: __mosek_2fusion_2BoundInterfaceVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2118_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2119_i1,std::shared_ptr< monty::ndarray< int32_t,1 > > _2120_i2) { return mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->__mosek_2fusion_2BoundInterfaceVariable__pick(_2118_i0,_2119_i1,_2120_i2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2118_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2119_i1,std::shared_ptr< monty::ndarray< int32_t,1 > > _2120_i2) { return __mosek_2fusion_2BoundInterfaceVariable__pick(_2118_i0,_2119_i1,_2120_i2); }
/* override: mosek.fusion.BaseVariable.pick*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::__mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2118_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2119_i1,std::shared_ptr< monty::ndarray< int32_t,1 > > _2120_i2) { return __mosek_2fusion_2BoundInterfaceVariable__pick(_2118_i0,_2119_i1,_2120_i2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BoundInterfaceVariable::__mosek_2fusion_2BoundInterfaceVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2118_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2119_i1,std::shared_ptr< monty::ndarray< int32_t,1 > > _2120_i2)
{
  _checked_ptr_1<int32_t> _ptr__2118_i0(_2118_i0 ? _2118_i0->raw() : nullptr, _2118_i0 ? _2118_i0->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__2119_i1(_2119_i1 ? _2119_i1->raw() : nullptr, _2119_i1 ? _2119_i1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__2120_i2(_2120_i2 ? _2120_i2->raw() : nullptr, _2120_i2 ? _2120_i2->size(0) : 0);
  return (__mosek_2fusion_2BoundInterfaceVariable__from_(::mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__pick(_2118_i0,_2119_i1,_2120_i2))).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BoundInterfaceVariable.pick

// Begin mosek.fusion.BoundInterfaceVariable.pick
// Method mosek.fusion.BoundInterfaceVariable.pick @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:76:6-98
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable :: __mosek_2fusion_2BoundInterfaceVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2121_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2122_i1) { return mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->__mosek_2fusion_2BoundInterfaceVariable__pick(_2121_i0,_2122_i1); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2121_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2122_i1) { return __mosek_2fusion_2BoundInterfaceVariable__pick(_2121_i0,_2122_i1); }
/* override: mosek.fusion.BaseVariable.pick*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::__mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2121_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2122_i1) { return __mosek_2fusion_2BoundInterfaceVariable__pick(_2121_i0,_2122_i1); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BoundInterfaceVariable::__mosek_2fusion_2BoundInterfaceVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2121_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2122_i1)
{
  _checked_ptr_1<int32_t> _ptr__2121_i0(_2121_i0 ? _2121_i0->raw() : nullptr, _2121_i0 ? _2121_i0->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__2122_i1(_2122_i1 ? _2122_i1->raw() : nullptr, _2122_i1 ? _2122_i1->size(0) : 0);
  return (__mosek_2fusion_2BoundInterfaceVariable__from_(::mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__pick(_2121_i0,_2122_i1))).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BoundInterfaceVariable.pick

// Begin mosek.fusion.BoundInterfaceVariable.pick
// Method mosek.fusion.BoundInterfaceVariable.pick @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:75:6-91
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable :: __mosek_2fusion_2BoundInterfaceVariable__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _2123_midxs) { return mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->__mosek_2fusion_2BoundInterfaceVariable__pick(_2123_midxs); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _2123_midxs) { return __mosek_2fusion_2BoundInterfaceVariable__pick(_2123_midxs); }
/* override: mosek.fusion.BaseVariable.pick*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::__mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _2123_midxs) { return __mosek_2fusion_2BoundInterfaceVariable__pick(_2123_midxs); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BoundInterfaceVariable::__mosek_2fusion_2BoundInterfaceVariable__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _2123_midxs)
{
  return (__mosek_2fusion_2BoundInterfaceVariable__from_(::mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__pick(_2123_midxs))).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BoundInterfaceVariable.pick

// Begin mosek.fusion.BoundInterfaceVariable.pick
// Method mosek.fusion.BoundInterfaceVariable.pick @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:74:6-88
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable :: __mosek_2fusion_2BoundInterfaceVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2124_idxs) { return mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->__mosek_2fusion_2BoundInterfaceVariable__pick(_2124_idxs); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2124_idxs) { return __mosek_2fusion_2BoundInterfaceVariable__pick(_2124_idxs); }
/* override: mosek.fusion.BaseVariable.pick*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::__mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2124_idxs) { return __mosek_2fusion_2BoundInterfaceVariable__pick(_2124_idxs); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BoundInterfaceVariable::__mosek_2fusion_2BoundInterfaceVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2124_idxs)
{
  _checked_ptr_1<int32_t> _ptr__2124_idxs(_2124_idxs ? _2124_idxs->raw() : nullptr, _2124_idxs ? _2124_idxs->size(0) : 0);
  return (__mosek_2fusion_2BoundInterfaceVariable__from_(::mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__pick(_2124_idxs))).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BoundInterfaceVariable.pick

// Begin mosek.fusion.BoundInterfaceVariable.antidiag
// Method mosek.fusion.BoundInterfaceVariable.antidiag @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:73:6-93
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable :: __mosek_2fusion_2BoundInterfaceVariable__antidiag(int32_t _2125_index) { return mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->__mosek_2fusion_2BoundInterfaceVariable__antidiag(_2125_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::antidiag(int32_t _2125_index) { return __mosek_2fusion_2BoundInterfaceVariable__antidiag(_2125_index); }
/* override: mosek.fusion.BaseVariable.antidiag*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::__mosek_2fusion_2BaseVariable__antidiag(int32_t _2125_index) { return __mosek_2fusion_2BoundInterfaceVariable__antidiag(_2125_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BoundInterfaceVariable::__mosek_2fusion_2BoundInterfaceVariable__antidiag(int32_t _2125_index)
{
  return (__mosek_2fusion_2BoundInterfaceVariable__from_(::mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__antidiag(_2125_index))).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BoundInterfaceVariable.antidiag

// Begin mosek.fusion.BoundInterfaceVariable.antidiag
// Method mosek.fusion.BoundInterfaceVariable.antidiag @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:72:6-76
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable :: __mosek_2fusion_2BoundInterfaceVariable__antidiag() { return mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->__mosek_2fusion_2BoundInterfaceVariable__antidiag(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::antidiag() { return __mosek_2fusion_2BoundInterfaceVariable__antidiag(); }
/* override: mosek.fusion.BaseVariable.antidiag*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::__mosek_2fusion_2BaseVariable__antidiag() { return __mosek_2fusion_2BoundInterfaceVariable__antidiag(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BoundInterfaceVariable::__mosek_2fusion_2BoundInterfaceVariable__antidiag()
{
  return (__mosek_2fusion_2BoundInterfaceVariable__from_(::mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__antidiag())).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BoundInterfaceVariable.antidiag

// Begin mosek.fusion.BoundInterfaceVariable.diag
// Method mosek.fusion.BoundInterfaceVariable.diag @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:71:6-88
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable :: __mosek_2fusion_2BoundInterfaceVariable__diag(int32_t _2126_index) { return mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->__mosek_2fusion_2BoundInterfaceVariable__diag(_2126_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::diag(int32_t _2126_index) { return __mosek_2fusion_2BoundInterfaceVariable__diag(_2126_index); }
/* override: mosek.fusion.BaseVariable.diag*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::__mosek_2fusion_2BaseVariable__diag(int32_t _2126_index) { return __mosek_2fusion_2BoundInterfaceVariable__diag(_2126_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BoundInterfaceVariable::__mosek_2fusion_2BoundInterfaceVariable__diag(int32_t _2126_index)
{
  return (__mosek_2fusion_2BoundInterfaceVariable__from_(::mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__diag(_2126_index))).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BoundInterfaceVariable.diag

// Begin mosek.fusion.BoundInterfaceVariable.diag
// Method mosek.fusion.BoundInterfaceVariable.diag @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:70:6-72
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable :: __mosek_2fusion_2BoundInterfaceVariable__diag() { return mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->__mosek_2fusion_2BoundInterfaceVariable__diag(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::diag() { return __mosek_2fusion_2BoundInterfaceVariable__diag(); }
/* override: mosek.fusion.BaseVariable.diag*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::__mosek_2fusion_2BaseVariable__diag() { return __mosek_2fusion_2BoundInterfaceVariable__diag(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BoundInterfaceVariable::__mosek_2fusion_2BoundInterfaceVariable__diag()
{
  return (__mosek_2fusion_2BoundInterfaceVariable__from_(::mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__diag())).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BoundInterfaceVariable.diag

// Begin mosek.fusion.BoundInterfaceVariable.slice
// Method mosek.fusion.BoundInterfaceVariable.slice @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:69:6-113
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable :: __mosek_2fusion_2BoundInterfaceVariable__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2127_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _2128_lasta) { return mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->__mosek_2fusion_2BoundInterfaceVariable__slice(_2127_firsta,_2128_lasta); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2127_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _2128_lasta) { return __mosek_2fusion_2BoundInterfaceVariable__slice(_2127_firsta,_2128_lasta); }
/* override: mosek.fusion.BaseVariable.slice*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::__mosek_2fusion_2BaseVariable__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2127_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _2128_lasta) { return __mosek_2fusion_2BoundInterfaceVariable__slice(_2127_firsta,_2128_lasta); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BoundInterfaceVariable::__mosek_2fusion_2BoundInterfaceVariable__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2127_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _2128_lasta)
{
  _checked_ptr_1<int32_t> _ptr__2127_firsta(_2127_firsta ? _2127_firsta->raw() : nullptr, _2127_firsta ? _2127_firsta->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__2128_lasta(_2128_lasta ? _2128_lasta->raw() : nullptr, _2128_lasta ? _2128_lasta->size(0) : 0);
  return (__mosek_2fusion_2BoundInterfaceVariable__from_(::mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__slice(_2127_firsta,_2128_lasta))).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BoundInterfaceVariable.slice

// Begin mosek.fusion.BoundInterfaceVariable.slice
// Method mosek.fusion.BoundInterfaceVariable.slice @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:68:6-105
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable :: __mosek_2fusion_2BoundInterfaceVariable__slice(int32_t _2129_first,int32_t _2130_last) { return mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->__mosek_2fusion_2BoundInterfaceVariable__slice(_2129_first,_2130_last); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::slice(int32_t _2129_first,int32_t _2130_last) { return __mosek_2fusion_2BoundInterfaceVariable__slice(_2129_first,_2130_last); }
/* override: mosek.fusion.BaseVariable.slice*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BoundInterfaceVariable::__mosek_2fusion_2BaseVariable__slice(int32_t _2129_first,int32_t _2130_last) { return __mosek_2fusion_2BoundInterfaceVariable__slice(_2129_first,_2130_last); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BoundInterfaceVariable::__mosek_2fusion_2BoundInterfaceVariable__slice(int32_t _2129_first,int32_t _2130_last)
{
  return (__mosek_2fusion_2BoundInterfaceVariable__from_(::mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__slice(_2129_first,_2130_last))).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BoundInterfaceVariable.slice

// Begin mosek.fusion.BoundInterfaceVariable.from_
// Method mosek.fusion.BoundInterfaceVariable.from_ @ bld/grindsted/final/default/src/fusion/BoundInterfaceVariable.mbi:52:6-66:7
monty::rc_ptr< ::mosek::fusion::BoundInterfaceVariable > mosek::fusion::p_BoundInterfaceVariable::__mosek_2fusion_2BoundInterfaceVariable__from_(monty::rc_ptr< ::mosek::fusion::Variable > _2131_v)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2132_shape = _pubthis->getShape();
  _checked_ptr_1<int32_t> _ptr__2132_shape(_2132_shape ? _2132_shape->raw() : nullptr,_2132_shape ? _2132_shape->size(0) : 0);
  int32_t _2133_nnz = _2131_v->numInst();
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2134_nativeidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2133_nnz)));
  _checked_ptr_1<int64_t> _ptr__2134_nativeidxs(_2134_nativeidxs ? _2134_nativeidxs->raw() : nullptr,_2134_nativeidxs ? _2134_nativeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2135_sparsity = nullptr;
  _checked_ptr_1<int64_t> _ptr__2135_sparsity(_2135_sparsity ? _2135_sparsity->raw() : nullptr,_2135_sparsity ? _2135_sparsity->size(0) : 0);
  if ((_2131_v->getSize() == _2133_nnz))
  {
    {
      _2131_v->inst((int)0,_2134_nativeidxs);
    }
  }
  else
  {
    {
      _2135_sparsity = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2133_nnz)));
      _ptr__2135_sparsity.update(_2135_sparsity ? _2135_sparsity->raw() : nullptr, _2135_sparsity ? _2135_sparsity->size(0) : 0);
      _2131_v->inst((int)0,_2135_sparsity,(int)0,_2134_nativeidxs);
    }
  }
  return ::mosek::fusion::p_BoundInterfaceVariable::_new_BoundInterfaceVariable(_2131_v->__mosek_2fusion_2Expression__getModel(),_2132_shape,_2135_sparsity,_2134_nativeidxs,islower);
}
// End mosek.fusion.BoundInterfaceVariable.from_

void mosek::fusion::p_BoundInterfaceVariable::destroy()
{
}
void mosek::fusion::BoundInterfaceVariable::destroy() { mosek::fusion::p_BoundInterfaceVariable::_get_impl(this)->destroy(); }
// } class BoundInterfaceVariable
// class SliceVariable { // @ bld/grindsted/final/default/src/fusion/SliceVariable.mbi:18:4-66:5
mosek::fusion::SliceVariable::SliceVariable(mosek::fusion::p_SliceVariable *_impl) : mosek::fusion::BaseVariable(_impl) { /*std::cout << "SliceVariable()" << this << std::endl; */ }
mosek::fusion::SliceVariable::~SliceVariable() {  /* std::cout << "~SliceVariable()" << this << std::endl << std::flush; */ }
mosek::fusion::p_SliceVariable::p_SliceVariable
  (::mosek::fusion::SliceVariable * _pubthis) :     mosek::fusion::p_BaseVariable(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.SliceVariable.ctor @ bld/grindsted/final/default/src/fusion/SliceVariable.mbi:54:6-65:7
mosek::fusion::SliceVariable::t mosek::fusion::p_SliceVariable::_new_SliceVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2136_m,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2137_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2138_sparsity,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2139_nativeidxs)
{ return new mosek::fusion::SliceVariable(_2136_m,_2137_shape,_2138_sparsity,_2139_nativeidxs); }
mosek::fusion::SliceVariable::SliceVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2136_m,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2137_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2138_sparsity,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2139_nativeidxs) : 
   SliceVariable(new mosek::fusion::p_SliceVariable(this))
{ mosek::fusion::p_SliceVariable::_get_impl(this)->_initialize(_2136_m,_2137_shape,_2138_sparsity,_2139_nativeidxs); }
void mosek::fusion::p_SliceVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2136_m,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2137_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2138_sparsity,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2139_nativeidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2137_shape(_2137_shape ? _2137_shape->raw() : nullptr, _2137_shape ? _2137_shape->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2138_sparsity(_2138_sparsity ? _2138_sparsity->raw() : nullptr, _2138_sparsity ? _2138_sparsity->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2139_nativeidxs(_2139_nativeidxs ? _2139_nativeidxs->raw() : nullptr, _2139_nativeidxs ? _2139_nativeidxs->size(0) : 0);
    mosek::fusion::p_BaseVariable::_initialize(_2136_m,_2137_shape,_2138_sparsity,_2139_nativeidxs);
    mosek::fusion::p_SliceVariable::_get_impl(::mosek::fusion::SliceVariable::t(_pubthis))->nativeidxs = _2139_nativeidxs;
    mosek::fusion::p_SliceVariable::_get_impl(::mosek::fusion::SliceVariable::t(_pubthis))->sparsity = _2138_sparsity;
    mosek::fusion::p_SliceVariable::_get_impl(::mosek::fusion::SliceVariable::t(_pubthis))->shape = _2137_shape;
  }
}
// mosek.fusion.SliceVariable.ctor

// mosek.fusion.SliceVariable.ctor @ bld/grindsted/final/default/src/fusion/SliceVariable.mbi:47:6-52:7
mosek::fusion::SliceVariable::t mosek::fusion::p_SliceVariable::_new_SliceVariable
  (monty::rc_ptr< ::mosek::fusion::SliceVariable > _2140_v)
{ return new mosek::fusion::SliceVariable(_2140_v); }
mosek::fusion::SliceVariable::SliceVariable
  (monty::rc_ptr< ::mosek::fusion::SliceVariable > _2140_v) : 
   SliceVariable(new mosek::fusion::p_SliceVariable(this))
{ mosek::fusion::p_SliceVariable::_get_impl(this)->_initialize(_2140_v); }
void mosek::fusion::p_SliceVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::SliceVariable > _2140_v)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseVariable::_initialize(_2140_v,_2140_v->__mosek_2fusion_2BaseVariable__getModel());
    mosek::fusion::p_SliceVariable::_get_impl(::mosek::fusion::SliceVariable::t(_pubthis))->nativeidxs = mosek::fusion::p_SliceVariable::_get_impl(_2140_v)->nativeidxs;
    mosek::fusion::p_SliceVariable::_get_impl(::mosek::fusion::SliceVariable::t(_pubthis))->sparsity = mosek::fusion::p_SliceVariable::_get_impl(_2140_v)->sparsity;
    mosek::fusion::p_SliceVariable::_get_impl(::mosek::fusion::SliceVariable::t(_pubthis))->shape = mosek::fusion::p_SliceVariable::_get_impl(_2140_v)->shape;
  }
}
// mosek.fusion.SliceVariable.ctor

void mosek::fusion::p_SliceVariable::destroy()
{
  shape.reset();
  sparsity.reset();
  nativeidxs.reset();
}
void mosek::fusion::SliceVariable::destroy() { mosek::fusion::p_SliceVariable::_get_impl(this)->destroy(); }
// } class SliceVariable
// class RangedVariable { // @ bld/grindsted/final/default/src/fusion/RangedVariable.mbi:15:4-103:5
mosek::fusion::RangedVariable::RangedVariable(mosek::fusion::p_RangedVariable *_impl) : mosek::fusion::ModelVariable(_impl) { /*std::cout << "RangedVariable()" << this << std::endl; */ }
mosek::fusion::RangedVariable::~RangedVariable() {  /* std::cout << "~RangedVariable()" << this << std::endl << std::flush; */ }
mosek::fusion::p_RangedVariable::p_RangedVariable
  (::mosek::fusion::RangedVariable * _pubthis) :     mosek::fusion::p_ModelVariable(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.RangedVariable.ctor @ bld/grindsted/final/default/src/fusion/RangedVariable.mbi:53:6-61:7
mosek::fusion::RangedVariable::t mosek::fusion::p_RangedVariable::_new_RangedVariable
  (monty::rc_ptr< ::mosek::fusion::RangedVariable > _2141_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2142_m)
{ return new mosek::fusion::RangedVariable(_2141_v,_2142_m); }
mosek::fusion::RangedVariable::RangedVariable
  (monty::rc_ptr< ::mosek::fusion::RangedVariable > _2141_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2142_m) : 
   RangedVariable(new mosek::fusion::p_RangedVariable(this))
{ mosek::fusion::p_RangedVariable::_get_impl(this)->_initialize(_2141_v,_2142_m); }
void mosek::fusion::p_RangedVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::RangedVariable > _2141_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2142_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ModelVariable::_initialize(_2141_v,_2142_m);
    name = mosek::fusion::p_RangedVariable::_get_impl(_2141_v)->name;
    nativeidxs = mosek::fusion::p_RangedVariable::_get_impl(_2141_v)->nativeidxs;
    sparsity = mosek::fusion::p_RangedVariable::_get_impl(_2141_v)->sparsity;
    shape = mosek::fusion::p_RangedVariable::_get_impl(_2141_v)->shape;
  }
}
// mosek.fusion.RangedVariable.ctor

// mosek.fusion.RangedVariable.ctor @ bld/grindsted/final/default/src/fusion/RangedVariable.mbi:38:6-51:7
mosek::fusion::RangedVariable::t mosek::fusion::p_RangedVariable::_new_RangedVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2143_model,
    const std::string &  _2144_name,
    int64_t _2145_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2146_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2147_sparsity,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2148_nativeidxs)
{ return new mosek::fusion::RangedVariable(_2143_model,_2144_name,_2145_varid,_2146_shape,_2147_sparsity,_2148_nativeidxs); }
mosek::fusion::RangedVariable::RangedVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2143_model,
    const std::string &  _2144_name,
    int64_t _2145_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2146_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2147_sparsity,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2148_nativeidxs) : 
   RangedVariable(new mosek::fusion::p_RangedVariable(this))
{ mosek::fusion::p_RangedVariable::_get_impl(this)->_initialize(_2143_model,_2144_name,_2145_varid,_2146_shape,_2147_sparsity,_2148_nativeidxs); }
void mosek::fusion::p_RangedVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2143_model,
    const std::string &  _2144_name,
    int64_t _2145_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2146_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2147_sparsity,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2148_nativeidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2146_shape(_2146_shape ? _2146_shape->raw() : nullptr, _2146_shape ? _2146_shape->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2147_sparsity(_2147_sparsity ? _2147_sparsity->raw() : nullptr, _2147_sparsity ? _2147_sparsity->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__2148_nativeidxs(_2148_nativeidxs ? _2148_nativeidxs->raw() : nullptr, _2148_nativeidxs ? _2148_nativeidxs->size(0) : 0);
    mosek::fusion::p_ModelVariable::_initialize(_2143_model,_2144_name,_2146_shape,_2145_varid,_2147_sparsity,::mosek::fusion::p_RangedVariable::globalNativeIndexes(_2148_nativeidxs));
    mosek::fusion::p_RangedVariable::_get_impl(::mosek::fusion::RangedVariable::t(_pubthis))->nativeidxs = _2148_nativeidxs;
    mosek::fusion::p_RangedVariable::_get_impl(::mosek::fusion::RangedVariable::t(_pubthis))->sparsity = _2147_sparsity;
    mosek::fusion::p_RangedVariable::_get_impl(::mosek::fusion::RangedVariable::t(_pubthis))->name = _2144_name;
    mosek::fusion::p_RangedVariable::_get_impl(::mosek::fusion::RangedVariable::t(_pubthis))->shape = _2146_shape;
  }
}
// mosek.fusion.RangedVariable.ctor

// Begin mosek.fusion.RangedVariable.elementDesc
// Method mosek.fusion.RangedVariable.elementDesc @ bld/grindsted/final/default/src/fusion/RangedVariable.mbi:97:6-102:7
monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > mosek::fusion::RangedVariable :: __mosek_2fusion_2RangedVariable__elementDesc(int64_t _2149_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2150_sb) { return mosek::fusion::p_RangedVariable::_get_impl(this)->__mosek_2fusion_2RangedVariable__elementDesc(_2149_index,_2150_sb); }
monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > mosek::fusion::RangedVariable::elementDesc(int64_t _2149_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2150_sb) { return __mosek_2fusion_2RangedVariable__elementDesc(_2149_index,_2150_sb); }
monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > mosek::fusion::p_RangedVariable::__mosek_2fusion_2RangedVariable__elementDesc(int64_t _2149_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2150_sb)
{
  _pubthis->elementName(_2149_index,_2150_sb);
  _2150_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (" : in range"));
  return _2150_sb;
}
// End mosek.fusion.RangedVariable.elementDesc

// Begin mosek.fusion.RangedVariable.dual_u
// Method mosek.fusion.RangedVariable.dual_u @ bld/grindsted/final/default/src/fusion/RangedVariable.mbi:88:6-93:7
void mosek::fusion::p_RangedVariable::dual_u(int32_t _2151_offset,std::shared_ptr< monty::ndarray< double,1 > > _2152_target)
{
  _checked_ptr_1<double> _ptr__2152_target(_2152_target ? _2152_target->raw() : nullptr, _2152_target ? _2152_target->size(0) : 0);
  dual_lu(_2151_offset,_2152_target,false);
}
// End mosek.fusion.RangedVariable.dual_u

// Begin mosek.fusion.RangedVariable.dual_l
// Method mosek.fusion.RangedVariable.dual_l @ bld/grindsted/final/default/src/fusion/RangedVariable.mbi:80:6-85:7
void mosek::fusion::p_RangedVariable::dual_l(int32_t _2153_offset,std::shared_ptr< monty::ndarray< double,1 > > _2154_target)
{
  _checked_ptr_1<double> _ptr__2154_target(_2154_target ? _2154_target->raw() : nullptr, _2154_target ? _2154_target->size(0) : 0);
  dual_lu(_2153_offset,_2154_target,true);
}
// End mosek.fusion.RangedVariable.dual_l

// Begin mosek.fusion.RangedVariable.upperBoundVar
// Method mosek.fusion.RangedVariable.upperBoundVar @ bld/grindsted/final/default/src/fusion/RangedVariable.mbi:76:6-78:7
monty::rc_ptr< ::mosek::fusion::BoundInterfaceVariable > mosek::fusion::RangedVariable :: __mosek_2fusion_2RangedVariable__upperBoundVar() { return mosek::fusion::p_RangedVariable::_get_impl(this)->__mosek_2fusion_2RangedVariable__upperBoundVar(); }
monty::rc_ptr< ::mosek::fusion::BoundInterfaceVariable > mosek::fusion::RangedVariable::upperBoundVar() { return __mosek_2fusion_2RangedVariable__upperBoundVar(); }
monty::rc_ptr< ::mosek::fusion::BoundInterfaceVariable > mosek::fusion::p_RangedVariable::__mosek_2fusion_2RangedVariable__upperBoundVar()
{
  std::vector<int64_t> _10148_;
  for (int32_t _2155_i = (int)0, _10149_ = (int)((nativeidxs)->size(0)); _2155_i < _10149_ ; ++_2155_i)
  {
    _10148_.push_back(((*nativeidxs)(_2155_i)));
  }
  auto _10150_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10148_.size()),_10148_.begin(),_10148_.end()));
  return ::mosek::fusion::p_BoundInterfaceVariable::_new_BoundInterfaceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),shape,sparsity,_10150_,false);
}
// End mosek.fusion.RangedVariable.upperBoundVar

// Begin mosek.fusion.RangedVariable.lowerBoundVar
// Method mosek.fusion.RangedVariable.lowerBoundVar @ bld/grindsted/final/default/src/fusion/RangedVariable.mbi:70:6-72:7
monty::rc_ptr< ::mosek::fusion::BoundInterfaceVariable > mosek::fusion::RangedVariable :: __mosek_2fusion_2RangedVariable__lowerBoundVar() { return mosek::fusion::p_RangedVariable::_get_impl(this)->__mosek_2fusion_2RangedVariable__lowerBoundVar(); }
monty::rc_ptr< ::mosek::fusion::BoundInterfaceVariable > mosek::fusion::RangedVariable::lowerBoundVar() { return __mosek_2fusion_2RangedVariable__lowerBoundVar(); }
monty::rc_ptr< ::mosek::fusion::BoundInterfaceVariable > mosek::fusion::p_RangedVariable::__mosek_2fusion_2RangedVariable__lowerBoundVar()
{
  std::vector<int64_t> _10151_;
  for (int32_t _2156_i = (int)0, _10152_ = (int)((nativeidxs)->size(0)); _2156_i < _10152_ ; ++_2156_i)
  {
    _10151_.push_back(((*nativeidxs)(_2156_i)));
  }
  auto _10153_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10151_.size()),_10151_.begin(),_10151_.end()));
  return ::mosek::fusion::p_BoundInterfaceVariable::_new_BoundInterfaceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),shape,sparsity,_10153_,true);
}
// End mosek.fusion.RangedVariable.lowerBoundVar

// Begin mosek.fusion.RangedVariable.clone
// Method mosek.fusion.RangedVariable.clone @ bld/grindsted/final/default/src/fusion/RangedVariable.mbi:63:6-65:7
monty::rc_ptr< ::mosek::fusion::ModelVariable > mosek::fusion::p_RangedVariable::__mosek_2fusion_2RangedVariable__clone(monty::rc_ptr< ::mosek::fusion::Model > _2157_m)
{
  return (::mosek::fusion::p_RangedVariable::_new_RangedVariable(::mosek::fusion::RangedVariable::t(_pubthis),_2157_m)).as<::mosek::fusion::ModelVariable>();
}
// End mosek.fusion.RangedVariable.clone

// Begin mosek.fusion.RangedVariable.globalNativeIndexes
// Method mosek.fusion.RangedVariable.globalNativeIndexes @ bld/grindsted/final/default/src/fusion/RangedVariable.mbi:24:6-27:7
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::p_RangedVariable::globalNativeIndexes(std::shared_ptr< monty::ndarray< int32_t,1 > > _2158_nativeidxs)
{
  _checked_ptr_1<int32_t> _ptr__2158_nativeidxs(_2158_nativeidxs ? _2158_nativeidxs->raw() : nullptr, _2158_nativeidxs ? _2158_nativeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2159_r = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)((_2158_nativeidxs)->size(0)))));
  _checked_ptr_1<int64_t> _ptr__2159_r(_2159_r ? _2159_r->raw() : nullptr,_2159_r ? _2159_r->size(0) : 0);
  int32_t _10154_ = (int)0;
  int32_t _10155_ = (int)((_2158_nativeidxs)->size(0));
  for (int32_t _2160_i = _10154_; _2160_i < _10155_; ++_2160_i)
  {
    {
      _ptr__2159_r[_2160_i] = _ptr__2158_nativeidxs[_2160_i];
    }
  }
  return _2159_r;
}
// End mosek.fusion.RangedVariable.globalNativeIndexes

void mosek::fusion::p_RangedVariable::destroy()
{
  shape.reset();
  nativeidxs.reset();
  sparsity.reset();
}
void mosek::fusion::RangedVariable::destroy() { mosek::fusion::p_RangedVariable::_get_impl(this)->destroy(); }
// } class RangedVariable
// class LinearPSDVariable { // @ bld/grindsted/final/default/src/fusion/LinearPSDVariable.monty:8:4-71:5
mosek::fusion::LinearPSDVariable::LinearPSDVariable(mosek::fusion::p_LinearPSDVariable *_impl) : mosek::fusion::ModelVariable(_impl) { /*std::cout << "LinearPSDVariable()" << this << std::endl; */ }
mosek::fusion::LinearPSDVariable::~LinearPSDVariable() {  /* std::cout << "~LinearPSDVariable()" << this << std::endl << std::flush; */ }
mosek::fusion::p_LinearPSDVariable::p_LinearPSDVariable
  (::mosek::fusion::LinearPSDVariable * _pubthis) :     mosek::fusion::p_ModelVariable(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.LinearPSDVariable.ctor @ bld/grindsted/final/default/src/fusion/LinearPSDVariable.monty:35:6-43:7
mosek::fusion::LinearPSDVariable::t mosek::fusion::p_LinearPSDVariable::_new_LinearPSDVariable
  (monty::rc_ptr< ::mosek::fusion::LinearPSDVariable > _2161_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2162_m)
{ return new mosek::fusion::LinearPSDVariable(_2161_v,_2162_m); }
mosek::fusion::LinearPSDVariable::LinearPSDVariable
  (monty::rc_ptr< ::mosek::fusion::LinearPSDVariable > _2161_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2162_m) : 
   LinearPSDVariable(new mosek::fusion::p_LinearPSDVariable(this))
{ mosek::fusion::p_LinearPSDVariable::_get_impl(this)->_initialize(_2161_v,_2162_m); }
void mosek::fusion::p_LinearPSDVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::LinearPSDVariable > _2161_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2162_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ModelVariable::_initialize(_2161_v,_2162_m);
    mosek::fusion::p_LinearPSDVariable::_get_impl(::mosek::fusion::LinearPSDVariable::t(_pubthis))->conedim = mosek::fusion::p_LinearPSDVariable::_get_impl(_2161_v)->conedim;
    mosek::fusion::p_LinearPSDVariable::_get_impl(::mosek::fusion::LinearPSDVariable::t(_pubthis))->varid = mosek::fusion::p_LinearPSDVariable::_get_impl(_2161_v)->varid;
    mosek::fusion::p_LinearPSDVariable::_get_impl(::mosek::fusion::LinearPSDVariable::t(_pubthis))->name = mosek::fusion::p_LinearPSDVariable::_get_impl(_2161_v)->name;
    mosek::fusion::p_LinearPSDVariable::_get_impl(::mosek::fusion::LinearPSDVariable::t(_pubthis))->shape = mosek::fusion::p_LinearPSDVariable::_get_impl(_2161_v)->shape;
    mosek::fusion::p_LinearPSDVariable::_get_impl(::mosek::fusion::LinearPSDVariable::t(_pubthis))->nativeidxs = mosek::fusion::p_LinearPSDVariable::_get_impl(_2161_v)->nativeidxs;
  }
}
// mosek.fusion.LinearPSDVariable.ctor

// mosek.fusion.LinearPSDVariable.ctor @ bld/grindsted/final/default/src/fusion/LinearPSDVariable.monty:19:6-33:7
mosek::fusion::LinearPSDVariable::t mosek::fusion::p_LinearPSDVariable::_new_LinearPSDVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2163_model,
    const std::string &  _2164_name,
    int32_t _2165_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2166_shape,
    int32_t _2167_conedim,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2168_nativeidxs)
{ return new mosek::fusion::LinearPSDVariable(_2163_model,_2164_name,_2165_varid,_2166_shape,_2167_conedim,_2168_nativeidxs); }
mosek::fusion::LinearPSDVariable::LinearPSDVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2163_model,
    const std::string &  _2164_name,
    int32_t _2165_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2166_shape,
    int32_t _2167_conedim,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2168_nativeidxs) : 
   LinearPSDVariable(new mosek::fusion::p_LinearPSDVariable(this))
{ mosek::fusion::p_LinearPSDVariable::_get_impl(this)->_initialize(_2163_model,_2164_name,_2165_varid,_2166_shape,_2167_conedim,_2168_nativeidxs); }
void mosek::fusion::p_LinearPSDVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2163_model,
    const std::string &  _2164_name,
    int32_t _2165_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2166_shape,
    int32_t _2167_conedim,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2168_nativeidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2166_shape(_2166_shape ? _2166_shape->raw() : nullptr, _2166_shape ? _2166_shape->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2168_nativeidxs(_2168_nativeidxs ? _2168_nativeidxs->raw() : nullptr, _2168_nativeidxs ? _2168_nativeidxs->size(0) : 0);
    mosek::fusion::p_ModelVariable::_initialize(_2163_model,_2164_name,_2166_shape,_2165_varid,nullptr,::mosek::fusion::p_LinearPSDVariable::globalNativeIndexes(_2168_nativeidxs));
    mosek::fusion::p_LinearPSDVariable::_get_impl(::mosek::fusion::LinearPSDVariable::t(_pubthis))->name = _2164_name;
    mosek::fusion::p_LinearPSDVariable::_get_impl(::mosek::fusion::LinearPSDVariable::t(_pubthis))->conedim = _2167_conedim;
    mosek::fusion::p_LinearPSDVariable::_get_impl(::mosek::fusion::LinearPSDVariable::t(_pubthis))->varid = _2165_varid;
    mosek::fusion::p_LinearPSDVariable::_get_impl(::mosek::fusion::LinearPSDVariable::t(_pubthis))->shape = _2166_shape;
    mosek::fusion::p_LinearPSDVariable::_get_impl(::mosek::fusion::LinearPSDVariable::t(_pubthis))->nativeidxs = _2168_nativeidxs;
  }
}
// mosek.fusion.LinearPSDVariable.ctor

// Begin mosek.fusion.LinearPSDVariable.toString
// Method mosek.fusion.LinearPSDVariable.toString @ bld/grindsted/final/default/src/fusion/LinearPSDVariable.monty:60:6-69:7
std::string mosek::fusion::LinearPSDVariable :: toString() { return mosek::fusion::p_LinearPSDVariable::_get_impl(this)->toString(); }
std::string mosek::fusion::p_LinearPSDVariable::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2169_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  _2169_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("PSDVariable("));
  if (((int)((name).size()) > (int)0))
  {
    {
      _2169_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"))->__mosek_2fusion_2Utils_2StringBuffer__a(name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("',"));
    }
  }
  {}
  _2169_sb->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)((int)0)));
  int32_t _10156_ = (int)1;
  int32_t _10157_ = (int)((shape)->size(0));
  for (int32_t _2170_i = _10156_; _2170_i < _10157_; ++_2170_i)
  {
    {
      _2169_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)(_2170_i)));
    }
  }
  _2169_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"));
  return _2169_sb->toString();
}
// End mosek.fusion.LinearPSDVariable.toString

// Begin mosek.fusion.LinearPSDVariable.make_continuous
// Method mosek.fusion.LinearPSDVariable.make_continuous @ bld/grindsted/final/default/src/fusion/LinearPSDVariable.monty:56:6-58:7
void mosek::fusion::LinearPSDVariable :: make_continuous(std::shared_ptr< monty::ndarray< int64_t,1 > > _2171_idxs) { mosek::fusion::p_LinearPSDVariable::_get_impl(this)->make_continuous(_2171_idxs); }
void mosek::fusion::p_LinearPSDVariable::make_continuous(std::shared_ptr< monty::ndarray< int64_t,1 > > _2171_idxs)
{
  _checked_ptr_1<int64_t> _ptr__2171_idxs(_2171_idxs ? _2171_idxs->raw() : nullptr, _2171_idxs ? _2171_idxs->size(0) : 0);
}
// End mosek.fusion.LinearPSDVariable.make_continuous

// Begin mosek.fusion.LinearPSDVariable.make_integer
// Method mosek.fusion.LinearPSDVariable.make_integer @ bld/grindsted/final/default/src/fusion/LinearPSDVariable.monty:51:6-54:7
void mosek::fusion::LinearPSDVariable :: make_integer(std::shared_ptr< monty::ndarray< int64_t,1 > > _2172_idxs) { mosek::fusion::p_LinearPSDVariable::_get_impl(this)->make_integer(_2172_idxs); }
void mosek::fusion::p_LinearPSDVariable::make_integer(std::shared_ptr< monty::ndarray< int64_t,1 > > _2172_idxs)
{
  _checked_ptr_1<int64_t> _ptr__2172_idxs(_2172_idxs ? _2172_idxs->raw() : nullptr, _2172_idxs ? _2172_idxs->size(0) : 0);
  throw ::mosek::fusion::UnimplementedError(std::string ("Cannot make PSDVariable elements integer"));
}
// End mosek.fusion.LinearPSDVariable.make_integer

// Begin mosek.fusion.LinearPSDVariable.clone
// Method mosek.fusion.LinearPSDVariable.clone @ bld/grindsted/final/default/src/fusion/LinearPSDVariable.monty:45:6-48:7
monty::rc_ptr< ::mosek::fusion::ModelVariable > mosek::fusion::p_LinearPSDVariable::__mosek_2fusion_2LinearPSDVariable__clone(monty::rc_ptr< ::mosek::fusion::Model > _2173_m)
{
  return (::mosek::fusion::p_LinearPSDVariable::_new_LinearPSDVariable(::mosek::fusion::LinearPSDVariable::t(_pubthis),_2173_m)).as<::mosek::fusion::ModelVariable>();
}
// End mosek.fusion.LinearPSDVariable.clone

// Begin mosek.fusion.LinearPSDVariable.globalNativeIndexes
// Method mosek.fusion.LinearPSDVariable.globalNativeIndexes @ bld/grindsted/final/default/src/fusion/LinearPSDVariable.monty:17:6-147
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::p_LinearPSDVariable::globalNativeIndexes(std::shared_ptr< monty::ndarray< int64_t,1 > > _2174_nativeidxs)
{
  _checked_ptr_1<int64_t> _ptr__2174_nativeidxs(_2174_nativeidxs ? _2174_nativeidxs->raw() : nullptr, _2174_nativeidxs ? _2174_nativeidxs->size(0) : 0);
  std::vector<int64_t> _10158_;
  for (int32_t _2175_i = (int)0, _10159_ = (int)((_2174_nativeidxs)->size(0)); _2175_i < _10159_ ; ++_2175_i)
  {
    _10158_.push_back((-safe_add( _ptr__2174_nativeidxs[_2175_i],(int)1 )));
  }
  auto _10160_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10158_.size()),_10158_.begin(),_10158_.end()));
  return _10160_;
}
// End mosek.fusion.LinearPSDVariable.globalNativeIndexes

void mosek::fusion::p_LinearPSDVariable::destroy()
{
  shape.reset();
  nativeidxs.reset();
}
void mosek::fusion::LinearPSDVariable::destroy() { mosek::fusion::p_LinearPSDVariable::_get_impl(this)->destroy(); }
// } class LinearPSDVariable
// class PSDVariable { // @ bld/grindsted/final/default/src/fusion/SemidefiniteVariable.mbi:8:4-126:5
mosek::fusion::PSDVariable::PSDVariable(mosek::fusion::p_PSDVariable *_impl) : mosek::fusion::ModelVariable(_impl) { /*std::cout << "PSDVariable()" << this << std::endl; */ }
mosek::fusion::PSDVariable::~PSDVariable() {  /* std::cout << "~PSDVariable()" << this << std::endl << std::flush; */ }
mosek::fusion::p_PSDVariable::p_PSDVariable
  (::mosek::fusion::PSDVariable * _pubthis) :     mosek::fusion::p_ModelVariable(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.PSDVariable.ctor @ bld/grindsted/final/default/src/fusion/SemidefiniteVariable.mbi:86:6-98:7
mosek::fusion::PSDVariable::t mosek::fusion::p_PSDVariable::_new_PSDVariable
  (monty::rc_ptr< ::mosek::fusion::PSDVariable > _2176_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2177_m)
{ return new mosek::fusion::PSDVariable(_2176_v,_2177_m); }
mosek::fusion::PSDVariable::PSDVariable
  (monty::rc_ptr< ::mosek::fusion::PSDVariable > _2176_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2177_m) : 
   PSDVariable(new mosek::fusion::p_PSDVariable(this))
{ mosek::fusion::p_PSDVariable::_get_impl(this)->_initialize(_2176_v,_2177_m); }
void mosek::fusion::p_PSDVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::PSDVariable > _2176_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2177_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ModelVariable::_initialize(_2176_v,_2177_m);
    varid = mosek::fusion::p_PSDVariable::_get_impl(_2176_v)->varid;
    nativeidxs = mosek::fusion::p_PSDVariable::_get_impl(_2176_v)->nativeidxs;
    name = mosek::fusion::p_PSDVariable::_get_impl(_2176_v)->name;
    shape = mosek::fusion::p_PSDVariable::_get_impl(_2176_v)->shape;
    conedim1 = mosek::fusion::p_PSDVariable::_get_impl(_2176_v)->conedim1;
    conedim2 = mosek::fusion::p_PSDVariable::_get_impl(_2176_v)->conedim2;
    model = _2177_m;
    barvaridxs = mosek::fusion::p_PSDVariable::_get_impl(_2176_v)->barvaridxs;
  }
}
// mosek.fusion.PSDVariable.ctor

// mosek.fusion.PSDVariable.ctor @ bld/grindsted/final/default/src/fusion/SemidefiniteVariable.mbi:64:6-84:7
mosek::fusion::PSDVariable::t mosek::fusion::p_PSDVariable::_new_PSDVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2178_model,
    const std::string &  _2179_name,
    int32_t _2180_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2181_shape,
    int32_t _2182_conedim1,
    int32_t _2183_conedim2,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2184_barvaridxs,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2185_nativeidxs)
{ return new mosek::fusion::PSDVariable(_2178_model,_2179_name,_2180_varid,_2181_shape,_2182_conedim1,_2183_conedim2,_2184_barvaridxs,_2185_nativeidxs); }
mosek::fusion::PSDVariable::PSDVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2178_model,
    const std::string &  _2179_name,
    int32_t _2180_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2181_shape,
    int32_t _2182_conedim1,
    int32_t _2183_conedim2,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2184_barvaridxs,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2185_nativeidxs) : 
   PSDVariable(new mosek::fusion::p_PSDVariable(this))
{ mosek::fusion::p_PSDVariable::_get_impl(this)->_initialize(_2178_model,_2179_name,_2180_varid,_2181_shape,_2182_conedim1,_2183_conedim2,_2184_barvaridxs,_2185_nativeidxs); }
void mosek::fusion::p_PSDVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2178_model,
    const std::string &  _2179_name,
    int32_t _2180_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2181_shape,
    int32_t _2182_conedim1,
    int32_t _2183_conedim2,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2184_barvaridxs,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2185_nativeidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2181_shape(_2181_shape ? _2181_shape->raw() : nullptr, _2181_shape ? _2181_shape->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__2184_barvaridxs(_2184_barvaridxs ? _2184_barvaridxs->raw() : nullptr, _2184_barvaridxs ? _2184_barvaridxs->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2185_nativeidxs(_2185_nativeidxs ? _2185_nativeidxs->raw() : nullptr, _2185_nativeidxs ? _2185_nativeidxs->size(0) : 0);
    mosek::fusion::p_ModelVariable::_initialize(_2178_model,_2179_name,_2181_shape,_2180_varid,nullptr,::mosek::fusion::p_PSDVariable::fullnativeidxs(_2181_shape,_2182_conedim1,_2183_conedim2,_2185_nativeidxs));
    mosek::fusion::p_PSDVariable::_get_impl(::mosek::fusion::PSDVariable::t(_pubthis))->varid = _2180_varid;
    mosek::fusion::p_PSDVariable::_get_impl(::mosek::fusion::PSDVariable::t(_pubthis))->nativeidxs = _2185_nativeidxs;
    mosek::fusion::p_PSDVariable::_get_impl(::mosek::fusion::PSDVariable::t(_pubthis))->name = _2179_name;
    mosek::fusion::p_PSDVariable::_get_impl(::mosek::fusion::PSDVariable::t(_pubthis))->shape = _2181_shape;
    mosek::fusion::p_PSDVariable::_get_impl(::mosek::fusion::PSDVariable::t(_pubthis))->conedim1 = _2182_conedim1;
    mosek::fusion::p_PSDVariable::_get_impl(::mosek::fusion::PSDVariable::t(_pubthis))->conedim2 = _2183_conedim2;
    mosek::fusion::p_PSDVariable::_get_impl(::mosek::fusion::PSDVariable::t(_pubthis))->model = _2178_model;
    mosek::fusion::p_PSDVariable::_get_impl(::mosek::fusion::PSDVariable::t(_pubthis))->barvaridxs = _2184_barvaridxs;
  }
}
// mosek.fusion.PSDVariable.ctor

// Begin mosek.fusion.PSDVariable.toString
// Method mosek.fusion.PSDVariable.toString @ bld/grindsted/final/default/src/fusion/SemidefiniteVariable.mbi:115:6-124:7
std::string mosek::fusion::PSDVariable :: toString() { return mosek::fusion::p_PSDVariable::_get_impl(this)->toString(); }
std::string mosek::fusion::p_PSDVariable::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2186_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  _2186_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("PSDVariable("));
  if (((int)((name).size()) > (int)0))
  {
    {
      _2186_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"))->__mosek_2fusion_2Utils_2StringBuffer__a(name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("',"));
    }
  }
  {}
  _2186_sb->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)((int)0)));
  int32_t _10161_ = (int)1;
  int32_t _10162_ = (int)((shape)->size(0));
  for (int32_t _2187_i = _10161_; _2187_i < _10162_; ++_2187_i)
  {
    {
      _2186_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)(_2187_i)));
    }
  }
  _2186_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"));
  return _2186_sb->toString();
}
// End mosek.fusion.PSDVariable.toString

// Begin mosek.fusion.PSDVariable.elementDesc
// Method mosek.fusion.PSDVariable.elementDesc @ bld/grindsted/final/default/src/fusion/SemidefiniteVariable.mbi:107:6-112:7
monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > mosek::fusion::PSDVariable :: __mosek_2fusion_2PSDVariable__elementDesc(int64_t _2188_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2189_sb) { return mosek::fusion::p_PSDVariable::_get_impl(this)->__mosek_2fusion_2PSDVariable__elementDesc(_2188_index,_2189_sb); }
monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > mosek::fusion::PSDVariable::elementDesc(int64_t _2188_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2189_sb) { return __mosek_2fusion_2PSDVariable__elementDesc(_2188_index,_2189_sb); }
monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > mosek::fusion::p_PSDVariable::__mosek_2fusion_2PSDVariable__elementDesc(int64_t _2188_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2189_sb)
{
  _pubthis->elementName(_2188_index,_2189_sb);
  _2189_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (" : element in positive semidefinite cone"));
  return _2189_sb;
}
// End mosek.fusion.PSDVariable.elementDesc

// Begin mosek.fusion.PSDVariable.clone
// Method mosek.fusion.PSDVariable.clone @ bld/grindsted/final/default/src/fusion/SemidefiniteVariable.mbi:100:6-103:7
monty::rc_ptr< ::mosek::fusion::ModelVariable > mosek::fusion::p_PSDVariable::__mosek_2fusion_2PSDVariable__clone(monty::rc_ptr< ::mosek::fusion::Model > _2190_m)
{
  return (::mosek::fusion::p_PSDVariable::_new_PSDVariable(::mosek::fusion::PSDVariable::t(_pubthis),_2190_m)).as<::mosek::fusion::ModelVariable>();
}
// End mosek.fusion.PSDVariable.clone

// Begin mosek.fusion.PSDVariable.fullnativeidxs
// Method mosek.fusion.PSDVariable.fullnativeidxs @ bld/grindsted/final/default/src/fusion/SemidefiniteVariable.mbi:21:6-57:7
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::p_PSDVariable::fullnativeidxs(std::shared_ptr< monty::ndarray< int32_t,1 > > _2191_shape,int32_t _2192_conedim1,int32_t _2193_conedim2,std::shared_ptr< monty::ndarray< int64_t,1 > > _2194_nativeidxs)
{
  _checked_ptr_1<int32_t> _ptr__2191_shape(_2191_shape ? _2191_shape->raw() : nullptr, _2191_shape ? _2191_shape->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__2194_nativeidxs(_2194_nativeidxs ? _2194_nativeidxs->raw() : nullptr, _2194_nativeidxs ? _2194_nativeidxs->size(0) : 0);
  int32_t _2195_nd = (int)((_2191_shape)->size(0));
  bool _2196_tril = (_2192_conedim1 < _2193_conedim2);
  int32_t _10163_;
  bool _10164_ = _2196_tril;
  if (_10164_)
  {
    _10163_ = _2192_conedim1;
  }
  else
  {
    _10163_ = _2193_conedim2;
  }
  int32_t _2197_cd1 = _10163_;
  int32_t _10165_;
  bool _10166_ = (!_2196_tril);
  if (_10166_)
  {
    _10165_ = _2192_conedim1;
  }
  else
  {
    _10165_ = _2193_conedim2;
  }
  int32_t _2198_cd2 = _10165_;
  int32_t _2199_d0 = (int)1;
  int32_t _10167_ = (int)0;
  int32_t _10168_ = _2197_cd1;
  for (int32_t _2200_i = _10167_; _2200_i < _10168_; ++_2200_i)
  {
    {
      _2199_d0 *= _ptr__2191_shape[_2200_i];
    }
  }
  int32_t _2201_d1 = _ptr__2191_shape[_2197_cd1];
  int32_t _2202_d2 = (int)1;
  int32_t _10169_ = safe_add( _2197_cd1,(int)1 );
  int32_t _10170_ = _2198_cd2;
  for (int32_t _2203_i = _10169_; _2203_i < _10170_; ++_2203_i)
  {
    {
      _2202_d2 *= _ptr__2191_shape[_2203_i];
    }
  }
  int32_t _2204_d3 = _ptr__2191_shape[_2198_cd2];
  int32_t _2205_d4 = (int)1;
  int32_t _10171_ = safe_add( _2198_cd2,(int)1 );
  int32_t _10172_ = _2195_nd;
  for (int32_t _2206_i = _10171_; _2206_i < _10172_; ++_2206_i)
  {
    {
      _2205_d4 *= _ptr__2191_shape[_2206_i];
    }
  }
  int32_t _2207_size = safe_mul( safe_mul( safe_mul( safe_mul( _2199_d0,_2201_d1 ),_2202_d2 ),_2204_d3 ),_2205_d4 );
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2208_residxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2207_size)));
  _checked_ptr_1<int64_t> _ptr__2208_residxs(_2208_residxs ? _2208_residxs->raw() : nullptr,_2208_residxs ? _2208_residxs->size(0) : 0);
  int32_t _2209_s3 = _2205_d4;
  int32_t _2210_s2 = safe_mul( _2209_s3,_2204_d3 );
  int32_t _2211_s1 = safe_mul( _2210_s2,_2202_d2 );
  int32_t _2212_s0 = safe_mul( _2211_s1,_2211_s1 );
  {
    int32_t _2213_k = (int)0;
    int32_t _10173_ = (int)0;
    int32_t _10174_ = _2199_d0;
    for (int32_t _2214_i0 = _10173_; _2214_i0 < _10174_; ++_2214_i0)
    {
      {
        int32_t _10175_ = (int)0;
        int32_t _10176_ = _2204_d3;
        for (int32_t _2215_i3 = _10175_; _2215_i3 < _10176_; ++_2215_i3)
        {
          {
            int32_t _10177_ = (int)0;
            int32_t _10178_ = _2202_d2;
            for (int32_t _2216_i2 = _10177_; _2216_i2 < _10178_; ++_2216_i2)
            {
              {
                int32_t _10179_ = _2215_i3;
                int32_t _10180_ = _2201_d1;
                for (int32_t _2217_i1 = _10179_; _2217_i1 < _10180_; ++_2217_i1)
                {
                  {
                    int32_t _10181_ = (int)0;
                    int32_t _10182_ = _2205_d4;
                    for (int32_t _2218_i4 = _10181_; _2218_i4 < _10182_; ++_2218_i4)
                    {
                      {
                        _ptr__2208_residxs[safe_add( safe_add( safe_add( safe_add( safe_mul( _2214_i0,_2212_s0 ),safe_mul( _2217_i1,_2211_s1 ) ),safe_mul( _2216_i2,_2210_s2 ) ),safe_mul( _2215_i3,_2209_s3 ) ),_2218_i4 )] = (-safe_add( _ptr__2194_nativeidxs[_2213_k],(int)1 ));
                        _ptr__2208_residxs[safe_add( safe_add( safe_add( safe_add( safe_mul( _2214_i0,_2212_s0 ),safe_mul( _2215_i3,_2211_s1 ) ),safe_mul( _2216_i2,_2210_s2 ) ),safe_mul( _2217_i1,_2209_s3 ) ),_2218_i4 )] = (-safe_add( _ptr__2194_nativeidxs[_2213_k],(int)1 ));
                        ++ _2213_k;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return _2208_residxs;
}
// End mosek.fusion.PSDVariable.fullnativeidxs

void mosek::fusion::p_PSDVariable::destroy()
{
  model.reset();
  barvaridxs.reset();
  shape.reset();
  nativeidxs.reset();
}
void mosek::fusion::PSDVariable::destroy() { mosek::fusion::p_PSDVariable::_get_impl(this)->destroy(); }
// } class PSDVariable
// class LinearVariable { // @ bld/grindsted/final/default/src/fusion/LinearVariable.mbi:21:4-81:5
mosek::fusion::LinearVariable::LinearVariable(mosek::fusion::p_LinearVariable *_impl) : mosek::fusion::ModelVariable(_impl) { /*std::cout << "LinearVariable()" << this << std::endl; */ }
mosek::fusion::LinearVariable::~LinearVariable() {  /* std::cout << "~LinearVariable()" << this << std::endl << std::flush; */ }
mosek::fusion::p_LinearVariable::p_LinearVariable
  (::mosek::fusion::LinearVariable * _pubthis) :     mosek::fusion::p_ModelVariable(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.LinearVariable.ctor @ bld/grindsted/final/default/src/fusion/LinearVariable.mbi:51:6-59:7
mosek::fusion::LinearVariable::t mosek::fusion::p_LinearVariable::_new_LinearVariable
  (monty::rc_ptr< ::mosek::fusion::LinearVariable > _2219_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2220_m)
{ return new mosek::fusion::LinearVariable(_2219_v,_2220_m); }
mosek::fusion::LinearVariable::LinearVariable
  (monty::rc_ptr< ::mosek::fusion::LinearVariable > _2219_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2220_m) : 
   LinearVariable(new mosek::fusion::p_LinearVariable(this))
{ mosek::fusion::p_LinearVariable::_get_impl(this)->_initialize(_2219_v,_2220_m); }
void mosek::fusion::p_LinearVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::LinearVariable > _2219_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2220_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ModelVariable::_initialize(_2219_v,_2220_m);
    nativeidxs = mosek::fusion::p_LinearVariable::_get_impl(_2219_v)->nativeidxs;
    sparsity = mosek::fusion::p_LinearVariable::_get_impl(_2219_v)->sparsity;
    shape = mosek::fusion::p_LinearVariable::_get_impl(_2219_v)->shape;
    name = mosek::fusion::p_LinearVariable::_get_impl(_2219_v)->name;
  }
}
// mosek.fusion.LinearVariable.ctor

// mosek.fusion.LinearVariable.ctor @ bld/grindsted/final/default/src/fusion/LinearVariable.mbi:35:6-49:7
mosek::fusion::LinearVariable::t mosek::fusion::p_LinearVariable::_new_LinearVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2221_model,
    const std::string &  _2222_name,
    int64_t _2223_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2224_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2225_sparsity,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2226_nativeidxs)
{ return new mosek::fusion::LinearVariable(_2221_model,_2222_name,_2223_varid,_2224_shape,_2225_sparsity,_2226_nativeidxs); }
mosek::fusion::LinearVariable::LinearVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2221_model,
    const std::string &  _2222_name,
    int64_t _2223_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2224_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2225_sparsity,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2226_nativeidxs) : 
   LinearVariable(new mosek::fusion::p_LinearVariable(this))
{ mosek::fusion::p_LinearVariable::_get_impl(this)->_initialize(_2221_model,_2222_name,_2223_varid,_2224_shape,_2225_sparsity,_2226_nativeidxs); }
void mosek::fusion::p_LinearVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2221_model,
    const std::string &  _2222_name,
    int64_t _2223_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2224_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2225_sparsity,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2226_nativeidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2224_shape(_2224_shape ? _2224_shape->raw() : nullptr, _2224_shape ? _2224_shape->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2225_sparsity(_2225_sparsity ? _2225_sparsity->raw() : nullptr, _2225_sparsity ? _2225_sparsity->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__2226_nativeidxs(_2226_nativeidxs ? _2226_nativeidxs->raw() : nullptr, _2226_nativeidxs ? _2226_nativeidxs->size(0) : 0);
    mosek::fusion::p_ModelVariable::_initialize(_2221_model,_2222_name,_2224_shape,_2223_varid,_2225_sparsity,::mosek::fusion::p_LinearVariable::globalNativeIndexes(_2226_nativeidxs));
    mosek::fusion::p_LinearVariable::_get_impl(::mosek::fusion::LinearVariable::t(_pubthis))->name = _2222_name;
    mosek::fusion::p_LinearVariable::_get_impl(::mosek::fusion::LinearVariable::t(_pubthis))->nativeidxs = _2226_nativeidxs;
    mosek::fusion::p_LinearVariable::_get_impl(::mosek::fusion::LinearVariable::t(_pubthis))->sparsity = _2225_sparsity;
    mosek::fusion::p_LinearVariable::_get_impl(::mosek::fusion::LinearVariable::t(_pubthis))->shape = _2224_shape;
  }
}
// mosek.fusion.LinearVariable.ctor

// Begin mosek.fusion.LinearVariable.toString
// Method mosek.fusion.LinearVariable.toString @ bld/grindsted/final/default/src/fusion/LinearVariable.mbi:65:6-79:7
std::string mosek::fusion::LinearVariable :: toString() { return mosek::fusion::p_LinearVariable::_get_impl(this)->toString(); }
std::string mosek::fusion::p_LinearVariable::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2227_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  _2227_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("LinearVariable(("));
  if (((int)((shape)->size(0)) > (int)0))
  {
    {
      _2227_sb->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)((int)0)));
      int32_t _10183_ = (int)1;
      int32_t _10184_ = (int)((shape)->size(0));
      for (int32_t _2228_i = _10183_; _2228_i < _10184_; ++_2228_i)
      {
        {
          _2227_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)(_2228_i)));
        }
      }
    }
  }
  {}
  _2227_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"));
  if ((NULL != sparsity.get()))
  {
    {
      _2227_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",sparse"));
    }
  }
  {}
  _2227_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"));
  return _2227_sb->toString();
}
// End mosek.fusion.LinearVariable.toString

// Begin mosek.fusion.LinearVariable.clone
// Method mosek.fusion.LinearVariable.clone @ bld/grindsted/final/default/src/fusion/LinearVariable.mbi:61:6-63:7
monty::rc_ptr< ::mosek::fusion::ModelVariable > mosek::fusion::p_LinearVariable::__mosek_2fusion_2LinearVariable__clone(monty::rc_ptr< ::mosek::fusion::Model > _2229_m)
{
  return (::mosek::fusion::p_LinearVariable::_new_LinearVariable(::mosek::fusion::LinearVariable::t(_pubthis),_2229_m)).as<::mosek::fusion::ModelVariable>();
}
// End mosek.fusion.LinearVariable.clone

// Begin mosek.fusion.LinearVariable.globalNativeIndexes
// Method mosek.fusion.LinearVariable.globalNativeIndexes @ bld/grindsted/final/default/src/fusion/LinearVariable.mbi:30:6-33:7
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::p_LinearVariable::globalNativeIndexes(std::shared_ptr< monty::ndarray< int32_t,1 > > _2230_nativeidxs)
{
  _checked_ptr_1<int32_t> _ptr__2230_nativeidxs(_2230_nativeidxs ? _2230_nativeidxs->raw() : nullptr, _2230_nativeidxs ? _2230_nativeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2231_r = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)((_2230_nativeidxs)->size(0)))));
  _checked_ptr_1<int64_t> _ptr__2231_r(_2231_r ? _2231_r->raw() : nullptr,_2231_r ? _2231_r->size(0) : 0);
  int32_t _10185_ = (int)0;
  int32_t _10186_ = (int)((_2230_nativeidxs)->size(0));
  for (int32_t _2232_i = _10185_; _2232_i < _10186_; ++_2232_i)
  {
    {
      _ptr__2231_r[_2232_i] = _ptr__2230_nativeidxs[_2232_i];
    }
  }
  return _2231_r;
}
// End mosek.fusion.LinearVariable.globalNativeIndexes

void mosek::fusion::p_LinearVariable::destroy()
{
  shape.reset();
  sparsity.reset();
  nativeidxs.reset();
}
void mosek::fusion::LinearVariable::destroy() { mosek::fusion::p_LinearVariable::_get_impl(this)->destroy(); }
// } class LinearVariable
// class ConicVariable { // @ bld/grindsted/final/default/src/fusion/ConicVariable.mbi:23:4-79:5
mosek::fusion::ConicVariable::ConicVariable(mosek::fusion::p_ConicVariable *_impl) : mosek::fusion::ModelVariable(_impl) { /*std::cout << "ConicVariable()" << this << std::endl; */ }
mosek::fusion::ConicVariable::~ConicVariable() {  /* std::cout << "~ConicVariable()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ConicVariable::p_ConicVariable
  (::mosek::fusion::ConicVariable * _pubthis) :     mosek::fusion::p_ModelVariable(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ConicVariable.ctor @ bld/grindsted/final/default/src/fusion/ConicVariable.mbi:53:6-61:7
mosek::fusion::ConicVariable::t mosek::fusion::p_ConicVariable::_new_ConicVariable
  (monty::rc_ptr< ::mosek::fusion::ConicVariable > _2233_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2234_m)
{ return new mosek::fusion::ConicVariable(_2233_v,_2234_m); }
mosek::fusion::ConicVariable::ConicVariable
  (monty::rc_ptr< ::mosek::fusion::ConicVariable > _2233_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2234_m) : 
   ConicVariable(new mosek::fusion::p_ConicVariable(this))
{ mosek::fusion::p_ConicVariable::_get_impl(this)->_initialize(_2233_v,_2234_m); }
void mosek::fusion::p_ConicVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::ConicVariable > _2233_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2234_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ModelVariable::_initialize(_2233_v,_2234_m);
    shape = mosek::fusion::p_ConicVariable::_get_impl(_2233_v)->shape;
    nativeidxs = mosek::fusion::p_ConicVariable::_get_impl(_2233_v)->nativeidxs;
    shape = mosek::fusion::p_ConicVariable::_get_impl(_2233_v)->shape;
    varid = mosek::fusion::p_ConicVariable::_get_impl(_2233_v)->varid;
    name = mosek::fusion::p_ConicVariable::_get_impl(_2233_v)->name;
  }
}
// mosek.fusion.ConicVariable.ctor

// mosek.fusion.ConicVariable.ctor @ bld/grindsted/final/default/src/fusion/ConicVariable.mbi:39:6-51:7
mosek::fusion::ConicVariable::t mosek::fusion::p_ConicVariable::_new_ConicVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2235_model,
    const std::string &  _2236_name,
    int32_t _2237_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2238_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2239_nativeidxs)
{ return new mosek::fusion::ConicVariable(_2235_model,_2236_name,_2237_varid,_2238_shape,_2239_nativeidxs); }
mosek::fusion::ConicVariable::ConicVariable
  (monty::rc_ptr< ::mosek::fusion::Model > _2235_model,
    const std::string &  _2236_name,
    int32_t _2237_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2238_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2239_nativeidxs) : 
   ConicVariable(new mosek::fusion::p_ConicVariable(this))
{ mosek::fusion::p_ConicVariable::_get_impl(this)->_initialize(_2235_model,_2236_name,_2237_varid,_2238_shape,_2239_nativeidxs); }
void mosek::fusion::p_ConicVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2235_model,
    const std::string &  _2236_name,
    int32_t _2237_varid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2238_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2239_nativeidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2238_shape(_2238_shape ? _2238_shape->raw() : nullptr, _2238_shape ? _2238_shape->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__2239_nativeidxs(_2239_nativeidxs ? _2239_nativeidxs->raw() : nullptr, _2239_nativeidxs ? _2239_nativeidxs->size(0) : 0);
    mosek::fusion::p_ModelVariable::_initialize(_2235_model,_2236_name,_2238_shape,_2237_varid,nullptr,::mosek::fusion::p_ConicVariable::globalNativeIndexes(_2239_nativeidxs));
    mosek::fusion::p_ConicVariable::_get_impl(::mosek::fusion::ConicVariable::t(_pubthis))->name = _2236_name;
    mosek::fusion::p_ConicVariable::_get_impl(::mosek::fusion::ConicVariable::t(_pubthis))->varid = _2237_varid;
    mosek::fusion::p_ConicVariable::_get_impl(::mosek::fusion::ConicVariable::t(_pubthis))->shape = _2238_shape;
    mosek::fusion::p_ConicVariable::_get_impl(::mosek::fusion::ConicVariable::t(_pubthis))->nativeidxs = _2239_nativeidxs;
  }
}
// mosek.fusion.ConicVariable.ctor

// Begin mosek.fusion.ConicVariable.toString
// Method mosek.fusion.ConicVariable.toString @ bld/grindsted/final/default/src/fusion/ConicVariable.mbi:68:6-78:7
std::string mosek::fusion::ConicVariable :: toString() { return mosek::fusion::p_ConicVariable::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ConicVariable::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2240_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  _2240_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ConicVariable( "));
  if (((int)((name).size()) > (int)0))
  {
    {
      _2240_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"))->__mosek_2fusion_2Utils_2StringBuffer__a(name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("',"));
    }
  }
  {}
  _2240_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("("));
  _2240_sb->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)((int)0)));
  int32_t _10187_ = (int)1;
  int32_t _10188_ = (int)((shape)->size(0));
  for (int32_t _2241_i = _10187_; _2241_i < _10188_; ++_2241_i)
  {
    {
      _2240_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)(_2241_i)));
    }
  }
  _2240_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") )"));
  return _2240_sb->toString();
}
// End mosek.fusion.ConicVariable.toString

// Begin mosek.fusion.ConicVariable.clone
// Method mosek.fusion.ConicVariable.clone @ bld/grindsted/final/default/src/fusion/ConicVariable.mbi:63:6-66:7
monty::rc_ptr< ::mosek::fusion::ModelVariable > mosek::fusion::p_ConicVariable::__mosek_2fusion_2ConicVariable__clone(monty::rc_ptr< ::mosek::fusion::Model > _2242_m)
{
  return (::mosek::fusion::p_ConicVariable::_new_ConicVariable(::mosek::fusion::ConicVariable::t(_pubthis),_2242_m)).as<::mosek::fusion::ModelVariable>();
}
// End mosek.fusion.ConicVariable.clone

// Begin mosek.fusion.ConicVariable.globalNativeIndexes
// Method mosek.fusion.ConicVariable.globalNativeIndexes @ bld/grindsted/final/default/src/fusion/ConicVariable.mbi:34:6-37:7
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::p_ConicVariable::globalNativeIndexes(std::shared_ptr< monty::ndarray< int32_t,1 > > _2243_nativeidxs)
{
  _checked_ptr_1<int32_t> _ptr__2243_nativeidxs(_2243_nativeidxs ? _2243_nativeidxs->raw() : nullptr, _2243_nativeidxs ? _2243_nativeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2244_r = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)((_2243_nativeidxs)->size(0)))));
  _checked_ptr_1<int64_t> _ptr__2244_r(_2244_r ? _2244_r->raw() : nullptr,_2244_r ? _2244_r->size(0) : 0);
  int32_t _10189_ = (int)0;
  int32_t _10190_ = (int)((_2243_nativeidxs)->size(0));
  for (int32_t _2245_i = _10189_; _2245_i < _10190_; ++_2245_i)
  {
    {
      _ptr__2244_r[_2245_i] = _ptr__2243_nativeidxs[_2245_i];
    }
  }
  return _2244_r;
}
// End mosek.fusion.ConicVariable.globalNativeIndexes

void mosek::fusion::p_ConicVariable::destroy()
{
  nativeidxs.reset();
  shape.reset();
}
void mosek::fusion::ConicVariable::destroy() { mosek::fusion::p_ConicVariable::_get_impl(this)->destroy(); }
// } class ConicVariable
// class ModelVariable { // @ bld/grindsted/final/default/src/fusion/ModelVariable.mbi:14:4-90:5
mosek::fusion::ModelVariable::ModelVariable(mosek::fusion::p_ModelVariable *_impl) : mosek::fusion::BaseVariable(_impl) { /*std::cout << "ModelVariable()" << this << std::endl; */ }
mosek::fusion::ModelVariable::~ModelVariable() {  /* std::cout << "~ModelVariable()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ModelVariable::p_ModelVariable
  (::mosek::fusion::ModelVariable * _pubthis) :     mosek::fusion::p_BaseVariable(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ModelVariable.ctor @ bld/grindsted/final/default/src/fusion/ModelVariable.mbi:62:6-72:7
void mosek::fusion::p_ModelVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::ModelVariable > _2246_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2247_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseVariable::_initialize(_2246_v,_2247_m);
    name = mosek::fusion::p_ModelVariable::_get_impl(_2246_v)->name;
    varid = mosek::fusion::p_ModelVariable::_get_impl(_2246_v)->varid;
    modelvar_nativeidxs = mosek::fusion::p_ModelVariable::_get_impl(_2246_v)->modelvar_nativeidxs;
    shape = mosek::fusion::p_ModelVariable::_get_impl(_2246_v)->shape;
    sparsity = mosek::fusion::p_ModelVariable::_get_impl(_2246_v)->sparsity;
  }
}
// mosek.fusion.ModelVariable.ctor

// mosek.fusion.ModelVariable.ctor @ bld/grindsted/final/default/src/fusion/ModelVariable.mbi:44:6-58:7
void mosek::fusion::p_ModelVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2248_model,
    const std::string &  _2249_name,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2250_shape,
    int64_t _2251_varid,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2252_sparsity,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2253_modelvar_nativeidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2250_shape(_2250_shape ? _2250_shape->raw() : nullptr, _2250_shape ? _2250_shape->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2252_sparsity(_2252_sparsity ? _2252_sparsity->raw() : nullptr, _2252_sparsity ? _2252_sparsity->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2253_modelvar_nativeidxs(_2253_modelvar_nativeidxs ? _2253_modelvar_nativeidxs->raw() : nullptr, _2253_modelvar_nativeidxs ? _2253_modelvar_nativeidxs->size(0) : 0);
    mosek::fusion::p_BaseVariable::_initialize(_2248_model,_2250_shape,_2252_sparsity,_2253_modelvar_nativeidxs);
    mosek::fusion::p_ModelVariable::_get_impl(::mosek::fusion::ModelVariable::t(_pubthis))->name = _2249_name;
    mosek::fusion::p_ModelVariable::_get_impl(::mosek::fusion::ModelVariable::t(_pubthis))->varid = _2251_varid;
    mosek::fusion::p_ModelVariable::_get_impl(::mosek::fusion::ModelVariable::t(_pubthis))->shape = _2250_shape;
    mosek::fusion::p_ModelVariable::_get_impl(::mosek::fusion::ModelVariable::t(_pubthis))->sparsity = _2252_sparsity;
    mosek::fusion::p_ModelVariable::_get_impl(::mosek::fusion::ModelVariable::t(_pubthis))->modelvar_nativeidxs = _2253_modelvar_nativeidxs;
  }
}
// mosek.fusion.ModelVariable.ctor

// Begin mosek.fusion.ModelVariable.elementName
// Method mosek.fusion.ModelVariable.elementName @ bld/grindsted/final/default/src/fusion/ModelVariable.mbi:84:6-88:7
void mosek::fusion::ModelVariable :: elementName(int64_t _2254_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2255_sb) { mosek::fusion::p_ModelVariable::_get_impl(this)->elementName(_2254_index,_2255_sb); }
void mosek::fusion::p_ModelVariable::elementName(int64_t _2254_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2255_sb)
{
  std::string _10191_;
  bool _10192_ = ((int)((name).size()) == (int)0);
  if (_10192_)
  {
    _10191_ = std::string ("_");
  }
  else
  {
    _10191_ = name;
  }
  _2255_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_10191_)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("["))->__mosek_2fusion_2Utils_2StringBuffer__a(::mosek::fusion::p_Set::indexToString(shape,_2254_index))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("]"));
}
// End mosek.fusion.ModelVariable.elementName

// Begin mosek.fusion.ModelVariable.remove
// Method mosek.fusion.ModelVariable.remove @ bld/grindsted/final/default/src/fusion/ModelVariable.mbi:78:6-80:7
void mosek::fusion::ModelVariable :: remove() { mosek::fusion::p_ModelVariable::_get_impl(this)->remove(); }
void mosek::fusion::p_ModelVariable::remove()
{
  mosek::fusion::p_Model::_get_impl(_pubthis->__mosek_2fusion_2BaseVariable__getModel().get())->removeVariableBlock(varid);
}
// End mosek.fusion.ModelVariable.remove

// Begin mosek.fusion.ModelVariable.clone
// End mosek.fusion.ModelVariable.clone

void mosek::fusion::p_ModelVariable::destroy()
{
  sparsity.reset();
  shape.reset();
  modelvar_nativeidxs.reset();
}
void mosek::fusion::ModelVariable::destroy() { mosek::fusion::p_ModelVariable::_get_impl(this)->destroy(); }
// } class ModelVariable
// class NilVariable { // @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1013:4-1098:5
mosek::fusion::NilVariable::NilVariable(mosek::fusion::p_NilVariable *_impl) : mosek::fusion::BaseVariable(_impl) { /*std::cout << "NilVariable()" << this << std::endl; */ }
mosek::fusion::NilVariable::~NilVariable() {  /* std::cout << "~NilVariable()" << this << std::endl << std::flush; */ }
mosek::fusion::p_NilVariable::p_NilVariable
  (::mosek::fusion::NilVariable * _pubthis) :     mosek::fusion::p_BaseVariable(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.NilVariable.ctor @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1020:6-1024:7
mosek::fusion::NilVariable::t mosek::fusion::p_NilVariable::_new_NilVariable
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _2257_shape)
{ return new mosek::fusion::NilVariable(_2257_shape); }
mosek::fusion::NilVariable::NilVariable
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _2257_shape) : 
   NilVariable(new mosek::fusion::p_NilVariable(this))
{ mosek::fusion::p_NilVariable::_get_impl(this)->_initialize(_2257_shape); }
void mosek::fusion::p_NilVariable::_initialize  (std::shared_ptr< monty::ndarray< int32_t,1 > > _2257_shape)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2257_shape(_2257_shape ? _2257_shape->raw() : nullptr, _2257_shape ? _2257_shape->size(0) : 0);
    mosek::fusion::p_BaseVariable::_initialize(nullptr,::mosek::fusion::Utils::Tools::arraycopy(_2257_shape),std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)0))),std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)0))));
    std::vector<int32_t> _10193_;
    for (int32_t _2258_i = (int)0, _10194_ = (int)((_2257_shape)->size(0)); _2258_i < _10194_ ; ++_2258_i)
    {
      _10193_.push_back(_ptr__2257_shape[_2258_i]);
    }
    auto _10195_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10193_.size()),_10193_.begin(),_10193_.end()));
    mosek::fusion::p_NilVariable::_get_impl(::mosek::fusion::NilVariable::t(_pubthis))->shape = _10195_;
  }
}
// mosek.fusion.NilVariable.ctor

// mosek.fusion.NilVariable.ctor @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1018:6-45
mosek::fusion::NilVariable::t mosek::fusion::p_NilVariable::_new_NilVariable
  ()
{ return new mosek::fusion::NilVariable(); }
mosek::fusion::NilVariable::NilVariable
  () : 
   NilVariable(new mosek::fusion::p_NilVariable(this))
{ mosek::fusion::p_NilVariable::_get_impl(this)->_initialize(); }
void mosek::fusion::p_NilVariable::_initialize  ()
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_NilVariable::_initialize(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))));
  }
}
// mosek.fusion.NilVariable.ctor

// Begin mosek.fusion.NilVariable.elementDesc
// Method mosek.fusion.NilVariable.elementDesc @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1096:6-102
monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > mosek::fusion::NilVariable :: __mosek_2fusion_2NilVariable__elementDesc(int64_t _2259_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2260_sb) { return mosek::fusion::p_NilVariable::_get_impl(this)->__mosek_2fusion_2NilVariable__elementDesc(_2259_index,_2260_sb); }
monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > mosek::fusion::NilVariable::elementDesc(int64_t _2259_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2260_sb) { return __mosek_2fusion_2NilVariable__elementDesc(_2259_index,_2260_sb); }
monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > mosek::fusion::p_NilVariable::__mosek_2fusion_2NilVariable__elementDesc(int64_t _2259_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2260_sb)
{
  return _2260_sb;
}
// End mosek.fusion.NilVariable.elementDesc

// Begin mosek.fusion.NilVariable.elementName
// Method mosek.fusion.NilVariable.elementName @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1095:6-76
void mosek::fusion::NilVariable :: elementName(int64_t _2261_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2262_sb) { mosek::fusion::p_NilVariable::_get_impl(this)->elementName(_2261_index,_2262_sb); }
void mosek::fusion::p_NilVariable::elementName(int64_t _2261_index,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2262_sb)
{
}
// End mosek.fusion.NilVariable.elementName

// Begin mosek.fusion.NilVariable.numInst
// Method mosek.fusion.NilVariable.numInst @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1091:6-1093:7
int32_t mosek::fusion::NilVariable :: numInst() { return mosek::fusion::p_NilVariable::_get_impl(this)->numInst(); }
int32_t mosek::fusion::p_NilVariable::numInst()
{
  return (int)0;
}
// End mosek.fusion.NilVariable.numInst

// Begin mosek.fusion.NilVariable.inst
// Method mosek.fusion.NilVariable.inst @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1083:6-1089:7
int32_t mosek::fusion::NilVariable :: inst(int32_t _2263_offset,std::shared_ptr< monty::ndarray< int64_t,1 > > _2264_sparsity,std::shared_ptr< monty::ndarray< int64_t,1 > > _2265_basevar_nativeidxs) { return mosek::fusion::p_NilVariable::_get_impl(this)->inst(_2263_offset,_2264_sparsity,_2265_basevar_nativeidxs); }
int32_t mosek::fusion::p_NilVariable::inst(int32_t _2263_offset,std::shared_ptr< monty::ndarray< int64_t,1 > > _2264_sparsity,std::shared_ptr< monty::ndarray< int64_t,1 > > _2265_basevar_nativeidxs)
{
  _checked_ptr_1<int64_t> _ptr__2264_sparsity(_2264_sparsity ? _2264_sparsity->raw() : nullptr, _2264_sparsity ? _2264_sparsity->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__2265_basevar_nativeidxs(_2265_basevar_nativeidxs ? _2265_basevar_nativeidxs->raw() : nullptr, _2265_basevar_nativeidxs ? _2265_basevar_nativeidxs->size(0) : 0);
  return (int)0;
}
// End mosek.fusion.NilVariable.inst

// Begin mosek.fusion.NilVariable.inst
// Method mosek.fusion.NilVariable.inst @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1078:6-1081:8
void mosek::fusion::NilVariable :: inst(int32_t _2266_offset,std::shared_ptr< monty::ndarray< int64_t,1 > > _2267_nindex) { mosek::fusion::p_NilVariable::_get_impl(this)->inst(_2266_offset,_2267_nindex); }
void mosek::fusion::p_NilVariable::inst(int32_t _2266_offset,std::shared_ptr< monty::ndarray< int64_t,1 > > _2267_nindex)
{
  _checked_ptr_1<int64_t> _ptr__2267_nindex(_2267_nindex ? _2267_nindex->raw() : nullptr, _2267_nindex ? _2267_nindex->size(0) : 0);
}
// End mosek.fusion.NilVariable.inst

// Begin mosek.fusion.NilVariable.set_values
// Method mosek.fusion.NilVariable.set_values @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1073:6-1076:8
void mosek::fusion::NilVariable :: set_values(std::shared_ptr< monty::ndarray< double,1 > > _2268_target,bool _2269_primal) { mosek::fusion::p_NilVariable::_get_impl(this)->set_values(_2268_target,_2269_primal); }
void mosek::fusion::p_NilVariable::set_values(std::shared_ptr< monty::ndarray< double,1 > > _2268_target,bool _2269_primal)
{
  _checked_ptr_1<double> _ptr__2268_target(_2268_target ? _2268_target->raw() : nullptr, _2268_target ? _2268_target->size(0) : 0);
}
// End mosek.fusion.NilVariable.set_values

// Begin mosek.fusion.NilVariable.values
// Method mosek.fusion.NilVariable.values @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1067:6-1071:8
void mosek::fusion::NilVariable :: values(int32_t _2270_offset,std::shared_ptr< monty::ndarray< double,1 > > _2271_target,bool _2272_primal) { mosek::fusion::p_NilVariable::_get_impl(this)->values(_2270_offset,_2271_target,_2272_primal); }
void mosek::fusion::p_NilVariable::values(int32_t _2270_offset,std::shared_ptr< monty::ndarray< double,1 > > _2271_target,bool _2272_primal)
{
  _checked_ptr_1<double> _ptr__2271_target(_2271_target ? _2271_target->raw() : nullptr, _2271_target ? _2271_target->size(0) : 0);
}
// End mosek.fusion.NilVariable.values

// Begin mosek.fusion.NilVariable.make_continuous
// Method mosek.fusion.NilVariable.make_continuous @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1065:6-40
void mosek::fusion::NilVariable :: make_continuous() { mosek::fusion::p_NilVariable::_get_impl(this)->make_continuous(); }
void mosek::fusion::p_NilVariable::make_continuous()
{
}
// End mosek.fusion.NilVariable.make_continuous

// Begin mosek.fusion.NilVariable.make_integer
// Method mosek.fusion.NilVariable.make_integer @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1064:6-37
void mosek::fusion::NilVariable :: make_integer() { mosek::fusion::p_NilVariable::_get_impl(this)->make_integer(); }
void mosek::fusion::p_NilVariable::make_integer()
{
}
// End mosek.fusion.NilVariable.make_integer

// Begin mosek.fusion.NilVariable.toString
// Method mosek.fusion.NilVariable.toString @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1062:6-63
std::string mosek::fusion::NilVariable :: toString() { return mosek::fusion::p_NilVariable::_get_impl(this)->toString(); }
std::string mosek::fusion::p_NilVariable::toString()
{
  return std::string ("NilVariable");
}
// End mosek.fusion.NilVariable.toString

// Begin mosek.fusion.NilVariable.index
// Method mosek.fusion.NilVariable.index @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1056:6-1060:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::NilVariable :: __mosek_2fusion_2NilVariable__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2273_first) { return mosek::fusion::p_NilVariable::_get_impl(this)->__mosek_2fusion_2NilVariable__index(_2273_first); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::NilVariable::index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2273_first) { return __mosek_2fusion_2NilVariable__index(_2273_first); }
/* override: mosek.fusion.BaseVariable.index*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::NilVariable::__mosek_2fusion_2BaseVariable__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2273_first) { return __mosek_2fusion_2NilVariable__index(_2273_first); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_NilVariable::__mosek_2fusion_2NilVariable__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2273_first)
{
  _checked_ptr_1<int32_t> _ptr__2273_first(_2273_first ? _2273_first->raw() : nullptr, _2273_first ? _2273_first->size(0) : 0);
  std::vector<int32_t> _10196_;
  for (int32_t _2274_i = (int)0, _10197_ = (int)((shape)->size(0)); _2274_i < _10197_ ; ++_2274_i)
  {
    _10196_.push_back((int)1);
  }
  auto _10198_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10196_.size()),_10196_.begin(),_10196_.end()));
  return (::mosek::fusion::p_NilVariable::_new_NilVariable(_10198_)).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.NilVariable.index

// Begin mosek.fusion.NilVariable.index
// Method mosek.fusion.NilVariable.index @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1050:6-1054:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::NilVariable :: __mosek_2fusion_2NilVariable__index(int32_t _2275_first) { return mosek::fusion::p_NilVariable::_get_impl(this)->__mosek_2fusion_2NilVariable__index(_2275_first); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::NilVariable::index(int32_t _2275_first) { return __mosek_2fusion_2NilVariable__index(_2275_first); }
/* override: mosek.fusion.BaseVariable.index*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::NilVariable::__mosek_2fusion_2BaseVariable__index(int32_t _2275_first) { return __mosek_2fusion_2NilVariable__index(_2275_first); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_NilVariable::__mosek_2fusion_2NilVariable__index(int32_t _2275_first)
{
  std::vector<int32_t> _10199_;
  for (int32_t _2276_i = (int)0, _10200_ = (int)((shape)->size(0)); _2276_i < _10200_ ; ++_2276_i)
  {
    _10199_.push_back((int)1);
  }
  auto _10201_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10199_.size()),_10199_.begin(),_10199_.end()));
  return (::mosek::fusion::p_NilVariable::_new_NilVariable(_10201_)).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.NilVariable.index

// Begin mosek.fusion.NilVariable.slice
// Method mosek.fusion.NilVariable.slice @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1038:6-1048:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::NilVariable :: __mosek_2fusion_2NilVariable__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2277_first,std::shared_ptr< monty::ndarray< int32_t,1 > > _2278_last) { return mosek::fusion::p_NilVariable::_get_impl(this)->__mosek_2fusion_2NilVariable__slice(_2277_first,_2278_last); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::NilVariable::slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2277_first,std::shared_ptr< monty::ndarray< int32_t,1 > > _2278_last) { return __mosek_2fusion_2NilVariable__slice(_2277_first,_2278_last); }
/* override: mosek.fusion.BaseVariable.slice*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::NilVariable::__mosek_2fusion_2BaseVariable__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2277_first,std::shared_ptr< monty::ndarray< int32_t,1 > > _2278_last) { return __mosek_2fusion_2NilVariable__slice(_2277_first,_2278_last); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_NilVariable::__mosek_2fusion_2NilVariable__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2277_first,std::shared_ptr< monty::ndarray< int32_t,1 > > _2278_last)
{
  _checked_ptr_1<int32_t> _ptr__2277_first(_2277_first ? _2277_first->raw() : nullptr, _2277_first ? _2277_first->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__2278_last(_2278_last ? _2278_last->raw() : nullptr, _2278_last ? _2278_last->size(0) : 0);
  if ((((int)((shape)->size(0)) != (int)((_2277_first)->size(0))) || ((int)((shape)->size(0)) != (int)((_2278_last)->size(0)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching slice shape"));
    }
  }
  {}
  int32_t _10202_ = (int)0;
  int32_t _10203_ = (int)((_2277_first)->size(0));
  for (int32_t _2279_i = _10202_; _2279_i < _10203_; ++_2279_i)
  {
    {
      if (((_ptr__2278_last[_2279_i] > _ptr__2277_first[_2279_i]) || ((_ptr__2277_first[_2279_i] < (int)0) || (_ptr__2278_last[_2279_i] >= ((*shape)(_2279_i))))))
      {
        {
          throw ::mosek::fusion::SliceError(std::string ("Slice is out of bounds"));
        }
      }
      {}
    }
  }
  std::vector<int32_t> _10204_;
  for (int32_t _2280_i = (int)0, _10205_ = (int)((shape)->size(0)); _2280_i < _10205_ ; ++_2280_i)
  {
    _10204_.push_back((_ptr__2278_last[_2280_i] - _ptr__2277_first[_2280_i]));
  }
  auto _10206_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10204_.size()),_10204_.begin(),_10204_.end()));
  return (::mosek::fusion::p_NilVariable::_new_NilVariable(_10206_)).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.NilVariable.slice

// Begin mosek.fusion.NilVariable.slice
// Method mosek.fusion.NilVariable.slice @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:1026:6-1036:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::NilVariable :: __mosek_2fusion_2NilVariable__slice(int32_t _2281_first,int32_t _2282_last) { return mosek::fusion::p_NilVariable::_get_impl(this)->__mosek_2fusion_2NilVariable__slice(_2281_first,_2282_last); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::NilVariable::slice(int32_t _2281_first,int32_t _2282_last) { return __mosek_2fusion_2NilVariable__slice(_2281_first,_2282_last); }
/* override: mosek.fusion.BaseVariable.slice*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::NilVariable::__mosek_2fusion_2BaseVariable__slice(int32_t _2281_first,int32_t _2282_last) { return __mosek_2fusion_2NilVariable__slice(_2281_first,_2282_last); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_NilVariable::__mosek_2fusion_2NilVariable__slice(int32_t _2281_first,int32_t _2282_last)
{
  if (((_2282_last > _2281_first) || ((_2281_first < (int)0) || (_2282_last > ((*shape)((int)0))))))
  {
    {
      throw ::mosek::fusion::SliceError(std::string ("Slice is out of bounds"));
    }
  }
  else if(((int)((shape)->size(0)) != (int)1))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching slice shape"));
    }
  }
  else
  {
    {
      return (::mosek::fusion::p_NilVariable::_new_NilVariable(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((_2282_last - _2281_first))}))).as<::mosek::fusion::Variable>();
    }
  }
}
// End mosek.fusion.NilVariable.slice

void mosek::fusion::p_NilVariable::destroy()
{
  shape.reset();
}
void mosek::fusion::NilVariable::destroy() { mosek::fusion::p_NilVariable::_get_impl(this)->destroy(); }
// } class NilVariable
// class BaseVariable { // @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:53:4-982:5
mosek::fusion::BaseVariable::BaseVariable(mosek::fusion::p_BaseVariable *_impl) : _impl(_impl) { /*std::cout << "BaseVariable() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::BaseVariable::~BaseVariable() { delete _impl; _impl = nullptr; }
mosek::fusion::p_BaseVariable::p_BaseVariable
  (::mosek::fusion::BaseVariable * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.BaseVariable.ctor @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:99:6-108:7
void mosek::fusion::p_BaseVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::BaseVariable > _2283_v,
    monty::rc_ptr< ::mosek::fusion::Model > _2284_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    model = _2284_m;
    shape = mosek::fusion::p_BaseVariable::_get_impl(_2283_v)->shape;
    sparsity = mosek::fusion::p_BaseVariable::_get_impl(_2283_v)->sparsity;
    basevar_nativeidxs = mosek::fusion::p_BaseVariable::_get_impl(_2283_v)->basevar_nativeidxs;
  }
}
// mosek.fusion.BaseVariable.ctor

// mosek.fusion.BaseVariable.ctor @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:83:6-94:7
void mosek::fusion::p_BaseVariable::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2285_m,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2286_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2287_sparsity,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2288_basevar_nativeidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2286_shape(_2286_shape ? _2286_shape->raw() : nullptr, _2286_shape ? _2286_shape->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2287_sparsity(_2287_sparsity ? _2287_sparsity->raw() : nullptr, _2287_sparsity ? _2287_sparsity->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2288_basevar_nativeidxs(_2288_basevar_nativeidxs ? _2288_basevar_nativeidxs->raw() : nullptr, _2288_basevar_nativeidxs ? _2288_basevar_nativeidxs->size(0) : 0);
    model = _2285_m;
    mosek::fusion::p_BaseVariable::_get_impl(::mosek::fusion::BaseVariable::t(_pubthis))->shape = _2286_shape;
    mosek::fusion::p_BaseVariable::_get_impl(::mosek::fusion::BaseVariable::t(_pubthis))->sparsity = _2287_sparsity;
    mosek::fusion::p_BaseVariable::_get_impl(::mosek::fusion::BaseVariable::t(_pubthis))->basevar_nativeidxs = _2288_basevar_nativeidxs;
  }
}
// mosek.fusion.BaseVariable.ctor

// Begin mosek.fusion.BaseVariable.toString
// Method mosek.fusion.BaseVariable.toString @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:970:6-981:7
std::string mosek::fusion::BaseVariable :: toString() { return mosek::fusion::p_BaseVariable::_get_impl(this)->toString(); }
std::string mosek::fusion::p_BaseVariable::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2289_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  _2289_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Variable(("));
  if (((int)((shape)->size(0)) > (int)0))
  {
    {
      _2289_sb->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)((int)0)));
      int32_t _10207_ = (int)1;
      int32_t _10208_ = (int)((shape)->size(0));
      for (int32_t _2290_i = _10207_; _2290_i < _10208_; ++_2290_i)
      {
        {
          _2289_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)(_2290_i)));
        }
      }
    }
  }
  {}
  _2289_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("))"));
  return _2289_sb->toString();
}
// End mosek.fusion.BaseVariable.toString

// Begin mosek.fusion.BaseVariable.eval
// Method mosek.fusion.BaseVariable.eval @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:939:6-967:7
void mosek::fusion::BaseVariable :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _2291_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _2292_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _2293_xs,bool _2294_cache_eval) { mosek::fusion::p_BaseVariable::_get_impl(this)->eval(_2291_rs,_2292_ws,_2293_xs,_2294_cache_eval); }
void mosek::fusion::p_BaseVariable::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _2291_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _2292_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _2293_xs,bool _2294_cache_eval)
{
  int32_t _2295_nnz = (int)((basevar_nativeidxs)->size(0));
  int32_t _2296_nelem = _2295_nnz;
  int32_t _2297_nd = (int)((shape)->size(0));
  bool _2298_hassp = (NULL != sparsity.get());
  _2291_rs->alloc_expr(_2297_nd,_2296_nelem,_2295_nnz,_2298_hassp);
  int32_t _2299_ptr = mosek::fusion::p_WorkStack::_get_impl(_2291_rs)->ptr_base;
  int32_t _2300_nidxs = mosek::fusion::p_WorkStack::_get_impl(_2291_rs)->nidxs_base;
  int32_t _2301_sp = mosek::fusion::p_WorkStack::_get_impl(_2291_rs)->sp_base;
  int32_t _2302_cof = mosek::fusion::p_WorkStack::_get_impl(_2291_rs)->cof_base;
  int32_t _2303_shape_base = mosek::fusion::p_WorkStack::_get_impl(_2291_rs)->shape_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2304_ri32 = mosek::fusion::p_WorkStack::_get_impl(_2291_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__2304_ri32(_2304_ri32 ? _2304_ri32->raw() : nullptr,_2304_ri32 ? _2304_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2305_ri64 = mosek::fusion::p_WorkStack::_get_impl(_2291_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__2305_ri64(_2305_ri64 ? _2305_ri64->raw() : nullptr,_2305_ri64 ? _2305_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _2306_rf64 = mosek::fusion::p_WorkStack::_get_impl(_2291_rs)->f64;
  _checked_ptr_1<double> _ptr__2306_rf64(_2306_rf64 ? _2306_rf64->raw() : nullptr,_2306_rf64 ? _2306_rf64->size(0) : 0);
  int32_t _10209_ = (int)0;
  int32_t _10210_ = _2297_nd;
  for (int32_t _2307_i = _10209_; _2307_i < _10210_; ++_2307_i)
  {
    {
      _ptr__2304_ri32[safe_add( _2303_shape_base,_2307_i )] = ((*shape)(_2307_i));
    }
  }
  {
    int32_t _10211_ = (int)0;
    int32_t _10212_ = safe_add( _2295_nnz,(int)1 );
    for (int32_t _2308_i = _10211_; _2308_i < _10212_; ++_2308_i)
    {
      {
        _ptr__2304_ri32[safe_add( _2299_ptr,_2308_i )] = _2308_i;
      }
    }
    int32_t _10213_ = (int)0;
    int32_t _10214_ = _2295_nnz;
    for (int32_t _2309_i = _10213_; _2309_i < _10214_; ++_2309_i)
    {
      {
        _ptr__2305_ri64[safe_add( _2300_nidxs,_2309_i )] = ((*basevar_nativeidxs)(_2309_i));
      }
    }
    if (_2298_hassp)
    {
      {
        int32_t _10215_ = (int)0;
        int32_t _10216_ = _2295_nnz;
        for (int32_t _2310_i = _10215_; _2310_i < _10216_; ++_2310_i)
        {
          {
            _ptr__2305_ri64[safe_add( _2301_sp,_2310_i )] = ((*sparsity)(_2310_i));
          }
        }
      }
    }
    {}
    int32_t _10217_ = (int)0;
    int32_t _10218_ = _2295_nnz;
    for (int32_t _2311_i = _10217_; _2311_i < _10218_; ++_2311_i)
    {
      {
        _ptr__2306_rf64[safe_add( _2302_cof,_2311_i )] = 1.0;
      }
    }
  }
}
// End mosek.fusion.BaseVariable.eval

// Begin mosek.fusion.BaseVariable.compress_when_caching
// Method mosek.fusion.BaseVariable.compress_when_caching @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:936:6-66
bool mosek::fusion::BaseVariable :: compress_when_caching() { return mosek::fusion::p_BaseVariable::_get_impl(this)->compress_when_caching(); }
bool mosek::fusion::p_BaseVariable::compress_when_caching()
{
  return false;
}
// End mosek.fusion.BaseVariable.compress_when_caching

// Begin mosek.fusion.BaseVariable.eval
// Method mosek.fusion.BaseVariable.eval @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:933:6-102
void mosek::fusion::BaseVariable :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _2312_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _2313_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _2314_xs) { mosek::fusion::p_BaseVariable::_get_impl(this)->eval(_2312_rs,_2313_ws,_2314_xs); }
void mosek::fusion::p_BaseVariable::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _2312_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _2313_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _2314_xs)
{
  _pubthis->recursive_eval(_2312_rs,_2313_ws,_2314_xs,false);
}
// End mosek.fusion.BaseVariable.eval

// Begin mosek.fusion.BaseVariable.recursive_eval
// Method mosek.fusion.BaseVariable.recursive_eval @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:927:6-930:7
void mosek::fusion::BaseVariable :: recursive_eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _2315_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _2316_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _2317_xs,bool _2318_cache_eval) { mosek::fusion::p_BaseVariable::_get_impl(this)->recursive_eval(_2315_rs,_2316_ws,_2317_xs,_2318_cache_eval); }
void mosek::fusion::p_BaseVariable::recursive_eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _2315_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _2316_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _2317_xs,bool _2318_cache_eval)
{
  _pubthis->eval(_2315_rs,_2316_ws,_2317_xs,_2318_cache_eval);
}
// End mosek.fusion.BaseVariable.recursive_eval

// Begin mosek.fusion.BaseVariable.remove
// Method mosek.fusion.BaseVariable.remove @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:920:6-922:7
void mosek::fusion::BaseVariable :: remove() { mosek::fusion::p_BaseVariable::_get_impl(this)->remove(); }
void mosek::fusion::p_BaseVariable::remove()
{
  throw ::mosek::fusion::DeletionError(std::string ("Only original variables can be removed"));
}
// End mosek.fusion.BaseVariable.remove

// Begin mosek.fusion.BaseVariable.fromTril
// Method mosek.fusion.BaseVariable.fromTril @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:844:6-918:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__fromTril(int32_t _2319_dim0,int32_t _2320_d) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__fromTril(_2319_dim0,_2320_d); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::fromTril(int32_t _2319_dim0,int32_t _2320_d) { return __mosek_2fusion_2BaseVariable__fromTril(_2319_dim0,_2320_d); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__fromTril(int32_t _2319_dim0,int32_t _2320_d)
{
  if (((_2319_dim0 < (int)0) || (_2319_dim0 >= (int)((shape)->size(0)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid dimension"));
    }
  }
  else if((((*shape)(_2319_dim0)) != (safe_mul( _2320_d,safe_add( _2320_d,(int)1 ) ) / (int)2)))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid shape for operation"));
    }
  }
  {}
  int32_t _2321_d0 = (int)1;
  int32_t _10219_ = (int)0;
  int32_t _10220_ = _2319_dim0;
  for (int32_t _2322_i = _10219_; _2322_i < _10220_; ++_2322_i)
  {
    {
      _2321_d0 *= ((*shape)(_2322_i));
    }
  }
  int32_t _2323_d1 = ((*shape)(_2319_dim0));
  int32_t _2324_d2 = (int)1;
  int32_t _10221_ = safe_add( _2319_dim0,(int)1 );
  int32_t _10222_ = (int)((shape)->size(0));
  for (int32_t _2325_i = _10221_; _2325_i < _10222_; ++_2325_i)
  {
    {
      _2324_d2 *= ((*shape)(_2325_i));
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2326_rshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( (int)((shape)->size(0)),(int)1 ))));
  _checked_ptr_1<int32_t> _ptr__2326_rshape(_2326_rshape ? _2326_rshape->raw() : nullptr,_2326_rshape ? _2326_rshape->size(0) : 0);
  int32_t _10223_ = (int)0;
  int32_t _10224_ = _2319_dim0;
  for (int32_t _2327_i = _10223_; _2327_i < _10224_; ++_2327_i)
  {
    {
      _ptr__2326_rshape[_2327_i] = ((*shape)(_2327_i));
    }
  }
  _ptr__2326_rshape[_2319_dim0] = _2320_d;
  _ptr__2326_rshape[safe_add( _2319_dim0,(int)1 )] = _2320_d;
  int32_t _10225_ = safe_add( _2319_dim0,(int)1 );
  int32_t _10226_ = (int)((shape)->size(0));
  for (int32_t _2328_i = _10225_; _2328_i < _10226_; ++_2328_i)
  {
    {
      _ptr__2326_rshape[safe_add( _2328_i,(int)1 )] = ((*shape)(_2328_i));
    }
  }
  if ((NULL == sparsity.get()))
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2329_nidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_mul( safe_mul( safe_mul( _2321_d0,_2320_d ),_2320_d ),_2324_d2 ))));
      _checked_ptr_1<int64_t> _ptr__2329_nidxs(_2329_nidxs ? _2329_nidxs->raw() : nullptr,_2329_nidxs ? _2329_nidxs->size(0) : 0);
      int32_t _2330_ofs = (int)0;
      int32_t _10227_ = (int)0;
      int32_t _10228_ = _2321_d0;
      for (int32_t _2331_i0 = _10227_; _2331_i0 < _10228_; ++_2331_i0)
      {
        {
          int32_t _10229_ = (int)0;
          int32_t _10230_ = _2320_d;
          for (int32_t _2332_i10 = _10229_; _2332_i10 < _10230_; ++_2332_i10)
          {
            {
              int32_t _10231_ = (int)0;
              int32_t _10232_ = _2320_d;
              for (int32_t _2333_i11 = _10231_; _2333_i11 < _10232_; ++_2333_i11)
              {
                {
                  int32_t _10233_ = (int)0;
                  int32_t _10234_ = _2324_d2;
                  for (int32_t _2334_i2 = _10233_; _2334_i2 < _10234_; ++_2334_i2)
                  {
                    {
                      if ((_2332_i10 >= _2333_i11))
                      {
                        {
                          _ptr__2329_nidxs[_2330_ofs] = ((*basevar_nativeidxs)(safe_add( safe_add( safe_mul( safe_mul( _2331_i0,_2323_d1 ),_2324_d2 ),safe_mul( safe_add( (safe_mul( _2332_i10,safe_add( _2332_i10,(int)1 ) ) / (int)2),_2333_i11 ),_2324_d2 ) ),_2334_i2 )));
                        }
                      }
                      else
                      {
                        {
                          _ptr__2329_nidxs[_2330_ofs] = ((*basevar_nativeidxs)(safe_add( safe_add( safe_mul( safe_mul( _2331_i0,_2323_d1 ),_2324_d2 ),safe_mul( safe_add( (safe_mul( _2333_i11,safe_add( _2333_i11,(int)1 ) ) / (int)2),_2332_i10 ),_2324_d2 ) ),_2334_i2 )));
                        }
                      }
                      ++ _2330_ofs;
                    }
                  }
                }
              }
            }
          }
        }
      }
      return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),_2326_rshape,nullptr,_2329_nidxs)).as<::mosek::fusion::Variable>();
    }
  }
  else
  {
    {
      int32_t _2335_nelm = (int)0;
      int32_t _10235_ = (int)0;
      int32_t _10236_ = (int)((sparsity)->size(0));
      for (int32_t _2336_i = _10235_; _2336_i < _10236_; ++_2336_i)
      {
        {
          int64_t _2337_i1 = ((((*sparsity)(_2336_i)) / _2324_d2) % _2323_d1);
          int32_t _2338_ii = (int32_t)(((-(int)1) + ::mosek::fusion::Utils::Tools::sqrt((double)(safe_mul( safe_add( (int)1,safe_mul( (int)2,_2337_i1 ) ),safe_add( (int)1,safe_mul( (int)2,_2337_i1 ) ) )))) / (int)4);
          int64_t _2339_jj = (((*sparsity)(_2336_i)) - (safe_mul( _2338_ii,safe_add( _2338_ii,(int)1 ) ) / (int)2));
          if ((_2338_ii == _2339_jj))
          {
            {
              _2335_nelm += (int)1;
            }
          }
          else
          {
            {
              _2335_nelm += (int)2;
            }
          }
        }
      }
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2340_nidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2335_nelm)));
      _checked_ptr_1<int64_t> _ptr__2340_nidxs(_2340_nidxs ? _2340_nidxs->raw() : nullptr,_2340_nidxs ? _2340_nidxs->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2341_sp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2335_nelm)));
      _checked_ptr_1<int64_t> _ptr__2341_sp(_2341_sp ? _2341_sp->raw() : nullptr,_2341_sp ? _2341_sp->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2342_perm = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2335_nelm)));
      _checked_ptr_1<int64_t> _ptr__2342_perm(_2342_perm ? _2342_perm->raw() : nullptr,_2342_perm ? _2342_perm->size(0) : 0);
      int32_t _10237_ = (int)0;
      int32_t _10238_ = _2335_nelm;
      for (int32_t _2343_i = _10237_; _2343_i < _10238_; ++_2343_i)
      {
        {
          _ptr__2342_perm[_2343_i] = _2343_i;
        }
      }
      int32_t _2344_elmi = (int)0;
      int32_t _10239_ = (int)0;
      int32_t _10240_ = (int)((sparsity)->size(0));
      for (int32_t _2345_i = _10239_; _2345_i < _10240_; ++_2345_i)
      {
        {
          int64_t _2346_i0 = (((*sparsity)(_2345_i)) / safe_mul( _2323_d1,_2324_d2 ));
          int64_t _2347_i1 = ((((*sparsity)(_2345_i)) / _2324_d2) % _2323_d1);
          int64_t _2348_i2 = (((*sparsity)(_2345_i)) % _2324_d2);
          int32_t _2349_ii1 = (int32_t)(((-(int)1) + ::mosek::fusion::Utils::Tools::sqrt((double)(safe_mul( safe_add( (int)1,safe_mul( (int)2,_2347_i1 ) ),safe_add( (int)1,safe_mul( (int)2,_2347_i1 ) ) )))) / (int)4);
          int64_t _2350_jj1 = (((*sparsity)(_2345_i)) - (safe_mul( _2349_ii1,safe_add( _2349_ii1,(int)1 ) ) / (int)2));
          if ((_2349_ii1 == _2350_jj1))
          {
            {
              _ptr__2340_nidxs[_2344_elmi] = ((*basevar_nativeidxs)(_2345_i));
              _ptr__2341_sp[_2344_elmi] = safe_add( safe_add( safe_mul( safe_mul( safe_mul( _2346_i0,_2320_d ),_2320_d ),_2324_d2 ),safe_mul( safe_add( safe_mul( _2349_ii1,_2320_d ),_2350_jj1 ),_2324_d2 ) ),_2348_i2 );
              _2344_elmi += (int)1;
            }
          }
          else
          {
            {
              _ptr__2340_nidxs[_2344_elmi] = ((*basevar_nativeidxs)(_2345_i));
              _ptr__2340_nidxs[safe_add( _2344_elmi,(int)1 )] = ((*basevar_nativeidxs)(_2345_i));
              _ptr__2341_sp[_2344_elmi] = safe_add( safe_add( safe_mul( safe_mul( safe_mul( _2346_i0,_2320_d ),_2320_d ),_2324_d2 ),safe_mul( safe_add( safe_mul( _2349_ii1,_2320_d ),_2350_jj1 ),_2324_d2 ) ),_2348_i2 );
              _ptr__2341_sp[safe_add( _2344_elmi,(int)1 )] = safe_add( safe_add( safe_mul( safe_mul( safe_mul( _2346_i0,_2320_d ),_2320_d ),_2324_d2 ),safe_mul( safe_add( safe_mul( _2350_jj1,_2320_d ),_2349_ii1 ),_2324_d2 ) ),_2348_i2 );
              _2344_elmi += (int)2;
            }
          }
        }
      }
      ::mosek::fusion::p_CommonTools::argQsort(_2342_perm,_2340_nidxs,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),(int64_t)((int)0),(int64_t)(_2335_nelm));
      std::vector<int64_t> _10241_;
      for (int32_t _2351_i = (int)0, _10242_ = _2335_nelm; _2351_i < _10242_ ; ++_2351_i)
      {
        _10241_.push_back(_ptr__2341_sp[_ptr__2342_perm[_2351_i]]);
      }
      auto _10243_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10241_.size()),_10241_.begin(),_10241_.end()));
      std::vector<int64_t> _10244_;
      for (int32_t _2352_i = (int)0, _10245_ = _2335_nelm; _2352_i < _10245_ ; ++_2352_i)
      {
        _10244_.push_back(_ptr__2340_nidxs[_ptr__2342_perm[_2352_i]]);
      }
      auto _10246_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10244_.size()),_10244_.begin(),_10244_.end()));
      return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),_2326_rshape,_10243_,_10246_)).as<::mosek::fusion::Variable>();
    }
  }
}
// End mosek.fusion.BaseVariable.fromTril

// Begin mosek.fusion.BaseVariable.fromTril
// Method mosek.fusion.BaseVariable.fromTril @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:827:6-842:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__fromTril(int32_t _2353_d) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__fromTril(_2353_d); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::fromTril(int32_t _2353_d) { return __mosek_2fusion_2BaseVariable__fromTril(_2353_d); }
/* override: mosek.fusion.Variable.fromTril*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__fromTril(int32_t _2353_d) { return __mosek_2fusion_2BaseVariable__fromTril(_2353_d); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__fromTril(int32_t _2353_d)
{
  return _pubthis->__mosek_2fusion_2BaseVariable__fromTril((int)0,_2353_d);
}
// End mosek.fusion.BaseVariable.fromTril

// Begin mosek.fusion.BaseVariable.tril
// Method mosek.fusion.BaseVariable.tril @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:738:6-825:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__tril(int32_t _2354_dim1,int32_t _2355_dim2) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__tril(_2354_dim1,_2355_dim2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::tril(int32_t _2354_dim1,int32_t _2355_dim2) { return __mosek_2fusion_2BaseVariable__tril(_2354_dim1,_2355_dim2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__tril(int32_t _2354_dim1,int32_t _2355_dim2)
{
  if (((_2354_dim1 < (int)0) || ((_2354_dim1 >= _2355_dim2) || (_2355_dim2 >= (int)((shape)->size(0))))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid dimension specification"));
    }
  }
  else
  {
    {
      if ((((*shape)(_2354_dim1)) != ((*shape)(_2355_dim2))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Operation only valid for square variables"));
        }
      }
      {}
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2356_rshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(((int)((shape)->size(0)) - (int)1))));
  _checked_ptr_1<int32_t> _ptr__2356_rshape(_2356_rshape ? _2356_rshape->raw() : nullptr,_2356_rshape ? _2356_rshape->size(0) : 0);
  int32_t _10247_ = (int)0;
  int32_t _10248_ = _2354_dim1;
  for (int32_t _2357_i = _10247_; _2357_i < _10248_; ++_2357_i)
  {
    {
      _ptr__2356_rshape[_2357_i] = ((*shape)(_2357_i));
    }
  }
  _ptr__2356_rshape[_2354_dim1] = (safe_mul( ((*shape)(_2354_dim1)),safe_add( ((*shape)(_2354_dim1)),(int)1 ) ) / (int)2);
  int32_t _10249_ = safe_add( _2354_dim1,(int)1 );
  int32_t _10250_ = _2355_dim2;
  for (int32_t _2358_i = _10249_; _2358_i < _10250_; ++_2358_i)
  {
    {
      _ptr__2356_rshape[_2358_i] = ((*shape)(_2358_i));
    }
  }
  int32_t _10251_ = safe_add( _2355_dim2,(int)1 );
  int32_t _10252_ = (int)((shape)->size(0));
  for (int32_t _2359_i = _10251_; _2359_i < _10252_; ++_2359_i)
  {
    {
      _ptr__2356_rshape[(_2359_i - (int)1)] = ((*shape)(_2359_i));
    }
  }
  if ((NULL == sparsity.get()))
  {
    {
      int32_t _2360_d0 = (int)1;
      int32_t _10253_ = (int)0;
      int32_t _10254_ = _2354_dim1;
      for (int32_t _2361_i = _10253_; _2361_i < _10254_; ++_2361_i)
      {
        {
          _2360_d0 *= ((*shape)(_2361_i));
        }
      }
      int32_t _2362_d1 = ((*shape)(_2354_dim1));
      int32_t _2363_d2 = (int)1;
      int32_t _10255_ = safe_add( _2354_dim1,(int)1 );
      int32_t _10256_ = _2355_dim2;
      for (int32_t _2364_i = _10255_; _2364_i < _10256_; ++_2364_i)
      {
        {
          _2363_d2 *= ((*shape)(_2364_i));
        }
      }
      int32_t _2365_d3 = ((*shape)(_2355_dim2));
      int32_t _2366_d4 = (int)1;
      int32_t _10257_ = safe_add( _2355_dim2,(int)1 );
      int32_t _10258_ = (int)((shape)->size(0));
      for (int32_t _2367_i = _10257_; _2367_i < _10258_; ++_2367_i)
      {
        {
          _2366_d4 *= ((*shape)(_2367_i));
        }
      }
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2368_nidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((safe_mul( safe_mul( safe_mul( safe_mul( _2360_d0,_2363_d2 ),_2366_d4 ),_2362_d1 ),safe_add( _2362_d1,(int)1 ) ) / (int)2))));
      _checked_ptr_1<int64_t> _ptr__2368_nidxs(_2368_nidxs ? _2368_nidxs->raw() : nullptr,_2368_nidxs ? _2368_nidxs->size(0) : 0);
      int32_t _2369_i = (int)0;
      int32_t _10259_ = (int)0;
      int32_t _10260_ = _2360_d0;
      for (int32_t _2370_i0 = _10259_; _2370_i0 < _10260_; ++_2370_i0)
      {
        {
          int32_t _10261_ = (int)0;
          int32_t _10262_ = _2362_d1;
          for (int32_t _2371_i1 = _10261_; _2371_i1 < _10262_; ++_2371_i1)
          {
            {
              int32_t _10263_ = (int)0;
              int32_t _10264_ = safe_add( _2371_i1,(int)1 );
              for (int32_t _2372_i3 = _10263_; _2372_i3 < _10264_; ++_2372_i3)
              {
                {
                  int32_t _10265_ = (int)0;
                  int32_t _10266_ = _2363_d2;
                  for (int32_t _2373_i2 = _10265_; _2373_i2 < _10266_; ++_2373_i2)
                  {
                    {
                      int32_t _10267_ = (int)0;
                      int32_t _10268_ = _2366_d4;
                      for (int32_t _2374_i4 = _10267_; _2374_i4 < _10268_; ++_2374_i4)
                      {
                        {
                          _ptr__2368_nidxs[_2369_i] = ((*basevar_nativeidxs)(safe_add( _2374_i4,safe_mul( _2366_d4,safe_add( _2372_i3,safe_mul( _2365_d3,safe_add( _2373_i2,safe_mul( _2363_d2,safe_add( _2371_i1,safe_mul( _2362_d1,_2370_i0 ) ) ) ) ) ) ) )));
                          _2369_i += (int)1;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),_2356_rshape,nullptr,_2368_nidxs)).as<::mosek::fusion::Variable>();
    }
  }
  else
  {
    {
      int32_t _2375_d0 = (int)1;
      int32_t _10269_ = (int)0;
      int32_t _10270_ = _2354_dim1;
      for (int32_t _2376_i = _10269_; _2376_i < _10270_; ++_2376_i)
      {
        {
          _2375_d0 *= ((*shape)(_2376_i));
        }
      }
      int32_t _2377_d1 = ((*shape)(_2354_dim1));
      int32_t _2378_d2 = (int)1;
      int32_t _10271_ = safe_add( _2354_dim1,(int)1 );
      int32_t _10272_ = _2355_dim2;
      for (int32_t _2379_i = _10271_; _2379_i < _10272_; ++_2379_i)
      {
        {
          _2378_d2 *= ((*shape)(_2379_i));
        }
      }
      int32_t _2380_d3 = ((*shape)(_2355_dim2));
      int32_t _2381_d4 = (int)1;
      int32_t _10273_ = safe_add( _2355_dim2,(int)1 );
      int32_t _10274_ = (int)((shape)->size(0));
      for (int32_t _2382_i = _10273_; _2382_i < _10274_; ++_2382_i)
      {
        {
          _2381_d4 *= ((*shape)(_2382_i));
        }
      }
      int32_t _2383_s4 = (int)1;
      int32_t _2384_s3 = _2381_d4;
      int32_t _2385_s2 = safe_mul( _2384_s3,_2380_d3 );
      int32_t _2386_s1 = safe_mul( _2385_s2,_2378_d2 );
      int32_t _2387_s0 = safe_mul( _2386_s1,_2377_d1 );
      int32_t _2388_nelm = (int)0;
      int32_t _10275_ = (int)0;
      int32_t _10276_ = (int)((sparsity)->size(0));
      for (int32_t _2389_i = _10275_; _2389_i < _10276_; ++_2389_i)
      {
        {
          if ((((((*sparsity)(_2389_i)) / _2386_s1) % _2377_d1) >= ((((*sparsity)(_2389_i)) / _2384_s3) % _2380_d3)))
          {
            {
              ++ _2388_nelm;
            }
          }
          {}
        }
      }
      int32_t _2390_rs3 = (int)1;
      int32_t _2391_rs2 = _2381_d4;
      int32_t _2392_rs1 = safe_mul( _2391_rs2,_2378_d2 );
      int32_t _2393_rs0 = (safe_mul( safe_mul( _2392_rs1,_2377_d1 ),safe_add( _2377_d1,(int)1 ) ) / (int)2);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2394_perm = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2388_nelm)));
      _checked_ptr_1<int64_t> _ptr__2394_perm(_2394_perm ? _2394_perm->raw() : nullptr,_2394_perm ? _2394_perm->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2395_rnidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2388_nelm)));
      _checked_ptr_1<int64_t> _ptr__2395_rnidxs(_2395_rnidxs ? _2395_rnidxs->raw() : nullptr,_2395_rnidxs ? _2395_rnidxs->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2396_rsp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2388_nelm)));
      _checked_ptr_1<int64_t> _ptr__2396_rsp(_2396_rsp ? _2396_rsp->raw() : nullptr,_2396_rsp ? _2396_rsp->size(0) : 0);
      int32_t _2397_elmi = (int)0;
      {
        int32_t _10277_ = (int)0;
        int32_t _10278_ = (int)((sparsity)->size(0));
        for (int32_t _2398_i = _10277_; _2398_i < _10278_; ++_2398_i)
        {
          {
            if ((((((*sparsity)(_2398_i)) / _2386_s1) % _2377_d1) >= ((((*sparsity)(_2398_i)) / _2384_s3) % _2380_d3)))
            {
              {
                int64_t _2399_i0 = (((*sparsity)(_2398_i)) / _2387_s0);
                int64_t _2400_i1 = ((((*sparsity)(_2398_i)) / _2386_s1) % _2377_d1);
                int64_t _2401_i2 = ((((*sparsity)(_2398_i)) / _2385_s2) % _2378_d2);
                int64_t _2402_i3 = ((((*sparsity)(_2398_i)) / _2384_s3) % _2380_d3);
                int64_t _2403_i4 = ((((*sparsity)(_2398_i)) / _2383_s4) % _2381_d4);
                _ptr__2395_rnidxs[_2397_elmi] = ((*basevar_nativeidxs)(_2398_i));
                _ptr__2396_rsp[_2397_elmi] = safe_add( safe_add( safe_add( safe_mul( _2393_rs0,_2399_i0 ),safe_mul( _2392_rs1,safe_add( (safe_mul( _2400_i1,safe_add( _2400_i1,(int)1 ) ) / (int)2),_2402_i3 ) ) ),safe_mul( _2391_rs2,_2401_i2 ) ),safe_mul( _2390_rs3,_2403_i4 ) );
                ++ _2397_elmi;
              }
            }
            {}
          }
        }
        int32_t _10279_ = (int)0;
        int32_t _10280_ = _2388_nelm;
        for (int32_t _2404_i = _10279_; _2404_i < _10280_; ++_2404_i)
        {
          {
            _ptr__2394_perm[_2404_i] = _2404_i;
          }
        }
      }
      ::mosek::fusion::p_CommonTools::argQsort(_2394_perm,_2395_rnidxs,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),(int64_t)((int)0),(int64_t)(_2388_nelm));
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2405_nidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2388_nelm)));
      _checked_ptr_1<int64_t> _ptr__2405_nidxs(_2405_nidxs ? _2405_nidxs->raw() : nullptr,_2405_nidxs ? _2405_nidxs->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2406_sp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2388_nelm)));
      _checked_ptr_1<int64_t> _ptr__2406_sp(_2406_sp ? _2406_sp->raw() : nullptr,_2406_sp ? _2406_sp->size(0) : 0);
      int32_t _10281_ = (int)0;
      int32_t _10282_ = _2388_nelm;
      for (int32_t _2407_i = _10281_; _2407_i < _10282_; ++_2407_i)
      {
        {
          _ptr__2405_nidxs[_2407_i] = _ptr__2395_rnidxs[_ptr__2394_perm[_2407_i]];
        }
      }
      int32_t _10283_ = (int)0;
      int32_t _10284_ = _2388_nelm;
      for (int32_t _2408_i = _10283_; _2408_i < _10284_; ++_2408_i)
      {
        {
          _ptr__2406_sp[_2408_i] = _ptr__2396_rsp[_ptr__2394_perm[_2408_i]];
        }
      }
      return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),_2356_rshape,_2406_sp,_2405_nidxs)).as<::mosek::fusion::Variable>();
    }
  }
}
// End mosek.fusion.BaseVariable.tril

// Begin mosek.fusion.BaseVariable.tril
// Method mosek.fusion.BaseVariable.tril @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:736:6-57
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__tril() { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__tril(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::tril() { return __mosek_2fusion_2BaseVariable__tril(); }
/* override: mosek.fusion.Variable.tril*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__tril() { return __mosek_2fusion_2BaseVariable__tril(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__tril()
{
  return _pubthis->__mosek_2fusion_2BaseVariable__tril((int)0,(int)1);
}
// End mosek.fusion.BaseVariable.tril

// Begin mosek.fusion.BaseVariable.reshape
// Method mosek.fusion.BaseVariable.reshape @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:734:6-114
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__reshape(int32_t _2409_dim0,int32_t _2410_dim1,int32_t _2411_dim2) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__reshape(_2409_dim0,_2410_dim1,_2411_dim2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::reshape(int32_t _2409_dim0,int32_t _2410_dim1,int32_t _2411_dim2) { return __mosek_2fusion_2BaseVariable__reshape(_2409_dim0,_2410_dim1,_2411_dim2); }
/* override: mosek.fusion.Variable.reshape*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__reshape(int32_t _2409_dim0,int32_t _2410_dim1,int32_t _2411_dim2) { return __mosek_2fusion_2BaseVariable__reshape(_2409_dim0,_2410_dim1,_2411_dim2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__reshape(int32_t _2409_dim0,int32_t _2410_dim1,int32_t _2411_dim2)
{
  return _pubthis->__mosek_2fusion_2BaseVariable__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_2409_dim0),(int32_t)(_2410_dim1),(int32_t)(_2411_dim2)}));
}
// End mosek.fusion.BaseVariable.reshape

// Begin mosek.fusion.BaseVariable.reshape
// Method mosek.fusion.BaseVariable.reshape @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:733:6-98
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__reshape(int32_t _2412_dim0,int32_t _2413_dim1) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__reshape(_2412_dim0,_2413_dim1); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::reshape(int32_t _2412_dim0,int32_t _2413_dim1) { return __mosek_2fusion_2BaseVariable__reshape(_2412_dim0,_2413_dim1); }
/* override: mosek.fusion.Variable.reshape*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__reshape(int32_t _2412_dim0,int32_t _2413_dim1) { return __mosek_2fusion_2BaseVariable__reshape(_2412_dim0,_2413_dim1); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__reshape(int32_t _2412_dim0,int32_t _2413_dim1)
{
  return _pubthis->__mosek_2fusion_2BaseVariable__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_2412_dim0),(int32_t)(_2413_dim1)}));
}
// End mosek.fusion.BaseVariable.reshape

// Begin mosek.fusion.BaseVariable.reshape
// Method mosek.fusion.BaseVariable.reshape @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:732:6-82
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__reshape(int32_t _2414_dim0) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__reshape(_2414_dim0); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::reshape(int32_t _2414_dim0) { return __mosek_2fusion_2BaseVariable__reshape(_2414_dim0); }
/* override: mosek.fusion.Variable.reshape*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__reshape(int32_t _2414_dim0) { return __mosek_2fusion_2BaseVariable__reshape(_2414_dim0); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__reshape(int32_t _2414_dim0)
{
  return _pubthis->__mosek_2fusion_2BaseVariable__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_2414_dim0)}));
}
// End mosek.fusion.BaseVariable.reshape

// Begin mosek.fusion.BaseVariable.reshape
// Method mosek.fusion.BaseVariable.reshape @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:719:6-730:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > > _2415_shape) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__reshape(_2415_shape); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::reshape(std::shared_ptr< monty::ndarray< int32_t,1 > > _2415_shape) { return __mosek_2fusion_2BaseVariable__reshape(_2415_shape); }
/* override: mosek.fusion.Variable.reshape*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > > _2415_shape) { return __mosek_2fusion_2BaseVariable__reshape(_2415_shape); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > > _2415_shape)
{
  _checked_ptr_1<int32_t> _ptr__2415_shape(_2415_shape ? _2415_shape->raw() : nullptr, _2415_shape ? _2415_shape->size(0) : 0);
  int64_t _2416_shapesize = (int)1;
  int32_t _10285_ = (int)0;
  int32_t _10286_ = (int)((_2415_shape)->size(0));
  for (int32_t _2417_i = _10285_; _2417_i < _10286_; ++_2417_i)
  {
    {
      if ((_ptr__2415_shape[_2417_i] < (int)0))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Invalid shape"));
        }
      }
      {}
      _2416_shapesize *= _ptr__2415_shape[_2417_i];
    }
  }
  if ((_2416_shapesize != _pubthis->getSize()))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Shape size does not match variable size"));
    }
  }
  {}
  std::vector<int32_t> _10287_;
  for (int32_t _2418_i = (int)0, _10288_ = (int)((_2415_shape)->size(0)); _2418_i < _10288_ ; ++_2418_i)
  {
    _10287_.push_back(_ptr__2415_shape[_2418_i]);
  }
  auto _10289_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10287_.size()),_10287_.begin(),_10287_.end()));
  return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),_10289_,sparsity,basevar_nativeidxs)).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BaseVariable.reshape

// Begin mosek.fusion.BaseVariable.setLevel
// Method mosek.fusion.BaseVariable.setLevel @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:705:6-717:7
void mosek::fusion::BaseVariable :: setLevel(std::shared_ptr< monty::ndarray< double,1 > > _2419_v) { mosek::fusion::p_BaseVariable::_get_impl(this)->setLevel(_2419_v); }
void mosek::fusion::p_BaseVariable::setLevel(std::shared_ptr< monty::ndarray< double,1 > > _2419_v)
{
  _checked_ptr_1<double> _ptr__2419_v(_2419_v ? _2419_v->raw() : nullptr, _2419_v ? _2419_v->size(0) : 0);
  if ((NULL == sparsity.get()))
  {
    {
      if (((int)((_2419_v)->size(0)) != (int)((basevar_nativeidxs)->size(0))))
      {
        {
          throw ::mosek::fusion::LengthError(std::string ("Invalid length of solution values vector"));
        }
      }
      {}
      model->setVariableValues(true,basevar_nativeidxs,_2419_v);
    }
  }
  else
  {
    {
      if (((int)((_2419_v)->size(0)) != _pubthis->getSize()))
      {
        {
          throw ::mosek::fusion::LengthError(std::string ("Invalid length of solution values vector"));
        }
      }
      {}
      std::vector<double> _10290_;
      for (int32_t _2421_i = (int)0, _10291_ = (int)((basevar_nativeidxs)->size(0)); _2421_i < _10291_ ; ++_2421_i)
      {
        _10290_.push_back(_ptr__2419_v[((*sparsity)(_2421_i))]);
      }
      auto _10292_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10290_.size()),_10290_.begin(),_10290_.end()));
      std::shared_ptr< monty::ndarray< double,1 > > _2420_v = _10292_;
      _checked_ptr_1<double> _ptr__2420_v(_2420_v ? _2420_v->raw() : nullptr,_2420_v ? _2420_v->size(0) : 0);
      model->setVariableValues(true,basevar_nativeidxs,_2420_v);
    }
  }
}
// End mosek.fusion.BaseVariable.setLevel

// Begin mosek.fusion.BaseVariable.getModel
// Method mosek.fusion.BaseVariable.getModel @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:703:6-55
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__getModel() { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__getModel(); }
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::BaseVariable::getModel() { return __mosek_2fusion_2BaseVariable__getModel(); }
/* override: mosek.fusion.Expression.getModel*/
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::BaseVariable::__mosek_2fusion_2Expression__getModel() { return __mosek_2fusion_2BaseVariable__getModel(); }
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__getModel()
{
  return model;
}
// End mosek.fusion.BaseVariable.getModel

// Begin mosek.fusion.BaseVariable.getND
// Method mosek.fusion.BaseVariable.getND @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:702:6-56
int32_t mosek::fusion::BaseVariable :: getND() { return mosek::fusion::p_BaseVariable::_get_impl(this)->getND(); }
int32_t mosek::fusion::p_BaseVariable::getND()
{
  return (int)((shape)->size(0));
}
// End mosek.fusion.BaseVariable.getND

// Begin mosek.fusion.BaseVariable.getDim
// Method mosek.fusion.BaseVariable.getDim @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:701:6-62
int32_t mosek::fusion::BaseVariable :: getDim(int32_t _2422_d) { return mosek::fusion::p_BaseVariable::_get_impl(this)->getDim(_2422_d); }
int32_t mosek::fusion::p_BaseVariable::getDim(int32_t _2422_d)
{
  return ((*shape)(_2422_d));
}
// End mosek.fusion.BaseVariable.getDim

// Begin mosek.fusion.BaseVariable.getShape
// Method mosek.fusion.BaseVariable.getShape @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:700:6-79
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::BaseVariable :: getShape() { return mosek::fusion::p_BaseVariable::_get_impl(this)->getShape(); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_BaseVariable::getShape()
{
  return ::mosek::fusion::Utils::Tools::arraycopy(shape);
}
// End mosek.fusion.BaseVariable.getShape

// Begin mosek.fusion.BaseVariable.getSize
// Method mosek.fusion.BaseVariable.getSize @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:699:6-107
int64_t mosek::fusion::BaseVariable :: getSize() { return mosek::fusion::p_BaseVariable::_get_impl(this)->getSize(); }
int64_t mosek::fusion::p_BaseVariable::getSize()
{
  int64_t _2423_sz = (int64_t)1;
  int32_t _10293_ = (int)0;
  int32_t _10294_ = (int)((shape)->size(0));
  for (int32_t _2424_i = _10293_; _2424_i < _10294_; ++_2424_i)
  {
    {
      _2423_sz *= ((*shape)(_2424_i));
    }
  }
  return _2423_sz;
}
// End mosek.fusion.BaseVariable.getSize

// Begin mosek.fusion.BaseVariable.dual
// Method mosek.fusion.BaseVariable.dual @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:686:6-696:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::BaseVariable :: dual() { return mosek::fusion::p_BaseVariable::_get_impl(this)->dual(); }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_BaseVariable::dual()
{
  std::shared_ptr< monty::ndarray< double,1 > > _2425_res = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)((basevar_nativeidxs)->size(0)))));
  _checked_ptr_1<double> _ptr__2425_res(_2425_res ? _2425_res->raw() : nullptr,_2425_res ? _2425_res->size(0) : 0);
  model->getVariableValues(false,basevar_nativeidxs,_2425_res,(int)0);
  if ((NULL != sparsity.get()))
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _2426_spread_res = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_pubthis->getSize())));
      _checked_ptr_1<double> _ptr__2426_spread_res(_2426_spread_res ? _2426_spread_res->raw() : nullptr,_2426_spread_res ? _2426_spread_res->size(0) : 0);
      int32_t _10295_ = (int)0;
      int32_t _10296_ = (int)((basevar_nativeidxs)->size(0));
      for (int32_t _2427_i = _10295_; _2427_i < _10296_; ++_2427_i)
      {
        {
          _ptr__2426_spread_res[((*sparsity)(_2427_i))] = _ptr__2425_res[_2427_i];
        }
      }
      _2425_res = _2426_spread_res;
      _ptr__2425_res.update(_2425_res ? _2425_res->raw() : nullptr, _2425_res ? _2425_res->size(0) : 0);
    }
  }
  {}
  return _2425_res;
}
// End mosek.fusion.BaseVariable.dual

// Begin mosek.fusion.BaseVariable.level
// Method mosek.fusion.BaseVariable.level @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:674:6-684:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::BaseVariable :: level() { return mosek::fusion::p_BaseVariable::_get_impl(this)->level(); }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_BaseVariable::level()
{
  std::shared_ptr< monty::ndarray< double,1 > > _2428_res = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)((basevar_nativeidxs)->size(0)))));
  _checked_ptr_1<double> _ptr__2428_res(_2428_res ? _2428_res->raw() : nullptr,_2428_res ? _2428_res->size(0) : 0);
  model->getVariableValues(true,basevar_nativeidxs,_2428_res,(int)0);
  if ((NULL != sparsity.get()))
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _2429_spread_res = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_pubthis->getSize())));
      _checked_ptr_1<double> _ptr__2429_spread_res(_2429_spread_res ? _2429_spread_res->raw() : nullptr,_2429_spread_res ? _2429_spread_res->size(0) : 0);
      int32_t _10297_ = (int)0;
      int32_t _10298_ = (int)((basevar_nativeidxs)->size(0));
      for (int32_t _2430_i = _10297_; _2430_i < _10298_; ++_2430_i)
      {
        {
          _ptr__2429_spread_res[((*sparsity)(_2430_i))] = _ptr__2428_res[_2430_i];
        }
      }
      _2428_res = _2429_spread_res;
      _ptr__2428_res.update(_2428_res ? _2428_res->raw() : nullptr, _2428_res ? _2428_res->size(0) : 0);
    }
  }
  {}
  return _2428_res;
}
// End mosek.fusion.BaseVariable.level

// Begin mosek.fusion.BaseVariable.makeContinuous
// Method mosek.fusion.BaseVariable.makeContinuous @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:670:6-59
void mosek::fusion::BaseVariable :: makeContinuous() { mosek::fusion::p_BaseVariable::_get_impl(this)->makeContinuous(); }
void mosek::fusion::p_BaseVariable::makeContinuous()
{
  _pubthis->make_continuous();
}
// End mosek.fusion.BaseVariable.makeContinuous

// Begin mosek.fusion.BaseVariable.makeInteger
// Method mosek.fusion.BaseVariable.makeInteger @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:669:6-53
void mosek::fusion::BaseVariable :: makeInteger() { mosek::fusion::p_BaseVariable::_get_impl(this)->makeInteger(); }
void mosek::fusion::p_BaseVariable::makeInteger()
{
  _pubthis->make_integer();
}
// End mosek.fusion.BaseVariable.makeInteger

// Begin mosek.fusion.BaseVariable.transpose
// Method mosek.fusion.BaseVariable.transpose @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:630:6-665:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__transpose() { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__transpose(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::transpose() { return __mosek_2fusion_2BaseVariable__transpose(); }
/* override: mosek.fusion.Variable.transpose*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__transpose() { return __mosek_2fusion_2BaseVariable__transpose(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__transpose()
{
  if (((int)((shape)->size(0)) == (int)1))
  {
    {
      return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)(((*shape)((int)0)))}),sparsity,basevar_nativeidxs)).as<::mosek::fusion::Variable>();
    }
  }
  else if(((int)((shape)->size(0)) > (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid shape for operation"));
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2431_idxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)((basevar_nativeidxs)->size(0)))));
      _checked_ptr_1<int64_t> _ptr__2431_idxs(_2431_idxs ? _2431_idxs->raw() : nullptr,_2431_idxs ? _2431_idxs->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _10299_;
      bool _10300_ = (NULL == sparsity.get());
      if (_10300_)
      {
        _10299_ = nullptr;
      }
      else
      {
        _10299_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)((basevar_nativeidxs)->size(0)))));
      }
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2432_sp = _10299_;
      _checked_ptr_1<int64_t> _ptr__2432_sp(_2432_sp ? _2432_sp->raw() : nullptr,_2432_sp ? _2432_sp->size(0) : 0);
      if ((NULL == sparsity.get()))
      {
        {
          int32_t _2433_k = (int)0;
          int32_t _10301_ = (int)0;
          int32_t _10302_ = ((*shape)((int)1));
          for (int32_t _2434_j = _10301_; _2434_j < _10302_; ++_2434_j)
          {
            {
              int32_t _10303_ = (int)0;
              int32_t _10304_ = ((*shape)((int)0));
              for (int32_t _2435_i = _10303_; _2435_i < _10304_; ++_2435_i)
              {
                {
                  _ptr__2431_idxs[_2433_k] = ((*basevar_nativeidxs)(safe_add( safe_mul( _2435_i,((*shape)((int)1)) ),_2434_j )));
                  ++ _2433_k;
                }
              }
            }
          }
        }
      }
      else
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _2436_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( ((*shape)((int)1)),(int)1 ))));
          _checked_ptr_1<int32_t> _ptr__2436_ptr(_2436_ptr ? _2436_ptr->raw() : nullptr,_2436_ptr ? _2436_ptr->size(0) : 0);
          int32_t _2437_dim0 = ((*shape)((int)0));
          int32_t _2438_dim1 = ((*shape)((int)1));
          int32_t _10305_ = (int)0;
          int32_t _10306_ = (int)((sparsity)->size(0));
          for (int32_t _2439_i = _10305_; _2439_i < _10306_; ++_2439_i)
          {
            {
              ++ _ptr__2436_ptr[safe_add( (((*sparsity)(_2439_i)) % _2438_dim1),(int)1 )];
            }
          }
          int32_t _10307_ = (int)0;
          int32_t _10308_ = _2438_dim1;
          for (int32_t _2440_i = _10307_; _2440_i < _10308_; ++_2440_i)
          {
            {
              _ptr__2436_ptr[safe_add( _2440_i,(int)1 )] += _ptr__2436_ptr[_2440_i];
            }
          }
          int32_t _10309_ = (int)0;
          int32_t _10310_ = (int)((sparsity)->size(0));
          for (int32_t _2441_i = _10309_; _2441_i < _10310_; ++_2441_i)
          {
            {
              int64_t _2442_ii = (((*sparsity)(_2441_i)) % _2438_dim1);
              _ptr__2431_idxs[_ptr__2436_ptr[_2442_ii]] = ((*basevar_nativeidxs)(_2441_i));
              _ptr__2432_sp[_ptr__2436_ptr[_2442_ii]] = safe_add( (((*sparsity)(_2441_i)) / _2438_dim1),safe_mul( (((*sparsity)(_2441_i)) % _2438_dim1),_2437_dim0 ) );
              ++ _ptr__2436_ptr[_2442_ii];
            }
          }
        }
      }
      return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(((*shape)((int)1))),(int32_t)(((*shape)((int)0)))}),_2432_sp,_2431_idxs)).as<::mosek::fusion::Variable>();
    }
  }
}
// End mosek.fusion.BaseVariable.transpose

// Begin mosek.fusion.BaseVariable.index
// Method mosek.fusion.BaseVariable.index @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:619:6-622:40
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__index(int32_t _2443_i0,int32_t _2444_i1,int32_t _2445_i2) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__index(_2443_i0,_2444_i1,_2445_i2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::index(int32_t _2443_i0,int32_t _2444_i1,int32_t _2445_i2) { return __mosek_2fusion_2BaseVariable__index(_2443_i0,_2444_i1,_2445_i2); }
/* override: mosek.fusion.Variable.index*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__index(int32_t _2443_i0,int32_t _2444_i1,int32_t _2445_i2) { return __mosek_2fusion_2BaseVariable__index(_2443_i0,_2444_i1,_2445_i2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__index(int32_t _2443_i0,int32_t _2444_i1,int32_t _2445_i2)
{
  return _pubthis->__mosek_2fusion_2BaseVariable__index(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_2443_i0),(int32_t)(_2444_i1),(int32_t)(_2445_i2)}));
}
// End mosek.fusion.BaseVariable.index

// Begin mosek.fusion.BaseVariable.index
// Method mosek.fusion.BaseVariable.index @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:614:6-616:37
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__index(int32_t _2446_i0,int32_t _2447_i1) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__index(_2446_i0,_2447_i1); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::index(int32_t _2446_i0,int32_t _2447_i1) { return __mosek_2fusion_2BaseVariable__index(_2446_i0,_2447_i1); }
/* override: mosek.fusion.Variable.index*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__index(int32_t _2446_i0,int32_t _2447_i1) { return __mosek_2fusion_2BaseVariable__index(_2446_i0,_2447_i1); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__index(int32_t _2446_i0,int32_t _2447_i1)
{
  return _pubthis->__mosek_2fusion_2BaseVariable__index(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_2446_i0),(int32_t)(_2447_i1)}));
}
// End mosek.fusion.BaseVariable.index

// Begin mosek.fusion.BaseVariable.index
// Method mosek.fusion.BaseVariable.index @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:606:6-611:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2448_index) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__index(_2448_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2448_index) { return __mosek_2fusion_2BaseVariable__index(_2448_index); }
/* override: mosek.fusion.Variable.index*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2448_index) { return __mosek_2fusion_2BaseVariable__index(_2448_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2448_index)
{
  _checked_ptr_1<int32_t> _ptr__2448_index(_2448_index ? _2448_index->raw() : nullptr, _2448_index ? _2448_index->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,2 > > _2449_midx = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape((int)1,(int)((_2448_index)->size(0)))));
  int32_t _10311_ = (int)0;
  int32_t _10312_ = (int)((_2448_index)->size(0));
  for (int32_t _2450_i = _10311_; _2450_i < _10312_; ++_2450_i)
  {
    {
      ((*_2449_midx)((int)0,_2450_i)) = _ptr__2448_index[_2450_i];
    }
  }
  return _pubthis->__mosek_2fusion_2BaseVariable__pick(_2449_midx)->__mosek_2fusion_2Variable__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))));
}
// End mosek.fusion.BaseVariable.index

// Begin mosek.fusion.BaseVariable.index
// Method mosek.fusion.BaseVariable.index @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:600:6-603:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__index(int32_t _2451_index) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__index(_2451_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::index(int32_t _2451_index) { return __mosek_2fusion_2BaseVariable__index(_2451_index); }
/* override: mosek.fusion.Variable.index*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__index(int32_t _2451_index) { return __mosek_2fusion_2BaseVariable__index(_2451_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__index(int32_t _2451_index)
{
  return _pubthis->__mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_2451_index)}))->__mosek_2fusion_2Variable__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))));
}
// End mosek.fusion.BaseVariable.index

// Begin mosek.fusion.BaseVariable.pick
// Method mosek.fusion.BaseVariable.pick @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:579:6-597:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2452_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2453_i1,std::shared_ptr< monty::ndarray< int32_t,1 > > _2454_i2) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__pick(_2452_i0,_2453_i1,_2454_i2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2452_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2453_i1,std::shared_ptr< monty::ndarray< int32_t,1 > > _2454_i2) { return __mosek_2fusion_2BaseVariable__pick(_2452_i0,_2453_i1,_2454_i2); }
/* override: mosek.fusion.Variable.pick*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2452_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2453_i1,std::shared_ptr< monty::ndarray< int32_t,1 > > _2454_i2) { return __mosek_2fusion_2BaseVariable__pick(_2452_i0,_2453_i1,_2454_i2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2452_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2453_i1,std::shared_ptr< monty::ndarray< int32_t,1 > > _2454_i2)
{
  _checked_ptr_1<int32_t> _ptr__2452_i0(_2452_i0 ? _2452_i0->raw() : nullptr, _2452_i0 ? _2452_i0->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__2453_i1(_2453_i1 ? _2453_i1->raw() : nullptr, _2453_i1 ? _2453_i1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__2454_i2(_2454_i2 ? _2454_i2->raw() : nullptr, _2454_i2 ? _2454_i2->size(0) : 0);
  if (((int)((shape)->size(0)) != (int)3))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid index"));
    }
  }
  {}
  if ((((int)((_2452_i0)->size(0)) != (int)((_2453_i1)->size(0))) || ((int)((_2452_i0)->size(0)) != (int)((_2454_i2)->size(0)))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Mismatching argument lengths"));
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,2 > > _2455_midxs = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape((int)((_2452_i0)->size(0)),(int)3)));
  int32_t _10313_ = (int)0;
  int32_t _10314_ = (int)((_2452_i0)->size(0));
  for (int32_t _2456_i = _10313_; _2456_i < _10314_; ++_2456_i)
  {
    {
      ((*_2455_midxs)(_2456_i,(int)0)) = _ptr__2452_i0[_2456_i];
      ((*_2455_midxs)(_2456_i,(int)1)) = _ptr__2453_i1[_2456_i];
      ((*_2455_midxs)(_2456_i,(int)2)) = _ptr__2454_i2[_2456_i];
    }
  }
  return _pubthis->__mosek_2fusion_2BaseVariable__pick(_2455_midxs);
}
// End mosek.fusion.BaseVariable.pick

// Begin mosek.fusion.BaseVariable.pick
// Method mosek.fusion.BaseVariable.pick @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:563:6-577:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2457_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2458_i1) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__pick(_2457_i0,_2458_i1); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2457_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2458_i1) { return __mosek_2fusion_2BaseVariable__pick(_2457_i0,_2458_i1); }
/* override: mosek.fusion.Variable.pick*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2457_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2458_i1) { return __mosek_2fusion_2BaseVariable__pick(_2457_i0,_2458_i1); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2457_i0,std::shared_ptr< monty::ndarray< int32_t,1 > > _2458_i1)
{
  _checked_ptr_1<int32_t> _ptr__2457_i0(_2457_i0 ? _2457_i0->raw() : nullptr, _2457_i0 ? _2457_i0->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__2458_i1(_2458_i1 ? _2458_i1->raw() : nullptr, _2458_i1 ? _2458_i1->size(0) : 0);
  if ((((int)((shape)->size(0)) != (int)2) || ((int)((_2457_i0)->size(0)) != (int)((_2458_i1)->size(0)))))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid index"));
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,2 > > _2459_midxs = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape((int)((_2457_i0)->size(0)),(int)2)));
  int32_t _10315_ = (int)0;
  int32_t _10316_ = (int)((_2457_i0)->size(0));
  for (int32_t _2460_i = _10315_; _2460_i < _10316_; ++_2460_i)
  {
    {
      ((*_2459_midxs)(_2460_i,(int)0)) = _ptr__2457_i0[_2460_i];
      ((*_2459_midxs)(_2460_i,(int)1)) = _ptr__2458_i1[_2460_i];
    }
  }
  return _pubthis->__mosek_2fusion_2BaseVariable__pick(_2459_midxs);
}
// End mosek.fusion.BaseVariable.pick

// Begin mosek.fusion.BaseVariable.pick
// Method mosek.fusion.BaseVariable.pick @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:502:6-561:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _2461_midxs) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__pick(_2461_midxs); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _2461_midxs) { return __mosek_2fusion_2BaseVariable__pick(_2461_midxs); }
/* override: mosek.fusion.Variable.pick*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _2461_midxs) { return __mosek_2fusion_2BaseVariable__pick(_2461_midxs); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _2461_midxs)
{
  if (((int)((shape)->size(0)) != (int)((_2461_midxs)->size(1))))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid index"));
    }
  }
  {}
  bool _2462_invalidindex = false;
  int32_t _10317_ = (int)0;
  int32_t _10318_ = (int)((_2461_midxs)->size(0));
  for (int32_t _2463_i = _10317_; _2463_i < _10318_; ++_2463_i)
  {
    {
      int32_t _10319_ = (int)0;
      int32_t _10320_ = (int)((_2461_midxs)->size(1));
      for (int32_t _2464_j = _10319_; _2464_j < _10320_; ++_2464_j)
      {
        {
          if (((((*_2461_midxs)(_2463_i,_2464_j)) < (int)0) || (((*_2461_midxs)(_2463_i,_2464_j)) >= ((*shape)(_2464_j)))))
          {
            {
              _2462_invalidindex = true;
            }
          }
          {}
        }
      }
    }
  }
  if (_2462_invalidindex)
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid index"));
    }
  }
  {}
  int32_t _2465_nd = (int)((shape)->size(0));
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2466_strides = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2465_nd)));
  _checked_ptr_1<int64_t> _ptr__2466_strides(_2466_strides ? _2466_strides->raw() : nullptr,_2466_strides ? _2466_strides->size(0) : 0);
  _ptr__2466_strides[(_2465_nd - (int)1)] = (int)1;
  int32_t _10321_ = (int)1;
  int32_t _10322_ = _2465_nd;
  for (int32_t _2467_i = _10321_; _2467_i < _10322_; ++_2467_i)
  {
    {
      _ptr__2466_strides[((_2465_nd - _2467_i) - (int)1)] = safe_mul( _ptr__2466_strides[(_2465_nd - _2467_i)],((*shape)((_2465_nd - _2467_i))) );
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2468_rshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_2461_midxs)->size(0)))});
  _checked_ptr_1<int32_t> _ptr__2468_rshape(_2468_rshape ? _2468_rshape->raw() : nullptr,_2468_rshape ? _2468_rshape->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2469_idxs;
  _checked_ptr_1<int64_t> _ptr__2469_idxs(_2469_idxs ? _2469_idxs->raw() : nullptr,_2469_idxs ? _2469_idxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2470_sp = nullptr;
  _checked_ptr_1<int64_t> _ptr__2470_sp(_2470_sp ? _2470_sp->raw() : nullptr,_2470_sp ? _2470_sp->size(0) : 0);
  if ((NULL == sparsity.get()))
  {
    {
      _2469_idxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)((_2461_midxs)->size(0)))));
      _ptr__2469_idxs.update(_2469_idxs ? _2469_idxs->raw() : nullptr, _2469_idxs ? _2469_idxs->size(0) : 0);
      {
        int32_t _10323_ = (int)0;
        int32_t _10324_ = (int)((_2461_midxs)->size(0));
        for (int32_t _2471_i = _10323_; _2471_i < _10324_; ++_2471_i)
        {
          {
            int64_t _2472_ii = (int64_t)0;
            int32_t _10325_ = (int)0;
            int32_t _10326_ = _2465_nd;
            for (int32_t _2473_j = _10325_; _2473_j < _10326_; ++_2473_j)
            {
              {
                _2472_ii += safe_mul( _ptr__2466_strides[_2473_j],((*_2461_midxs)(_2471_i,_2473_j)) );
              }
            }
            _ptr__2469_idxs[_2471_i] = ((*basevar_nativeidxs)(_2472_ii));
          }
        }
      }
    }
  }
  else
  {
    {
      int32_t _2474_nnz = (int)0;
      int32_t _10327_ = (int)0;
      int32_t _10328_ = (int)((_2461_midxs)->size(0));
      for (int32_t _2475_i = _10327_; _2475_i < _10328_; ++_2475_i)
      {
        {
          int64_t _2476_ii = (int64_t)0;
          int32_t _10329_ = (int)0;
          int32_t _10330_ = _2465_nd;
          for (int32_t _2477_j = _10329_; _2477_j < _10330_; ++_2477_j)
          {
            {
              _2476_ii += safe_mul( _ptr__2466_strides[_2477_j],((*_2461_midxs)(_2475_i,_2477_j)) );
            }
          }
          if ((::mosek::fusion::p_CommonTools::binarySearch(sparsity,_2476_ii) >= (int)0))
          {
            {
              ++ _2474_nnz;
            }
          }
          {}
        }
      }
      _2469_idxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2474_nnz)));
      _ptr__2469_idxs.update(_2469_idxs ? _2469_idxs->raw() : nullptr, _2469_idxs ? _2469_idxs->size(0) : 0);
      _2470_sp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2474_nnz)));
      _ptr__2470_sp.update(_2470_sp ? _2470_sp->raw() : nullptr, _2470_sp ? _2470_sp->size(0) : 0);
      {
        int32_t _2478_k = (int)0;
        int32_t _10331_ = (int)0;
        int32_t _10332_ = (int)((_2461_midxs)->size(0));
        for (int32_t _2479_i = _10331_; _2479_i < _10332_; ++_2479_i)
        {
          {
            int64_t _2480_ii = (int64_t)0;
            int32_t _10333_ = (int)0;
            int32_t _10334_ = _2465_nd;
            for (int32_t _2481_j = _10333_; _2481_j < _10334_; ++_2481_j)
            {
              {
                _2480_ii += safe_mul( _ptr__2466_strides[_2481_j],((*_2461_midxs)(_2479_i,_2481_j)) );
              }
            }
            int32_t _2482_iidx = ::mosek::fusion::p_CommonTools::binarySearch(sparsity,_2480_ii);
            if ((_2482_iidx >= (int)0))
            {
              {
                _ptr__2469_idxs[_2478_k] = ((*basevar_nativeidxs)(_2482_iidx));
                _ptr__2470_sp[_2478_k] = _2479_i;
                ++ _2478_k;
              }
            }
            {}
          }
        }
      }
      if ((_2474_nnz == (int)((_2461_midxs)->size(0))))
      {
        {
          _2470_sp = nullptr;
          _ptr__2470_sp.update(_2470_sp ? _2470_sp->raw() : nullptr, _2470_sp ? _2470_sp->size(0) : 0);
        }
      }
      {}
    }
  }
  return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),_2468_rshape,_2470_sp,_2469_idxs)).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BaseVariable.pick

// Begin mosek.fusion.BaseVariable.pick
// Method mosek.fusion.BaseVariable.pick @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:460:6-500:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2483_idxs) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__pick(_2483_idxs); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2483_idxs) { return __mosek_2fusion_2BaseVariable__pick(_2483_idxs); }
/* override: mosek.fusion.Variable.pick*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2483_idxs) { return __mosek_2fusion_2BaseVariable__pick(_2483_idxs); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2483_idxs)
{
  _checked_ptr_1<int32_t> _ptr__2483_idxs(_2483_idxs ? _2483_idxs->raw() : nullptr, _2483_idxs ? _2483_idxs->size(0) : 0);
  if (((int)((shape)->size(0)) != (int)1))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid index"));
    }
  }
  {}
  bool _2484_invalidindex = false;
  int32_t _10335_ = (int)0;
  int32_t _10336_ = (int)((_2483_idxs)->size(0));
  for (int32_t _2485_i = _10335_; _2485_i < _10336_; ++_2485_i)
  {
    {
      if (((_ptr__2483_idxs[_2485_i] < (int)0) || (_ptr__2483_idxs[_2485_i] >= ((*shape)((int)0)))))
      {
        {
          _2484_invalidindex = true;
        }
      }
      {}
    }
  }
  if (_2484_invalidindex)
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid index"));
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2486_nidxs;
  _checked_ptr_1<int64_t> _ptr__2486_nidxs(_2486_nidxs ? _2486_nidxs->raw() : nullptr,_2486_nidxs ? _2486_nidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2487_sp = nullptr;
  _checked_ptr_1<int64_t> _ptr__2487_sp(_2487_sp ? _2487_sp->raw() : nullptr,_2487_sp ? _2487_sp->size(0) : 0);
  if ((NULL == sparsity.get()))
  {
    {
      std::vector<int64_t> _10337_;
      for (int32_t _2488_i = (int)0, _10338_ = (int)((_2483_idxs)->size(0)); _2488_i < _10338_ ; ++_2488_i)
      {
        _10337_.push_back(((*basevar_nativeidxs)(_ptr__2483_idxs[_2488_i])));
      }
      auto _10339_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10337_.size()),_10337_.begin(),_10337_.end()));
      _2486_nidxs = _10339_;
      _ptr__2486_nidxs.update(_2486_nidxs ? _2486_nidxs->raw() : nullptr, _2486_nidxs ? _2486_nidxs->size(0) : 0);
    }
  }
  else
  {
    {
      int32_t _2489_nnz = (int)0;
      int32_t _10340_ = (int)0;
      int32_t _10341_ = (int)((_2483_idxs)->size(0));
      for (int32_t _2490_i = _10340_; _2490_i < _10341_; ++_2490_i)
      {
        {
          if ((::mosek::fusion::p_CommonTools::binarySearch(sparsity,(int64_t)(_ptr__2483_idxs[_2490_i])) >= (int)0))
          {
            {
              ++ _2489_nnz;
            }
          }
          {}
        }
      }
      _2486_nidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2489_nnz)));
      _ptr__2486_nidxs.update(_2486_nidxs ? _2486_nidxs->raw() : nullptr, _2486_nidxs ? _2486_nidxs->size(0) : 0);
      _2487_sp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2489_nnz)));
      _ptr__2487_sp.update(_2487_sp ? _2487_sp->raw() : nullptr, _2487_sp ? _2487_sp->size(0) : 0);
      int32_t _2491_k = (int)0;
      int32_t _10342_ = (int)0;
      int32_t _10343_ = (int)((_2483_idxs)->size(0));
      for (int32_t _2492_i = _10342_; _2492_i < _10343_; ++_2492_i)
      {
        {
          int32_t _2493_j = ::mosek::fusion::p_CommonTools::binarySearch(sparsity,(int64_t)(_ptr__2483_idxs[_2492_i]));
          if ((_2493_j >= (int)0))
          {
            {
              _ptr__2487_sp[_2491_k] = _2492_i;
              _ptr__2486_nidxs[_2491_k] = ((*basevar_nativeidxs)(_2493_j));
              ++ _2491_k;
            }
          }
          {}
        }
      }
      if ((_2489_nnz == (int)((_2483_idxs)->size(0))))
      {
        {
          _2487_sp = nullptr;
          _ptr__2487_sp.update(_2487_sp ? _2487_sp->raw() : nullptr, _2487_sp ? _2487_sp->size(0) : 0);
        }
      }
      {}
    }
  }
  return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_2483_idxs)->size(0)))}),_2487_sp,_2486_nidxs)).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.BaseVariable.pick

// Begin mosek.fusion.BaseVariable.antidiag
// Method mosek.fusion.BaseVariable.antidiag @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:446:6-457:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__antidiag(int32_t _2494_index) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__antidiag(_2494_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::antidiag(int32_t _2494_index) { return __mosek_2fusion_2BaseVariable__antidiag(_2494_index); }
/* override: mosek.fusion.Variable.antidiag*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__antidiag(int32_t _2494_index) { return __mosek_2fusion_2BaseVariable__antidiag(_2494_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__antidiag(int32_t _2494_index)
{
  if (((int)((shape)->size(0)) != (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("antidiag() only works on two-dimensional objects"));
    }
  }
  else if(((_2494_index >= ((*shape)((int)1))) || ((-_2494_index) >= ((*shape)((int)2)))))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Diagonal index out of bounds"));
    }
  }
  {}
  if ((_2494_index >= (int)0))
  {
    {
      int32_t _10344_;
      bool _10345_ = (((*shape)((int)0)) < (((*shape)((int)1)) - _2494_index));
      if (_10345_)
      {
        _10344_ = ((*shape)((int)0));
      }
      else
      {
        _10344_ = (((*shape)((int)1)) - _2494_index);
      }
      return __mosek_2fusion_2BaseVariable__general_diag(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)0),(int32_t)(((((*shape)((int)1)) - (int)1) - _2494_index))}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)((-(int)1))}),_10344_);
    }
  }
  else
  {
    {
      int32_t _10346_;
      bool _10347_ = (((*shape)((int)1)) < safe_add( ((*shape)((int)0)),_2494_index ));
      if (_10347_)
      {
        _10346_ = ((*shape)((int)1));
      }
      else
      {
        _10346_ = safe_add( ((*shape)((int)0)),_2494_index );
      }
      return __mosek_2fusion_2BaseVariable__general_diag(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((-_2494_index)),(int32_t)((((*shape)((int)1)) - (int)1))}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)((-(int)1))}),_10346_);
    }
  }
}
// End mosek.fusion.BaseVariable.antidiag

// Begin mosek.fusion.BaseVariable.antidiag
// Method mosek.fusion.BaseVariable.antidiag @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:438:6-444:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__antidiag() { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__antidiag(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::antidiag() { return __mosek_2fusion_2BaseVariable__antidiag(); }
/* override: mosek.fusion.Variable.antidiag*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__antidiag() { return __mosek_2fusion_2BaseVariable__antidiag(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__antidiag()
{
  if (((int)((shape)->size(0)) != (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("antidiag() only works on two-dimensional objects"));
    }
  }
  {}
  int32_t _10348_;
  bool _10349_ = (((*shape)((int)0)) < ((*shape)((int)1)));
  if (_10349_)
  {
    _10348_ = ((*shape)((int)0));
  }
  else
  {
    _10348_ = ((*shape)((int)1));
  }
  return __mosek_2fusion_2BaseVariable__general_diag(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)0),(int32_t)((((*shape)((int)1)) - (int)1))}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)((-(int)1))}),_10348_);
}
// End mosek.fusion.BaseVariable.antidiag

// Begin mosek.fusion.BaseVariable.diag
// Method mosek.fusion.BaseVariable.diag @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:425:6-436:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__diag(int32_t _2495_index) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__diag(_2495_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::diag(int32_t _2495_index) { return __mosek_2fusion_2BaseVariable__diag(_2495_index); }
/* override: mosek.fusion.Variable.diag*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__diag(int32_t _2495_index) { return __mosek_2fusion_2BaseVariable__diag(_2495_index); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__diag(int32_t _2495_index)
{
  if (((int)((shape)->size(0)) != (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("diag() only works on two-dimensional objects"));
    }
  }
  else if(((_2495_index >= ((*shape)((int)1))) || ((-_2495_index) >= ((*shape)((int)2)))))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Diagonal index out of bounds"));
    }
  }
  {}
  if ((_2495_index >= (int)0))
  {
    {
      int32_t _10350_;
      bool _10351_ = (((*shape)((int)0)) < (((*shape)((int)1)) - _2495_index));
      if (_10351_)
      {
        _10350_ = ((*shape)((int)0));
      }
      else
      {
        _10350_ = (((*shape)((int)1)) - _2495_index);
      }
      return __mosek_2fusion_2BaseVariable__general_diag(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)0),(int32_t)(_2495_index)}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)((int)1)}),_10350_);
    }
  }
  else
  {
    {
      int32_t _10352_;
      bool _10353_ = (((*shape)((int)1)) < safe_add( ((*shape)((int)0)),_2495_index ));
      if (_10353_)
      {
        _10352_ = ((*shape)((int)1));
      }
      else
      {
        _10352_ = safe_add( ((*shape)((int)0)),_2495_index );
      }
      return __mosek_2fusion_2BaseVariable__general_diag(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((-_2495_index)),(int32_t)((int)0)}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)((int)1)}),_10352_);
    }
  }
}
// End mosek.fusion.BaseVariable.diag

// Begin mosek.fusion.BaseVariable.diag
// Method mosek.fusion.BaseVariable.diag @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:418:6-423:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__diag() { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__diag(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::diag() { return __mosek_2fusion_2BaseVariable__diag(); }
/* override: mosek.fusion.Variable.diag*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__diag() { return __mosek_2fusion_2BaseVariable__diag(); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__diag()
{
  if (((int)((shape)->size(0)) != (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("diag() only works on two-dimensional objects"));
    }
  }
  {}
  int32_t _10354_;
  bool _10355_ = (((*shape)((int)0)) < ((*shape)((int)1)));
  if (_10355_)
  {
    _10354_ = ((*shape)((int)0));
  }
  else
  {
    _10354_ = ((*shape)((int)1));
  }
  return __mosek_2fusion_2BaseVariable__general_diag(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)0),(int32_t)((int)0)}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)((int)1)}),_10354_);
}
// End mosek.fusion.BaseVariable.diag

// Begin mosek.fusion.BaseVariable.general_diag
// Method mosek.fusion.BaseVariable.general_diag @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:368:6-415:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__general_diag(std::shared_ptr< monty::ndarray< int32_t,1 > > _2496_firstidx,std::shared_ptr< monty::ndarray< int32_t,1 > > _2497_step,int32_t _2498_num)
{
  _checked_ptr_1<int32_t> _ptr__2496_firstidx(_2496_firstidx ? _2496_firstidx->raw() : nullptr, _2496_firstidx ? _2496_firstidx->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__2497_step(_2497_step ? _2497_step->raw() : nullptr, _2497_step ? _2497_step->size(0) : 0);
  int32_t _2499_nd = (int)((shape)->size(0));
  if (((_2499_nd != (int)((_2496_firstidx)->size(0))) || (_2499_nd != (int)((_2497_step)->size(0)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid start or step definition"));
    }
  }
  {}
  int32_t _10356_ = (int)0;
  int32_t _10357_ = _2499_nd;
  for (int32_t _2500_i = _10356_; _2500_i < _10357_; ++_2500_i)
  {
    {
      if (((_ptr__2496_firstidx[_2500_i] < (int)0) || (_ptr__2496_firstidx[_2500_i] >= ((*shape)(_2500_i)))))
      {
        {
          throw ::mosek::fusion::LengthError(std::string ("Start element is out of bounds"));
        }
      }
      {}
    }
  }
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2501_strides = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2499_nd)));
  _checked_ptr_1<int64_t> _ptr__2501_strides(_2501_strides ? _2501_strides->raw() : nullptr,_2501_strides ? _2501_strides->size(0) : 0);
  _ptr__2501_strides[(_2499_nd - (int)1)] = (int)1;
  int32_t _10358_ = (int)1;
  int32_t _10359_ = _2499_nd;
  for (int32_t _2502_i = _10358_; _2502_i < _10359_; ++_2502_i)
  {
    {
      _ptr__2501_strides[((_2499_nd - _2502_i) - (int)1)] = safe_mul( _ptr__2501_strides[(_2499_nd - _2502_i)],((*shape)((_2499_nd - _2502_i))) );
    }
  }
  int64_t _2503_startidx = (int64_t)0;
  int32_t _10360_ = (int)0;
  int32_t _10361_ = (int)((_2497_step)->size(0));
  for (int32_t _2504_i = _10360_; _2504_i < _10361_; ++_2504_i)
  {
    {
      _2503_startidx += safe_mul( _ptr__2496_firstidx[_2504_i],_ptr__2501_strides[_2504_i] );
    }
  }
  int64_t _2505_stepstride = (int64_t)0;
  int32_t _10362_ = (int)0;
  int32_t _10363_ = (int)((_2497_step)->size(0));
  for (int32_t _2506_i = _10362_; _2506_i < _10363_; ++_2506_i)
  {
    {
      _2505_stepstride += safe_mul( _ptr__2497_step[_2506_i],_ptr__2501_strides[_2506_i] );
    }
  }
  if ((NULL == sparsity.get()))
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2507_residxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2498_num)));
      _checked_ptr_1<int64_t> _ptr__2507_residxs(_2507_residxs ? _2507_residxs->raw() : nullptr,_2507_residxs ? _2507_residxs->size(0) : 0);
      int32_t _10364_ = (int)0;
      int32_t _10365_ = _2498_num;
      for (int32_t _2508_i = _10364_; _2508_i < _10365_; ++_2508_i)
      {
        {
          _ptr__2507_residxs[_2508_i] = ((*basevar_nativeidxs)(safe_add( _2503_startidx,safe_mul( _2505_stepstride,_2508_i ) )));
        }
      }
      return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_2498_num)}),nullptr,_2507_residxs)).as<::mosek::fusion::Variable>();
    }
  }
  else
  {
    {
      int32_t _2509_numnz = (int)0;
      int32_t _10366_ = (int)0;
      int32_t _10367_ = _2498_num;
      for (int32_t _2510_i = _10366_; _2510_i < _10367_; ++_2510_i)
      {
        {
          int64_t _2511_residx = safe_add( _2503_startidx,safe_mul( _2505_stepstride,_2510_i ) );
          int32_t _2512_spidx = ::mosek::fusion::p_CommonTools::binarySearch(sparsity,_2511_residx);
          if ((_2512_spidx >= (int)0))
          {
            {
              ++ _2509_numnz;
            }
          }
          {}
        }
      }
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2513_residxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2509_numnz)));
      _checked_ptr_1<int64_t> _ptr__2513_residxs(_2513_residxs ? _2513_residxs->raw() : nullptr,_2513_residxs ? _2513_residxs->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2514_ressp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2509_numnz)));
      _checked_ptr_1<int64_t> _ptr__2514_ressp(_2514_ressp ? _2514_ressp->raw() : nullptr,_2514_ressp ? _2514_ressp->size(0) : 0);
      int32_t _2515_k = (int)0;
      int32_t _10368_ = (int)0;
      int32_t _10369_ = _2498_num;
      for (int32_t _2516_i = _10368_; _2516_i < _10369_; ++_2516_i)
      {
        {
          _ptr__2513_residxs[_2516_i] = ((*basevar_nativeidxs)(safe_add( _2503_startidx,safe_mul( _2505_stepstride,_2516_i ) )));
          int64_t _2517_residx = safe_add( _2503_startidx,safe_mul( _2505_stepstride,_2516_i ) );
          int32_t _2518_spidx = ::mosek::fusion::p_CommonTools::binarySearch(sparsity,_2517_residx);
          if ((_2518_spidx >= (int)0))
          {
            {
              _ptr__2514_ressp[_2515_k] = _2516_i;
              _ptr__2513_residxs[_2515_k] = ((*basevar_nativeidxs)(_2518_spidx));
              ++ _2515_k;
            }
          }
          {}
        }
      }
      return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_2498_num)}),_2514_ressp,_2513_residxs)).as<::mosek::fusion::Variable>();
    }
  }
}
// End mosek.fusion.BaseVariable.general_diag

// Begin mosek.fusion.BaseVariable.slice
// Method mosek.fusion.BaseVariable.slice @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:260:6-357:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2519_first,std::shared_ptr< monty::ndarray< int32_t,1 > > _2520_last) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__slice(_2519_first,_2520_last); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2519_first,std::shared_ptr< monty::ndarray< int32_t,1 > > _2520_last) { return __mosek_2fusion_2BaseVariable__slice(_2519_first,_2520_last); }
/* override: mosek.fusion.Variable.slice*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2519_first,std::shared_ptr< monty::ndarray< int32_t,1 > > _2520_last) { return __mosek_2fusion_2BaseVariable__slice(_2519_first,_2520_last); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2519_first,std::shared_ptr< monty::ndarray< int32_t,1 > > _2520_last)
{
  _checked_ptr_1<int32_t> _ptr__2519_first(_2519_first ? _2519_first->raw() : nullptr, _2519_first ? _2519_first->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__2520_last(_2520_last ? _2520_last->raw() : nullptr, _2520_last ? _2520_last->size(0) : 0);
  if (((int)((_2519_first)->size(0)) != (int)((_2520_last)->size(0))))
  {
    {
      throw ::mosek::fusion::SliceError(std::string ("Invalid slice"));
    }
  }
  else if(((int)((_2519_first)->size(0)) != (int)((shape)->size(0))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Variable shape and slice do not match"));
    }
  }
  else
  {
    {
      int32_t _10370_ = (int)0;
      int32_t _10371_ = (int)((shape)->size(0));
      for (int32_t _2521_i = _10370_; _2521_i < _10371_; ++_2521_i)
      {
        {
          if (((_ptr__2519_first[_2521_i] < (int)0) || (_ptr__2520_last[_2521_i] > ((*shape)(_2521_i)))))
          {
            {
              throw ::mosek::fusion::IndexError(std::string ("Slice is out of bounds"));
            }
          }
          else if((_ptr__2519_first[_2521_i] > _ptr__2520_last[_2521_i]))
          {
            {
              throw ::mosek::fusion::SliceError(std::string ("Invalid slice"));
            }
          }
          {}
        }
      }
      int32_t _2522_nd = (int)((shape)->size(0));
      std::vector<int32_t> _10372_;
      for (int32_t _2524_i = (int)0, _10373_ = _2522_nd; _2524_i < _10373_ ; ++_2524_i)
      {
        _10372_.push_back((_ptr__2520_last[_2524_i] - _ptr__2519_first[_2524_i]));
      }
      auto _10374_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10372_.size()),_10372_.begin(),_10372_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2523_sliceshape = _10374_;
      _checked_ptr_1<int32_t> _ptr__2523_sliceshape(_2523_sliceshape ? _2523_sliceshape->raw() : nullptr,_2523_sliceshape ? _2523_sliceshape->size(0) : 0);
      int32_t _2525_slicesize = (int)1;
      int32_t _10375_ = (int)0;
      int32_t _10376_ = _2522_nd;
      for (int32_t _2526_i = _10375_; _2526_i < _10376_; ++_2526_i)
      {
        {
          _2525_slicesize *= (_ptr__2520_last[_2526_i] - _ptr__2519_first[_2526_i]);
        }
      }
      if ((_2525_slicesize == (int)0))
      {
        {
          return (::mosek::fusion::p_NilVariable::_new_NilVariable()).as<::mosek::fusion::Variable>();
        }
      }
      else if((NULL != sparsity.get()))
      {
        {
          int32_t _2527_nnz = (int)0;
          std::shared_ptr< monty::ndarray< int32_t,1 > > _2528_key = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2522_nd)));
          _checked_ptr_1<int32_t> _ptr__2528_key(_2528_key ? _2528_key->raw() : nullptr,_2528_key ? _2528_key->size(0) : 0);
          int32_t _10377_ = (int)0;
          int32_t _10378_ = (int)((sparsity)->size(0));
          for (int32_t _2529_i = _10377_; _2529_i < _10378_; ++_2529_i)
          {
            {
              int64_t _2530_rem = ((*sparsity)(_2529_i));
              int32_t _10379_ = (int)1;
              int32_t _10380_ = _2522_nd;
              for (int32_t _2531_k = _10379_; _2531_k < _10380_; ++_2531_k)
              {
                {
                  _ptr__2528_key[(_2522_nd - _2531_k)] = (int32_t)(_2530_rem % ((*shape)((_2522_nd - _2531_k))));
                  _2530_rem /= ((*shape)((_2522_nd - _2531_k)));
                }
              }
              _ptr__2528_key[(int)0] = (int32_t)_2530_rem;
              int32_t _2532_k = (int)0;
              while ( ((_ptr__2528_key[_2532_k] >= _ptr__2519_first[_2532_k]) && (_ptr__2528_key[_2532_k] < _ptr__2520_last[_2532_k])) )
              {
                {
                  ++ _2532_k;
                }
              }
              if ((_2532_k == _2522_nd))
              {
                {
                  ++ _2527_nnz;
                }
              }
              {}
            }
          }
          int32_t _2533_idx = (int)0;
          std::shared_ptr< monty::ndarray< int64_t,1 > > _2534_idxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2527_nnz)));
          _checked_ptr_1<int64_t> _ptr__2534_idxs(_2534_idxs ? _2534_idxs->raw() : nullptr,_2534_idxs ? _2534_idxs->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _2535_sp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2527_nnz)));
          _checked_ptr_1<int64_t> _ptr__2535_sp(_2535_sp ? _2535_sp->raw() : nullptr,_2535_sp ? _2535_sp->size(0) : 0);
          int32_t _10381_ = (int)0;
          int32_t _10382_ = (int)((sparsity)->size(0));
          for (int32_t _2536_i = _10381_; _2536_i < _10382_; ++_2536_i)
          {
            {
              int64_t _2537_rem = ((*sparsity)(_2536_i));
              int32_t _10383_ = (int)1;
              int32_t _10384_ = _2522_nd;
              for (int32_t _2538_k = _10383_; _2538_k < _10384_; ++_2538_k)
              {
                {
                  _ptr__2528_key[(_2522_nd - _2538_k)] = (int32_t)(_2537_rem % ((*shape)((_2522_nd - _2538_k))));
                  _2537_rem /= ((*shape)((_2522_nd - _2538_k)));
                }
              }
              _ptr__2528_key[(int)0] = (int32_t)_2537_rem;
              int32_t _2539_k = (int)0;
              while ( ((_ptr__2528_key[_2539_k] >= _ptr__2519_first[_2539_k]) && (_ptr__2528_key[_2539_k] < _ptr__2520_last[_2539_k])) )
              {
                {
                  ++ _2539_k;
                }
              }
              if ((_2539_k == _2522_nd))
              {
                {
                  _ptr__2534_idxs[_2533_idx] = ((*basevar_nativeidxs)(_2536_i));
                  int32_t _2540_spidx = (int)0;
                  int32_t _10385_ = (int)0;
                  int32_t _10386_ = _2522_nd;
                  for (int32_t _2541_i = _10385_; _2541_i < _10386_; ++_2541_i)
                  {
                    {
                      _2540_spidx = safe_add( safe_mul( _2540_spidx,_ptr__2523_sliceshape[_2541_i] ),(_ptr__2528_key[_2541_i] - _ptr__2519_first[_2541_i]) );
                    }
                  }
                  _ptr__2535_sp[_2533_idx] = _2540_spidx;
                  ++ _2533_idx;
                }
              }
              {}
            }
          }
          return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),_2523_sliceshape,_2535_sp,_2534_idxs)).as<::mosek::fusion::Variable>();
        }
      }
      else
      {
        {
          std::shared_ptr< monty::ndarray< int64_t,1 > > _2542_sliceidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2525_slicesize)));
          _checked_ptr_1<int64_t> _ptr__2542_sliceidxs(_2542_sliceidxs ? _2542_sliceidxs->raw() : nullptr,_2542_sliceidxs ? _2542_sliceidxs->size(0) : 0);
          {
            std::shared_ptr< monty::ndarray< int32_t,1 > > _2543_strides = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2522_nd)));
            _checked_ptr_1<int32_t> _ptr__2543_strides(_2543_strides ? _2543_strides->raw() : nullptr,_2543_strides ? _2543_strides->size(0) : 0);
            _ptr__2543_strides[(_2522_nd - (int)1)] = (int)1;
            int32_t _10387_ = (int)1;
            int32_t _10388_ = _2522_nd;
            for (int32_t _2544_i = _10387_; _2544_i < _10388_; ++_2544_i)
            {
              {
                _ptr__2543_strides[((_2522_nd - _2544_i) - (int)1)] = safe_mul( _ptr__2543_strides[(_2522_nd - _2544_i)],((*shape)((_2522_nd - _2544_i))) );
              }
            }
            int32_t _2545_start = (int)0;
            int32_t _10389_ = (int)0;
            int32_t _10390_ = _2522_nd;
            for (int32_t _2546_i = _10389_; _2546_i < _10390_; ++_2546_i)
            {
              {
                _2545_start += safe_mul( _ptr__2519_first[_2546_i],_ptr__2543_strides[_2546_i] );
              }
            }
            std::vector<int32_t> _10391_;
            for (int32_t _2548_i = (int)0, _10392_ = _2522_nd; _2548_i < _10392_ ; ++_2548_i)
            {
              _10391_.push_back(_2545_start);
            }
            auto _10393_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10391_.size()),_10391_.begin(),_10391_.end()));
            std::shared_ptr< monty::ndarray< int32_t,1 > > _2547_pp = _10393_;
            _checked_ptr_1<int32_t> _ptr__2547_pp(_2547_pp ? _2547_pp->raw() : nullptr,_2547_pp ? _2547_pp->size(0) : 0);
            std::vector<int32_t> _10394_;
            for (int32_t _2550_i = (int)0, _10395_ = _2522_nd; _2550_i < _10395_ ; ++_2550_i)
            {
              _10394_.push_back(_ptr__2519_first[_2550_i]);
            }
            auto _10396_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10394_.size()),_10394_.begin(),_10394_.end()));
            std::shared_ptr< monty::ndarray< int32_t,1 > > _2549_ii = _10396_;
            _checked_ptr_1<int32_t> _ptr__2549_ii(_2549_ii ? _2549_ii->raw() : nullptr,_2549_ii ? _2549_ii->size(0) : 0);
            int32_t _10397_ = (int)0;
            int32_t _10398_ = _2525_slicesize;
            for (int32_t _2551_i = _10397_; _2551_i < _10398_; ++_2551_i)
            {
              {
                _ptr__2542_sliceidxs[_2551_i] = ((*basevar_nativeidxs)(_ptr__2547_pp[(_2522_nd - (int)1)]));
                _ptr__2549_ii[(_2522_nd - (int)1)] += (int)1;
                _ptr__2547_pp[(_2522_nd - (int)1)] += _ptr__2543_strides[(_2522_nd - (int)1)];
                if ((_ptr__2549_ii[(_2522_nd - (int)1)] >= _ptr__2520_last[(_2522_nd - (int)1)]))
                {
                  {
                    int32_t _2552_k = (_2522_nd - (int)1);
                    while ( ((_2552_k > (int)0) && (_ptr__2549_ii[_2552_k] >= _ptr__2520_last[_2552_k])) )
                    {
                      {
                        _ptr__2549_ii[_2552_k] = _ptr__2519_first[_2552_k];
                        _ptr__2549_ii[(_2552_k - (int)1)] += (int)1;
                        _ptr__2547_pp[(_2552_k - (int)1)] += _ptr__2543_strides[(_2552_k - (int)1)];
                        -- _2552_k;
                      }
                    }
                    int32_t _10399_ = safe_add( _2552_k,(int)1 );
                    int32_t _10400_ = _2522_nd;
                    for (int32_t _2553_k2 = _10399_; _2553_k2 < _10400_; ++_2553_k2)
                    {
                      {
                        _ptr__2547_pp[_2553_k2] = _ptr__2547_pp[_2552_k];
                      }
                    }
                  }
                }
                {}
              }
            }
          }
          return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),_2523_sliceshape,nullptr,_2542_sliceidxs)).as<::mosek::fusion::Variable>();
        }
      }
    }
  }
}
// End mosek.fusion.BaseVariable.slice

// Begin mosek.fusion.BaseVariable.slice
// Method mosek.fusion.BaseVariable.slice @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:228:6-257:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__slice(int32_t _2554_first,int32_t _2555_last) { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__slice(_2554_first,_2555_last); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::slice(int32_t _2554_first,int32_t _2555_last) { return __mosek_2fusion_2BaseVariable__slice(_2554_first,_2555_last); }
/* override: mosek.fusion.Variable.slice*/
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__slice(int32_t _2554_first,int32_t _2555_last) { return __mosek_2fusion_2BaseVariable__slice(_2554_first,_2555_last); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__slice(int32_t _2554_first,int32_t _2555_last)
{
  if (((int)((shape)->size(0)) != (int)1))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Variable shape and slice do not match"));
    }
  }
  {}
  if (((_2554_first == (int)0) && (_2555_last == ((*shape)((int)0)))))
  {
    {
      return (::mosek::fusion::BaseVariable::t(_pubthis)).as<::mosek::fusion::Variable>();
    }
  }
  else if(((_2554_first < (int)0) || (_2555_last > ((*shape)((int)0)))))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Slice is out of bounds"));
    }
  }
  else if((_2554_first > _2555_last))
  {
    {
      throw ::mosek::fusion::SliceError(std::string ("Invalid slice"));
    }
  }
  else if((_2554_first == _2555_last))
  {
    {
      return (::mosek::fusion::p_NilVariable::_new_NilVariable()).as<::mosek::fusion::Variable>();
    }
  }
  else if((NULL != sparsity.get()))
  {
    {
      int32_t _2556_slicesize = (_2555_last - _2554_first);
      int32_t _2557_nnz = (int)0;
      int32_t _2558_i0 = ::mosek::fusion::p_CommonTools::binarySearchL(sparsity,(int64_t)(_2554_first));
      int32_t _2559_i1 = ::mosek::fusion::p_CommonTools::binarySearchL(sparsity,(int64_t)(_2555_last));
      std::vector<int64_t> _10401_;
      for (int32_t _2560_i = _2558_i0, _10402_ = _2559_i1; _2560_i < _10402_ ; ++_2560_i)
      {
        _10401_.push_back((((*sparsity)(_2560_i)) - _2554_first));
      }
      auto _10403_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10401_.size()),_10401_.begin(),_10401_.end()));
      std::vector<int64_t> _10404_;
      for (int32_t _2561_i = _2558_i0, _10405_ = _2559_i1; _2561_i < _10405_ ; ++_2561_i)
      {
        _10404_.push_back(((*basevar_nativeidxs)(_2561_i)));
      }
      auto _10406_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10404_.size()),_10404_.begin(),_10404_.end()));
      return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_2556_slicesize)}),_10403_,_10406_)).as<::mosek::fusion::Variable>();
    }
  }
  else
  {
    {
      int32_t _2562_slicesize = (_2555_last - _2554_first);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2563_sliceidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2562_slicesize)));
      _checked_ptr_1<int64_t> _ptr__2563_sliceidxs(_2563_sliceidxs ? _2563_sliceidxs->raw() : nullptr,_2563_sliceidxs ? _2563_sliceidxs->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(basevar_nativeidxs,_2554_first,_2563_sliceidxs,(int)0,_2562_slicesize);
      return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_pubthis->__mosek_2fusion_2BaseVariable__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_2562_slicesize)}),nullptr,_2563_sliceidxs)).as<::mosek::fusion::Variable>();
    }
  }
}
// End mosek.fusion.BaseVariable.slice

// Begin mosek.fusion.BaseVariable.asExpr
// Method mosek.fusion.BaseVariable.asExpr @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:226:6-74
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseVariable :: __mosek_2fusion_2BaseVariable__asExpr() { return mosek::fusion::p_BaseVariable::_get_impl(this)->__mosek_2fusion_2BaseVariable__asExpr(); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseVariable::asExpr() { return __mosek_2fusion_2BaseVariable__asExpr(); }
/* override: mosek.fusion.Variable.asExpr*/
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseVariable::__mosek_2fusion_2Variable__asExpr() { return __mosek_2fusion_2BaseVariable__asExpr(); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_BaseVariable::__mosek_2fusion_2BaseVariable__asExpr()
{
  return (::mosek::fusion::p_ExprFromVar::_new_ExprFromVar((::mosek::fusion::BaseVariable::t(_pubthis)).as<::mosek::fusion::Variable>())).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.BaseVariable.asExpr

// Begin mosek.fusion.BaseVariable.inst
// Method mosek.fusion.BaseVariable.inst @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:185:6-207:7
int32_t mosek::fusion::BaseVariable :: inst(int32_t _2564_spoffset,std::shared_ptr< monty::ndarray< int64_t,1 > > _2565_sparsity,int32_t _2566_nioffset,std::shared_ptr< monty::ndarray< int64_t,1 > > _2567_basevar_nativeidxs) { return mosek::fusion::p_BaseVariable::_get_impl(this)->inst(_2564_spoffset,_2565_sparsity,_2566_nioffset,_2567_basevar_nativeidxs); }
int32_t mosek::fusion::p_BaseVariable::inst(int32_t _2564_spoffset,std::shared_ptr< monty::ndarray< int64_t,1 > > _2565_sparsity,int32_t _2566_nioffset,std::shared_ptr< monty::ndarray< int64_t,1 > > _2567_basevar_nativeidxs)
{
  _checked_ptr_1<int64_t> _ptr__2565_sparsity(_2565_sparsity ? _2565_sparsity->raw() : nullptr, _2565_sparsity ? _2565_sparsity->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__2567_basevar_nativeidxs(_2567_basevar_nativeidxs ? _2567_basevar_nativeidxs->raw() : nullptr, _2567_basevar_nativeidxs ? _2567_basevar_nativeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2568_thisnidxs = mosek::fusion::p_BaseVariable::_get_impl(::mosek::fusion::BaseVariable::t(_pubthis))->basevar_nativeidxs;
  _checked_ptr_1<int64_t> _ptr__2568_thisnidxs(_2568_thisnidxs ? _2568_thisnidxs->raw() : nullptr,_2568_thisnidxs ? _2568_thisnidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2569_thissp = mosek::fusion::p_BaseVariable::_get_impl(::mosek::fusion::BaseVariable::t(_pubthis))->sparsity;
  _checked_ptr_1<int64_t> _ptr__2569_thissp(_2569_thissp ? _2569_thissp->raw() : nullptr,_2569_thissp ? _2569_thissp->size(0) : 0);
  if ((NULL == _2569_thissp.get()))
  {
    {
      int32_t _10407_ = (int)0;
      int32_t _10408_ = (int)((_2568_thisnidxs)->size(0));
      for (int32_t _2570_i = _10407_; _2570_i < _10408_; ++_2570_i)
      {
        {
          _ptr__2565_sparsity[safe_add( _2570_i,_2564_spoffset )] = _2570_i;
          _ptr__2567_basevar_nativeidxs[safe_add( _2570_i,_2566_nioffset )] = _ptr__2568_thisnidxs[_2570_i];
        }
      }
    }
  }
  else
  {
    {
      int32_t _10409_ = (int)0;
      int32_t _10410_ = (int)((mosek::fusion::p_BaseVariable::_get_impl(::mosek::fusion::BaseVariable::t(_pubthis))->sparsity)->size(0));
      for (int32_t _2571_i = _10409_; _2571_i < _10410_; ++_2571_i)
      {
        {
          _ptr__2565_sparsity[safe_add( _2564_spoffset,_2571_i )] = _ptr__2569_thissp[_2571_i];
          _ptr__2567_basevar_nativeidxs[safe_add( _2571_i,_2566_nioffset )] = _ptr__2568_thisnidxs[_2571_i];
        }
      }
    }
  }
  return (int)((mosek::fusion::p_BaseVariable::_get_impl(::mosek::fusion::BaseVariable::t(_pubthis))->basevar_nativeidxs)->size(0));
}
// End mosek.fusion.BaseVariable.inst

// Begin mosek.fusion.BaseVariable.numInst
// Method mosek.fusion.BaseVariable.numInst @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:181:6-183:7
int32_t mosek::fusion::BaseVariable :: numInst() { return mosek::fusion::p_BaseVariable::_get_impl(this)->numInst(); }
int32_t mosek::fusion::p_BaseVariable::numInst()
{
  return (int)((basevar_nativeidxs)->size(0));
}
// End mosek.fusion.BaseVariable.numInst

// Begin mosek.fusion.BaseVariable.inst
// Method mosek.fusion.BaseVariable.inst @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:165:6-179:7
void mosek::fusion::BaseVariable :: inst(int32_t _2572_offset,std::shared_ptr< monty::ndarray< int64_t,1 > > _2573_nindex) { mosek::fusion::p_BaseVariable::_get_impl(this)->inst(_2572_offset,_2573_nindex); }
void mosek::fusion::p_BaseVariable::inst(int32_t _2572_offset,std::shared_ptr< monty::ndarray< int64_t,1 > > _2573_nindex)
{
  _checked_ptr_1<int64_t> _ptr__2573_nindex(_2573_nindex ? _2573_nindex->raw() : nullptr, _2573_nindex ? _2573_nindex->size(0) : 0);
  if ((NULL == sparsity.get()))
  {
    {
      int32_t _10411_ = (int)0;
      int32_t _10412_ = (int)((basevar_nativeidxs)->size(0));
      for (int32_t _2574_i = _10411_; _2574_i < _10412_; ++_2574_i)
      {
        {
          _ptr__2573_nindex[safe_add( _2572_offset,_2574_i )] = ((*basevar_nativeidxs)(_2574_i));
        }
      }
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2575_shape = _pubthis->getShape();
      _checked_ptr_1<int32_t> _ptr__2575_shape(_2575_shape ? _2575_shape->raw() : nullptr,_2575_shape ? _2575_shape->size(0) : 0);
      int32_t _2576_domsize = (int)1;
      int32_t _10413_ = (int)0;
      int32_t _10414_ = (int)((_2575_shape)->size(0));
      for (int32_t _2577_i = _10413_; _2577_i < _10414_; ++_2577_i)
      {
        {
          _2576_domsize *= _ptr__2575_shape[_2577_i];
        }
      }
      int32_t _10415_ = (int)0;
      int32_t _10416_ = _2576_domsize;
      for (int32_t _2578_i = _10415_; _2578_i < _10416_; ++_2578_i)
      {
        {
          _ptr__2573_nindex[safe_add( _2572_offset,_2578_i )] = (int)0;
        }
      }
      int32_t _10417_ = (int)0;
      int32_t _10418_ = (int)((sparsity)->size(0));
      for (int32_t _2579_i = _10417_; _2579_i < _10418_; ++_2579_i)
      {
        {
          _ptr__2573_nindex[safe_add( _2572_offset,((*sparsity)(_2579_i)) )] = ((*basevar_nativeidxs)(_2579_i));
        }
      }
    }
  }
}
// End mosek.fusion.BaseVariable.inst

// Begin mosek.fusion.BaseVariable.set_values
// Method mosek.fusion.BaseVariable.set_values @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:147:6-163:7
void mosek::fusion::BaseVariable :: set_values(std::shared_ptr< monty::ndarray< double,1 > > _2580_values,bool _2581_primal) { mosek::fusion::p_BaseVariable::_get_impl(this)->set_values(_2580_values,_2581_primal); }
void mosek::fusion::p_BaseVariable::set_values(std::shared_ptr< monty::ndarray< double,1 > > _2580_values,bool _2581_primal)
{
  _checked_ptr_1<double> _ptr__2580_values(_2580_values ? _2580_values->raw() : nullptr, _2580_values ? _2580_values->size(0) : 0);
  if ((NULL == sparsity.get()))
  {
    {
      _pubthis->__mosek_2fusion_2BaseVariable__getModel()->setVariableValues(_2581_primal,basevar_nativeidxs,_2580_values);
    }
  }
  else
  {
    {
      int32_t _2582_varsize = (int)1;
      int32_t _10419_ = (int)0;
      int32_t _10420_ = (int)((shape)->size(0));
      for (int32_t _2583_i = _10419_; _2583_i < _10420_; ++_2583_i)
      {
        {
          _2582_varsize *= ((*shape)(_2583_i));
        }
      }
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2584_idxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2582_varsize)));
      _checked_ptr_1<int64_t> _ptr__2584_idxs(_2584_idxs ? _2584_idxs->raw() : nullptr,_2584_idxs ? _2584_idxs->size(0) : 0);
      int32_t _10421_ = (int)0;
      int32_t _10422_ = (int)((basevar_nativeidxs)->size(0));
      for (int32_t _2585_i = _10421_; _2585_i < _10422_; ++_2585_i)
      {
        {
          _ptr__2584_idxs[((*sparsity)(_2585_i))] = ((*basevar_nativeidxs)(_2585_i));
        }
      }
      _pubthis->__mosek_2fusion_2BaseVariable__getModel()->setVariableValues(_2581_primal,_2584_idxs,_2580_values);
    }
  }
}
// End mosek.fusion.BaseVariable.set_values

// Begin mosek.fusion.BaseVariable.dual_lu
// Method mosek.fusion.BaseVariable.dual_lu @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:131:6-144:7
void mosek::fusion::p_BaseVariable::dual_lu(int32_t _2586_offset,std::shared_ptr< monty::ndarray< double,1 > > _2587_target,bool _2588_lower)
{
  _checked_ptr_1<double> _ptr__2587_target(_2587_target ? _2587_target->raw() : nullptr, _2587_target ? _2587_target->size(0) : 0);
  if ((NULL == sparsity.get()))
  {
    {
      model->getVariableDuals(_2588_lower,basevar_nativeidxs,_2587_target,_2586_offset);
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2589_idxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_pubthis->getSize())));
      _checked_ptr_1<int64_t> _ptr__2589_idxs(_2589_idxs ? _2589_idxs->raw() : nullptr,_2589_idxs ? _2589_idxs->size(0) : 0);
      int32_t _10423_ = (int)0;
      int32_t _10424_ = (int)((sparsity)->size(0));
      for (int32_t _2590_i = _10423_; _2590_i < _10424_; ++_2590_i)
      {
        {
          _ptr__2589_idxs[((*sparsity)(_2590_i))] = ((*basevar_nativeidxs)(_2590_i));
        }
      }
      model->getVariableDuals(_2588_lower,_2589_idxs,_2587_target,_2586_offset);
    }
  }
}
// End mosek.fusion.BaseVariable.dual_lu

// Begin mosek.fusion.BaseVariable.values
// Method mosek.fusion.BaseVariable.values @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:116:6-129:7
void mosek::fusion::BaseVariable :: values(int32_t _2591_offset,std::shared_ptr< monty::ndarray< double,1 > > _2592_target,bool _2593_primal) { mosek::fusion::p_BaseVariable::_get_impl(this)->values(_2591_offset,_2592_target,_2593_primal); }
void mosek::fusion::p_BaseVariable::values(int32_t _2591_offset,std::shared_ptr< monty::ndarray< double,1 > > _2592_target,bool _2593_primal)
{
  _checked_ptr_1<double> _ptr__2592_target(_2592_target ? _2592_target->raw() : nullptr, _2592_target ? _2592_target->size(0) : 0);
  if ((NULL == sparsity.get()))
  {
    {
      model->getVariableValues(_2593_primal,basevar_nativeidxs,_2592_target,_2591_offset);
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2594_idxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_pubthis->getSize())));
      _checked_ptr_1<int64_t> _ptr__2594_idxs(_2594_idxs ? _2594_idxs->raw() : nullptr,_2594_idxs ? _2594_idxs->size(0) : 0);
      int32_t _10425_ = (int)0;
      int32_t _10426_ = (int)((sparsity)->size(0));
      for (int32_t _2595_i = _10425_; _2595_i < _10426_; ++_2595_i)
      {
        {
          _ptr__2594_idxs[((*sparsity)(_2595_i))] = ((*basevar_nativeidxs)(_2595_i));
        }
      }
      model->getVariableValues(_2593_primal,_2594_idxs,_2592_target,_2591_offset);
    }
  }
}
// End mosek.fusion.BaseVariable.values

// Begin mosek.fusion.BaseVariable.make_continuous
// Method mosek.fusion.BaseVariable.make_continuous @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:114:6-89
void mosek::fusion::BaseVariable :: make_continuous() { mosek::fusion::p_BaseVariable::_get_impl(this)->make_continuous(); }
void mosek::fusion::p_BaseVariable::make_continuous()
{
  mosek::fusion::p_Model::_get_impl(_pubthis->__mosek_2fusion_2BaseVariable__getModel().get())->make_continuous(basevar_nativeidxs);
}
// End mosek.fusion.BaseVariable.make_continuous

// Begin mosek.fusion.BaseVariable.make_integer
// Method mosek.fusion.BaseVariable.make_integer @ bld/grindsted/final/default/src/fusion/BaseVariable.monty:113:6-83
void mosek::fusion::BaseVariable :: make_integer() { mosek::fusion::p_BaseVariable::_get_impl(this)->make_integer(); }
void mosek::fusion::p_BaseVariable::make_integer()
{
  mosek::fusion::p_Model::_get_impl(_pubthis->__mosek_2fusion_2BaseVariable__getModel().get())->make_integer(basevar_nativeidxs);
}
// End mosek.fusion.BaseVariable.make_integer

void mosek::fusion::p_BaseVariable::destroy()
{
  sparsity.reset();
  basevar_nativeidxs.reset();
  model.reset();
  shape.reset();
}
void mosek::fusion::BaseVariable::destroy() { mosek::fusion::p_BaseVariable::_get_impl(this)->destroy(); }
// } class BaseVariable
// class Variable { // @ bld/grindsted/final/default/src/fusion/Variable.mbi:187:4-423:5
// Begin mosek.fusion.Variable.toString
// End mosek.fusion.Variable.toString

// Begin mosek.fusion.Variable.numInst
// End mosek.fusion.Variable.numInst

// Begin mosek.fusion.Variable.inst
// End mosek.fusion.Variable.inst

// Begin mosek.fusion.Variable.inst
// End mosek.fusion.Variable.inst

// Begin mosek.fusion.Variable.remove
// End mosek.fusion.Variable.remove

// Begin mosek.fusion.Variable.getND
// End mosek.fusion.Variable.getND

// Begin mosek.fusion.Variable.getShape
// End mosek.fusion.Variable.getShape

// Begin mosek.fusion.Variable.getSize
// End mosek.fusion.Variable.getSize

// Begin mosek.fusion.Variable.setLevel
// End mosek.fusion.Variable.setLevel

// Begin mosek.fusion.Variable.fromTril
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::fromTril(int32_t _2603_dim) { return __mosek_2fusion_2Variable__fromTril(_2603_dim); }
// End mosek.fusion.Variable.fromTril

// Begin mosek.fusion.Variable.tril
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::tril() { return __mosek_2fusion_2Variable__tril(); }
// End mosek.fusion.Variable.tril

// Begin mosek.fusion.Variable.reshape
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::reshape(int32_t _2604_dim0,int32_t _2605_dim1,int32_t _2606_dim2) { return __mosek_2fusion_2Variable__reshape(_2604_dim0,_2605_dim1,_2606_dim2); }
// End mosek.fusion.Variable.reshape

// Begin mosek.fusion.Variable.reshape
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::reshape(int32_t _2607_dim0,int32_t _2608_dim1) { return __mosek_2fusion_2Variable__reshape(_2607_dim0,_2608_dim1); }
// End mosek.fusion.Variable.reshape

// Begin mosek.fusion.Variable.reshape
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::reshape(int32_t _2609_dim0) { return __mosek_2fusion_2Variable__reshape(_2609_dim0); }
// End mosek.fusion.Variable.reshape

// Begin mosek.fusion.Variable.reshape
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::reshape(std::shared_ptr< monty::ndarray< int32_t,1 > > _2610_shape) { return __mosek_2fusion_2Variable__reshape(_2610_shape); }
// End mosek.fusion.Variable.reshape

// Begin mosek.fusion.Variable.set_values
// End mosek.fusion.Variable.set_values

// Begin mosek.fusion.Variable.dual
// End mosek.fusion.Variable.dual

// Begin mosek.fusion.Variable.level
// End mosek.fusion.Variable.level

// Begin mosek.fusion.Variable.values
// End mosek.fusion.Variable.values

// Begin mosek.fusion.Variable.make_continuous
// End mosek.fusion.Variable.make_continuous

// Begin mosek.fusion.Variable.make_integer
// End mosek.fusion.Variable.make_integer

// Begin mosek.fusion.Variable.makeContinuous
// End mosek.fusion.Variable.makeContinuous

// Begin mosek.fusion.Variable.makeInteger
// End mosek.fusion.Variable.makeInteger

// Begin mosek.fusion.Variable.transpose
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::transpose() { return __mosek_2fusion_2Variable__transpose(); }
// End mosek.fusion.Variable.transpose

// Begin mosek.fusion.Variable.pick
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2616_i1,std::shared_ptr< monty::ndarray< int32_t,1 > > _2617_i2,std::shared_ptr< monty::ndarray< int32_t,1 > > _2618_i3) { return __mosek_2fusion_2Variable__pick(_2616_i1,_2617_i2,_2618_i3); }
// End mosek.fusion.Variable.pick

// Begin mosek.fusion.Variable.pick
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2619_i1,std::shared_ptr< monty::ndarray< int32_t,1 > > _2620_i2) { return __mosek_2fusion_2Variable__pick(_2619_i1,_2620_i2); }
// End mosek.fusion.Variable.pick

// Begin mosek.fusion.Variable.pick
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Variable::__mosek_2fusion_2Expression__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _2621_midxs) { return __mosek_2fusion_2Variable__pick(_2621_midxs); }
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _2621_midxs) { return __mosek_2fusion_2Variable__pick(_2621_midxs); }
// End mosek.fusion.Variable.pick

// Begin mosek.fusion.Variable.pick
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Variable::__mosek_2fusion_2Expression__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2622_idxs) { return __mosek_2fusion_2Variable__pick(_2622_idxs); }
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _2622_idxs) { return __mosek_2fusion_2Variable__pick(_2622_idxs); }
// End mosek.fusion.Variable.pick

// Begin mosek.fusion.Variable.antidiag
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::antidiag() { return __mosek_2fusion_2Variable__antidiag(); }
// End mosek.fusion.Variable.antidiag

// Begin mosek.fusion.Variable.antidiag
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::antidiag(int32_t _2623_index) { return __mosek_2fusion_2Variable__antidiag(_2623_index); }
// End mosek.fusion.Variable.antidiag

// Begin mosek.fusion.Variable.diag
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::diag() { return __mosek_2fusion_2Variable__diag(); }
// End mosek.fusion.Variable.diag

// Begin mosek.fusion.Variable.diag
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::diag(int32_t _2624_index) { return __mosek_2fusion_2Variable__diag(_2624_index); }
// End mosek.fusion.Variable.diag

// Begin mosek.fusion.Variable.index
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Variable::__mosek_2fusion_2Expression__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2625_idx) { return __mosek_2fusion_2Variable__index(_2625_idx); }
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2625_idx) { return __mosek_2fusion_2Variable__index(_2625_idx); }
// End mosek.fusion.Variable.index

// Begin mosek.fusion.Variable.index
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::index(int32_t _2626_i1,int32_t _2627_i2,int32_t _2628_i3) { return __mosek_2fusion_2Variable__index(_2626_i1,_2627_i2,_2628_i3); }
// End mosek.fusion.Variable.index

// Begin mosek.fusion.Variable.index
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::index(int32_t _2629_i1,int32_t _2630_i2) { return __mosek_2fusion_2Variable__index(_2629_i1,_2630_i2); }
// End mosek.fusion.Variable.index

// Begin mosek.fusion.Variable.index
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Variable::__mosek_2fusion_2Expression__index(int32_t _2631_i1) { return __mosek_2fusion_2Variable__index(_2631_i1); }
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::index(int32_t _2631_i1) { return __mosek_2fusion_2Variable__index(_2631_i1); }
// End mosek.fusion.Variable.index

// Begin mosek.fusion.Variable.slice
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Variable::__mosek_2fusion_2Expression__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2632_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _2633_lasta) { return __mosek_2fusion_2Variable__slice(_2632_firsta,_2633_lasta); }
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2632_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _2633_lasta) { return __mosek_2fusion_2Variable__slice(_2632_firsta,_2633_lasta); }
// End mosek.fusion.Variable.slice

// Begin mosek.fusion.Variable.slice
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Variable::__mosek_2fusion_2Expression__slice(int32_t _2634_first,int32_t _2635_last) { return __mosek_2fusion_2Variable__slice(_2634_first,_2635_last); }
monty::rc_ptr< mosek::fusion::Variable > mosek::fusion::Variable::slice(int32_t _2634_first,int32_t _2635_last) { return __mosek_2fusion_2Variable__slice(_2634_first,_2635_last); }
// End mosek.fusion.Variable.slice

// Begin mosek.fusion.Variable.asExpr
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Variable::asExpr() { return __mosek_2fusion_2Variable__asExpr(); }
// End mosek.fusion.Variable.asExpr

// } class Variable
// class Var { // @ bld/grindsted/final/default/src/fusion/Var.monty:144:4-833:5
mosek::fusion::Var::Var(mosek::fusion::p_Var *_impl) : _impl(_impl) { /*std::cout << "Var() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::Var::~Var() { delete _impl; _impl = nullptr; }
mosek::fusion::p_Var::p_Var
  (::mosek::fusion::Var * _pubthis) :     _pubthis(_pubthis)
{}
// Begin mosek.fusion.Var.empty
// Method mosek.fusion.Var.empty @ bld/grindsted/final/default/src/fusion/Var.monty:827:6-832:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::empty
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _2636_shape) { return mosek::fusion::p_Var::empty(_2636_shape); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::empty(std::shared_ptr< monty::ndarray< int32_t,1 > > _2636_shape)
{
  _checked_ptr_1<int32_t> _ptr__2636_shape(_2636_shape ? _2636_shape->raw() : nullptr, _2636_shape ? _2636_shape->size(0) : 0);
  int32_t _10427_ = (int)0;
  int32_t _10428_ = (int)((_2636_shape)->size(0));
  for (int32_t _2637_i = _10427_; _2637_i < _10428_; ++_2637_i)
  {
    {
      if ((_ptr__2636_shape[_2637_i] < (int)0))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Invalid shape"));
        }
      }
      {}
    }
  }
  return (::mosek::fusion::p_NilVariable::_new_NilVariable(_2636_shape)).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.Var.empty

// Begin mosek.fusion.Var.compress
// Method mosek.fusion.Var.compress @ bld/grindsted/final/default/src/fusion/Var.monty:801:6-819:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::compress
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2638_v) { return mosek::fusion::p_Var::compress(_2638_v); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::compress(monty::rc_ptr< ::mosek::fusion::Variable > _2638_v)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2639_shape = _2638_v->getShape();
  _checked_ptr_1<int32_t> _ptr__2639_shape(_2639_shape ? _2639_shape->raw() : nullptr,_2639_shape ? _2639_shape->size(0) : 0);
  int32_t _2640_nd = (int)((_2639_shape)->size(0));
  int32_t _2641_realnd = (int)0;
  int32_t _10429_ = (int)0;
  int32_t _10430_ = _2640_nd;
  for (int32_t _2642_i = _10429_; _2642_i < _10430_; ++_2642_i)
  {
    {
      if ((_ptr__2639_shape[_2642_i] != (int)1))
      {
        {
          ++ _2641_realnd;
        }
      }
      {}
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2643_realshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2641_realnd)));
  _checked_ptr_1<int32_t> _ptr__2643_realshape(_2643_realshape ? _2643_realshape->raw() : nullptr,_2643_realshape ? _2643_realshape->size(0) : 0);
  {
    int32_t _2644_k = (int)0;
    int32_t _10431_ = (int)0;
    int32_t _10432_ = _2640_nd;
    for (int32_t _2645_i = _10431_; _2645_i < _10432_; ++_2645_i)
    {
      {
        if ((_ptr__2639_shape[_2645_i] != (int)1))
        {
          {
            _ptr__2643_realshape[_2644_k] = _ptr__2639_shape[_2645_i];
            ++ _2644_k;
          }
        }
        {}
      }
    }
  }
  return ::mosek::fusion::p_Var::reshape(_2638_v,_2643_realshape);
}
// End mosek.fusion.Var.compress

// Begin mosek.fusion.Var.reshape
// Method mosek.fusion.Var.reshape @ bld/grindsted/final/default/src/fusion/Var.monty:784:6-787:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::reshape
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2646_v,
    int32_t _2647_d1) { return mosek::fusion::p_Var::reshape(_2646_v,_2647_d1); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::reshape(monty::rc_ptr< ::mosek::fusion::Variable > _2646_v,int32_t _2647_d1)
{
  return ::mosek::fusion::p_Var::reshape(_2646_v,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_2647_d1)}));
}
// End mosek.fusion.Var.reshape

// Begin mosek.fusion.Var.reshape
// Method mosek.fusion.Var.reshape @ bld/grindsted/final/default/src/fusion/Var.monty:770:6-773:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::reshape
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2648_v,
    int32_t _2649_d1,
    int32_t _2650_d2) { return mosek::fusion::p_Var::reshape(_2648_v,_2649_d1,_2650_d2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::reshape(monty::rc_ptr< ::mosek::fusion::Variable > _2648_v,int32_t _2649_d1,int32_t _2650_d2)
{
  return ::mosek::fusion::p_Var::reshape(_2648_v,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_2649_d1),(int32_t)(_2650_d2)}));
}
// End mosek.fusion.Var.reshape

// Begin mosek.fusion.Var.flatten
// Method mosek.fusion.Var.flatten @ bld/grindsted/final/default/src/fusion/Var.monty:757:6-760:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::flatten
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2651_v) { return mosek::fusion::p_Var::flatten(_2651_v); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::flatten(monty::rc_ptr< ::mosek::fusion::Variable > _2651_v)
{
  return ::mosek::fusion::p_Var::reshape(_2651_v,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int32_t)::mosek::fusion::p_Set::size(_2651_v->getShape()))}));
}
// End mosek.fusion.Var.flatten

// Begin mosek.fusion.Var.reshape
// Method mosek.fusion.Var.reshape @ bld/grindsted/final/default/src/fusion/Var.monty:726:6-728:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::reshape
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2652_v,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2653_shape) { return mosek::fusion::p_Var::reshape(_2652_v,_2653_shape); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::reshape(monty::rc_ptr< ::mosek::fusion::Variable > _2652_v,std::shared_ptr< monty::ndarray< int32_t,1 > > _2653_shape)
{
  _checked_ptr_1<int32_t> _ptr__2653_shape(_2653_shape ? _2653_shape->raw() : nullptr, _2653_shape ? _2653_shape->size(0) : 0);
  return _2652_v->__mosek_2fusion_2Variable__reshape(_2653_shape);
}
// End mosek.fusion.Var.reshape

// Begin mosek.fusion.Var.index_permute_
// Method mosek.fusion.Var.index_permute_ @ bld/grindsted/final/default/src/fusion/Var.monty:638:6-691:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::index_permute_(monty::rc_ptr< ::mosek::fusion::Variable > _2654_v,std::shared_ptr< monty::ndarray< int32_t,1 > > _2655_perm)
{
  _checked_ptr_1<int32_t> _ptr__2655_perm(_2655_perm ? _2655_perm->raw() : nullptr, _2655_perm ? _2655_perm->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2656_sparsity;
  _checked_ptr_1<int64_t> _ptr__2656_sparsity(_2656_sparsity ? _2656_sparsity->raw() : nullptr,_2656_sparsity ? _2656_sparsity->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2657_nativeidxs;
  _checked_ptr_1<int64_t> _ptr__2657_nativeidxs(_2657_nativeidxs ? _2657_nativeidxs->raw() : nullptr,_2657_nativeidxs ? _2657_nativeidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2658_shape = _2654_v->getShape();
  _checked_ptr_1<int32_t> _ptr__2658_shape(_2658_shape ? _2658_shape->raw() : nullptr,_2658_shape ? _2658_shape->size(0) : 0);
  int32_t _2659_nd = (int)((_2658_shape)->size(0));
  int32_t _2660_shapesize = (int)1;
  int32_t _10433_ = (int)0;
  int32_t _10434_ = _2659_nd;
  for (int32_t _2661_i = _10433_; _2661_i < _10434_; ++_2661_i)
  {
    {
      _2660_shapesize *= _ptr__2658_shape[_2661_i];
    }
  }
  int32_t _2662_nnz = _2654_v->numInst();
  std::shared_ptr< monty::ndarray< int64_t,1 > > _2663_pstrides = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2659_nd)));
  _checked_ptr_1<int64_t> _ptr__2663_pstrides(_2663_pstrides ? _2663_pstrides->raw() : nullptr,_2663_pstrides ? _2663_pstrides->size(0) : 0);
  _ptr__2663_pstrides[(_2659_nd - (int)1)] = (int)1;
  int32_t _10435_ = (int)1;
  int32_t _10436_ = _2659_nd;
  for (int32_t _2664_i = _10435_; _2664_i < _10436_; ++_2664_i)
  {
    {
      _ptr__2663_pstrides[((_2659_nd - _2664_i) - (int)1)] = safe_mul( _ptr__2663_pstrides[(_2659_nd - _2664_i)],_ptr__2658_shape[_ptr__2655_perm[(_2659_nd - _2664_i)]] );
    }
  }
  if ((_2662_nnz < _2660_shapesize))
  {
    {
      _2656_sparsity = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2662_nnz)));
      _ptr__2656_sparsity.update(_2656_sparsity ? _2656_sparsity->raw() : nullptr, _2656_sparsity ? _2656_sparsity->size(0) : 0);
      _2657_nativeidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2662_nnz)));
      _ptr__2657_nativeidxs.update(_2657_nativeidxs ? _2657_nativeidxs->raw() : nullptr, _2657_nativeidxs ? _2657_nativeidxs->size(0) : 0);
      _2654_v->inst((int)0,_2656_sparsity,(int)0,_2657_nativeidxs);
    }
  }
  else
  {
    {
      _2656_sparsity = nullptr;
      _ptr__2656_sparsity.update(_2656_sparsity ? _2656_sparsity->raw() : nullptr, _2656_sparsity ? _2656_sparsity->size(0) : 0);
      _2657_nativeidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2662_nnz)));
      _ptr__2657_nativeidxs.update(_2657_nativeidxs ? _2657_nativeidxs->raw() : nullptr, _2657_nativeidxs ? _2657_nativeidxs->size(0) : 0);
      _2654_v->inst((int)0,_2657_nativeidxs);
    }
  }
  if ((NULL == _2656_sparsity.get()))
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2665_residxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2662_nnz)));
      _checked_ptr_1<int64_t> _ptr__2665_residxs(_2665_residxs ? _2665_residxs->raw() : nullptr,_2665_residxs ? _2665_residxs->size(0) : 0);
      {
        std::shared_ptr< monty::ndarray< int32_t,1 > > _2666_ii = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2659_nd)));
        _checked_ptr_1<int32_t> _ptr__2666_ii(_2666_ii ? _2666_ii->raw() : nullptr,_2666_ii ? _2666_ii->size(0) : 0);
        int32_t _10437_ = (int)0;
        int32_t _10438_ = _2662_nnz;
        for (int32_t _2667_i = _10437_; _2667_i < _10438_; ++_2667_i)
        {
          {
            int32_t _2668_rem = _2667_i;
            int32_t _10439_ = (int)0;
            int32_t _10440_ = _2659_nd;
            for (int32_t _2669_j = _10439_; _2669_j < _10440_; ++_2669_j)
            {
              {
                _ptr__2666_ii[((_2659_nd - _2667_i) - (int)1)] = (_2668_rem % _ptr__2658_shape[((_2659_nd - _2667_i) - (int)1)]);
                _2668_rem /= _ptr__2658_shape[((_2659_nd - _2667_i) - (int)1)];
              }
            }
            int32_t _2670_newi = (int)0;
            int32_t _10441_ = (int)0;
            int32_t _10442_ = _2659_nd;
            for (int32_t _2671_j = _10441_; _2671_j < _10442_; ++_2671_j)
            {
              {
                _2670_newi += (int32_t)safe_mul( _ptr__2666_ii[_ptr__2655_perm[_2671_j]],_ptr__2663_pstrides[_2671_j] );
              }
            }
            _ptr__2665_residxs[_2670_newi] = _ptr__2657_nativeidxs[_2667_i];
          }
        }
      }
      _2657_nativeidxs = _2665_residxs;
      _ptr__2657_nativeidxs.update(_2657_nativeidxs ? _2657_nativeidxs->raw() : nullptr, _2657_nativeidxs ? _2657_nativeidxs->size(0) : 0);
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2672_ressp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2662_nnz)));
      _checked_ptr_1<int64_t> _ptr__2672_ressp(_2672_ressp ? _2672_ressp->raw() : nullptr,_2672_ressp ? _2672_ressp->size(0) : 0);
      {
        std::shared_ptr< monty::ndarray< int32_t,1 > > _2673_ii = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2659_nd)));
        _checked_ptr_1<int32_t> _ptr__2673_ii(_2673_ii ? _2673_ii->raw() : nullptr,_2673_ii ? _2673_ii->size(0) : 0);
        int32_t _10443_ = (int)0;
        int32_t _10444_ = _2662_nnz;
        for (int32_t _2674_i = _10443_; _2674_i < _10444_; ++_2674_i)
        {
          {
            int32_t _2675_rem = _2674_i;
            int32_t _10445_ = (int)0;
            int32_t _10446_ = _2659_nd;
            for (int32_t _2676_j = _10445_; _2676_j < _10446_; ++_2676_j)
            {
              {
                _ptr__2673_ii[((_2659_nd - _2674_i) - (int)1)] = (_2675_rem % _ptr__2658_shape[((_2659_nd - _2674_i) - (int)1)]);
                _2675_rem /= _ptr__2658_shape[((_2659_nd - _2674_i) - (int)1)];
              }
            }
            int32_t _2677_newi = (int)0;
            int32_t _10447_ = (int)0;
            int32_t _10448_ = _2659_nd;
            for (int32_t _2678_j = _10447_; _2678_j < _10448_; ++_2678_j)
            {
              {
                _2677_newi += (int32_t)safe_mul( _ptr__2673_ii[_ptr__2655_perm[_2678_j]],_ptr__2663_pstrides[_2678_j] );
              }
            }
            _ptr__2672_ressp[_2674_i] = _2677_newi;
          }
        }
      }
      std::vector<int64_t> _10449_;
      for (int32_t _2680_i = (int)0, _10450_ = _2662_nnz; _2680_i < _10450_ ; ++_2680_i)
      {
        _10449_.push_back(_2680_i);
      }
      auto _10451_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10449_.size()),_10449_.begin(),_10449_.end()));
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2679_spperm = _10451_;
      _checked_ptr_1<int64_t> _ptr__2679_spperm(_2679_spperm ? _2679_spperm->raw() : nullptr,_2679_spperm ? _2679_spperm->size(0) : 0);
      ::mosek::fusion::p_CommonTools::argQsort(_2679_spperm,_2672_ressp,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),(int64_t)((int)0),(int64_t)(_2662_nnz));
      std::vector<int64_t> _10452_;
      for (int32_t _2681_i = (int)0, _10453_ = _2662_nnz; _2681_i < _10453_ ; ++_2681_i)
      {
        _10452_.push_back(_ptr__2656_sparsity[_ptr__2679_spperm[_2681_i]]);
      }
      auto _10454_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10452_.size()),_10452_.begin(),_10452_.end()));
      _2656_sparsity = _10454_;
      _ptr__2656_sparsity.update(_2656_sparsity ? _2656_sparsity->raw() : nullptr, _2656_sparsity ? _2656_sparsity->size(0) : 0);
      std::vector<int64_t> _10455_;
      for (int32_t _2682_i = (int)0, _10456_ = _2662_nnz; _2682_i < _10456_ ; ++_2682_i)
      {
        _10455_.push_back(_ptr__2657_nativeidxs[_ptr__2679_spperm[_2682_i]]);
      }
      auto _10457_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10455_.size()),_10455_.begin(),_10455_.end()));
      _2657_nativeidxs = _10457_;
      _ptr__2657_nativeidxs.update(_2657_nativeidxs ? _2657_nativeidxs->raw() : nullptr, _2657_nativeidxs ? _2657_nativeidxs->size(0) : 0);
    }
  }
  std::vector<int32_t> _10458_;
  for (int32_t _2683_i = (int)0, _10459_ = _2659_nd; _2683_i < _10459_ ; ++_2683_i)
  {
    _10458_.push_back(_ptr__2658_shape[_ptr__2655_perm[_2683_i]]);
  }
  auto _10460_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10458_.size()),_10458_.begin(),_10458_.end()));
  return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_2654_v->__mosek_2fusion_2Expression__getModel(),_10460_,_2656_sparsity,_2657_nativeidxs)).as<::mosek::fusion::Variable>();
}
// End mosek.fusion.Var.index_permute_

// Begin mosek.fusion.Var.hrepeat
// Method mosek.fusion.Var.hrepeat @ bld/grindsted/final/default/src/fusion/Var.monty:630:6-106
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::hrepeat
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2684_v,
    int32_t _2685_n) { return mosek::fusion::p_Var::hrepeat(_2684_v,_2685_n); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::hrepeat(monty::rc_ptr< ::mosek::fusion::Variable > _2684_v,int32_t _2685_n)
{
  return ::mosek::fusion::p_Var::drepeat(_2684_v,(int)1,_2685_n);
}
// End mosek.fusion.Var.hrepeat

// Begin mosek.fusion.Var.vrepeat
// Method mosek.fusion.Var.vrepeat @ bld/grindsted/final/default/src/fusion/Var.monty:629:6-106
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::vrepeat
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2686_v,
    int32_t _2687_n) { return mosek::fusion::p_Var::vrepeat(_2686_v,_2687_n); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::vrepeat(monty::rc_ptr< ::mosek::fusion::Variable > _2686_v,int32_t _2687_n)
{
  return ::mosek::fusion::p_Var::drepeat(_2686_v,(int)0,_2687_n);
}
// End mosek.fusion.Var.vrepeat

// Begin mosek.fusion.Var.repeat
// Method mosek.fusion.Var.repeat @ bld/grindsted/final/default/src/fusion/Var.monty:628:6-106
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::repeat
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2688_v,
    int32_t _2689_n) { return mosek::fusion::p_Var::repeat(_2688_v,_2689_n); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::repeat(monty::rc_ptr< ::mosek::fusion::Variable > _2688_v,int32_t _2689_n)
{
  return ::mosek::fusion::p_Var::drepeat(_2688_v,(int)0,_2689_n);
}
// End mosek.fusion.Var.repeat

// Begin mosek.fusion.Var.repeat
// Method mosek.fusion.Var.repeat @ bld/grindsted/final/default/src/fusion/Var.monty:627:6-106
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::repeat
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2690_v,
    int32_t _2691_n,
    int32_t _2692_dim) { return mosek::fusion::p_Var::repeat(_2690_v,_2691_n,_2692_dim); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::repeat(monty::rc_ptr< ::mosek::fusion::Variable > _2690_v,int32_t _2691_n,int32_t _2692_dim)
{
  return ::mosek::fusion::p_Var::drepeat(_2690_v,_2692_dim,_2691_n);
}
// End mosek.fusion.Var.repeat

// Begin mosek.fusion.Var.drepeat
// Method mosek.fusion.Var.drepeat @ bld/grindsted/final/default/src/fusion/Var.monty:472:6-625:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::drepeat(monty::rc_ptr< ::mosek::fusion::Variable > _2693_v,int32_t _2694_dim,int32_t _2695_n)
{
  if ((_2695_n < (int)0))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Cannot repeat less than 0 times"));
    }
  }
  else if((_2695_n == (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2696_vshape = _2693_v->getShape();
      _checked_ptr_1<int32_t> _ptr__2696_vshape(_2696_vshape ? _2696_vshape->raw() : nullptr,_2696_vshape ? _2696_vshape->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2697_shape = _2696_vshape;
      _checked_ptr_1<int32_t> _ptr__2697_shape(_2697_shape ? _2697_shape->raw() : nullptr,_2697_shape ? _2697_shape->size(0) : 0);
      if (((int)((_2696_vshape)->size(0)) == _2694_dim))
      {
        {
          _2697_shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _2694_dim,(int)1 ))));
          _ptr__2697_shape.update(_2697_shape ? _2697_shape->raw() : nullptr, _2697_shape ? _2697_shape->size(0) : 0);
          int32_t _10461_ = (int)0;
          int32_t _10462_ = _2694_dim;
          for (int32_t _2698_i = _10461_; _2698_i < _10462_; ++_2698_i)
          {
            {
              _ptr__2697_shape[_2698_i] = _ptr__2696_vshape[_2698_i];
            }
          }
        }
      }
      {}
      _ptr__2697_shape[_2694_dim] = (int)0;
      ::mosek::fusion::p_Debug::o()->__mosek_2fusion_2Debug__p(std::string ("drepeat dim="))->__mosek_2fusion_2Debug__p(_2694_dim)->__mosek_2fusion_2Debug__p(std::string (", n="))->__mosek_2fusion_2Debug__p(_2695_n)->__mosek_2fusion_2Debug__p(std::string (", shape="))->__mosek_2fusion_2Debug__p(_2693_v->getShape())->__mosek_2fusion_2Debug__p(std::string (" -> "))->__mosek_2fusion_2Debug__p(_2697_shape)->__mosek_2fusion_2Debug__lf();
      return (::mosek::fusion::p_NilVariable::_new_NilVariable(_2697_shape)).as<::mosek::fusion::Variable>();
    }
  }
  else if((_2695_n == (int)1))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2699_vshape = _2693_v->getShape();
      _checked_ptr_1<int32_t> _ptr__2699_vshape(_2699_vshape ? _2699_vshape->raw() : nullptr,_2699_vshape ? _2699_vshape->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2700_shape = _2699_vshape;
      _checked_ptr_1<int32_t> _ptr__2700_shape(_2700_shape ? _2700_shape->raw() : nullptr,_2700_shape ? _2700_shape->size(0) : 0);
      if (((int)((_2699_vshape)->size(0)) == _2694_dim))
      {
        {
          _2700_shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _2694_dim,(int)1 ))));
          _ptr__2700_shape.update(_2700_shape ? _2700_shape->raw() : nullptr, _2700_shape ? _2700_shape->size(0) : 0);
          int32_t _10463_ = (int)0;
          int32_t _10464_ = _2694_dim;
          for (int32_t _2701_i = _10463_; _2701_i < _10464_; ++_2701_i)
          {
            {
              _ptr__2700_shape[_2701_i] = _ptr__2699_vshape[_2701_i];
            }
          }
          _ptr__2700_shape[_2694_dim] = (int)1;
        }
      }
      {}
      ::mosek::fusion::p_Debug::o()->__mosek_2fusion_2Debug__p(std::string ("drepeat dim="))->__mosek_2fusion_2Debug__p(_2694_dim)->__mosek_2fusion_2Debug__p(std::string (", n="))->__mosek_2fusion_2Debug__p(_2695_n)->__mosek_2fusion_2Debug__p(std::string (", shape="))->__mosek_2fusion_2Debug__p(_2693_v->getShape())->__mosek_2fusion_2Debug__p(std::string (" -> "))->__mosek_2fusion_2Debug__p(_2700_shape)->__mosek_2fusion_2Debug__lf();
      return _2693_v;
    }
  }
  else
  {
    {
      monty::rc_ptr< ::mosek::fusion::Model > _2702_model = _2693_v->__mosek_2fusion_2Expression__getModel();
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2703_shape = _2693_v->getShape();
      _checked_ptr_1<int32_t> _ptr__2703_shape(_2703_shape ? _2703_shape->raw() : nullptr,_2703_shape ? _2703_shape->size(0) : 0);
      int32_t _2704_nd = (int)((_2703_shape)->size(0));
      if (((_2694_dim < (int)0) || (_2694_dim > _2704_nd)))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Invalid stacking dimension"));
        }
      }
      {}
      int64_t _2705_domsize = ::mosek::fusion::p_Set::size(_2703_shape);
      int32_t _2706_nnz = _2693_v->numInst();
      int32_t _2707_rnnz = safe_mul( _2706_nnz,_2695_n );
      int32_t _2708_d0 = (int)1;
      int32_t _10465_ = (int)0;
      int32_t _10466_ = _2694_dim;
      for (int32_t _2709_i = _10465_; _2709_i < _10466_; ++_2709_i)
      {
        {
          _2708_d0 *= _ptr__2703_shape[_2709_i];
        }
      }
      int32_t _10467_;
      bool _10468_ = (_2694_dim < _2704_nd);
      if (_10468_)
      {
        _10467_ = _ptr__2703_shape[_2694_dim];
      }
      else
      {
        _10467_ = (int)1;
      }
      int32_t _2710_d1 = _10467_;
      int32_t _2711_nd1 = safe_mul( _2710_d1,_2695_n );
      int32_t _2712_d2 = (int)1;
      int32_t _10469_ = safe_add( _2694_dim,(int)1 );
      int32_t _10470_ = _2704_nd;
      for (int32_t _2713_i = _10469_; _2713_i < _10470_; ++_2713_i)
      {
        {
          _2712_d2 *= _ptr__2703_shape[_2713_i];
        }
      }
      int32_t _10471_;
      bool _10472_ = (_2694_dim < _2704_nd);
      if (_10472_)
      {
        _10471_ = _2704_nd;
      }
      else
      {
        _10471_ = safe_add( _2694_dim,(int)1 );
      }
      int32_t _2714_rnd = _10471_;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2715_rshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2714_rnd)));
      _checked_ptr_1<int32_t> _ptr__2715_rshape(_2715_rshape ? _2715_rshape->raw() : nullptr,_2715_rshape ? _2715_rshape->size(0) : 0);
      int32_t _10473_ = (int)0;
      int32_t _10474_ = _2704_nd;
      for (int32_t _2716_i = _10473_; _2716_i < _10474_; ++_2716_i)
      {
        {
          _ptr__2715_rshape[_2716_i] = _ptr__2703_shape[_2716_i];
        }
      }
      int32_t _10475_ = _2704_nd;
      int32_t _10476_ = _2714_rnd;
      for (int32_t _2717_i = _10475_; _2717_i < _10476_; ++_2717_i)
      {
        {
          _ptr__2715_rshape[_2717_i] = (int)1;
        }
      }
      _ptr__2715_rshape[_2694_dim] = _2711_nd1;
      if ((_2706_nnz < _2705_domsize))
      {
        {
          std::shared_ptr< monty::ndarray< int64_t,1 > > _2718_tnativeidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2706_nnz)));
          _checked_ptr_1<int64_t> _ptr__2718_tnativeidxs(_2718_tnativeidxs ? _2718_tnativeidxs->raw() : nullptr,_2718_tnativeidxs ? _2718_tnativeidxs->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _2719_tsp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2706_nnz)));
          _checked_ptr_1<int64_t> _ptr__2719_tsp(_2719_tsp ? _2719_tsp->raw() : nullptr,_2719_tsp ? _2719_tsp->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _2720_rnativeidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2707_rnnz)));
          _checked_ptr_1<int64_t> _ptr__2720_rnativeidxs(_2720_rnativeidxs ? _2720_rnativeidxs->raw() : nullptr,_2720_rnativeidxs ? _2720_rnativeidxs->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _2721_rsp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2707_rnnz)));
          _checked_ptr_1<int64_t> _ptr__2721_rsp(_2721_rsp ? _2721_rsp->raw() : nullptr,_2721_rsp ? _2721_rsp->size(0) : 0);
          _2693_v->inst((int)0,_2719_tsp,(int)0,_2718_tnativeidxs);
          {
            int32_t _2722_ns0 = safe_mul( _2711_nd1,_2712_d2 );
            int32_t _2723_s0 = safe_mul( _2710_d1,_2712_d2 );
            int32_t _2724_s1 = _2712_d2;
            if ((_2694_dim == (int)0))
            {
              {
                int32_t _2725_k = (int)0;
                int32_t _10477_ = (int)0;
                int32_t _10478_ = _2695_n;
                for (int32_t _2726_i = _10477_; _2726_i < _10478_; ++_2726_i)
                {
                  {
                    int32_t _10479_ = (int)0;
                    int32_t _10480_ = _2706_nnz;
                    for (int32_t _2727_j = _10479_; _2727_j < _10480_; ++_2727_j)
                    {
                      {
                        _ptr__2721_rsp[_2725_k] = safe_add( _ptr__2719_tsp[_2727_j],safe_mul( _2726_i,_2705_domsize ) );
                        _ptr__2720_rnativeidxs[_2725_k] = _ptr__2718_tnativeidxs[_2727_j];
                        ++ _2725_k;
                      }
                    }
                  }
                }
                return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_2702_model,_2715_rshape,_2721_rsp,_2720_rnativeidxs)).as<::mosek::fusion::Variable>();
              }
            }
            else if((_2694_dim >= _2704_nd))
            {
              {
                int32_t _2728_k = (int)0;
                int32_t _10481_ = (int)0;
                int32_t _10482_ = _2706_nnz;
                for (int32_t _2729_j = _10481_; _2729_j < _10482_; ++_2729_j)
                {
                  {
                    int32_t _10483_ = (int)0;
                    int32_t _10484_ = _2695_n;
                    for (int32_t _2730_i = _10483_; _2730_i < _10484_; ++_2730_i)
                    {
                      {
                        _ptr__2721_rsp[_2728_k] = safe_add( safe_mul( _ptr__2719_tsp[_2729_j],_2695_n ),_2730_i );
                        _ptr__2720_rnativeidxs[_2728_k] = _ptr__2718_tnativeidxs[_2729_j];
                        ++ _2728_k;
                      }
                    }
                  }
                }
                return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_2702_model,_2715_rshape,_2721_rsp,_2720_rnativeidxs)).as<::mosek::fusion::Variable>();
              }
            }
            else
            {
              {
                int32_t _2731_k = (int)0;
                int32_t _10485_ = (int)0;
                int32_t _10486_ = _2706_nnz;
                for (int32_t _2732_i = _10485_; _2732_i < _10486_; ++_2732_i)
                {
                  {
                    int64_t _2733_i0 = (_ptr__2719_tsp[_2732_i] / _2723_s0);
                    int64_t _2734_i1 = ((_ptr__2719_tsp[_2732_i] / _2724_s1) % _2710_d1);
                    int64_t _2735_i2 = (_ptr__2719_tsp[_2732_i] % _2712_d2);
                    int32_t _10487_ = (int)0;
                    int32_t _10488_ = _2695_n;
                    for (int32_t _2736_j = _10487_; _2736_j < _10488_; ++_2736_j)
                    {
                      {
                        _ptr__2721_rsp[_2731_k] = safe_add( safe_add( safe_mul( _2733_i0,_2722_ns0 ),safe_mul( safe_add( _2734_i1,safe_mul( _2710_d1,_2736_j ) ),_2712_d2 ) ),_2735_i2 );
                        _ptr__2720_rnativeidxs[_2731_k] = _ptr__2718_tnativeidxs[_2732_i];
                        ++ _2731_k;
                      }
                    }
                  }
                }
                int32_t _2737_maxdim = (int)1;
                int32_t _10489_ = (int)0;
                int32_t _10490_ = _2714_rnd;
                for (int32_t _2738_i = _10489_; _2738_i < _10490_; ++_2738_i)
                {
                  {
                    if ((_2737_maxdim < _ptr__2715_rshape[_2738_i]))
                    {
                      {
                        _2737_maxdim = _ptr__2715_rshape[_2738_i];
                      }
                    }
                    {}
                  }
                }
                std::shared_ptr< monty::ndarray< int32_t,1 > > _2739_curperm = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2707_rnnz)));
                _checked_ptr_1<int32_t> _ptr__2739_curperm(_2739_curperm ? _2739_curperm->raw() : nullptr,_2739_curperm ? _2739_curperm->size(0) : 0);
                std::shared_ptr< monty::ndarray< int32_t,1 > > _2740_tgtperm = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2707_rnnz)));
                _checked_ptr_1<int32_t> _ptr__2740_tgtperm(_2740_tgtperm ? _2740_tgtperm->raw() : nullptr,_2740_tgtperm ? _2740_tgtperm->size(0) : 0);
                {
                  std::shared_ptr< monty::ndarray< int32_t,1 > > _2741_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _2737_maxdim,(int)1 ))));
                  _checked_ptr_1<int32_t> _ptr__2741_ptr(_2741_ptr ? _2741_ptr->raw() : nullptr,_2741_ptr ? _2741_ptr->size(0) : 0);
                  std::shared_ptr< monty::ndarray< int64_t,1 > > _2742_s = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2714_rnd)));
                  _checked_ptr_1<int64_t> _ptr__2742_s(_2742_s ? _2742_s->raw() : nullptr,_2742_s ? _2742_s->size(0) : 0);
                  _ptr__2742_s[(_2714_rnd - (int)1)] = (int)1;
                  int32_t _10491_ = (int)1;
                  int32_t _10492_ = _2714_rnd;
                  for (int32_t _2743_i = _10491_; _2743_i < _10492_; ++_2743_i)
                  {
                    {
                      _ptr__2742_s[((_2714_rnd - _2743_i) - (int)1)] = safe_mul( _ptr__2742_s[(_2714_rnd - _2743_i)],_ptr__2715_rshape[(_2714_rnd - _2743_i)] );
                    }
                  }
                  int32_t _10493_ = (int)0;
                  int32_t _10494_ = _2707_rnnz;
                  for (int32_t _2744_i = _10493_; _2744_i < _10494_; ++_2744_i)
                  {
                    {
                      _ptr__2739_curperm[_2744_i] = _2744_i;
                    }
                  }
                  int32_t _10495_ = (int)0;
                  int32_t _10496_ = _2714_rnd;
                  for (int32_t _2745_ii = _10495_; _2745_ii < _10496_; ++_2745_ii)
                  {
                    {
                      int32_t _2746_i = ((_2714_rnd - _2745_ii) - (int)1);
                      int32_t _10497_ = (int)0;
                      int32_t _10498_ = safe_add( _ptr__2715_rshape[_2746_i],(int)1 );
                      for (int32_t _2747_j = _10497_; _2747_j < _10498_; ++_2747_j)
                      {
                        {
                          _ptr__2741_ptr[_2747_j] = (int)0;
                        }
                      }
                      int32_t _10499_ = (int)0;
                      int32_t _10500_ = _2707_rnnz;
                      for (int32_t _2748_j = _10499_; _2748_j < _10500_; ++_2748_j)
                      {
                        {
                          ++ _ptr__2741_ptr[safe_add( ((_ptr__2721_rsp[_2748_j] / _ptr__2742_s[_2746_i]) % _ptr__2715_rshape[_2746_i]),(int)1 )];
                        }
                      }
                      int32_t _10501_ = (int)0;
                      int32_t _10502_ = _ptr__2715_rshape[_2746_i];
                      for (int32_t _2749_j = _10501_; _2749_j < _10502_; ++_2749_j)
                      {
                        {
                          _ptr__2741_ptr[safe_add( _2749_j,(int)1 )] += _ptr__2741_ptr[_2749_j];
                        }
                      }
                      int32_t _10503_ = (int)0;
                      int32_t _10504_ = _2707_rnnz;
                      for (int32_t _2750_jj = _10503_; _2750_jj < _10504_; ++_2750_jj)
                      {
                        {
                          int32_t _2751_j = _ptr__2739_curperm[_2750_jj];
                          int64_t _2752_idx = ((_ptr__2721_rsp[_2751_j] / _ptr__2742_s[_2746_i]) % _ptr__2715_rshape[_2746_i]);
                          _ptr__2740_tgtperm[_ptr__2741_ptr[_2752_idx]] = _2751_j;
                          ++ _ptr__2741_ptr[_2752_idx];
                        }
                      }
                      std::shared_ptr< monty::ndarray< int32_t,1 > > _2753_tmp = _2739_curperm;
                      _checked_ptr_1<int32_t> _ptr__2753_tmp(_2753_tmp ? _2753_tmp->raw() : nullptr,_2753_tmp ? _2753_tmp->size(0) : 0);
                      _2739_curperm = _2740_tgtperm;
                      _ptr__2739_curperm.update(_2739_curperm ? _2739_curperm->raw() : nullptr, _2739_curperm ? _2739_curperm->size(0) : 0);
                      _2740_tgtperm = _2753_tmp;
                      _ptr__2740_tgtperm.update(_2740_tgtperm ? _2740_tgtperm->raw() : nullptr, _2740_tgtperm ? _2740_tgtperm->size(0) : 0);
                    }
                  }
                }
                std::vector<int64_t> _10505_;
                for (int32_t _2754_i = (int)0, _10506_ = _2707_rnnz; _2754_i < _10506_ ; ++_2754_i)
                {
                  _10505_.push_back(_ptr__2721_rsp[_ptr__2739_curperm[_2754_i]]);
                }
                auto _10507_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10505_.size()),_10505_.begin(),_10505_.end()));
                std::vector<int64_t> _10508_;
                for (int32_t _2755_i = (int)0, _10509_ = _2707_rnnz; _2755_i < _10509_ ; ++_2755_i)
                {
                  _10508_.push_back(_ptr__2720_rnativeidxs[_ptr__2739_curperm[_2755_i]]);
                }
                auto _10510_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10508_.size()),_10508_.begin(),_10508_.end()));
                return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_2702_model,_2715_rshape,_10507_,_10510_)).as<::mosek::fusion::Variable>();
              }
            }
          }
        }
      }
      else
      {
        {
          std::shared_ptr< monty::ndarray< int64_t,1 > > _2756_tnativeidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2706_nnz)));
          _checked_ptr_1<int64_t> _ptr__2756_tnativeidxs(_2756_tnativeidxs ? _2756_tnativeidxs->raw() : nullptr,_2756_tnativeidxs ? _2756_tnativeidxs->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _2757_rnativeidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_mul( _2706_nnz,_2695_n ))));
          _checked_ptr_1<int64_t> _ptr__2757_rnativeidxs(_2757_rnativeidxs ? _2757_rnativeidxs->raw() : nullptr,_2757_rnativeidxs ? _2757_rnativeidxs->size(0) : 0);
          _2693_v->inst((int)0,_2756_tnativeidxs);
          int32_t _2758_s0 = safe_mul( _2711_nd1,_2712_d2 );
          int32_t _2759_s1 = _2712_d2;
          int32_t _2760_k = (int)0;
          int32_t _10511_ = (int)0;
          int32_t _10512_ = _2708_d0;
          for (int32_t _2761_i0 = _10511_; _2761_i0 < _10512_; ++_2761_i0)
          {
            {
              int32_t _10513_ = (int)0;
              int32_t _10514_ = _2710_d1;
              for (int32_t _2762_i1 = _10513_; _2762_i1 < _10514_; ++_2762_i1)
              {
                {
                  int32_t _10515_ = (int)0;
                  int32_t _10516_ = _2712_d2;
                  for (int32_t _2763_i2 = _10515_; _2763_i2 < _10516_; ++_2763_i2)
                  {
                    {
                      int32_t _10517_ = (int)0;
                      int32_t _10518_ = _2695_n;
                      for (int32_t _2764_j = _10517_; _2764_j < _10518_; ++_2764_j)
                      {
                        {
                          _ptr__2757_rnativeidxs[safe_add( safe_add( safe_mul( _2761_i0,_2758_s0 ),safe_mul( safe_add( _2762_i1,safe_mul( _2764_j,_2710_d1 ) ),_2759_s1 ) ),_2763_i2 )] = _ptr__2756_tnativeidxs[_2760_k];
                        }
                      }
                      ++ _2760_k;
                    }
                  }
                }
              }
            }
          }
          return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_2702_model,_2715_rshape,nullptr,_2757_rnativeidxs)).as<::mosek::fusion::Variable>();
        }
      }
    }
  }
}
// End mosek.fusion.Var.drepeat

// Begin mosek.fusion.Var.stack
// Method mosek.fusion.Var.stack @ bld/grindsted/final/default/src/fusion/Var.monty:450:6-454:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::stack
  ( std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >,1 > > _2765_vlist) { return mosek::fusion::p_Var::stack(_2765_vlist); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::stack(std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >,1 > > _2765_vlist)
{
  std::vector<monty::rc_ptr< ::mosek::fusion::Variable >> _10519_;
  for (int32_t _2766_i = (int)0, _10520_ = (int)((_2765_vlist)->size(0)); _2766_i < _10520_ ; ++_2766_i)
  {
    _10519_.push_back(::mosek::fusion::p_Var::dstack(((*_2765_vlist)(_2766_i)),(int)1));
  }
  auto _10521_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 >(monty::shape(_10519_.size()),_10519_.begin(),_10519_.end()));
  return ::mosek::fusion::p_Var::dstack(_10521_,(int)0);
}
// End mosek.fusion.Var.stack

// Begin mosek.fusion.Var.vstack
// Method mosek.fusion.Var.vstack @ bld/grindsted/final/default/src/fusion/Var.monty:414:6-420:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::vstack
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2767_v1,
    monty::rc_ptr< ::mosek::fusion::Variable > _2768_v2,
    monty::rc_ptr< ::mosek::fusion::Variable > _2769_v3) { return mosek::fusion::p_Var::vstack(_2767_v1,_2768_v2,_2769_v3); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::vstack(monty::rc_ptr< ::mosek::fusion::Variable > _2767_v1,monty::rc_ptr< ::mosek::fusion::Variable > _2768_v2,monty::rc_ptr< ::mosek::fusion::Variable > _2769_v3)
{
  return ::mosek::fusion::p_Var::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 >{::monty::rc_ptr<::mosek::fusion::Variable>(_2767_v1.get()),::monty::rc_ptr<::mosek::fusion::Variable>(_2768_v2.get()),::monty::rc_ptr<::mosek::fusion::Variable>(_2769_v3.get())}),(int)0);
}
// End mosek.fusion.Var.vstack

// Begin mosek.fusion.Var.vstack
// Method mosek.fusion.Var.vstack @ bld/grindsted/final/default/src/fusion/Var.monty:396:6-401:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::vstack
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2770_v1,
    monty::rc_ptr< ::mosek::fusion::Variable > _2771_v2) { return mosek::fusion::p_Var::vstack(_2770_v1,_2771_v2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::vstack(monty::rc_ptr< ::mosek::fusion::Variable > _2770_v1,monty::rc_ptr< ::mosek::fusion::Variable > _2771_v2)
{
  return ::mosek::fusion::p_Var::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 >{::monty::rc_ptr<::mosek::fusion::Variable>(_2770_v1.get()),::monty::rc_ptr<::mosek::fusion::Variable>(_2771_v2.get())}),(int)0);
}
// End mosek.fusion.Var.vstack

// Begin mosek.fusion.Var.vstack
// Method mosek.fusion.Var.vstack @ bld/grindsted/final/default/src/fusion/Var.monty:377:6-381:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::vstack
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _2772_v) { return mosek::fusion::p_Var::vstack(_2772_v); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::vstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _2772_v)
{
  return ::mosek::fusion::p_Var::dstack(_2772_v,(int)0);
}
// End mosek.fusion.Var.vstack

// Begin mosek.fusion.Var.hstack
// Method mosek.fusion.Var.hstack @ bld/grindsted/final/default/src/fusion/Var.monty:357:6-363:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::hstack
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2773_v1,
    monty::rc_ptr< ::mosek::fusion::Variable > _2774_v2,
    monty::rc_ptr< ::mosek::fusion::Variable > _2775_v3) { return mosek::fusion::p_Var::hstack(_2773_v1,_2774_v2,_2775_v3); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::hstack(monty::rc_ptr< ::mosek::fusion::Variable > _2773_v1,monty::rc_ptr< ::mosek::fusion::Variable > _2774_v2,monty::rc_ptr< ::mosek::fusion::Variable > _2775_v3)
{
  return ::mosek::fusion::p_Var::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 >{::monty::rc_ptr<::mosek::fusion::Variable>(_2773_v1.get()),::monty::rc_ptr<::mosek::fusion::Variable>(_2774_v2.get()),::monty::rc_ptr<::mosek::fusion::Variable>(_2775_v3.get())}),(int)1);
}
// End mosek.fusion.Var.hstack

// Begin mosek.fusion.Var.hstack
// Method mosek.fusion.Var.hstack @ bld/grindsted/final/default/src/fusion/Var.monty:336:6-341:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::hstack
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2776_v1,
    monty::rc_ptr< ::mosek::fusion::Variable > _2777_v2) { return mosek::fusion::p_Var::hstack(_2776_v1,_2777_v2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::hstack(monty::rc_ptr< ::mosek::fusion::Variable > _2776_v1,monty::rc_ptr< ::mosek::fusion::Variable > _2777_v2)
{
  return ::mosek::fusion::p_Var::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 >{::monty::rc_ptr<::mosek::fusion::Variable>(_2776_v1.get()),::monty::rc_ptr<::mosek::fusion::Variable>(_2777_v2.get())}),(int)1);
}
// End mosek.fusion.Var.hstack

// Begin mosek.fusion.Var.hstack
// Method mosek.fusion.Var.hstack @ bld/grindsted/final/default/src/fusion/Var.monty:315:6-319:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::hstack
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _2778_v) { return mosek::fusion::p_Var::hstack(_2778_v); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::hstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _2778_v)
{
  return ::mosek::fusion::p_Var::dstack(_2778_v,(int)1);
}
// End mosek.fusion.Var.hstack

// Begin mosek.fusion.Var.stack
// Method mosek.fusion.Var.stack @ bld/grindsted/final/default/src/fusion/Var.monty:298:6-91
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::stack
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _2779_v,
    int32_t _2780_dim) { return mosek::fusion::p_Var::stack(_2779_v,_2780_dim); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::stack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _2779_v,int32_t _2780_dim)
{
  return ::mosek::fusion::p_Var::stack(_2780_dim,_2779_v);
}
// End mosek.fusion.Var.stack

// Begin mosek.fusion.Var.stack
// Method mosek.fusion.Var.stack @ bld/grindsted/final/default/src/fusion/Var.monty:297:6-130
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::stack
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2781_v1,
    monty::rc_ptr< ::mosek::fusion::Variable > _2782_v2,
    monty::rc_ptr< ::mosek::fusion::Variable > _2783_v3,
    int32_t _2784_dim) { return mosek::fusion::p_Var::stack(_2781_v1,_2782_v2,_2783_v3,_2784_dim); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::stack(monty::rc_ptr< ::mosek::fusion::Variable > _2781_v1,monty::rc_ptr< ::mosek::fusion::Variable > _2782_v2,monty::rc_ptr< ::mosek::fusion::Variable > _2783_v3,int32_t _2784_dim)
{
  return ::mosek::fusion::p_Var::stack(_2784_dim,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 >{::monty::rc_ptr<::mosek::fusion::Variable>(_2781_v1.get()),::monty::rc_ptr<::mosek::fusion::Variable>(_2782_v2.get()),::monty::rc_ptr<::mosek::fusion::Variable>(_2783_v3.get())}));
}
// End mosek.fusion.Var.stack

// Begin mosek.fusion.Var.stack
// Method mosek.fusion.Var.stack @ bld/grindsted/final/default/src/fusion/Var.monty:296:6-114
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::stack
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2785_v1,
    monty::rc_ptr< ::mosek::fusion::Variable > _2786_v2,
    int32_t _2787_dim) { return mosek::fusion::p_Var::stack(_2785_v1,_2786_v2,_2787_dim); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::stack(monty::rc_ptr< ::mosek::fusion::Variable > _2785_v1,monty::rc_ptr< ::mosek::fusion::Variable > _2786_v2,int32_t _2787_dim)
{
  return ::mosek::fusion::p_Var::stack(_2787_dim,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 >{::monty::rc_ptr<::mosek::fusion::Variable>(_2785_v1.get()),::monty::rc_ptr<::mosek::fusion::Variable>(_2786_v2.get())}));
}
// End mosek.fusion.Var.stack

// Begin mosek.fusion.Var.stack
// Method mosek.fusion.Var.stack @ bld/grindsted/final/default/src/fusion/Var.monty:290:6-293:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::stack
  ( int32_t _2788_dim,
    std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _2789_v) { return mosek::fusion::p_Var::stack(_2788_dim,_2789_v); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::stack(int32_t _2788_dim,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _2789_v)
{
  int32_t _2790_maxnd = _2788_dim;
  int32_t _10522_ = (int)0;
  int32_t _10523_ = (int)((_2789_v)->size(0));
  for (int32_t _2791_i = _10522_; _2791_i < _10523_; ++_2791_i)
  {
    {
      if ((_2790_maxnd < ((*_2789_v)(_2791_i))->getND()))
      {
        {
          _2790_maxnd = ((*_2789_v)(_2791_i))->getND();
        }
      }
      {}
    }
  }
  return ::mosek::fusion::p_Var::dstack(_2789_v,_2788_dim);
}
// End mosek.fusion.Var.stack

// Begin mosek.fusion.Var.stack
// Method mosek.fusion.Var.stack @ bld/grindsted/final/default/src/fusion/Var.monty:289:6-131
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::stack
  ( int32_t _2792_dim,
    monty::rc_ptr< ::mosek::fusion::Variable > _2793_v1,
    monty::rc_ptr< ::mosek::fusion::Variable > _2794_v2,
    monty::rc_ptr< ::mosek::fusion::Variable > _2795_v3) { return mosek::fusion::p_Var::stack(_2792_dim,_2793_v1,_2794_v2,_2795_v3); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::stack(int32_t _2792_dim,monty::rc_ptr< ::mosek::fusion::Variable > _2793_v1,monty::rc_ptr< ::mosek::fusion::Variable > _2794_v2,monty::rc_ptr< ::mosek::fusion::Variable > _2795_v3)
{
  return ::mosek::fusion::p_Var::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 >{::monty::rc_ptr<::mosek::fusion::Variable>(_2793_v1.get()),::monty::rc_ptr<::mosek::fusion::Variable>(_2794_v2.get()),::monty::rc_ptr<::mosek::fusion::Variable>(_2795_v3.get())}),_2792_dim);
}
// End mosek.fusion.Var.stack

// Begin mosek.fusion.Var.stack
// Method mosek.fusion.Var.stack @ bld/grindsted/final/default/src/fusion/Var.monty:288:6-115
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::stack
  ( int32_t _2796_dim,
    monty::rc_ptr< ::mosek::fusion::Variable > _2797_v1,
    monty::rc_ptr< ::mosek::fusion::Variable > _2798_v2) { return mosek::fusion::p_Var::stack(_2796_dim,_2797_v1,_2798_v2); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::stack(int32_t _2796_dim,monty::rc_ptr< ::mosek::fusion::Variable > _2797_v1,monty::rc_ptr< ::mosek::fusion::Variable > _2798_v2)
{
  return ::mosek::fusion::p_Var::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 >{::monty::rc_ptr<::mosek::fusion::Variable>(_2797_v1.get()),::monty::rc_ptr<::mosek::fusion::Variable>(_2798_v2.get())}),_2796_dim);
}
// End mosek.fusion.Var.stack

// Begin mosek.fusion.Var.promote
// Method mosek.fusion.Var.promote @ bld/grindsted/final/default/src/fusion/Var.monty:275:6-285:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::Var::promote
  ( monty::rc_ptr< ::mosek::fusion::Variable > _2799_v,
    int32_t _2800_nd) { return mosek::fusion::p_Var::promote(_2799_v,_2800_nd); }
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::promote(monty::rc_ptr< ::mosek::fusion::Variable > _2799_v,int32_t _2800_nd)
{
  if ((_2800_nd > _2799_v->getND()))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2801_shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2800_nd)));
      _checked_ptr_1<int32_t> _ptr__2801_shape(_2801_shape ? _2801_shape->raw() : nullptr,_2801_shape ? _2801_shape->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2802_sh = _2799_v->getShape();
      _checked_ptr_1<int32_t> _ptr__2802_sh(_2802_sh ? _2802_sh->raw() : nullptr,_2802_sh ? _2802_sh->size(0) : 0);
      int32_t _10524_ = (int)0;
      int32_t _10525_ = (int)((_2802_sh)->size(0));
      for (int32_t _2803_i = _10524_; _2803_i < _10525_; ++_2803_i)
      {
        {
          _ptr__2801_shape[_2803_i] = _ptr__2802_sh[_2803_i];
        }
      }
      int32_t _10526_ = (int)((_2802_sh)->size(0));
      int32_t _10527_ = _2800_nd;
      for (int32_t _2804_i = _10526_; _2804_i < _10527_; ++_2804_i)
      {
        {
          _ptr__2801_shape[_2804_i] = (int)1;
        }
      }
      return _2799_v->__mosek_2fusion_2Variable__reshape(_2801_shape);
    }
  }
  else
  {
    {
      return _2799_v;
    }
  }
}
// End mosek.fusion.Var.promote

// Begin mosek.fusion.Var.dstack
// Method mosek.fusion.Var.dstack @ bld/grindsted/final/default/src/fusion/Var.monty:151:6-267:7
monty::rc_ptr< ::mosek::fusion::Variable > mosek::fusion::p_Var::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _2805_v,int32_t _2806_dim)
{
  if ((_2806_dim < (int)0))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid stacking dimension"));
    }
  }
  {}
  monty::rc_ptr< ::mosek::fusion::Model > _2807_m0 = nullptr;
  {
    int32_t _10528_ = (int)0;
    int32_t _10529_ = (int)((_2805_v)->size(0));
    for (int32_t _2808_i = _10528_; _2808_i < _10529_; ++_2808_i)
    {
      {
        if ((NULL == _2807_m0.get()))
        {
          {
            _2807_m0 = ((*_2805_v)(_2808_i))->__mosek_2fusion_2Expression__getModel();
          }
        }
        else if(((NULL != ((*_2805_v)(_2808_i))->__mosek_2fusion_2Expression__getModel().get()) && (((*_2805_v)(_2808_i))->__mosek_2fusion_2Expression__getModel() != _2807_m0)))
        {
          {
            monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2809_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
            std::string _10530_;
            bool _10531_ = ((int)((mosek::fusion::p_Model::_get_impl(_2807_m0.get())->getName()).size()) > (int)0);
            if (_10531_)
            {
              _10530_ = mosek::fusion::p_Model::_get_impl(_2807_m0.get())->getName();
            }
            else
            {
              _10530_ = std::string ("?");
            }
            std::string _2810_m1name = _10530_;
            std::string _10532_;
            bool _10533_ = ((int)((mosek::fusion::p_Model::_get_impl(((*_2805_v)(_2808_i))->__mosek_2fusion_2Expression__getModel().get())->getName()).size()) > (int)0);
            if (_10533_)
            {
              _10532_ = mosek::fusion::p_Model::_get_impl(((*_2805_v)(_2808_i))->__mosek_2fusion_2Expression__getModel().get())->getName();
            }
            else
            {
              _10532_ = std::string ("?");
            }
            std::string _2811_m2name = _10532_;
            _2809_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Variables belong to different models: '"))->__mosek_2fusion_2Utils_2StringBuffer__a(_2810_m1name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("' and '"))->__mosek_2fusion_2Utils_2StringBuffer__a(_2811_m2name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"));
            throw ::mosek::fusion::ModelError(_2809_sb->toString());
          }
        }
        {}
      }
    }
  }
  if (((int)((_2805_v)->size(0)) == (int)0))
  {
    {
      return (::mosek::fusion::p_NilVariable::_new_NilVariable()).as<::mosek::fusion::Variable>();
    }
  }
  else if(((int)((_2805_v)->size(0)) == (int)1))
  {
    {
      return ((*_2805_v)((int)0));
    }
  }
  else
  {
    {
      int32_t _2812_n = (int)((_2805_v)->size(0));
      std::vector<int32_t> _10534_;
      for (int32_t _2814_i = (int)0, _10535_ = _2812_n; _2814_i < _10535_ ; ++_2814_i)
      {
        _10534_.push_back(((*_2805_v)(_2814_i))->numInst());
      }
      auto _10536_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10534_.size()),_10534_.begin(),_10534_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2813_numnz = _10536_;
      _checked_ptr_1<int32_t> _ptr__2813_numnz(_2813_numnz ? _2813_numnz->raw() : nullptr,_2813_numnz ? _2813_numnz->size(0) : 0);
      std::vector<std::shared_ptr< monty::ndarray< int32_t,1 > >> _10537_;
      for (int32_t _2816_i = (int)0, _10538_ = _2812_n; _2816_i < _10538_ ; ++_2816_i)
      {
        _10537_.push_back(((*_2805_v)(_2816_i))->getShape());
      }
      auto _10539_ = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 >(monty::shape(_10537_.size()),_10537_.begin(),_10537_.end()));
      std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _2815_shapes = _10539_;
      std::vector<int32_t> _10540_;
      for (int32_t _2818_i = (int)0, _10541_ = _2812_n; _2818_i < _10541_ ; ++_2818_i)
      {
        _10540_.push_back((int)((((*_2815_shapes)(_2818_i)))->size(0)));
      }
      auto _10542_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10540_.size()),_10540_.begin(),_10540_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2817_nds = _10542_;
      _checked_ptr_1<int32_t> _ptr__2817_nds(_2817_nds ? _2817_nds->raw() : nullptr,_2817_nds ? _2817_nds->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2819_shape0 = ((*_2815_shapes)((int)0));
      _checked_ptr_1<int32_t> _ptr__2819_shape0(_2819_shape0 ? _2819_shape0->raw() : nullptr,_2819_shape0 ? _2819_shape0->size(0) : 0);
      int32_t _2820_nd0 = _ptr__2817_nds[(int)0];
      int32_t _2821_rnnz = (int)0;
      int32_t _10543_ = (int)0;
      int32_t _10544_ = _2812_n;
      for (int32_t _2822_i = _10543_; _2822_i < _10544_; ++_2822_i)
      {
        {
          _2821_rnnz += _ptr__2813_numnz[_2822_i];
        }
      }
      int32_t _2823_rnd = safe_add( _2806_dim,(int)1 );
      int32_t _10545_ = (int)0;
      int32_t _10546_ = _2812_n;
      for (int32_t _2824_i = _10545_; _2824_i < _10546_; ++_2824_i)
      {
        {
          if ((_2823_rnd < _ptr__2817_nds[_2824_i]))
          {
            {
              _2823_rnd = _ptr__2817_nds[_2824_i];
            }
          }
          {}
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2825_rshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2823_rnd)));
      _checked_ptr_1<int32_t> _ptr__2825_rshape(_2825_rshape ? _2825_rshape->raw() : nullptr,_2825_rshape ? _2825_rshape->size(0) : 0);
      int32_t _10547_ = (int)0;
      int32_t _10548_ = _2820_nd0;
      for (int32_t _2826_i = _10547_; _2826_i < _10548_; ++_2826_i)
      {
        {
          _ptr__2825_rshape[_2826_i] = _ptr__2819_shape0[_2826_i];
        }
      }
      int32_t _10549_ = _2820_nd0;
      int32_t _10550_ = _2823_rnd;
      for (int32_t _2827_i = _10549_; _2827_i < _10550_; ++_2827_i)
      {
        {
          _ptr__2825_rshape[_2827_i] = (int)1;
        }
      }
      _ptr__2825_rshape[_2806_dim] = (int)0;
      int32_t _10551_ = (int)0;
      int32_t _10552_ = _2812_n;
      for (int32_t _2828_i = _10551_; _2828_i < _10552_; ++_2828_i)
      {
        {
          int32_t _10553_;
          bool _10554_ = ((int)((((*_2815_shapes)(_2828_i)))->size(0)) > _2806_dim);
          if (_10554_)
          {
            _10553_ = ((*((*_2815_shapes)(_2828_i)))(_2806_dim));
          }
          else
          {
            _10553_ = (int)1;
          }
          _ptr__2825_rshape[_2806_dim] += _10553_;
        }
      }
      int32_t _10555_ = (int)0;
      int32_t _10556_ = _2812_n;
      for (int32_t _2829_i = _10555_; _2829_i < _10556_; ++_2829_i)
      {
        {
          int32_t _10557_ = (int)0;
          int32_t _10558_ = (int)((((*_2815_shapes)(_2829_i)))->size(0));
          for (int32_t _2830_j = _10557_; _2830_j < _10558_; ++_2830_j)
          {
            {
              if (((_2830_j != _2806_dim) && (((*((*_2815_shapes)(_2829_i)))(_2830_j)) != _ptr__2825_rshape[_2830_j])))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("Variable dimensions do not match"));
                }
              }
              {}
            }
          }
          int32_t _10559_ = (int)((((*_2815_shapes)(_2829_i)))->size(0));
          int32_t _10560_ = _2823_rnd;
          for (int32_t _2831_j = _10559_; _2831_j < _10560_; ++_2831_j)
          {
            {
              if (((_2831_j != _2806_dim) && ((int)1 != _ptr__2825_rshape[_2831_j])))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("Variable dimensions do not match"));
                }
              }
              {}
            }
          }
        }
      }
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2832_rnidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2821_rnnz)));
      _checked_ptr_1<int64_t> _ptr__2832_rnidxs(_2832_rnidxs ? _2832_rnidxs->raw() : nullptr,_2832_rnidxs ? _2832_rnidxs->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _2833_rsp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2821_rnnz)));
      _checked_ptr_1<int64_t> _ptr__2833_rsp(_2833_rsp ? _2833_rsp->raw() : nullptr,_2833_rsp ? _2833_rsp->size(0) : 0);
      std::vector<int32_t> _10561_;
      for (int32_t _2835_i = (int)0, _10562_ = (int)((_2805_v)->size(0)); _2835_i < _10562_ ; ++_2835_i)
      {
        int32_t _10563_;
        bool _10564_ = (_2806_dim < (int)((((*_2815_shapes)(_2835_i)))->size(0)));
        if (_10564_)
        {
          _10563_ = ((*((*_2815_shapes)(_2835_i)))(_2806_dim));
        }
        else
        {
          _10563_ = (int)1;
        }
        _10561_.push_back(_10563_);
      }
      auto _10565_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10561_.size()),_10561_.begin(),_10561_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _2834_sdims = _10565_;
      _checked_ptr_1<int32_t> _ptr__2834_sdims(_2834_sdims ? _2834_sdims->raw() : nullptr,_2834_sdims ? _2834_sdims->size(0) : 0);
      int32_t _2836_d0 = (int)1;
      int32_t _10566_ = (int)0;
      int32_t _10567_ = _2806_dim;
      for (int32_t _2837_i = _10566_; _2837_i < _10567_; ++_2837_i)
      {
        {
          int32_t _10568_;
          bool _10569_ = (_2837_i < (int)((_2819_shape0)->size(0)));
          if (_10569_)
          {
            _10568_ = _ptr__2819_shape0[_2837_i];
          }
          else
          {
            _10568_ = (int)1;
          }
          _2836_d0 *= _10568_;
        }
      }
      int32_t _2838_d1 = (int)0;
      int32_t _10570_ = (int)0;
      int32_t _10571_ = _2812_n;
      for (int32_t _2839_i = _10570_; _2839_i < _10571_; ++_2839_i)
      {
        {
          _2838_d1 += _ptr__2834_sdims[_2839_i];
        }
      }
      int32_t _2840_d2 = (int)1;
      int32_t _10572_ = safe_add( _2806_dim,(int)1 );
      int32_t _10573_ = (int)((_2819_shape0)->size(0));
      for (int32_t _2841_i = _10572_; _2841_i < _10573_; ++_2841_i)
      {
        {
          _2840_d2 *= _ptr__2819_shape0[_2841_i];
        }
      }
      if ((_2836_d0 == (int)1))
      {
        {
          int32_t _2842_k = (int)0;
          int64_t _2843_kspofs = (int)0;
          int32_t _10574_ = (int)0;
          int32_t _10575_ = _2812_n;
          for (int32_t _2844_i = _10574_; _2844_i < _10575_; ++_2844_i)
          {
            {
              ((*_2805_v)(_2844_i))->inst(_2842_k,_2833_rsp,_2842_k,_2832_rnidxs);
              int32_t _10576_ = (int)0;
              int32_t _10577_ = _ptr__2813_numnz[_2844_i];
              for (int32_t _2845_j = _10576_; _2845_j < _10577_; ++_2845_j)
              {
                {
                  _ptr__2833_rsp[_2842_k] += _2843_kspofs;
                  ++ _2842_k;
                }
              }
              _2843_kspofs += ::mosek::fusion::p_Set::size(((*_2815_shapes)(_2844_i)));
            }
          }
          std::shared_ptr< monty::ndarray< int64_t,1 > > _10578_;
          bool _10579_ = (_2821_rnnz < safe_mul( safe_mul( _2836_d0,_2838_d1 ),_2840_d2 ));
          if (_10579_)
          {
            _10578_ = _2833_rsp;
          }
          else
          {
            _10578_ = nullptr;
          }
          return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_2807_m0,_2825_rshape,_10578_,_2832_rnidxs)).as<::mosek::fusion::Variable>();
        }
      }
      else
      {
        {
          int32_t _2846_b = (int)0;
          int32_t _10580_ = (int)0;
          int32_t _10581_ = _2812_n;
          for (int32_t _2847_i = _10580_; _2847_i < _10581_; ++_2847_i)
          {
            {
              _2846_b += ((*_2805_v)(_2847_i))->inst(_2846_b,_2833_rsp,_2846_b,_2832_rnidxs);
            }
          }
          std::shared_ptr< monty::ndarray< int32_t,1 > > _2848_curperm = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2821_rnnz)));
          _checked_ptr_1<int32_t> _ptr__2848_curperm(_2848_curperm ? _2848_curperm->raw() : nullptr,_2848_curperm ? _2848_curperm->size(0) : 0);
          std::shared_ptr< monty::ndarray< int32_t,1 > > _2849_tgtperm = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2821_rnnz)));
          _checked_ptr_1<int32_t> _ptr__2849_tgtperm(_2849_tgtperm ? _2849_tgtperm->raw() : nullptr,_2849_tgtperm ? _2849_tgtperm->size(0) : 0);
          std::shared_ptr< monty::ndarray< int32_t,1 > > _2850_offset = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2812_n)));
          _checked_ptr_1<int32_t> _ptr__2850_offset(_2850_offset ? _2850_offset->raw() : nullptr,_2850_offset ? _2850_offset->size(0) : 0);
          int32_t _10582_ = (int)0;
          int32_t _10583_ = (_2812_n - (int)1);
          for (int32_t _2851_i = _10582_; _2851_i < _10583_; ++_2851_i)
          {
            {
              _ptr__2850_offset[safe_add( _2851_i,(int)1 )] = safe_add( _ptr__2850_offset[_2851_i],_ptr__2834_sdims[_2851_i] );
            }
          }
          int32_t _10584_ = (int)0;
          int32_t _10585_ = _2821_rnnz;
          for (int32_t _2852_i = _10584_; _2852_i < _10585_; ++_2852_i)
          {
            {
              _ptr__2848_curperm[_2852_i] = _2852_i;
            }
          }
          int32_t _2853_k = (int)0;
          int32_t _10586_ = (int)0;
          int32_t _10587_ = _2812_n;
          for (int32_t _2854_i = _10586_; _2854_i < _10587_; ++_2854_i)
          {
            {
              int32_t _10588_ = (int)0;
              int32_t _10589_ = _ptr__2813_numnz[_2854_i];
              for (int32_t _2855_j = _10588_; _2855_j < _10589_; ++_2855_j)
              {
                {
                  int64_t _2856_i0 = (_ptr__2833_rsp[_2853_k] / safe_mul( _ptr__2834_sdims[_2854_i],_2840_d2 ));
                  int64_t _2857_i1 = ((_ptr__2833_rsp[_2853_k] / _2840_d2) % _ptr__2834_sdims[_2854_i]);
                  int64_t _2858_i2 = (_ptr__2833_rsp[_2853_k] % _2840_d2);
                  _ptr__2833_rsp[_2853_k] = safe_add( safe_mul( safe_add( safe_add( safe_mul( _2856_i0,_2838_d1 ),_2857_i1 ),_ptr__2850_offset[_2854_i] ),_2840_d2 ),_2858_i2 );
                  ++ _2853_k;
                }
              }
            }
          }
          int32_t _2859_maxdim = (int)1;
          int32_t _10590_ = (int)0;
          int32_t _10591_ = _2823_rnd;
          for (int32_t _2860_i = _10590_; _2860_i < _10591_; ++_2860_i)
          {
            {
              int32_t _10592_;
              bool _10593_ = (_2859_maxdim < _ptr__2825_rshape[_2860_i]);
              if (_10593_)
              {
                _10592_ = _ptr__2825_rshape[_2860_i];
              }
              else
              {
                _10592_ = _2859_maxdim;
              }
              _2859_maxdim = _10592_;
            }
          }
          std::shared_ptr< monty::ndarray< int64_t,1 > > _2861_s = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_2823_rnd)));
          _checked_ptr_1<int64_t> _ptr__2861_s(_2861_s ? _2861_s->raw() : nullptr,_2861_s ? _2861_s->size(0) : 0);
          _ptr__2861_s[(_2823_rnd - (int)1)] = (int)1;
          int32_t _10594_ = (int)1;
          int32_t _10595_ = _2823_rnd;
          for (int32_t _2862_i = _10594_; _2862_i < _10595_; ++_2862_i)
          {
            {
              _ptr__2861_s[((_2823_rnd - _2862_i) - (int)1)] = safe_mul( _ptr__2861_s[(_2823_rnd - _2862_i)],_ptr__2825_rshape[(_2823_rnd - _2862_i)] );
            }
          }
          std::shared_ptr< monty::ndarray< int32_t,1 > > _2863_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _2859_maxdim,(int)1 ))));
          _checked_ptr_1<int32_t> _ptr__2863_ptr(_2863_ptr ? _2863_ptr->raw() : nullptr,_2863_ptr ? _2863_ptr->size(0) : 0);
          int32_t _10596_ = (int)0;
          int32_t _10597_ = _2823_rnd;
          for (int32_t _2864_ii = _10596_; _2864_ii < _10597_; ++_2864_ii)
          {
            {
              int32_t _2865_i = ((_2823_rnd - _2864_ii) - (int)1);
              int32_t _10598_ = (int)0;
              int32_t _10599_ = safe_add( _ptr__2825_rshape[_2865_i],(int)1 );
              for (int32_t _2866_j = _10598_; _2866_j < _10599_; ++_2866_j)
              {
                {
                  _ptr__2863_ptr[_2866_j] = (int)0;
                }
              }
              int32_t _10600_ = (int)0;
              int32_t _10601_ = _2821_rnnz;
              for (int32_t _2867_j = _10600_; _2867_j < _10601_; ++_2867_j)
              {
                {
                  ++ _ptr__2863_ptr[safe_add( ((_ptr__2833_rsp[_2867_j] / _ptr__2861_s[_2865_i]) % _ptr__2825_rshape[_2865_i]),(int)1 )];
                }
              }
              int32_t _10602_ = (int)0;
              int32_t _10603_ = _ptr__2825_rshape[_2865_i];
              for (int32_t _2868_j = _10602_; _2868_j < _10603_; ++_2868_j)
              {
                {
                  _ptr__2863_ptr[safe_add( _2868_j,(int)1 )] += _ptr__2863_ptr[_2868_j];
                }
              }
              int32_t _10604_ = (int)0;
              int32_t _10605_ = _2821_rnnz;
              for (int32_t _2869_jj = _10604_; _2869_jj < _10605_; ++_2869_jj)
              {
                {
                  int32_t _2870_j = _ptr__2848_curperm[_2869_jj];
                  int64_t _2871_idx = ((_ptr__2833_rsp[_2870_j] / _ptr__2861_s[_2865_i]) % _ptr__2825_rshape[_2865_i]);
                  _ptr__2849_tgtperm[_ptr__2863_ptr[_2871_idx]] = _2870_j;
                  ++ _ptr__2863_ptr[_2871_idx];
                }
              }
              std::shared_ptr< monty::ndarray< int32_t,1 > > _2872_tmp = _2848_curperm;
              _checked_ptr_1<int32_t> _ptr__2872_tmp(_2872_tmp ? _2872_tmp->raw() : nullptr,_2872_tmp ? _2872_tmp->size(0) : 0);
              _2848_curperm = _2849_tgtperm;
              _ptr__2848_curperm.update(_2848_curperm ? _2848_curperm->raw() : nullptr, _2848_curperm ? _2848_curperm->size(0) : 0);
              _2849_tgtperm = _2872_tmp;
              _ptr__2849_tgtperm.update(_2849_tgtperm ? _2849_tgtperm->raw() : nullptr, _2849_tgtperm ? _2849_tgtperm->size(0) : 0);
            }
          }
          std::shared_ptr< monty::ndarray< int64_t,1 > > _10606_;
          bool _10607_ = (_2821_rnnz < safe_mul( safe_mul( _2836_d0,_2838_d1 ),_2840_d2 ));
          if (_10607_)
          {
            std::vector<int64_t> _10608_;
            for (int32_t _2873_i = (int)0, _10609_ = _2821_rnnz; _2873_i < _10609_ ; ++_2873_i)
            {
              _10608_.push_back(_ptr__2833_rsp[_ptr__2848_curperm[_2873_i]]);
            }
            auto _10610_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10608_.size()),_10608_.begin(),_10608_.end()));
            _10606_ = _10610_;
          }
          else
          {
            _10606_ = nullptr;
          }
          std::vector<int64_t> _10611_;
          for (int32_t _2874_i = (int)0, _10612_ = _2821_rnnz; _2874_i < _10612_ ; ++_2874_i)
          {
            _10611_.push_back(_ptr__2832_rnidxs[_ptr__2848_curperm[_2874_i]]);
          }
          auto _10613_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10611_.size()),_10611_.begin(),_10611_.end()));
          return (::mosek::fusion::p_SliceVariable::_new_SliceVariable(_2807_m0,_2825_rshape,_10606_,_10613_)).as<::mosek::fusion::Variable>();
        }
      }
    }
  }
}
// End mosek.fusion.Var.dstack

void mosek::fusion::p_Var::destroy()
{
}
void mosek::fusion::Var::destroy() { mosek::fusion::p_Var::_get_impl(this)->destroy(); }
// } class Var
// class BoundInterfaceConstraint { // @ bld/grindsted/final/default/src/fusion/BoundInterfaceConstraint.mbi:26:4-69:5
mosek::fusion::BoundInterfaceConstraint::BoundInterfaceConstraint(mosek::fusion::p_BoundInterfaceConstraint *_impl) : mosek::fusion::SliceConstraint(_impl) { /*std::cout << "BoundInterfaceConstraint()" << this << std::endl; */ }
mosek::fusion::BoundInterfaceConstraint::~BoundInterfaceConstraint() {  /* std::cout << "~BoundInterfaceConstraint()" << this << std::endl << std::flush; */ }
mosek::fusion::p_BoundInterfaceConstraint::p_BoundInterfaceConstraint
  (::mosek::fusion::BoundInterfaceConstraint * _pubthis) :     mosek::fusion::p_SliceConstraint(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.BoundInterfaceConstraint.ctor @ bld/grindsted/final/default/src/fusion/BoundInterfaceConstraint.mbi:39:6-47:7
mosek::fusion::BoundInterfaceConstraint::t mosek::fusion::p_BoundInterfaceConstraint::_new_BoundInterfaceConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2875_m,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2876_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2877_nativeidxs,
    bool _2878_islower)
{ return new mosek::fusion::BoundInterfaceConstraint(_2875_m,_2876_shape,_2877_nativeidxs,_2878_islower); }
mosek::fusion::BoundInterfaceConstraint::BoundInterfaceConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2875_m,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2876_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2877_nativeidxs,
    bool _2878_islower) : 
   BoundInterfaceConstraint(new mosek::fusion::p_BoundInterfaceConstraint(this))
{ mosek::fusion::p_BoundInterfaceConstraint::_get_impl(this)->_initialize(_2875_m,_2876_shape,_2877_nativeidxs,_2878_islower); }
void mosek::fusion::p_BoundInterfaceConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2875_m,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2876_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2877_nativeidxs,
    bool _2878_islower)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2876_shape(_2876_shape ? _2876_shape->raw() : nullptr, _2876_shape ? _2876_shape->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__2877_nativeidxs(_2877_nativeidxs ? _2877_nativeidxs->raw() : nullptr, _2877_nativeidxs ? _2877_nativeidxs->size(0) : 0);
    mosek::fusion::p_SliceConstraint::_initialize(_2875_m,_2876_shape,_2877_nativeidxs);
    mosek::fusion::p_BoundInterfaceConstraint::_get_impl(::mosek::fusion::BoundInterfaceConstraint::t(_pubthis))->islower = _2878_islower;
  }
}
// mosek.fusion.BoundInterfaceConstraint.ctor

// mosek.fusion.BoundInterfaceConstraint.ctor @ bld/grindsted/final/default/src/fusion/BoundInterfaceConstraint.mbi:31:6-37:7
mosek::fusion::BoundInterfaceConstraint::t mosek::fusion::p_BoundInterfaceConstraint::_new_BoundInterfaceConstraint
  (monty::rc_ptr< ::mosek::fusion::SliceConstraint > _2879_c,
    bool _2880_islower)
{ return new mosek::fusion::BoundInterfaceConstraint(_2879_c,_2880_islower); }
mosek::fusion::BoundInterfaceConstraint::BoundInterfaceConstraint
  (monty::rc_ptr< ::mosek::fusion::SliceConstraint > _2879_c,
    bool _2880_islower) : 
   BoundInterfaceConstraint(new mosek::fusion::p_BoundInterfaceConstraint(this))
{ mosek::fusion::p_BoundInterfaceConstraint::_get_impl(this)->_initialize(_2879_c,_2880_islower); }
void mosek::fusion::p_BoundInterfaceConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::SliceConstraint > _2879_c,
    bool _2880_islower)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_SliceConstraint::_initialize(_2879_c);
    mosek::fusion::p_BoundInterfaceConstraint::_get_impl(::mosek::fusion::BoundInterfaceConstraint::t(_pubthis))->islower = _2880_islower;
  }
}
// mosek.fusion.BoundInterfaceConstraint.ctor

// Begin mosek.fusion.BoundInterfaceConstraint.dual
// Method mosek.fusion.BoundInterfaceConstraint.dual @ bld/grindsted/final/default/src/fusion/BoundInterfaceConstraint.mbi:64:6-68:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::BoundInterfaceConstraint :: dual() { return mosek::fusion::p_BoundInterfaceConstraint::_get_impl(this)->dual(); }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_BoundInterfaceConstraint::dual()
{
  std::shared_ptr< monty::ndarray< double,1 > > _2881_target = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_pubthis->getSize())));
  _checked_ptr_1<double> _ptr__2881_target(_2881_target ? _2881_target->raw() : nullptr,_2881_target ? _2881_target->size(0) : 0);
  dual_lu((int)0,_2881_target,islower);
  return _2881_target;
}
// End mosek.fusion.BoundInterfaceConstraint.dual

// Begin mosek.fusion.BoundInterfaceConstraint.slice
// Method mosek.fusion.BoundInterfaceConstraint.slice @ bld/grindsted/final/default/src/fusion/BoundInterfaceConstraint.mbi:62:6-124
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::BoundInterfaceConstraint :: __mosek_2fusion_2BoundInterfaceConstraint__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2882_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _2883_lasta) { return mosek::fusion::p_BoundInterfaceConstraint::_get_impl(this)->__mosek_2fusion_2BoundInterfaceConstraint__slice(_2882_firsta,_2883_lasta); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::BoundInterfaceConstraint::slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2882_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _2883_lasta) { return __mosek_2fusion_2BoundInterfaceConstraint__slice(_2882_firsta,_2883_lasta); }
/* override: mosek.fusion.Constraint.slice*/
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::BoundInterfaceConstraint::__mosek_2fusion_2Constraint__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2882_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _2883_lasta) { return __mosek_2fusion_2BoundInterfaceConstraint__slice(_2882_firsta,_2883_lasta); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_BoundInterfaceConstraint::__mosek_2fusion_2BoundInterfaceConstraint__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _2882_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _2883_lasta)
{
  _checked_ptr_1<int32_t> _ptr__2882_firsta(_2882_firsta ? _2882_firsta->raw() : nullptr, _2882_firsta ? _2882_firsta->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__2883_lasta(_2883_lasta ? _2883_lasta->raw() : nullptr, _2883_lasta ? _2883_lasta->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::Constraint > _2884_c = ::mosek::fusion::p_Constraint::__mosek_2fusion_2Constraint__slice(_2882_firsta,_2883_lasta);
  return (__mosek_2fusion_2BoundInterfaceConstraint__from_(_2884_c)).as<::mosek::fusion::Constraint>();
}
// End mosek.fusion.BoundInterfaceConstraint.slice

// Begin mosek.fusion.BoundInterfaceConstraint.slice
// Method mosek.fusion.BoundInterfaceConstraint.slice @ bld/grindsted/final/default/src/fusion/BoundInterfaceConstraint.mbi:61:6-122
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::BoundInterfaceConstraint :: __mosek_2fusion_2BoundInterfaceConstraint__slice(int32_t _2885_first,int32_t _2886_last) { return mosek::fusion::p_BoundInterfaceConstraint::_get_impl(this)->__mosek_2fusion_2BoundInterfaceConstraint__slice(_2885_first,_2886_last); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::BoundInterfaceConstraint::slice(int32_t _2885_first,int32_t _2886_last) { return __mosek_2fusion_2BoundInterfaceConstraint__slice(_2885_first,_2886_last); }
/* override: mosek.fusion.Constraint.slice*/
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::BoundInterfaceConstraint::__mosek_2fusion_2Constraint__slice(int32_t _2885_first,int32_t _2886_last) { return __mosek_2fusion_2BoundInterfaceConstraint__slice(_2885_first,_2886_last); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_BoundInterfaceConstraint::__mosek_2fusion_2BoundInterfaceConstraint__slice(int32_t _2885_first,int32_t _2886_last)
{
  monty::rc_ptr< ::mosek::fusion::Constraint > _2887_c = ::mosek::fusion::p_Constraint::__mosek_2fusion_2Constraint__slice(_2885_first,_2886_last);
  return (__mosek_2fusion_2BoundInterfaceConstraint__from_(_2887_c)).as<::mosek::fusion::Constraint>();
}
// End mosek.fusion.BoundInterfaceConstraint.slice

// Begin mosek.fusion.BoundInterfaceConstraint.index
// Method mosek.fusion.BoundInterfaceConstraint.index @ bld/grindsted/final/default/src/fusion/BoundInterfaceConstraint.mbi:60:6-115
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::BoundInterfaceConstraint :: __mosek_2fusion_2BoundInterfaceConstraint__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2888_idxa) { return mosek::fusion::p_BoundInterfaceConstraint::_get_impl(this)->__mosek_2fusion_2BoundInterfaceConstraint__index(_2888_idxa); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::BoundInterfaceConstraint::index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2888_idxa) { return __mosek_2fusion_2BoundInterfaceConstraint__index(_2888_idxa); }
/* override: mosek.fusion.Constraint.index*/
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::BoundInterfaceConstraint::__mosek_2fusion_2Constraint__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2888_idxa) { return __mosek_2fusion_2BoundInterfaceConstraint__index(_2888_idxa); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_BoundInterfaceConstraint::__mosek_2fusion_2BoundInterfaceConstraint__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _2888_idxa)
{
  _checked_ptr_1<int32_t> _ptr__2888_idxa(_2888_idxa ? _2888_idxa->raw() : nullptr, _2888_idxa ? _2888_idxa->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::Constraint > _2889_c = ::mosek::fusion::p_Constraint::__mosek_2fusion_2Constraint__index(_2888_idxa);
  return (__mosek_2fusion_2BoundInterfaceConstraint__from_(_2889_c)).as<::mosek::fusion::Constraint>();
}
// End mosek.fusion.BoundInterfaceConstraint.index

// Begin mosek.fusion.BoundInterfaceConstraint.index
// Method mosek.fusion.BoundInterfaceConstraint.index @ bld/grindsted/final/default/src/fusion/BoundInterfaceConstraint.mbi:59:6-114
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::BoundInterfaceConstraint :: __mosek_2fusion_2BoundInterfaceConstraint__index(int32_t _2890_idx) { return mosek::fusion::p_BoundInterfaceConstraint::_get_impl(this)->__mosek_2fusion_2BoundInterfaceConstraint__index(_2890_idx); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::BoundInterfaceConstraint::index(int32_t _2890_idx) { return __mosek_2fusion_2BoundInterfaceConstraint__index(_2890_idx); }
/* override: mosek.fusion.Constraint.index*/
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::BoundInterfaceConstraint::__mosek_2fusion_2Constraint__index(int32_t _2890_idx) { return __mosek_2fusion_2BoundInterfaceConstraint__index(_2890_idx); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_BoundInterfaceConstraint::__mosek_2fusion_2BoundInterfaceConstraint__index(int32_t _2890_idx)
{
  monty::rc_ptr< ::mosek::fusion::Constraint > _2891_c = ::mosek::fusion::p_Constraint::__mosek_2fusion_2Constraint__index(_2890_idx);
  return (__mosek_2fusion_2BoundInterfaceConstraint__from_(_2891_c)).as<::mosek::fusion::Constraint>();
}
// End mosek.fusion.BoundInterfaceConstraint.index

// Begin mosek.fusion.BoundInterfaceConstraint.from_
// Method mosek.fusion.BoundInterfaceConstraint.from_ @ bld/grindsted/final/default/src/fusion/BoundInterfaceConstraint.mbi:49:6-57:7
monty::rc_ptr< ::mosek::fusion::BoundInterfaceConstraint > mosek::fusion::p_BoundInterfaceConstraint::__mosek_2fusion_2BoundInterfaceConstraint__from_(monty::rc_ptr< ::mosek::fusion::Constraint > _2892_c)
{
  monty::rc_ptr< ::mosek::fusion::Constraint > _10614_ = _2892_c;
  if (false) {}
  else if (nullptr != dynamic_cast<::mosek::fusion::SliceConstraint*>(_10614_.get()))
  {
    ::mosek::fusion::SliceConstraint::t _2893_cc (dynamic_cast<::mosek::fusion::SliceConstraint*>(_10614_.get()));
    {
      return ::mosek::fusion::p_BoundInterfaceConstraint::_new_BoundInterfaceConstraint(_2893_cc,islower);
    }
  }
  else
  {
    mosek::fusion::Constraint::t _2894_cc = _10614_;
    {
      return nullptr;
    }
  }
}
// End mosek.fusion.BoundInterfaceConstraint.from_

void mosek::fusion::p_BoundInterfaceConstraint::destroy()
{
}
void mosek::fusion::BoundInterfaceConstraint::destroy() { mosek::fusion::p_BoundInterfaceConstraint::_get_impl(this)->destroy(); }
// } class BoundInterfaceConstraint
// class LinearPSDConstraint { // @ bld/grindsted/final/default/src/fusion/LinearPSDConstraint.monty:17:4-183:5
mosek::fusion::LinearPSDConstraint::LinearPSDConstraint(mosek::fusion::p_LinearPSDConstraint *_impl) : mosek::fusion::ModelConstraint(_impl) { /*std::cout << "LinearPSDConstraint()" << this << std::endl; */ }
mosek::fusion::LinearPSDConstraint::~LinearPSDConstraint() {  /* std::cout << "~LinearPSDConstraint()" << this << std::endl << std::flush; */ }
mosek::fusion::p_LinearPSDConstraint::p_LinearPSDConstraint
  (::mosek::fusion::LinearPSDConstraint * _pubthis) :     mosek::fusion::p_ModelConstraint(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.LinearPSDConstraint.ctor @ bld/grindsted/final/default/src/fusion/LinearPSDConstraint.monty:48:6-58:7
mosek::fusion::LinearPSDConstraint::t mosek::fusion::p_LinearPSDConstraint::_new_LinearPSDConstraint
  (monty::rc_ptr< ::mosek::fusion::LinearPSDConstraint > _2895_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2896_m)
{ return new mosek::fusion::LinearPSDConstraint(_2895_c,_2896_m); }
mosek::fusion::LinearPSDConstraint::LinearPSDConstraint
  (monty::rc_ptr< ::mosek::fusion::LinearPSDConstraint > _2895_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2896_m) : 
   LinearPSDConstraint(new mosek::fusion::p_LinearPSDConstraint(this))
{ mosek::fusion::p_LinearPSDConstraint::_get_impl(this)->_initialize(_2895_c,_2896_m); }
void mosek::fusion::p_LinearPSDConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::LinearPSDConstraint > _2895_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2896_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ModelConstraint::_initialize(_2895_c,_2896_m);
    conid = mosek::fusion::p_LinearPSDConstraint::_get_impl(_2895_c)->conid;
    slackidxs = mosek::fusion::p_LinearPSDConstraint::_get_impl(_2895_c)->slackidxs;
    nativeidxs = mosek::fusion::p_LinearPSDConstraint::_get_impl(_2895_c)->nativeidxs;
    conedim = mosek::fusion::p_LinearPSDConstraint::_get_impl(_2895_c)->conedim;
    shape = mosek::fusion::p_LinearPSDConstraint::_get_impl(_2895_c)->shape;
  }
}
// mosek.fusion.LinearPSDConstraint.ctor

// mosek.fusion.LinearPSDConstraint.ctor @ bld/grindsted/final/default/src/fusion/LinearPSDConstraint.monty:27:6-46:7
mosek::fusion::LinearPSDConstraint::t mosek::fusion::p_LinearPSDConstraint::_new_LinearPSDConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2897_model,
    const std::string &  _2898_name,
    int32_t _2899_conid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2900_shape,
    int32_t _2901_conedim,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2902_nativeidxs,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2903_slackidxs)
{ return new mosek::fusion::LinearPSDConstraint(_2897_model,_2898_name,_2899_conid,_2900_shape,_2901_conedim,_2902_nativeidxs,_2903_slackidxs); }
mosek::fusion::LinearPSDConstraint::LinearPSDConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2897_model,
    const std::string &  _2898_name,
    int32_t _2899_conid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2900_shape,
    int32_t _2901_conedim,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2902_nativeidxs,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2903_slackidxs) : 
   LinearPSDConstraint(new mosek::fusion::p_LinearPSDConstraint(this))
{ mosek::fusion::p_LinearPSDConstraint::_get_impl(this)->_initialize(_2897_model,_2898_name,_2899_conid,_2900_shape,_2901_conedim,_2902_nativeidxs,_2903_slackidxs); }
void mosek::fusion::p_LinearPSDConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2897_model,
    const std::string &  _2898_name,
    int32_t _2899_conid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2900_shape,
    int32_t _2901_conedim,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2902_nativeidxs,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2903_slackidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2900_shape(_2900_shape ? _2900_shape->raw() : nullptr, _2900_shape ? _2900_shape->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__2902_nativeidxs(_2902_nativeidxs ? _2902_nativeidxs->raw() : nullptr, _2902_nativeidxs ? _2902_nativeidxs->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2903_slackidxs(_2903_slackidxs ? _2903_slackidxs->raw() : nullptr, _2903_slackidxs ? _2903_slackidxs->size(0) : 0);
    mosek::fusion::p_ModelConstraint::_initialize(_2897_model,_2898_name,_2900_shape,_2902_nativeidxs,_2899_conid);
    mosek::fusion::p_LinearPSDConstraint::_get_impl(::mosek::fusion::LinearPSDConstraint::t(_pubthis))->conid = _2899_conid;
    mosek::fusion::p_LinearPSDConstraint::_get_impl(::mosek::fusion::LinearPSDConstraint::t(_pubthis))->slackidxs = _2903_slackidxs;
    mosek::fusion::p_LinearPSDConstraint::_get_impl(::mosek::fusion::LinearPSDConstraint::t(_pubthis))->nativeidxs = _2902_nativeidxs;
    mosek::fusion::p_LinearPSDConstraint::_get_impl(::mosek::fusion::LinearPSDConstraint::t(_pubthis))->conedim = _2901_conedim;
    mosek::fusion::p_LinearPSDConstraint::_get_impl(::mosek::fusion::LinearPSDConstraint::t(_pubthis))->shape = _2900_shape;
  }
}
// mosek.fusion.LinearPSDConstraint.ctor

// Begin mosek.fusion.LinearPSDConstraint.domainToString
// Method mosek.fusion.LinearPSDConstraint.domainToString @ bld/grindsted/final/default/src/fusion/LinearPSDConstraint.monty:174:6-182:7
void mosek::fusion::p_LinearPSDConstraint::domainToString(int64_t _2904_i,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2905_sb)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2906_k = ::mosek::fusion::p_Set::idxtokey(shape,_2904_i);
  _checked_ptr_1<int32_t> _ptr__2906_k(_2906_k ? _2906_k->raw() : nullptr,_2906_k ? _2906_k->size(0) : 0);
  _2905_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (" : element ("))->__mosek_2fusion_2Utils_2StringBuffer__a(_ptr__2906_k[(int)0]);
  int32_t _10615_ = (int)1;
  int32_t _10616_ = (int)((_2906_k)->size(0));
  for (int32_t _2907_j = _10615_; _2907_j < _10616_; ++_2907_j)
  {
    {
      _2905_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(_ptr__2906_k[_2907_j]);
    }
  }
  _2905_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (") in a positive semi-definite cone of size ("))->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)((int)0)));
  int32_t _10617_ = (int)1;
  int32_t _10618_ = (int)((_2906_k)->size(0));
  for (int32_t _2908_j = _10617_; _2908_j < _10618_; ++_2908_j)
  {
    {
      _2905_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)(_2908_j)));
    }
  }
  _2905_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"));
}
// End mosek.fusion.LinearPSDConstraint.domainToString

// Begin mosek.fusion.LinearPSDConstraint.clone
// Method mosek.fusion.LinearPSDConstraint.clone @ bld/grindsted/final/default/src/fusion/LinearPSDConstraint.monty:60:6-63:7
monty::rc_ptr< ::mosek::fusion::ModelConstraint > mosek::fusion::p_LinearPSDConstraint::__mosek_2fusion_2LinearPSDConstraint__clone(monty::rc_ptr< ::mosek::fusion::Model > _2909_m)
{
  return (::mosek::fusion::p_LinearPSDConstraint::_new_LinearPSDConstraint(::mosek::fusion::LinearPSDConstraint::t(_pubthis),_2909_m)).as<::mosek::fusion::ModelConstraint>();
}
// End mosek.fusion.LinearPSDConstraint.clone

void mosek::fusion::p_LinearPSDConstraint::destroy()
{
  shape.reset();
  slackidxs.reset();
  nativeidxs.reset();
}
void mosek::fusion::LinearPSDConstraint::destroy() { mosek::fusion::p_LinearPSDConstraint::_get_impl(this)->destroy(); }
// } class LinearPSDConstraint
// class PSDConstraint { // @ bld/grindsted/final/default/src/fusion/SemidefiniteConstraint.mbi:17:4-133:5
mosek::fusion::PSDConstraint::PSDConstraint(mosek::fusion::p_PSDConstraint *_impl) : mosek::fusion::ModelConstraint(_impl) { /*std::cout << "PSDConstraint()" << this << std::endl; */ }
mosek::fusion::PSDConstraint::~PSDConstraint() {  /* std::cout << "~PSDConstraint()" << this << std::endl << std::flush; */ }
mosek::fusion::p_PSDConstraint::p_PSDConstraint
  (::mosek::fusion::PSDConstraint * _pubthis) :     mosek::fusion::p_ModelConstraint(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.PSDConstraint.ctor @ bld/grindsted/final/default/src/fusion/SemidefiniteConstraint.mbi:100:6-112:7
mosek::fusion::PSDConstraint::t mosek::fusion::p_PSDConstraint::_new_PSDConstraint
  (monty::rc_ptr< ::mosek::fusion::PSDConstraint > _2910_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2911_m)
{ return new mosek::fusion::PSDConstraint(_2910_c,_2911_m); }
mosek::fusion::PSDConstraint::PSDConstraint
  (monty::rc_ptr< ::mosek::fusion::PSDConstraint > _2910_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2911_m) : 
   PSDConstraint(new mosek::fusion::p_PSDConstraint(this))
{ mosek::fusion::p_PSDConstraint::_get_impl(this)->_initialize(_2910_c,_2911_m); }
void mosek::fusion::p_PSDConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::PSDConstraint > _2910_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2911_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ModelConstraint::_initialize(_2910_c,_2911_m);
    conid = mosek::fusion::p_PSDConstraint::_get_impl(_2910_c)->conid;
    name = mosek::fusion::p_PSDConstraint::_get_impl(_2910_c)->name;
    shape = mosek::fusion::p_PSDConstraint::_get_impl(_2910_c)->shape;
    slackidxs = mosek::fusion::p_PSDConstraint::_get_impl(_2910_c)->slackidxs;
    nativeidxs = mosek::fusion::p_PSDConstraint::_get_impl(_2910_c)->nativeidxs;
    conedim0 = mosek::fusion::p_PSDConstraint::_get_impl(_2910_c)->conedim0;
    conedim1 = mosek::fusion::p_PSDConstraint::_get_impl(_2910_c)->conedim1;
  }
}
// mosek.fusion.PSDConstraint.ctor

// mosek.fusion.PSDConstraint.ctor @ bld/grindsted/final/default/src/fusion/SemidefiniteConstraint.mbi:76:6-98:7
mosek::fusion::PSDConstraint::t mosek::fusion::p_PSDConstraint::_new_PSDConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2912_model,
    const std::string &  _2913_name,
    int32_t _2914_conid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2915_shape,
    int32_t _2916_conedim0,
    int32_t _2917_conedim1,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2918_slackidxs,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2919_nativeidxs)
{ return new mosek::fusion::PSDConstraint(_2912_model,_2913_name,_2914_conid,_2915_shape,_2916_conedim0,_2917_conedim1,_2918_slackidxs,_2919_nativeidxs); }
mosek::fusion::PSDConstraint::PSDConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2912_model,
    const std::string &  _2913_name,
    int32_t _2914_conid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2915_shape,
    int32_t _2916_conedim0,
    int32_t _2917_conedim1,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2918_slackidxs,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2919_nativeidxs) : 
   PSDConstraint(new mosek::fusion::p_PSDConstraint(this))
{ mosek::fusion::p_PSDConstraint::_get_impl(this)->_initialize(_2912_model,_2913_name,_2914_conid,_2915_shape,_2916_conedim0,_2917_conedim1,_2918_slackidxs,_2919_nativeidxs); }
void mosek::fusion::p_PSDConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2912_model,
    const std::string &  _2913_name,
    int32_t _2914_conid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2915_shape,
    int32_t _2916_conedim0,
    int32_t _2917_conedim1,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _2918_slackidxs,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2919_nativeidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2915_shape(_2915_shape ? _2915_shape->raw() : nullptr, _2915_shape ? _2915_shape->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__2918_slackidxs(_2918_slackidxs ? _2918_slackidxs->raw() : nullptr, _2918_slackidxs ? _2918_slackidxs->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__2919_nativeidxs(_2919_nativeidxs ? _2919_nativeidxs->raw() : nullptr, _2919_nativeidxs ? _2919_nativeidxs->size(0) : 0);
    mosek::fusion::p_ModelConstraint::_initialize(_2912_model,_2913_name,_2915_shape,::mosek::fusion::p_PSDConstraint::computenidxs(_2915_shape,_2916_conedim0,_2917_conedim1,_2919_nativeidxs),_2914_conid);
    mosek::fusion::p_PSDConstraint::_get_impl(::mosek::fusion::PSDConstraint::t(_pubthis))->conid = _2914_conid;
    mosek::fusion::p_PSDConstraint::_get_impl(::mosek::fusion::PSDConstraint::t(_pubthis))->nativeidxs = _2919_nativeidxs;
    mosek::fusion::p_PSDConstraint::_get_impl(::mosek::fusion::PSDConstraint::t(_pubthis))->slackidxs = _2918_slackidxs;
    mosek::fusion::p_PSDConstraint::_get_impl(::mosek::fusion::PSDConstraint::t(_pubthis))->name = _2913_name;
    mosek::fusion::p_PSDConstraint::_get_impl(::mosek::fusion::PSDConstraint::t(_pubthis))->shape = _2915_shape;
    mosek::fusion::p_PSDConstraint::_get_impl(::mosek::fusion::PSDConstraint::t(_pubthis))->conedim0 = _2916_conedim0;
    mosek::fusion::p_PSDConstraint::_get_impl(::mosek::fusion::PSDConstraint::t(_pubthis))->conedim1 = _2917_conedim1;
  }
}
// mosek.fusion.PSDConstraint.ctor

// Begin mosek.fusion.PSDConstraint.toString
// Method mosek.fusion.PSDConstraint.toString @ bld/grindsted/final/default/src/fusion/SemidefiniteConstraint.mbi:120:6-132:7
std::string mosek::fusion::PSDConstraint :: toString() { return mosek::fusion::p_PSDConstraint::_get_impl(this)->toString(); }
std::string mosek::fusion::p_PSDConstraint::toString()
{
  throw ::mosek::fusion::UnimplementedError(std::string ("PSDConstraint.toString not implemented"));
}
// End mosek.fusion.PSDConstraint.toString

// Begin mosek.fusion.PSDConstraint.clone
// Method mosek.fusion.PSDConstraint.clone @ bld/grindsted/final/default/src/fusion/SemidefiniteConstraint.mbi:114:6-117:7
monty::rc_ptr< ::mosek::fusion::ModelConstraint > mosek::fusion::p_PSDConstraint::__mosek_2fusion_2PSDConstraint__clone(monty::rc_ptr< ::mosek::fusion::Model > _2920_m)
{
  return (::mosek::fusion::p_PSDConstraint::_new_PSDConstraint(::mosek::fusion::PSDConstraint::t(_pubthis),_2920_m)).as<::mosek::fusion::ModelConstraint>();
}
// End mosek.fusion.PSDConstraint.clone

// Begin mosek.fusion.PSDConstraint.computenidxs
// Method mosek.fusion.PSDConstraint.computenidxs @ bld/grindsted/final/default/src/fusion/SemidefiniteConstraint.mbi:29:6-70:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_PSDConstraint::computenidxs(std::shared_ptr< monty::ndarray< int32_t,1 > > _2921_shape,int32_t _2922_d0,int32_t _2923_d1,std::shared_ptr< monty::ndarray< int32_t,1 > > _2924_nativeidxs)
{
  _checked_ptr_1<int32_t> _ptr__2921_shape(_2921_shape ? _2921_shape->raw() : nullptr, _2921_shape ? _2921_shape->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__2924_nativeidxs(_2924_nativeidxs ? _2924_nativeidxs->raw() : nullptr, _2924_nativeidxs ? _2924_nativeidxs->size(0) : 0);
  int32_t _2925_nd = (int)((_2921_shape)->size(0));
  bool _2926_tril = (_2922_d0 < _2923_d1);
  int32_t _10619_;
  bool _10620_ = _2926_tril;
  if (_10620_)
  {
    _10619_ = _2922_d0;
  }
  else
  {
    _10619_ = _2923_d1;
  }
  int32_t _2927_conedim0 = _10619_;
  int32_t _10621_;
  bool _10622_ = _2926_tril;
  if (_10622_)
  {
    _10621_ = _2923_d1;
  }
  else
  {
    _10621_ = _2922_d0;
  }
  int32_t _2928_conedim1 = _10621_;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2929_dim = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)((int)1),(int32_t)((int)1),(int32_t)((int)1),(int32_t)((int)1)});
  _checked_ptr_1<int32_t> _ptr__2929_dim(_2929_dim ? _2929_dim->raw() : nullptr,_2929_dim ? _2929_dim->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2930_stride = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)5)));
  _checked_ptr_1<int32_t> _ptr__2930_stride(_2930_stride ? _2930_stride->raw() : nullptr,_2930_stride ? _2930_stride->size(0) : 0);
  int32_t _2931_size = (int)1;
  int32_t _10623_ = (int)0;
  int32_t _10624_ = (int)((_2921_shape)->size(0));
  for (int32_t _2932_i = _10623_; _2932_i < _10624_; ++_2932_i)
  {
    {
      _2931_size *= _ptr__2921_shape[_2932_i];
    }
  }
  int32_t _10625_ = (int)0;
  int32_t _10626_ = _2927_conedim0;
  for (int32_t _2933_i = _10625_; _2933_i < _10626_; ++_2933_i)
  {
    {
      _ptr__2929_dim[(int)0] *= _ptr__2921_shape[_2933_i];
    }
  }
  _ptr__2929_dim[(int)1] = _ptr__2921_shape[_2927_conedim0];
  int32_t _10627_ = safe_add( _2927_conedim0,(int)1 );
  int32_t _10628_ = _2928_conedim1;
  for (int32_t _2934_i = _10627_; _2934_i < _10628_; ++_2934_i)
  {
    {
      _ptr__2929_dim[(int)2] *= _ptr__2921_shape[_2934_i];
    }
  }
  _ptr__2929_dim[(int)3] = _ptr__2921_shape[_2928_conedim1];
  int32_t _10629_ = safe_add( _2928_conedim1,(int)1 );
  int32_t _10630_ = _2925_nd;
  for (int32_t _2935_i = _10629_; _2935_i < _10630_; ++_2935_i)
  {
    {
      _ptr__2929_dim[(int)4] *= _ptr__2921_shape[_2935_i];
    }
  }
  _ptr__2930_stride[(int)4] = (int)1;
  int32_t _10631_ = (int)1;
  int32_t _10632_ = (int)5;
  for (int32_t _2936_i = _10631_; _2936_i < _10632_; ++_2936_i)
  {
    {
      _ptr__2930_stride[(((int)5 - _2936_i) - (int)1)] = safe_mul( _ptr__2930_stride[((int)5 - _2936_i)],_ptr__2929_dim[((int)5 - _2936_i)] );
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _2937_nidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_2931_size)));
  _checked_ptr_1<int32_t> _ptr__2937_nidxs(_2937_nidxs ? _2937_nidxs->raw() : nullptr,_2937_nidxs ? _2937_nidxs->size(0) : 0);
  int32_t _2938_k = (int)0;
  if (_2926_tril)
  {
    {
      int32_t _10633_ = (int)0;
      int32_t _10634_ = _ptr__2929_dim[(int)0];
      for (int32_t _2939_i0 = _10633_; _2939_i0 < _10634_; ++_2939_i0)
      {
        {
          int32_t _10635_ = (int)0;
          int32_t _10636_ = _ptr__2929_dim[(int)1];
          for (int32_t _2940_i1 = _10635_; _2940_i1 < _10636_; ++_2940_i1)
          {
            {
              int32_t _10637_ = (int)0;
              int32_t _10638_ = _ptr__2929_dim[(int)2];
              for (int32_t _2941_i2 = _10637_; _2941_i2 < _10638_; ++_2941_i2)
              {
                {
                  int32_t _10639_ = _2940_i1;
                  int32_t _10640_ = _ptr__2929_dim[(int)1];
                  for (int32_t _2942_i3 = _10639_; _2942_i3 < _10640_; ++_2942_i3)
                  {
                    {
                      int32_t _10641_ = (int)0;
                      int32_t _10642_ = _ptr__2929_dim[(int)4];
                      for (int32_t _2943_i4 = _10641_; _2943_i4 < _10642_; ++_2943_i4)
                      {
                        {
                          _ptr__2937_nidxs[safe_add( safe_add( safe_add( safe_add( safe_mul( _2939_i0,_ptr__2930_stride[(int)0] ),safe_mul( _2940_i1,_ptr__2930_stride[(int)1] ) ),safe_mul( _2941_i2,_ptr__2930_stride[(int)2] ) ),safe_mul( _2942_i3,_ptr__2930_stride[(int)3] ) ),safe_mul( _2943_i4,_ptr__2930_stride[(int)4] ) )] = _ptr__2924_nativeidxs[_2938_k];
                          _ptr__2937_nidxs[safe_add( safe_add( safe_add( safe_add( safe_mul( _2939_i0,_ptr__2930_stride[(int)0] ),safe_mul( _2942_i3,_ptr__2930_stride[(int)1] ) ),safe_mul( _2941_i2,_ptr__2930_stride[(int)2] ) ),safe_mul( _2940_i1,_ptr__2930_stride[(int)3] ) ),safe_mul( _2943_i4,_ptr__2930_stride[(int)4] ) )] = _ptr__2924_nativeidxs[_2938_k];
                          ++ _2938_k;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  else
  {
    {
      int32_t _10643_ = (int)0;
      int32_t _10644_ = _ptr__2929_dim[(int)0];
      for (int32_t _2944_i0 = _10643_; _2944_i0 < _10644_; ++_2944_i0)
      {
        {
          int32_t _10645_ = (int)0;
          int32_t _10646_ = _ptr__2929_dim[(int)1];
          for (int32_t _2945_i1 = _10645_; _2945_i1 < _10646_; ++_2945_i1)
          {
            {
              int32_t _10647_ = (int)0;
              int32_t _10648_ = _ptr__2929_dim[(int)2];
              for (int32_t _2946_i2 = _10647_; _2946_i2 < _10648_; ++_2946_i2)
              {
                {
                  int32_t _10649_ = (int)0;
                  int32_t _10650_ = safe_add( _2945_i1,(int)1 );
                  for (int32_t _2947_i3 = _10649_; _2947_i3 < _10650_; ++_2947_i3)
                  {
                    {
                      int32_t _10651_ = (int)0;
                      int32_t _10652_ = _ptr__2929_dim[(int)4];
                      for (int32_t _2948_i4 = _10651_; _2948_i4 < _10652_; ++_2948_i4)
                      {
                        {
                          _ptr__2937_nidxs[safe_add( safe_add( safe_add( safe_add( safe_mul( _2944_i0,_ptr__2930_stride[(int)0] ),safe_mul( _2945_i1,_ptr__2930_stride[(int)1] ) ),safe_mul( _2946_i2,_ptr__2930_stride[(int)2] ) ),safe_mul( _2947_i3,_ptr__2930_stride[(int)3] ) ),safe_mul( _2948_i4,_ptr__2930_stride[(int)4] ) )] = _ptr__2924_nativeidxs[_2938_k];
                          _ptr__2937_nidxs[safe_add( safe_add( safe_add( safe_add( safe_mul( _2944_i0,_ptr__2930_stride[(int)0] ),safe_mul( _2947_i3,_ptr__2930_stride[(int)1] ) ),safe_mul( _2946_i2,_ptr__2930_stride[(int)2] ) ),safe_mul( _2945_i1,_ptr__2930_stride[(int)3] ) ),safe_mul( _2948_i4,_ptr__2930_stride[(int)4] ) )] = _ptr__2924_nativeidxs[_2938_k];
                          ++ _2938_k;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return _2937_nidxs;
}
// End mosek.fusion.PSDConstraint.computenidxs

void mosek::fusion::p_PSDConstraint::destroy()
{
  shape.reset();
  slackidxs.reset();
  nativeidxs.reset();
}
void mosek::fusion::PSDConstraint::destroy() { mosek::fusion::p_PSDConstraint::_get_impl(this)->destroy(); }
// } class PSDConstraint
// class SliceConstraint { // @ bld/grindsted/final/default/src/fusion/SliceConstraint.mbi:23:4-43:5
mosek::fusion::SliceConstraint::SliceConstraint(mosek::fusion::p_SliceConstraint *_impl) : mosek::fusion::Constraint(_impl) { /*std::cout << "SliceConstraint()" << this << std::endl; */ }
mosek::fusion::SliceConstraint::~SliceConstraint() {  /* std::cout << "~SliceConstraint()" << this << std::endl << std::flush; */ }
mosek::fusion::p_SliceConstraint::p_SliceConstraint
  (::mosek::fusion::SliceConstraint * _pubthis) :     mosek::fusion::p_Constraint(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.SliceConstraint.ctor @ bld/grindsted/final/default/src/fusion/SliceConstraint.mbi:33:6-36:7
mosek::fusion::SliceConstraint::t mosek::fusion::p_SliceConstraint::_new_SliceConstraint
  (monty::rc_ptr< ::mosek::fusion::SliceConstraint > _2949_c)
{ return new mosek::fusion::SliceConstraint(_2949_c); }
mosek::fusion::SliceConstraint::SliceConstraint
  (monty::rc_ptr< ::mosek::fusion::SliceConstraint > _2949_c) : 
   SliceConstraint(new mosek::fusion::p_SliceConstraint(this))
{ mosek::fusion::p_SliceConstraint::_get_impl(this)->_initialize(_2949_c); }
void mosek::fusion::p_SliceConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::SliceConstraint > _2949_c)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_Constraint::_initialize(_2949_c,_2949_c->__mosek_2fusion_2Constraint__getModel());
  }
}
// mosek.fusion.SliceConstraint.ctor

// mosek.fusion.SliceConstraint.ctor @ bld/grindsted/final/default/src/fusion/SliceConstraint.mbi:26:6-31:7
mosek::fusion::SliceConstraint::t mosek::fusion::p_SliceConstraint::_new_SliceConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2950_model,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2951_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2952_nativeidxs)
{ return new mosek::fusion::SliceConstraint(_2950_model,_2951_shape,_2952_nativeidxs); }
mosek::fusion::SliceConstraint::SliceConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2950_model,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2951_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2952_nativeidxs) : 
   SliceConstraint(new mosek::fusion::p_SliceConstraint(this))
{ mosek::fusion::p_SliceConstraint::_get_impl(this)->_initialize(_2950_model,_2951_shape,_2952_nativeidxs); }
void mosek::fusion::p_SliceConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2950_model,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2951_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2952_nativeidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2951_shape(_2951_shape ? _2951_shape->raw() : nullptr, _2951_shape ? _2951_shape->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__2952_nativeidxs(_2952_nativeidxs ? _2952_nativeidxs->raw() : nullptr, _2952_nativeidxs ? _2952_nativeidxs->size(0) : 0);
    mosek::fusion::p_Constraint::_initialize(_2950_model,_2951_shape,_2952_nativeidxs);
  }
}
// mosek.fusion.SliceConstraint.ctor

// Begin mosek.fusion.SliceConstraint.toString
// Method mosek.fusion.SliceConstraint.toString @ bld/grindsted/final/default/src/fusion/SliceConstraint.mbi:38:6-42:7
std::string mosek::fusion::SliceConstraint :: toString() { return mosek::fusion::p_SliceConstraint::_get_impl(this)->toString(); }
std::string mosek::fusion::p_SliceConstraint::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2953_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  _2953_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("SliceConstraint()"));
  return _2953_sb->toString();
}
// End mosek.fusion.SliceConstraint.toString

void mosek::fusion::p_SliceConstraint::destroy()
{
}
void mosek::fusion::SliceConstraint::destroy() { mosek::fusion::p_SliceConstraint::_get_impl(this)->destroy(); }
// } class SliceConstraint
// class RangedConstraint { // @ bld/grindsted/final/default/src/fusion/RangedConstraint.mbi:13:4-204:5
mosek::fusion::RangedConstraint::RangedConstraint(mosek::fusion::p_RangedConstraint *_impl) : mosek::fusion::ModelConstraint(_impl) { /*std::cout << "RangedConstraint()" << this << std::endl; */ }
mosek::fusion::RangedConstraint::~RangedConstraint() {  /* std::cout << "~RangedConstraint()" << this << std::endl << std::flush; */ }
mosek::fusion::p_RangedConstraint::p_RangedConstraint
  (::mosek::fusion::RangedConstraint * _pubthis) :     mosek::fusion::p_ModelConstraint(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.RangedConstraint.ctor @ bld/grindsted/final/default/src/fusion/RangedConstraint.mbi:32:6-39:7
mosek::fusion::RangedConstraint::t mosek::fusion::p_RangedConstraint::_new_RangedConstraint
  (monty::rc_ptr< ::mosek::fusion::RangedConstraint > _2954_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2955_m)
{ return new mosek::fusion::RangedConstraint(_2954_c,_2955_m); }
mosek::fusion::RangedConstraint::RangedConstraint
  (monty::rc_ptr< ::mosek::fusion::RangedConstraint > _2954_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2955_m) : 
   RangedConstraint(new mosek::fusion::p_RangedConstraint(this))
{ mosek::fusion::p_RangedConstraint::_get_impl(this)->_initialize(_2954_c,_2955_m); }
void mosek::fusion::p_RangedConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::RangedConstraint > _2954_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2955_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ModelConstraint::_initialize(_2954_c,_2955_m);
    shape = mosek::fusion::p_RangedConstraint::_get_impl(_2954_c)->shape;
    nativeidxs = mosek::fusion::p_RangedConstraint::_get_impl(_2954_c)->nativeidxs;
  }
}
// mosek.fusion.RangedConstraint.ctor

// mosek.fusion.RangedConstraint.ctor @ bld/grindsted/final/default/src/fusion/RangedConstraint.mbi:19:6-29:7
mosek::fusion::RangedConstraint::t mosek::fusion::p_RangedConstraint::_new_RangedConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2956_model,
    const std::string &  _2957_name,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2958_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2959_nativeidxs,
    int32_t _2960_conid)
{ return new mosek::fusion::RangedConstraint(_2956_model,_2957_name,_2958_shape,_2959_nativeidxs,_2960_conid); }
mosek::fusion::RangedConstraint::RangedConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2956_model,
    const std::string &  _2957_name,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2958_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2959_nativeidxs,
    int32_t _2960_conid) : 
   RangedConstraint(new mosek::fusion::p_RangedConstraint(this))
{ mosek::fusion::p_RangedConstraint::_get_impl(this)->_initialize(_2956_model,_2957_name,_2958_shape,_2959_nativeidxs,_2960_conid); }
void mosek::fusion::p_RangedConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2956_model,
    const std::string &  _2957_name,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2958_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2959_nativeidxs,
    int32_t _2960_conid)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2958_shape(_2958_shape ? _2958_shape->raw() : nullptr, _2958_shape ? _2958_shape->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__2959_nativeidxs(_2959_nativeidxs ? _2959_nativeidxs->raw() : nullptr, _2959_nativeidxs ? _2959_nativeidxs->size(0) : 0);
    mosek::fusion::p_ModelConstraint::_initialize(_2956_model,_2957_name,_2958_shape,_2959_nativeidxs,_2960_conid);
    mosek::fusion::p_RangedConstraint::_get_impl(::mosek::fusion::RangedConstraint::t(_pubthis))->shape = _2958_shape;
    mosek::fusion::p_RangedConstraint::_get_impl(::mosek::fusion::RangedConstraint::t(_pubthis))->nativeidxs = _2959_nativeidxs;
  }
}
// mosek.fusion.RangedConstraint.ctor

// Begin mosek.fusion.RangedConstraint.upperBoundCon
// Method mosek.fusion.RangedConstraint.upperBoundCon @ bld/grindsted/final/default/src/fusion/RangedConstraint.mbi:55:6-57:7
monty::rc_ptr< ::mosek::fusion::BoundInterfaceConstraint > mosek::fusion::RangedConstraint :: __mosek_2fusion_2RangedConstraint__upperBoundCon() { return mosek::fusion::p_RangedConstraint::_get_impl(this)->__mosek_2fusion_2RangedConstraint__upperBoundCon(); }
monty::rc_ptr< ::mosek::fusion::BoundInterfaceConstraint > mosek::fusion::RangedConstraint::upperBoundCon() { return __mosek_2fusion_2RangedConstraint__upperBoundCon(); }
monty::rc_ptr< ::mosek::fusion::BoundInterfaceConstraint > mosek::fusion::p_RangedConstraint::__mosek_2fusion_2RangedConstraint__upperBoundCon()
{
  return ::mosek::fusion::p_BoundInterfaceConstraint::_new_BoundInterfaceConstraint(_pubthis->__mosek_2fusion_2Constraint__getModel(),shape,nativeidxs,false);
}
// End mosek.fusion.RangedConstraint.upperBoundCon

// Begin mosek.fusion.RangedConstraint.lowerBoundCon
// Method mosek.fusion.RangedConstraint.lowerBoundCon @ bld/grindsted/final/default/src/fusion/RangedConstraint.mbi:49:6-51:7
monty::rc_ptr< ::mosek::fusion::BoundInterfaceConstraint > mosek::fusion::RangedConstraint :: __mosek_2fusion_2RangedConstraint__lowerBoundCon() { return mosek::fusion::p_RangedConstraint::_get_impl(this)->__mosek_2fusion_2RangedConstraint__lowerBoundCon(); }
monty::rc_ptr< ::mosek::fusion::BoundInterfaceConstraint > mosek::fusion::RangedConstraint::lowerBoundCon() { return __mosek_2fusion_2RangedConstraint__lowerBoundCon(); }
monty::rc_ptr< ::mosek::fusion::BoundInterfaceConstraint > mosek::fusion::p_RangedConstraint::__mosek_2fusion_2RangedConstraint__lowerBoundCon()
{
  return ::mosek::fusion::p_BoundInterfaceConstraint::_new_BoundInterfaceConstraint(_pubthis->__mosek_2fusion_2Constraint__getModel(),shape,nativeidxs,true);
}
// End mosek.fusion.RangedConstraint.lowerBoundCon

// Begin mosek.fusion.RangedConstraint.clone
// Method mosek.fusion.RangedConstraint.clone @ bld/grindsted/final/default/src/fusion/RangedConstraint.mbi:41:6-44:7
monty::rc_ptr< ::mosek::fusion::ModelConstraint > mosek::fusion::p_RangedConstraint::__mosek_2fusion_2RangedConstraint__clone(monty::rc_ptr< ::mosek::fusion::Model > _2961_m)
{
  return (::mosek::fusion::p_RangedConstraint::_new_RangedConstraint(::mosek::fusion::RangedConstraint::t(_pubthis),_2961_m)).as<::mosek::fusion::ModelConstraint>();
}
// End mosek.fusion.RangedConstraint.clone

void mosek::fusion::p_RangedConstraint::destroy()
{
  nativeidxs.reset();
  shape.reset();
}
void mosek::fusion::RangedConstraint::destroy() { mosek::fusion::p_RangedConstraint::_get_impl(this)->destroy(); }
// } class RangedConstraint
// class ConicConstraint { // @ bld/grindsted/final/default/src/fusion/ConicConstraint.mbi:22:4-94:5
mosek::fusion::ConicConstraint::ConicConstraint(mosek::fusion::p_ConicConstraint *_impl) : mosek::fusion::ModelConstraint(_impl) { /*std::cout << "ConicConstraint()" << this << std::endl; */ }
mosek::fusion::ConicConstraint::~ConicConstraint() {  /* std::cout << "~ConicConstraint()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ConicConstraint::p_ConicConstraint
  (::mosek::fusion::ConicConstraint * _pubthis) :     mosek::fusion::p_ModelConstraint(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ConicConstraint.ctor @ bld/grindsted/final/default/src/fusion/ConicConstraint.mbi:65:6-75:7
mosek::fusion::ConicConstraint::t mosek::fusion::p_ConicConstraint::_new_ConicConstraint
  (monty::rc_ptr< ::mosek::fusion::ConicConstraint > _2962_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2963_m)
{ return new mosek::fusion::ConicConstraint(_2962_c,_2963_m); }
mosek::fusion::ConicConstraint::ConicConstraint
  (monty::rc_ptr< ::mosek::fusion::ConicConstraint > _2962_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2963_m) : 
   ConicConstraint(new mosek::fusion::p_ConicConstraint(this))
{ mosek::fusion::p_ConicConstraint::_get_impl(this)->_initialize(_2962_c,_2963_m); }
void mosek::fusion::p_ConicConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::ConicConstraint > _2962_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2963_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ModelConstraint::_initialize(_2962_c,_2963_m);
    dom = mosek::fusion::p_ConicConstraint::_get_impl(_2962_c)->dom;
    conid = mosek::fusion::p_ConicConstraint::_get_impl(_2962_c)->conid;
    shape = mosek::fusion::p_ConicConstraint::_get_impl(_2962_c)->shape;
    name = mosek::fusion::p_ConicConstraint::_get_impl(_2962_c)->name;
    nativeidxs = mosek::fusion::p_ConicConstraint::_get_impl(_2962_c)->nativeidxs;
    names_flushed = mosek::fusion::p_ConicConstraint::_get_impl(_2962_c)->names_flushed;
    indexnames = mosek::fusion::p_ConicConstraint::_get_impl(_2962_c)->indexnames;
  }
}
// mosek.fusion.ConicConstraint.ctor

// mosek.fusion.ConicConstraint.ctor @ bld/grindsted/final/default/src/fusion/ConicConstraint.mbi:38:6-62:7
mosek::fusion::ConicConstraint::t mosek::fusion::p_ConicConstraint::_new_ConicConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2964_model,
    const std::string &  _2965_name,
    monty::rc_ptr< ::mosek::fusion::ConeDomain > _2966_dom,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2967_shape,
    int32_t _2968_conid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2969_nativeidxs,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _2970_indexnames)
{ return new mosek::fusion::ConicConstraint(_2964_model,_2965_name,_2966_dom,_2967_shape,_2968_conid,_2969_nativeidxs,_2970_indexnames); }
mosek::fusion::ConicConstraint::ConicConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2964_model,
    const std::string &  _2965_name,
    monty::rc_ptr< ::mosek::fusion::ConeDomain > _2966_dom,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2967_shape,
    int32_t _2968_conid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2969_nativeidxs,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _2970_indexnames) : 
   ConicConstraint(new mosek::fusion::p_ConicConstraint(this))
{ mosek::fusion::p_ConicConstraint::_get_impl(this)->_initialize(_2964_model,_2965_name,_2966_dom,_2967_shape,_2968_conid,_2969_nativeidxs,_2970_indexnames); }
void mosek::fusion::p_ConicConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2964_model,
    const std::string &  _2965_name,
    monty::rc_ptr< ::mosek::fusion::ConeDomain > _2966_dom,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2967_shape,
    int32_t _2968_conid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2969_nativeidxs,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _2970_indexnames)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2967_shape(_2967_shape ? _2967_shape->raw() : nullptr, _2967_shape ? _2967_shape->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__2969_nativeidxs(_2969_nativeidxs ? _2969_nativeidxs->raw() : nullptr, _2969_nativeidxs ? _2969_nativeidxs->size(0) : 0);
    std::vector<int32_t> _10653_;
    for (int32_t _2971_i = (int)0, _10654_ = (int)((_2969_nativeidxs)->size(0)); _2971_i < _10654_ ; ++_2971_i)
    {
      _10653_.push_back((-safe_add( (int)1,_ptr__2969_nativeidxs[_2971_i] )));
    }
    auto _10655_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10653_.size()),_10653_.begin(),_10653_.end()));
    mosek::fusion::p_ModelConstraint::_initialize(_2964_model,_2965_name,_2967_shape,_10655_,(-safe_add( (int)1,_2968_conid )));
    mosek::fusion::p_ConicConstraint::_get_impl(::mosek::fusion::ConicConstraint::t(_pubthis))->dom = _2966_dom;
    mosek::fusion::p_ConicConstraint::_get_impl(::mosek::fusion::ConicConstraint::t(_pubthis))->shape = _2967_shape;
    mosek::fusion::p_ConicConstraint::_get_impl(::mosek::fusion::ConicConstraint::t(_pubthis))->name = _2965_name;
    mosek::fusion::p_ConicConstraint::_get_impl(::mosek::fusion::ConicConstraint::t(_pubthis))->nativeidxs = _2969_nativeidxs;
    mosek::fusion::p_ConicConstraint::_get_impl(::mosek::fusion::ConicConstraint::t(_pubthis))->indexnames = _2970_indexnames;
    mosek::fusion::p_ConicConstraint::_get_impl(::mosek::fusion::ConicConstraint::t(_pubthis))->conid = _2968_conid;
    names_flushed = false;
  }
}
// mosek.fusion.ConicConstraint.ctor

// Begin mosek.fusion.ConicConstraint.toString
// Method mosek.fusion.ConicConstraint.toString @ bld/grindsted/final/default/src/fusion/ConicConstraint.mbi:88:6-92:7
std::string mosek::fusion::ConicConstraint :: toString() { return mosek::fusion::p_ConicConstraint::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ConicConstraint::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2972_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  _2972_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ConicConstraint('"))->__mosek_2fusion_2Utils_2StringBuffer__a(name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("')"));
  return _2972_sb->toString();
}
// End mosek.fusion.ConicConstraint.toString

// Begin mosek.fusion.ConicConstraint.domainToString
// Method mosek.fusion.ConicConstraint.domainToString @ bld/grindsted/final/default/src/fusion/ConicConstraint.mbi:83:6-85:7
void mosek::fusion::p_ConicConstraint::domainToString(int64_t _2973_i,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2974_sb)
{
  throw ::mosek::fusion::UnimplementedError(std::string ("ConicConstraint.domainToString"));
}
// End mosek.fusion.ConicConstraint.domainToString

// Begin mosek.fusion.ConicConstraint.clone
// Method mosek.fusion.ConicConstraint.clone @ bld/grindsted/final/default/src/fusion/ConicConstraint.mbi:77:6-80:7
monty::rc_ptr< ::mosek::fusion::ModelConstraint > mosek::fusion::p_ConicConstraint::__mosek_2fusion_2ConicConstraint__clone(monty::rc_ptr< ::mosek::fusion::Model > _2975_m)
{
  return (::mosek::fusion::p_ConicConstraint::_new_ConicConstraint(::mosek::fusion::ConicConstraint::t(_pubthis),_2975_m)).as<::mosek::fusion::ModelConstraint>();
}
// End mosek.fusion.ConicConstraint.clone

void mosek::fusion::p_ConicConstraint::destroy()
{
  indexnames.reset();
  nativeidxs.reset();
  shape.reset();
  dom.reset();
}
void mosek::fusion::ConicConstraint::destroy() { mosek::fusion::p_ConicConstraint::_get_impl(this)->destroy(); }
// } class ConicConstraint
// class LinearConstraint { // @ bld/grindsted/final/default/src/fusion/LinearConstraint.mbi:24:4-87:5
mosek::fusion::LinearConstraint::LinearConstraint(mosek::fusion::p_LinearConstraint *_impl) : mosek::fusion::ModelConstraint(_impl) { /*std::cout << "LinearConstraint()" << this << std::endl; */ }
mosek::fusion::LinearConstraint::~LinearConstraint() {  /* std::cout << "~LinearConstraint()" << this << std::endl << std::flush; */ }
mosek::fusion::p_LinearConstraint::p_LinearConstraint
  (::mosek::fusion::LinearConstraint * _pubthis) :     mosek::fusion::p_ModelConstraint(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.LinearConstraint.ctor @ bld/grindsted/final/default/src/fusion/LinearConstraint.mbi:51:6-60:7
mosek::fusion::LinearConstraint::t mosek::fusion::p_LinearConstraint::_new_LinearConstraint
  (monty::rc_ptr< ::mosek::fusion::LinearConstraint > _2976_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2977_m)
{ return new mosek::fusion::LinearConstraint(_2976_c,_2977_m); }
mosek::fusion::LinearConstraint::LinearConstraint
  (monty::rc_ptr< ::mosek::fusion::LinearConstraint > _2976_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2977_m) : 
   LinearConstraint(new mosek::fusion::p_LinearConstraint(this))
{ mosek::fusion::p_LinearConstraint::_get_impl(this)->_initialize(_2976_c,_2977_m); }
void mosek::fusion::p_LinearConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::LinearConstraint > _2976_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2977_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ModelConstraint::_initialize(_2976_c,_2977_m);
    conid = mosek::fusion::p_LinearConstraint::_get_impl(_2976_c)->conid;
    name = mosek::fusion::p_LinearConstraint::_get_impl(_2976_c)->name;
    nidxs = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_LinearConstraint::_get_impl(_2976_c)->nidxs);
    indexnames = mosek::fusion::p_LinearConstraint::_get_impl(_2976_c)->indexnames;
  }
}
// mosek.fusion.LinearConstraint.ctor

// mosek.fusion.LinearConstraint.ctor @ bld/grindsted/final/default/src/fusion/LinearConstraint.mbi:36:6-49:7
mosek::fusion::LinearConstraint::t mosek::fusion::p_LinearConstraint::_new_LinearConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2978_model,
    const std::string &  _2979_name,
    int32_t _2980_conid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2981_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2982_nidxs,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _2983_indexnames)
{ return new mosek::fusion::LinearConstraint(_2978_model,_2979_name,_2980_conid,_2981_shape,_2982_nidxs,_2983_indexnames); }
mosek::fusion::LinearConstraint::LinearConstraint
  (monty::rc_ptr< ::mosek::fusion::Model > _2978_model,
    const std::string &  _2979_name,
    int32_t _2980_conid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2981_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2982_nidxs,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _2983_indexnames) : 
   LinearConstraint(new mosek::fusion::p_LinearConstraint(this))
{ mosek::fusion::p_LinearConstraint::_get_impl(this)->_initialize(_2978_model,_2979_name,_2980_conid,_2981_shape,_2982_nidxs,_2983_indexnames); }
void mosek::fusion::p_LinearConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2978_model,
    const std::string &  _2979_name,
    int32_t _2980_conid,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2981_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2982_nidxs,
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _2983_indexnames)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2981_shape(_2981_shape ? _2981_shape->raw() : nullptr, _2981_shape ? _2981_shape->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__2982_nidxs(_2982_nidxs ? _2982_nidxs->raw() : nullptr, _2982_nidxs ? _2982_nidxs->size(0) : 0);
    mosek::fusion::p_ModelConstraint::_initialize(_2978_model,_2979_name,_2981_shape,_2982_nidxs,_2980_conid);
    mosek::fusion::p_LinearConstraint::_get_impl(::mosek::fusion::LinearConstraint::t(_pubthis))->nidxs = _2982_nidxs;
    mosek::fusion::p_LinearConstraint::_get_impl(::mosek::fusion::LinearConstraint::t(_pubthis))->conid = _2980_conid;
    mosek::fusion::p_LinearConstraint::_get_impl(::mosek::fusion::LinearConstraint::t(_pubthis))->name = _2979_name;
    mosek::fusion::p_LinearConstraint::_get_impl(::mosek::fusion::LinearConstraint::t(_pubthis))->indexnames = _2983_indexnames;
  }
}
// mosek.fusion.LinearConstraint.ctor

// Begin mosek.fusion.LinearConstraint.toString
// Method mosek.fusion.LinearConstraint.toString @ bld/grindsted/final/default/src/fusion/LinearConstraint.mbi:72:6-85:7
std::string mosek::fusion::LinearConstraint :: toString() { return mosek::fusion::p_LinearConstraint::_get_impl(this)->toString(); }
std::string mosek::fusion::p_LinearConstraint::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2984_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  _2984_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("LinearConstraint('"))->__mosek_2fusion_2Utils_2StringBuffer__a(name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("')"));
  return _2984_sb->toString();
}
// End mosek.fusion.LinearConstraint.toString

// Begin mosek.fusion.LinearConstraint.domainToString
// Method mosek.fusion.LinearConstraint.domainToString @ bld/grindsted/final/default/src/fusion/LinearConstraint.mbi:67:6-70:7
void mosek::fusion::p_LinearConstraint::domainToString(int64_t _2985_i,monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2986_sb)
{
}
// End mosek.fusion.LinearConstraint.domainToString

// Begin mosek.fusion.LinearConstraint.clone
// Method mosek.fusion.LinearConstraint.clone @ bld/grindsted/final/default/src/fusion/LinearConstraint.mbi:62:6-65:7
monty::rc_ptr< ::mosek::fusion::ModelConstraint > mosek::fusion::p_LinearConstraint::__mosek_2fusion_2LinearConstraint__clone(monty::rc_ptr< ::mosek::fusion::Model > _2987_m)
{
  return (::mosek::fusion::p_LinearConstraint::_new_LinearConstraint(::mosek::fusion::LinearConstraint::t(_pubthis),_2987_m)).as<::mosek::fusion::ModelConstraint>();
}
// End mosek.fusion.LinearConstraint.clone

void mosek::fusion::p_LinearConstraint::destroy()
{
  indexnames.reset();
  nidxs.reset();
}
void mosek::fusion::LinearConstraint::destroy() { mosek::fusion::p_LinearConstraint::_get_impl(this)->destroy(); }
// } class LinearConstraint
// class ModelConstraint { // @ bld/grindsted/final/default/src/fusion/ModelConstraint.mbi:19:4-79:5
mosek::fusion::ModelConstraint::ModelConstraint(mosek::fusion::p_ModelConstraint *_impl) : mosek::fusion::Constraint(_impl) { /*std::cout << "ModelConstraint()" << this << std::endl; */ }
mosek::fusion::ModelConstraint::~ModelConstraint() {  /* std::cout << "~ModelConstraint()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ModelConstraint::p_ModelConstraint
  (::mosek::fusion::ModelConstraint * _pubthis) :     mosek::fusion::p_Constraint(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ModelConstraint.ctor @ bld/grindsted/final/default/src/fusion/ModelConstraint.mbi:57:6-66:7
void mosek::fusion::p_ModelConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::ModelConstraint > _2988_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2989_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_Constraint::_initialize(_2988_c,_2989_m);
    mosek::fusion::p_ModelConstraint::_get_impl(::mosek::fusion::ModelConstraint::t(_pubthis))->conid = mosek::fusion::p_ModelConstraint::_get_impl(_2988_c)->conid;
    name = mosek::fusion::p_ModelConstraint::_get_impl(_2988_c)->name;
    modelcon_nativeidxs = mosek::fusion::p_ModelConstraint::_get_impl(_2988_c)->modelcon_nativeidxs;
    shape = mosek::fusion::p_ModelConstraint::_get_impl(_2988_c)->shape;
  }
}
// mosek.fusion.ModelConstraint.ctor

// mosek.fusion.ModelConstraint.ctor @ bld/grindsted/final/default/src/fusion/ModelConstraint.mbi:42:6-55:7
void mosek::fusion::p_ModelConstraint::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2990_model,
    const std::string &  _2991_name,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2992_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _2993_nidxs,
    int32_t _2994_conid)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__2992_shape(_2992_shape ? _2992_shape->raw() : nullptr, _2992_shape ? _2992_shape->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__2993_nidxs(_2993_nidxs ? _2993_nidxs->raw() : nullptr, _2993_nidxs ? _2993_nidxs->size(0) : 0);
    mosek::fusion::p_Constraint::_initialize(_2990_model,_2992_shape,_2993_nidxs);
    mosek::fusion::p_ModelConstraint::_get_impl(::mosek::fusion::ModelConstraint::t(_pubthis))->name = _2991_name;
    mosek::fusion::p_ModelConstraint::_get_impl(::mosek::fusion::ModelConstraint::t(_pubthis))->modelcon_nativeidxs = _2993_nidxs;
    mosek::fusion::p_ModelConstraint::_get_impl(::mosek::fusion::ModelConstraint::t(_pubthis))->shape = _2992_shape;
    mosek::fusion::p_ModelConstraint::_get_impl(::mosek::fusion::ModelConstraint::t(_pubthis))->conid = _2994_conid;
  }
}
// mosek.fusion.ModelConstraint.ctor

// Begin mosek.fusion.ModelConstraint.toString
// Method mosek.fusion.ModelConstraint.toString @ bld/grindsted/final/default/src/fusion/ModelConstraint.mbi:74:6-78:7
std::string mosek::fusion::ModelConstraint :: toString() { return mosek::fusion::p_ModelConstraint::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ModelConstraint::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _2995_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  _2995_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Constraint('"))->__mosek_2fusion_2Utils_2StringBuffer__a(name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("')"));
  return _2995_sb->toString();
}
// End mosek.fusion.ModelConstraint.toString

// Begin mosek.fusion.ModelConstraint.clone
// End mosek.fusion.ModelConstraint.clone

// Begin mosek.fusion.ModelConstraint.remove
// Method mosek.fusion.ModelConstraint.remove @ bld/grindsted/final/default/src/fusion/ModelConstraint.mbi:68:6-70:7
void mosek::fusion::ModelConstraint :: remove() { mosek::fusion::p_ModelConstraint::_get_impl(this)->remove(); }
void mosek::fusion::p_ModelConstraint::remove()
{
  mosek::fusion::p_Model::_get_impl(_pubthis->__mosek_2fusion_2Constraint__getModel().get())->removeConstraintBlock(conid);
}
// End mosek.fusion.ModelConstraint.remove

void mosek::fusion::p_ModelConstraint::destroy()
{
  shape.reset();
  modelcon_nativeidxs.reset();
}
void mosek::fusion::ModelConstraint::destroy() { mosek::fusion::p_ModelConstraint::_get_impl(this)->destroy(); }
// } class ModelConstraint
// class Constraint { // @ bld/grindsted/final/default/src/fusion/Constraint.mbi:110:4-680:5
mosek::fusion::Constraint::Constraint(mosek::fusion::p_Constraint *_impl) : _impl(_impl) { /*std::cout << "Constraint() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::Constraint::~Constraint() { delete _impl; _impl = nullptr; }
mosek::fusion::p_Constraint::p_Constraint
  (::mosek::fusion::Constraint * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.Constraint.ctor @ bld/grindsted/final/default/src/fusion/Constraint.mbi:135:6-140:7
void mosek::fusion::p_Constraint::_initialize  (monty::rc_ptr< ::mosek::fusion::Constraint > _2997_c,
    monty::rc_ptr< ::mosek::fusion::Model > _2998_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    model = _2998_m;
    shape = mosek::fusion::p_Constraint::_get_impl(_2997_c)->shape;
    con_nativeidxs = mosek::fusion::p_Constraint::_get_impl(_2997_c)->con_nativeidxs;
  }
}
// mosek.fusion.Constraint.ctor

// mosek.fusion.Constraint.ctor @ bld/grindsted/final/default/src/fusion/Constraint.mbi:124:6-132:7
void mosek::fusion::p_Constraint::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _2999_model,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3000_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3001_con_nativeidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__3000_shape(_3000_shape ? _3000_shape->raw() : nullptr, _3000_shape ? _3000_shape->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__3001_con_nativeidxs(_3001_con_nativeidxs ? _3001_con_nativeidxs->raw() : nullptr, _3001_con_nativeidxs ? _3001_con_nativeidxs->size(0) : 0);
    mosek::fusion::p_Constraint::_get_impl(::mosek::fusion::Constraint::t(_pubthis))->model = _2999_model;
    mosek::fusion::p_Constraint::_get_impl(::mosek::fusion::Constraint::t(_pubthis))->shape = _3000_shape;
    mosek::fusion::p_Constraint::_get_impl(::mosek::fusion::Constraint::t(_pubthis))->con_nativeidxs = _3001_con_nativeidxs;
  }
}
// mosek.fusion.Constraint.ctor

// Begin mosek.fusion.Constraint.toString
// Method mosek.fusion.Constraint.toString @ bld/grindsted/final/default/src/fusion/Constraint.mbi:662:6-679:7
std::string mosek::fusion::Constraint :: toString() { return mosek::fusion::p_Constraint::_get_impl(this)->toString(); }
std::string mosek::fusion::p_Constraint::toString()
{
  throw ::mosek::fusion::UnimplementedError(std::string ("Constraint.toString"));
}
// End mosek.fusion.Constraint.toString

// Begin mosek.fusion.Constraint.toStringArray
// Method mosek.fusion.Constraint.toStringArray @ bld/grindsted/final/default/src/fusion/Constraint.mbi:651:6-657:7
void mosek::fusion::p_Constraint::toStringArray(std::shared_ptr< monty::ndarray< int64_t,1 > > _3002_subi,int64_t _3003_dstidx,std::shared_ptr< monty::ndarray< std::string,1 > > _3004_result)
{
  _checked_ptr_1<int64_t> _ptr__3002_subi(_3002_subi ? _3002_subi->raw() : nullptr, _3002_subi ? _3002_subi->size(0) : 0);
}
// End mosek.fusion.Constraint.toStringArray

// Begin mosek.fusion.Constraint.dual_lu
// Method mosek.fusion.Constraint.dual_lu @ bld/grindsted/final/default/src/fusion/Constraint.mbi:642:6-644:7
void mosek::fusion::p_Constraint::dual_lu(int32_t _3005_offset,std::shared_ptr< monty::ndarray< double,1 > > _3006_target,bool _3007_islower)
{
  _checked_ptr_1<double> _ptr__3006_target(_3006_target ? _3006_target->raw() : nullptr, _3006_target ? _3006_target->size(0) : 0);
  model->getConstraintDuals(_3007_islower,con_nativeidxs,_3006_target,_3005_offset);
}
// End mosek.fusion.Constraint.dual_lu

// Begin mosek.fusion.Constraint.dual
// Method mosek.fusion.Constraint.dual @ bld/grindsted/final/default/src/fusion/Constraint.mbi:636:6-640:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::Constraint :: dual() { return mosek::fusion::p_Constraint::_get_impl(this)->dual(); }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Constraint::dual()
{
  std::shared_ptr< monty::ndarray< double,1 > > _3008_res = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)((con_nativeidxs)->size(0)))));
  _checked_ptr_1<double> _ptr__3008_res(_3008_res ? _3008_res->raw() : nullptr,_3008_res ? _3008_res->size(0) : 0);
  values(false,(int)0,_3008_res);
  return _3008_res;
}
// End mosek.fusion.Constraint.dual

// Begin mosek.fusion.Constraint.level
// Method mosek.fusion.Constraint.level @ bld/grindsted/final/default/src/fusion/Constraint.mbi:623:6-627:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::Constraint :: level() { return mosek::fusion::p_Constraint::_get_impl(this)->level(); }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_Constraint::level()
{
  std::shared_ptr< monty::ndarray< double,1 > > _3009_res = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)((con_nativeidxs)->size(0)))));
  _checked_ptr_1<double> _ptr__3009_res(_3009_res ? _3009_res->raw() : nullptr,_3009_res ? _3009_res->size(0) : 0);
  values(true,(int)0,_3009_res);
  return _3009_res;
}
// End mosek.fusion.Constraint.level

// Begin mosek.fusion.Constraint.values
// Method mosek.fusion.Constraint.values @ bld/grindsted/final/default/src/fusion/Constraint.mbi:607:6-613:7
void mosek::fusion::p_Constraint::values(bool _3010_primal,int32_t _3011_offset,std::shared_ptr< monty::ndarray< double,1 > > _3012_target)
{
  _checked_ptr_1<double> _ptr__3012_target(_3012_target ? _3012_target->raw() : nullptr, _3012_target ? _3012_target->size(0) : 0);
  model->getConstraintValues(_3010_primal,con_nativeidxs,_3012_target,_3011_offset);
}
// End mosek.fusion.Constraint.values

// Begin mosek.fusion.Constraint.remove
// Method mosek.fusion.Constraint.remove @ bld/grindsted/final/default/src/fusion/Constraint.mbi:601:6-603:7
void mosek::fusion::Constraint :: remove() { mosek::fusion::p_Constraint::_get_impl(this)->remove(); }
void mosek::fusion::p_Constraint::remove()
{
  throw ::mosek::fusion::DeletionError(std::string ("Only original constraints can be removed"));
}
// End mosek.fusion.Constraint.remove

// Begin mosek.fusion.Constraint.update
// Method mosek.fusion.Constraint.update @ bld/grindsted/final/default/src/fusion/Constraint.mbi:592:6-594:7
void mosek::fusion::Constraint :: update(std::shared_ptr< monty::ndarray< double,1 > > _3013_bfix) { mosek::fusion::p_Constraint::_get_impl(this)->update(_3013_bfix); }
void mosek::fusion::p_Constraint::update(std::shared_ptr< monty::ndarray< double,1 > > _3013_bfix)
{
  _checked_ptr_1<double> _ptr__3013_bfix(_3013_bfix ? _3013_bfix->raw() : nullptr, _3013_bfix ? _3013_bfix->size(0) : 0);
  _pubthis->update(::mosek::fusion::p_Expr::reshape(::mosek::fusion::p_Expr::constTerm(_3013_bfix),_pubthis->getShape()),(::mosek::fusion::p_NilVariable::_new_NilVariable()).as<::mosek::fusion::Variable>(),true);
}
// End mosek.fusion.Constraint.update

// Begin mosek.fusion.Constraint.update
// Method mosek.fusion.Constraint.update @ bld/grindsted/final/default/src/fusion/Constraint.mbi:577:6-590:7
void mosek::fusion::Constraint :: update(monty::rc_ptr< ::mosek::fusion::Expression > _3014_expr) { mosek::fusion::p_Constraint::_get_impl(this)->update(_3014_expr); }
void mosek::fusion::p_Constraint::update(monty::rc_ptr< ::mosek::fusion::Expression > _3014_expr)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3015_eshape = _3014_expr->getShape();
  _checked_ptr_1<int32_t> _ptr__3015_eshape(_3015_eshape ? _3015_eshape->raw() : nullptr,_3015_eshape ? _3015_eshape->size(0) : 0);
  if (((int)((shape)->size(0)) < (int)((_3015_eshape)->size(0))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Expression shape does not match constraint"));
    }
  }
  {}
  int32_t _10656_ = (int)0;
  int32_t _10657_ = (int)((_3015_eshape)->size(0));
  for (int32_t _3016_i = _10656_; _3016_i < _10657_; ++_3016_i)
  {
    {
      if ((_ptr__3015_eshape[_3016_i] != ((*shape)(_3016_i))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Expression shape does not match constraint"));
        }
      }
      {}
    }
  }
  int32_t _10658_ = (int)((_3015_eshape)->size(0));
  int32_t _10659_ = (int)((shape)->size(0));
  for (int32_t _3017_i = _10658_; _3017_i < _10659_; ++_3017_i)
  {
    {
      if ((((*shape)(_3017_i)) != (int)1))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Expression shape does not match constraint"));
        }
      }
      {}
    }
  }
  mosek::fusion::p_Model::_get_impl(model.get())->update(con_nativeidxs,_3014_expr);
}
// End mosek.fusion.Constraint.update

// Begin mosek.fusion.Constraint.update
// Method mosek.fusion.Constraint.update @ bld/grindsted/final/default/src/fusion/Constraint.mbi:517:6-574:7
void mosek::fusion::Constraint :: update(monty::rc_ptr< ::mosek::fusion::Expression > _3018_expr,monty::rc_ptr< ::mosek::fusion::Variable > _3019_x,bool _3020_bfixupdate) { mosek::fusion::p_Constraint::_get_impl(this)->update(_3018_expr,_3019_x,_3020_bfixupdate); }
void mosek::fusion::p_Constraint::update(monty::rc_ptr< ::mosek::fusion::Expression > _3018_expr,monty::rc_ptr< ::mosek::fusion::Variable > _3019_x,bool _3020_bfixupdate)
{
  int32_t _3021_nd = _pubthis->getND();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3022_eshape = _3018_expr->getShape();
  _checked_ptr_1<int32_t> _ptr__3022_eshape(_3022_eshape ? _3022_eshape->raw() : nullptr,_3022_eshape ? _3022_eshape->size(0) : 0);
  if ((_3021_nd < (int)((_3022_eshape)->size(0))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Expression shape does not match constraint"));
    }
  }
  {}
  int32_t _10660_ = (int)0;
  int32_t _10661_ = (int)((_3022_eshape)->size(0));
  for (int32_t _3023_i = _10660_; _3023_i < _10661_; ++_3023_i)
  {
    {
      if ((_ptr__3022_eshape[_3023_i] != ((*shape)(_3023_i))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Expression shape does not match constraint"));
        }
      }
      {}
    }
  }
  int32_t _10662_ = (int)((_3022_eshape)->size(0));
  int32_t _10663_ = (int)((shape)->size(0));
  for (int32_t _3024_i = _10662_; _3024_i < _10663_; ++_3024_i)
  {
    {
      if ((((*shape)(_3024_i)) != (int)1))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Expression shape does not match constraint"));
        }
      }
      {}
    }
  }
  int32_t _3025_ni = _3019_x->numInst();
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3026_varidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_3025_ni)));
  _checked_ptr_1<int64_t> _ptr__3026_varidxs(_3026_varidxs ? _3026_varidxs->raw() : nullptr,_3026_varidxs ? _3026_varidxs->size(0) : 0);
  if ((_3025_ni < _3019_x->getSize()))
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _3027_sp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_3025_ni)));
      _checked_ptr_1<int64_t> _ptr__3027_sp(_3027_sp ? _3027_sp->raw() : nullptr,_3027_sp ? _3027_sp->size(0) : 0);
      _3019_x->inst((int)0,_3027_sp,(int)0,_3026_varidxs);
    }
  }
  else
  {
    {
      _3019_x->inst((int)0,_3026_varidxs);
    }
  }
  int32_t _10664_ = (int)0;
  int32_t _10665_ = _3025_ni;
  for (int32_t _3028_i = _10664_; _3028_i < _10665_; ++_3028_i)
  {
    {
      if ((_ptr__3026_varidxs[_3028_i] < (int)0))
      {
        {
          throw ::mosek::fusion::UpdateError(std::string ("Semidefinite terms cannot be updated"));
        }
      }
      {}
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3029_varidxs32;
  _checked_ptr_1<int32_t> _ptr__3029_varidxs32(_3029_varidxs32 ? _3029_varidxs32->raw() : nullptr,_3029_varidxs32 ? _3029_varidxs32->size(0) : 0);
  {
    bool _3030_issorted = true;
    int32_t _10666_ = (int)0;
    int32_t _10667_ = (_3025_ni - (int)1);
    for (int32_t _3031_i = _10666_; _3031_i < _10667_; ++_3031_i)
    {
      {
        _3030_issorted = (_3030_issorted && (_ptr__3026_varidxs[_3031_i] < _ptr__3026_varidxs[safe_add( _3031_i,(int)1 )]));
      }
    }
    if (_3030_issorted)
    {
      {
        if ((!_3020_bfixupdate))
        {
          {
            std::vector<int32_t> _10668_;
            for (int32_t _3032_i = (int)0, _10669_ = _3025_ni; _3032_i < _10669_ ; ++_3032_i)
            {
              _10668_.push_back((int32_t)_ptr__3026_varidxs[_3032_i]);
            }
            auto _10670_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10668_.size()),_10668_.begin(),_10668_.end()));
            _3029_varidxs32 = _10670_;
            _ptr__3029_varidxs32.update(_3029_varidxs32 ? _3029_varidxs32->raw() : nullptr, _3029_varidxs32 ? _3029_varidxs32->size(0) : 0);
          }
        }
        else
        {
          {
            _3029_varidxs32 = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _3025_ni,(int)1 ))));
            _ptr__3029_varidxs32.update(_3029_varidxs32 ? _3029_varidxs32->raw() : nullptr, _3029_varidxs32 ? _3029_varidxs32->size(0) : 0);
            _ptr__3029_varidxs32[(int)0] = (int)0;
            int32_t _10671_ = (int)0;
            int32_t _10672_ = _3025_ni;
            for (int32_t _3033_i = _10671_; _3033_i < _10672_; ++_3033_i)
            {
              {
                _ptr__3029_varidxs32[safe_add( (int)1,_3033_i )] = (int32_t)_ptr__3026_varidxs[_3033_i];
              }
            }
          }
        }
      }
    }
    else
    {
      {
        std::vector<int64_t> _10673_;
        for (int32_t _3035_i = (int)0, _10674_ = _3025_ni; _3035_i < _10674_ ; ++_3035_i)
        {
          _10673_.push_back(_3035_i);
        }
        auto _10675_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_10673_.size()),_10673_.begin(),_10673_.end()));
        std::shared_ptr< monty::ndarray< int64_t,1 > > _3034_perm = _10675_;
        _checked_ptr_1<int64_t> _ptr__3034_perm(_3034_perm ? _3034_perm->raw() : nullptr,_3034_perm ? _3034_perm->size(0) : 0);
        ::mosek::fusion::p_CommonTools::argQsort(_3034_perm,_3026_varidxs,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),(int64_t)((int)0),(int64_t)(_3025_ni));
        int32_t _3036_nunique = (int)1;
        int32_t _10676_ = (int)1;
        int32_t _10677_ = _3025_ni;
        for (int32_t _3037_i = _10676_; _3037_i < _10677_; ++_3037_i)
        {
          {
            if ((_ptr__3026_varidxs[_ptr__3034_perm[(_3037_i - (int)1)]] < _ptr__3026_varidxs[_ptr__3034_perm[_3037_i]]))
            {
              {
                ++ _3036_nunique;
              }
            }
            {}
          }
        }
        if (_3020_bfixupdate)
        {
          {
            _3036_nunique += (int)1;
          }
        }
        {}
        _3029_varidxs32 = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3036_nunique)));
        _ptr__3029_varidxs32.update(_3029_varidxs32 ? _3029_varidxs32->raw() : nullptr, _3029_varidxs32 ? _3029_varidxs32->size(0) : 0);
        int32_t _3038_k = (int)0;
        if (_3020_bfixupdate)
        {
          {
            _ptr__3029_varidxs32[(int)0] = (int)0;
            ++ _3038_k;
          }
        }
        {}
        _ptr__3029_varidxs32[_3038_k] = (int32_t)_ptr__3026_varidxs[_ptr__3034_perm[(int)0]];
        int32_t _10678_ = (int)1;
        int32_t _10679_ = _3025_ni;
        for (int32_t _3039_i = _10678_; _3039_i < _10679_; ++_3039_i)
        {
          {
            if ((_ptr__3026_varidxs[(_3039_i - (int)1)] < _ptr__3026_varidxs[_3039_i]))
            {
              {
                _ptr__3029_varidxs32[_3038_k] = (int32_t)_ptr__3026_varidxs[_ptr__3034_perm[_3039_i]];
                ++ _3038_k;
              }
            }
            {}
          }
        }
      }
    }
  }
  mosek::fusion::p_Model::_get_impl(model.get())->update(con_nativeidxs,_3018_expr,_3029_varidxs32);
}
// End mosek.fusion.Constraint.update

// Begin mosek.fusion.Constraint.update
// Method mosek.fusion.Constraint.update @ bld/grindsted/final/default/src/fusion/Constraint.mbi:513:6-515:7
void mosek::fusion::Constraint :: update(monty::rc_ptr< ::mosek::fusion::Expression > _3040_expr,monty::rc_ptr< ::mosek::fusion::Variable > _3041_x) { mosek::fusion::p_Constraint::_get_impl(this)->update(_3040_expr,_3041_x); }
void mosek::fusion::p_Constraint::update(monty::rc_ptr< ::mosek::fusion::Expression > _3040_expr,monty::rc_ptr< ::mosek::fusion::Variable > _3041_x)
{
  _pubthis->update(_3040_expr,_3041_x,false);
}
// End mosek.fusion.Constraint.update

// Begin mosek.fusion.Constraint.get_model
// Method mosek.fusion.Constraint.get_model @ bld/grindsted/final/default/src/fusion/Constraint.mbi:505:6-508:7
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::Constraint :: __mosek_2fusion_2Constraint__get_model() { return mosek::fusion::p_Constraint::_get_impl(this)->__mosek_2fusion_2Constraint__get_model(); }
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::Constraint::get_model() { return __mosek_2fusion_2Constraint__get_model(); }
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::p_Constraint::__mosek_2fusion_2Constraint__get_model()
{
  return model;
}
// End mosek.fusion.Constraint.get_model

// Begin mosek.fusion.Constraint.get_nd
// Method mosek.fusion.Constraint.get_nd @ bld/grindsted/final/default/src/fusion/Constraint.mbi:498:6-501:7
int32_t mosek::fusion::Constraint :: get_nd() { return mosek::fusion::p_Constraint::_get_impl(this)->get_nd(); }
int32_t mosek::fusion::p_Constraint::get_nd()
{
  return (int)((shape)->size(0));
}
// End mosek.fusion.Constraint.get_nd

// Begin mosek.fusion.Constraint.size
// Method mosek.fusion.Constraint.size @ bld/grindsted/final/default/src/fusion/Constraint.mbi:491:6-494:7
int64_t mosek::fusion::Constraint :: size() { return mosek::fusion::p_Constraint::_get_impl(this)->size(); }
int64_t mosek::fusion::p_Constraint::size()
{
  int64_t _3042_sz = (int)1;
  int32_t _10680_ = (int)0;
  int32_t _10681_ = (int)((shape)->size(0));
  for (int32_t _3043_i = _10680_; _3043_i < _10681_; ++_3043_i)
  {
    {
      _3042_sz *= ((*shape)(_3043_i));
    }
  }
  return _3042_sz;
}
// End mosek.fusion.Constraint.size

// Begin mosek.fusion.Constraint.stack
// Method mosek.fusion.Constraint.stack @ bld/grindsted/final/default/src/fusion/Constraint.mbi:479:6-484:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::stack
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > > _3044_clist,
    int32_t _3045_dim) { return mosek::fusion::p_Constraint::stack(_3044_clist,_3045_dim); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::stack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > > _3044_clist,int32_t _3045_dim)
{
  return ::mosek::fusion::p_Constraint::dstack(_3044_clist,_3045_dim);
}
// End mosek.fusion.Constraint.stack

// Begin mosek.fusion.Constraint.stack
// Method mosek.fusion.Constraint.stack @ bld/grindsted/final/default/src/fusion/Constraint.mbi:471:6-478:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::stack
  ( monty::rc_ptr< ::mosek::fusion::Constraint > _3046_v1,
    monty::rc_ptr< ::mosek::fusion::Constraint > _3047_v2,
    monty::rc_ptr< ::mosek::fusion::Constraint > _3048_v3,
    int32_t _3049_dim) { return mosek::fusion::p_Constraint::stack(_3046_v1,_3047_v2,_3048_v3,_3049_dim); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::stack(monty::rc_ptr< ::mosek::fusion::Constraint > _3046_v1,monty::rc_ptr< ::mosek::fusion::Constraint > _3047_v2,monty::rc_ptr< ::mosek::fusion::Constraint > _3048_v3,int32_t _3049_dim)
{
  return ::mosek::fusion::p_Constraint::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 >{::monty::rc_ptr<::mosek::fusion::Constraint>(_3046_v1.get()),::monty::rc_ptr<::mosek::fusion::Constraint>(_3047_v2.get()),::monty::rc_ptr<::mosek::fusion::Constraint>(_3048_v3.get())}),_3049_dim);
}
// End mosek.fusion.Constraint.stack

// Begin mosek.fusion.Constraint.stack
// Method mosek.fusion.Constraint.stack @ bld/grindsted/final/default/src/fusion/Constraint.mbi:463:6-469:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::stack
  ( monty::rc_ptr< ::mosek::fusion::Constraint > _3050_v1,
    monty::rc_ptr< ::mosek::fusion::Constraint > _3051_v2,
    int32_t _3052_dim) { return mosek::fusion::p_Constraint::stack(_3050_v1,_3051_v2,_3052_dim); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::stack(monty::rc_ptr< ::mosek::fusion::Constraint > _3050_v1,monty::rc_ptr< ::mosek::fusion::Constraint > _3051_v2,int32_t _3052_dim)
{
  return ::mosek::fusion::p_Constraint::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 >{::monty::rc_ptr<::mosek::fusion::Constraint>(_3050_v1.get()),::monty::rc_ptr<::mosek::fusion::Constraint>(_3051_v2.get())}),_3052_dim);
}
// End mosek.fusion.Constraint.stack

// Begin mosek.fusion.Constraint.hstack
// Method mosek.fusion.Constraint.hstack @ bld/grindsted/final/default/src/fusion/Constraint.mbi:456:6-460:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::hstack
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > > _3053_clist) { return mosek::fusion::p_Constraint::hstack(_3053_clist); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::hstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > > _3053_clist)
{
  return ::mosek::fusion::p_Constraint::dstack(_3053_clist,(int)1);
}
// End mosek.fusion.Constraint.hstack

// Begin mosek.fusion.Constraint.vstack
// Method mosek.fusion.Constraint.vstack @ bld/grindsted/final/default/src/fusion/Constraint.mbi:451:6-455:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::vstack
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > > _3054_clist) { return mosek::fusion::p_Constraint::vstack(_3054_clist); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::vstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > > _3054_clist)
{
  return ::mosek::fusion::p_Constraint::dstack(_3054_clist,(int)0);
}
// End mosek.fusion.Constraint.vstack

// Begin mosek.fusion.Constraint.hstack
// Method mosek.fusion.Constraint.hstack @ bld/grindsted/final/default/src/fusion/Constraint.mbi:432:6-438:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::hstack
  ( monty::rc_ptr< ::mosek::fusion::Constraint > _3055_v1,
    monty::rc_ptr< ::mosek::fusion::Constraint > _3056_v2,
    monty::rc_ptr< ::mosek::fusion::Constraint > _3057_v3) { return mosek::fusion::p_Constraint::hstack(_3055_v1,_3056_v2,_3057_v3); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::hstack(monty::rc_ptr< ::mosek::fusion::Constraint > _3055_v1,monty::rc_ptr< ::mosek::fusion::Constraint > _3056_v2,monty::rc_ptr< ::mosek::fusion::Constraint > _3057_v3)
{
  return ::mosek::fusion::p_Constraint::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 >{::monty::rc_ptr<::mosek::fusion::Constraint>(_3055_v1.get()),::monty::rc_ptr<::mosek::fusion::Constraint>(_3056_v2.get()),::monty::rc_ptr<::mosek::fusion::Constraint>(_3057_v3.get())}),(int)1);
}
// End mosek.fusion.Constraint.hstack

// Begin mosek.fusion.Constraint.vstack
// Method mosek.fusion.Constraint.vstack @ bld/grindsted/final/default/src/fusion/Constraint.mbi:425:6-431:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::vstack
  ( monty::rc_ptr< ::mosek::fusion::Constraint > _3058_v1,
    monty::rc_ptr< ::mosek::fusion::Constraint > _3059_v2,
    monty::rc_ptr< ::mosek::fusion::Constraint > _3060_v3) { return mosek::fusion::p_Constraint::vstack(_3058_v1,_3059_v2,_3060_v3); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::vstack(monty::rc_ptr< ::mosek::fusion::Constraint > _3058_v1,monty::rc_ptr< ::mosek::fusion::Constraint > _3059_v2,monty::rc_ptr< ::mosek::fusion::Constraint > _3060_v3)
{
  return ::mosek::fusion::p_Constraint::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 >{::monty::rc_ptr<::mosek::fusion::Constraint>(_3058_v1.get()),::monty::rc_ptr<::mosek::fusion::Constraint>(_3059_v2.get()),::monty::rc_ptr<::mosek::fusion::Constraint>(_3060_v3.get())}),(int)0);
}
// End mosek.fusion.Constraint.vstack

// Begin mosek.fusion.Constraint.hstack
// Method mosek.fusion.Constraint.hstack @ bld/grindsted/final/default/src/fusion/Constraint.mbi:406:6-411:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::hstack
  ( monty::rc_ptr< ::mosek::fusion::Constraint > _3061_v1,
    monty::rc_ptr< ::mosek::fusion::Constraint > _3062_v2) { return mosek::fusion::p_Constraint::hstack(_3061_v1,_3062_v2); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::hstack(monty::rc_ptr< ::mosek::fusion::Constraint > _3061_v1,monty::rc_ptr< ::mosek::fusion::Constraint > _3062_v2)
{
  return ::mosek::fusion::p_Constraint::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 >{::monty::rc_ptr<::mosek::fusion::Constraint>(_3061_v1.get()),::monty::rc_ptr<::mosek::fusion::Constraint>(_3062_v2.get())}),(int)1);
}
// End mosek.fusion.Constraint.hstack

// Begin mosek.fusion.Constraint.vstack
// Method mosek.fusion.Constraint.vstack @ bld/grindsted/final/default/src/fusion/Constraint.mbi:399:6-404:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::vstack
  ( monty::rc_ptr< ::mosek::fusion::Constraint > _3063_v1,
    monty::rc_ptr< ::mosek::fusion::Constraint > _3064_v2) { return mosek::fusion::p_Constraint::vstack(_3063_v1,_3064_v2); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::vstack(monty::rc_ptr< ::mosek::fusion::Constraint > _3063_v1,monty::rc_ptr< ::mosek::fusion::Constraint > _3064_v2)
{
  return ::mosek::fusion::p_Constraint::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 >{::monty::rc_ptr<::mosek::fusion::Constraint>(_3063_v1.get()),::monty::rc_ptr<::mosek::fusion::Constraint>(_3064_v2.get())}),(int)0);
}
// End mosek.fusion.Constraint.vstack

// Begin mosek.fusion.Constraint.dstack
// Method mosek.fusion.Constraint.dstack @ bld/grindsted/final/default/src/fusion/Constraint.mbi:277:6-386:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Constraint >,1 > > _3065_c,int32_t _3066_dim)
{
  monty::rc_ptr< ::mosek::fusion::Model > _3067_m0 = nullptr;
  {
    int32_t _10682_ = (int)0;
    int32_t _10683_ = (int)((_3065_c)->size(0));
    for (int32_t _3068_i = _10682_; _3068_i < _10683_; ++_3068_i)
    {
      {
        if ((NULL == _3067_m0.get()))
        {
          {
            _3067_m0 = ((*_3065_c)(_3068_i))->__mosek_2fusion_2Constraint__getModel();
          }
        }
        else if(((NULL != mosek::fusion::p_Constraint::_get_impl(((*_3065_c)(_3068_i)))->model.get()) && (mosek::fusion::p_Constraint::_get_impl(((*_3065_c)(_3068_i)))->model != _3067_m0)))
        {
          {
            monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _3069_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
            std::string _10684_;
            bool _10685_ = ((int)((mosek::fusion::p_Model::_get_impl(_3067_m0.get())->getName()).size()) > (int)0);
            if (_10685_)
            {
              _10684_ = mosek::fusion::p_Model::_get_impl(_3067_m0.get())->getName();
            }
            else
            {
              _10684_ = std::string ("?");
            }
            std::string _3070_m1name = _10684_;
            std::string _10686_;
            bool _10687_ = ((int)((mosek::fusion::p_Model::_get_impl(((*_3065_c)(_3068_i))->__mosek_2fusion_2Constraint__getModel().get())->getName()).size()) > (int)0);
            if (_10687_)
            {
              _10686_ = mosek::fusion::p_Model::_get_impl(((*_3065_c)(_3068_i))->__mosek_2fusion_2Constraint__getModel().get())->getName();
            }
            else
            {
              _10686_ = std::string ("?");
            }
            std::string _3071_m2name = _10686_;
            _3069_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Constraints belong to different models: '"))->__mosek_2fusion_2Utils_2StringBuffer__a(_3070_m1name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("' and '"))->__mosek_2fusion_2Utils_2StringBuffer__a(_3071_m2name)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("'"));
            throw ::mosek::fusion::ModelError(_3069_sb->toString());
          }
        }
        {}
      }
    }
  }
  if (((int)((_3065_c)->size(0)) == (int)0))
  {
    {
      return (::mosek::fusion::p_SliceConstraint::_new_SliceConstraint(nullptr,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)0)}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))))).as<::mosek::fusion::Constraint>();
    }
  }
  else if(((int)((_3065_c)->size(0)) == (int)1))
  {
    {
      return ((*_3065_c)((int)1));
    }
  }
  else
  {
    {
      int32_t _3072_n = (int)((_3065_c)->size(0));
      int32_t _3073_nd = (int)1;
      int32_t _10688_ = (int)0;
      int32_t _10689_ = _3072_n;
      for (int32_t _3074_i = _10688_; _3074_i < _10689_; ++_3074_i)
      {
        {
          int32_t _10690_;
          bool _10691_ = (((*_3065_c)(_3074_i))->getND() > _3073_nd);
          if (_10691_)
          {
            _10690_ = ((*_3065_c)(_3074_i))->getND();
          }
          else
          {
            _10690_ = _3073_nd;
          }
          _3073_nd = _10690_;
        }
      }
      if ((_3066_dim == _3073_nd))
      {
        {
          ++ _3073_nd;
        }
      }
      {}
      std::shared_ptr< monty::ndarray< int32_t,2 > > _3075_shape = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape(_3072_n,_3073_nd)));
      int32_t _10692_ = (int)0;
      int32_t _10693_ = _3072_n;
      for (int32_t _3076_i = _10692_; _3076_i < _10693_; ++_3076_i)
      {
        {
          int32_t _10694_ = (int)0;
          int32_t _10695_ = _3073_nd;
          for (int32_t _3077_j = _10694_; _3077_j < _10695_; ++_3077_j)
          {
            {
              ((*_3075_shape)(_3076_i,_3077_j)) = (int)1;
            }
          }
        }
      }
      std::vector<int32_t> _10696_;
      for (int32_t _3079_i = (int)0, _10697_ = _3072_n; _3079_i < _10697_ ; ++_3079_i)
      {
        _10696_.push_back(((*_3065_c)(_3079_i))->getSize());
      }
      auto _10698_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10696_.size()),_10696_.begin(),_10696_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3078_numnz = _10698_;
      _checked_ptr_1<int32_t> _ptr__3078_numnz(_3078_numnz ? _3078_numnz->raw() : nullptr,_3078_numnz ? _3078_numnz->size(0) : 0);
      int32_t _3080_totalnnz = (int)0;
      int32_t _10699_ = (int)0;
      int32_t _10700_ = _3072_n;
      for (int32_t _3081_i = _10699_; _3081_i < _10700_; ++_3081_i)
      {
        {
          _3080_totalnnz += _ptr__3078_numnz[_3081_i];
        }
      }
      int32_t _10701_ = (int)0;
      int32_t _10702_ = _3072_n;
      for (int32_t _3082_i = _10701_; _3082_i < _10702_; ++_3082_i)
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _3083_shpi = ((*_3065_c)(_3082_i))->getShape();
          _checked_ptr_1<int32_t> _ptr__3083_shpi(_3083_shpi ? _3083_shpi->raw() : nullptr,_3083_shpi ? _3083_shpi->size(0) : 0);
          int32_t _10703_ = (int)0;
          int32_t _10704_ = (int)((_3083_shpi)->size(0));
          for (int32_t _3084_j = _10703_; _3084_j < _10704_; ++_3084_j)
          {
            {
              ((*_3075_shape)(_3082_i,_3084_j)) = _ptr__3083_shpi[_3084_j];
            }
          }
        }
      }
      if (((_3066_dim < (int)0) || (_3066_dim > _3073_nd)))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Invalid stacking dimension"));
        }
      }
      {}
      int32_t _10705_ = (int)0;
      int32_t _10706_ = _3066_dim;
      for (int32_t _3085_i = _10705_; _3085_i < _10706_; ++_3085_i)
      {
        {
          int32_t _10707_ = (int)1;
          int32_t _10708_ = _3072_n;
          for (int32_t _3086_j = _10707_; _3086_j < _10708_; ++_3086_j)
          {
            {
              if ((((*_3075_shape)((int)0,_3085_i)) != ((*_3075_shape)(_3086_j,_3085_i))))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("Constraint dimensions do not match"));
                }
              }
              {}
            }
          }
        }
      }
      int32_t _10709_ = safe_add( _3066_dim,(int)1 );
      int32_t _10710_ = _3073_nd;
      for (int32_t _3087_i = _10709_; _3087_i < _10710_; ++_3087_i)
      {
        {
          int32_t _10711_ = (int)1;
          int32_t _10712_ = _3072_n;
          for (int32_t _3088_j = _10711_; _3088_j < _10712_; ++_3088_j)
          {
            {
              if ((((*_3075_shape)((int)0,_3087_i)) != ((*_3075_shape)(_3088_j,_3087_i))))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("Constraint dimensions do not match"));
                }
              }
              {}
            }
          }
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3089_con_nativeidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3080_totalnnz)));
      _checked_ptr_1<int32_t> _ptr__3089_con_nativeidxs(_3089_con_nativeidxs ? _3089_con_nativeidxs->raw() : nullptr,_3089_con_nativeidxs ? _3089_con_nativeidxs->size(0) : 0);
      std::vector<int32_t> _10713_;
      for (int32_t _3091_i = (int)0, _10714_ = _3073_nd; _3091_i < _10714_ ; ++_3091_i)
      {
        _10713_.push_back(((*_3075_shape)((int)0,_3091_i)));
      }
      auto _10715_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10713_.size()),_10713_.begin(),_10713_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3090_resshape = _10715_;
      _checked_ptr_1<int32_t> _ptr__3090_resshape(_3090_resshape ? _3090_resshape->raw() : nullptr,_3090_resshape ? _3090_resshape->size(0) : 0);
      int32_t _10716_ = (int)1;
      int32_t _10717_ = _3072_n;
      for (int32_t _3092_i = _10716_; _3092_i < _10717_; ++_3092_i)
      {
        {
          _ptr__3090_resshape[_3066_dim] += ((*_3075_shape)(_3092_i,_3066_dim));
        }
      }
      {
        int32_t _3093_rnd = (int)((_3090_resshape)->size(0));
        std::shared_ptr< monty::ndarray< int64_t,1 > > _3094_cumdims = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( (int)((_3065_c)->size(0)),(int)1 ))));
        _checked_ptr_1<int64_t> _ptr__3094_cumdims(_3094_cumdims ? _3094_cumdims->raw() : nullptr,_3094_cumdims ? _3094_cumdims->size(0) : 0);
        int32_t _10718_ = (int)0;
        int32_t _10719_ = (int)((_3065_c)->size(0));
        for (int32_t _3095_i = _10718_; _3095_i < _10719_; ++_3095_i)
        {
          {
            _ptr__3094_cumdims[safe_add( _3095_i,(int)1 )] = safe_add( _ptr__3094_cumdims[_3095_i],((*_3075_shape)(_3095_i,_3066_dim)) );
          }
        }
        if ((_3066_dim == (int)0))
        {
          {
            int32_t _3096_b = (int)0;
            int32_t _10720_ = (int)0;
            int32_t _10721_ = _3072_n;
            for (int32_t _3097_i = _10720_; _3097_i < _10721_; ++_3097_i)
            {
              {
                int32_t _3098_nnz = (int)((mosek::fusion::p_Constraint::_get_impl(((*_3065_c)(_3097_i)))->con_nativeidxs)->size(0));
                ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_Constraint::_get_impl(((*_3065_c)(_3097_i)))->con_nativeidxs,(int)0,_3089_con_nativeidxs,_3096_b,_3098_nnz);
                _3096_b += _3098_nnz;
              }
            }
          }
        }
        else
        {
          {
            std::vector<std::shared_ptr< monty::ndarray< int32_t,1 > >> _10722_;
            for (int32_t _3100_i = (int)0, _10723_ = _3072_n; _3100_i < _10723_ ; ++_3100_i)
            {
              _10722_.push_back(mosek::fusion::p_Constraint::_get_impl(((*_3065_c)(_3100_i)))->con_nativeidxs);
            }
            auto _10724_ = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 >(monty::shape(_10722_.size()),_10722_.begin(),_10722_.end()));
            std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _3099_nidxlist = _10724_;
            if ((_3066_dim < _3073_nd))
            {
              {
                int32_t _3101_d0 = (int)1;
                int32_t _10725_ = (int)0;
                int32_t _10726_ = _3066_dim;
                for (int32_t _3102_i = _10725_; _3102_i < _10726_; ++_3102_i)
                {
                  {
                    _3101_d0 *= _ptr__3090_resshape[_3102_i];
                  }
                }
                int32_t _3103_d2 = (int)1;
                int32_t _10727_ = safe_add( _3066_dim,(int)1 );
                int32_t _10728_ = _3073_nd;
                for (int32_t _3104_i = _10727_; _3104_i < _10728_; ++_3104_i)
                {
                  {
                    _3103_d2 *= _ptr__3090_resshape[_3104_i];
                  }
                }
                int32_t _3105_k = (int)0;
                int32_t _10729_ = (int)0;
                int32_t _10730_ = _3101_d0;
                for (int32_t _3106_i0 = _10729_; _3106_i0 < _10730_; ++_3106_i0)
                {
                  {
                    int32_t _10731_ = (int)0;
                    int32_t _10732_ = _3072_n;
                    for (int32_t _3107_j = _10731_; _3107_j < _10732_; ++_3107_j)
                    {
                      {
                        int32_t _3108_l = (int)0;
                        int32_t _3109_d1 = ((*_3075_shape)(_3107_j,_3066_dim));
                        int32_t _10733_ = (int)0;
                        int32_t _10734_ = _3109_d1;
                        for (int32_t _3110_i1 = _10733_; _3110_i1 < _10734_; ++_3110_i1)
                        {
                          {
                            int32_t _10735_ = (int)0;
                            int32_t _10736_ = _3103_d2;
                            for (int32_t _3111_i2 = _10735_; _3111_i2 < _10736_; ++_3111_i2)
                            {
                              {
                                _ptr__3089_con_nativeidxs[_3105_k] = ((*mosek::fusion::p_Constraint::_get_impl(((*_3065_c)(_3072_n)))->con_nativeidxs)(safe_add( safe_mul( safe_mul( _3106_i0,_3103_d2 ),_3109_d1 ),_3108_l )));
                                ++ _3105_k;
                                ++ _3108_l;
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
            else
            {
              {
                int32_t _3112_prodshape = (int)1;
                int32_t _10737_ = (int)0;
                int32_t _10738_ = _3073_nd;
                for (int32_t _3113_i = _10737_; _3113_i < _10738_; ++_3113_i)
                {
                  {
                    _3112_prodshape *= _ptr__3090_resshape[_3113_i];
                  }
                }
                int32_t _3114_k = (int)0;
                int32_t _10739_ = (int)0;
                int32_t _10740_ = _3112_prodshape;
                for (int32_t _3115_i = _10739_; _3115_i < _10740_; ++_3115_i)
                {
                  {
                    int32_t _10741_ = (int)0;
                    int32_t _10742_ = _3072_n;
                    for (int32_t _3116_j = _10741_; _3116_j < _10742_; ++_3116_j)
                    {
                      {
                        _ptr__3089_con_nativeidxs[_3114_k] = ((*((*_3099_nidxlist)(_3116_j)))(_3115_i));
                        ++ _3114_k;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      return (::mosek::fusion::p_SliceConstraint::_new_SliceConstraint(_3067_m0,_3090_resshape,_3089_con_nativeidxs)).as<::mosek::fusion::Constraint>();
    }
  }
}
// End mosek.fusion.Constraint.dstack

// Begin mosek.fusion.Constraint.index
// Method mosek.fusion.Constraint.index @ bld/grindsted/final/default/src/fusion/Constraint.mbi:251:6-266:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint :: __mosek_2fusion_2Constraint__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _3117_idxa) { return mosek::fusion::p_Constraint::_get_impl(this)->__mosek_2fusion_2Constraint__index(_3117_idxa); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::index(std::shared_ptr< monty::ndarray< int32_t,1 > > _3117_idxa) { return __mosek_2fusion_2Constraint__index(_3117_idxa); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::__mosek_2fusion_2Constraint__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _3117_idxa)
{
  _checked_ptr_1<int32_t> _ptr__3117_idxa(_3117_idxa ? _3117_idxa->raw() : nullptr, _3117_idxa ? _3117_idxa->size(0) : 0);
  if (((int)((_3117_idxa)->size(0)) != (int)((shape)->size(0))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("variable shape and slice do not match"));
    }
  }
  else
  {
    {
      int32_t _10743_ = (int)0;
      int32_t _10744_ = (int)((shape)->size(0));
      for (int32_t _3118_i = _10743_; _3118_i < _10744_; ++_3118_i)
      {
        {
          if (((_ptr__3117_idxa[_3118_i] < (int)0) || (_ptr__3117_idxa[_3118_i] > ((*shape)(_3118_i)))))
          {
            {
              throw ::mosek::fusion::IndexError(std::string ("index is out of bounds"));
            }
          }
          {}
        }
      }
      int32_t _3119_nd = (int)((shape)->size(0));
      std::shared_ptr< monty::ndarray< int64_t,1 > > _3120_strides = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_3119_nd)));
      _checked_ptr_1<int64_t> _ptr__3120_strides(_3120_strides ? _3120_strides->raw() : nullptr,_3120_strides ? _3120_strides->size(0) : 0);
      _ptr__3120_strides[(_3119_nd - (int)1)] = (int)1;
      int32_t _10745_ = (int)1;
      int32_t _10746_ = _3119_nd;
      for (int32_t _3121_i = _10745_; _3121_i < _10746_; ++_3121_i)
      {
        {
          _ptr__3120_strides[((_3119_nd - _3121_i) - (int)1)] = safe_mul( _ptr__3120_strides[(_3119_nd - _3121_i)],((*shape)((_3119_nd - _3121_i))) );
        }
      }
      int32_t _3122_ii = (int)0;
      int32_t _10747_ = (int)0;
      int32_t _10748_ = _3119_nd;
      for (int32_t _3123_i = _10747_; _3123_i < _10748_; ++_3123_i)
      {
        {
          _3122_ii += (int32_t)safe_mul( _ptr__3120_strides[_3123_i],_ptr__3117_idxa[_3123_i] );
        }
      }
      return (::mosek::fusion::p_SliceConstraint::_new_SliceConstraint(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(((*con_nativeidxs)(_3122_ii)))}))).as<::mosek::fusion::Constraint>();
    }
  }
}
// End mosek.fusion.Constraint.index

// Begin mosek.fusion.Constraint.index
// Method mosek.fusion.Constraint.index @ bld/grindsted/final/default/src/fusion/Constraint.mbi:236:6-246:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint :: __mosek_2fusion_2Constraint__index(int32_t _3124_idx) { return mosek::fusion::p_Constraint::_get_impl(this)->__mosek_2fusion_2Constraint__index(_3124_idx); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::index(int32_t _3124_idx) { return __mosek_2fusion_2Constraint__index(_3124_idx); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::__mosek_2fusion_2Constraint__index(int32_t _3124_idx)
{
  if ((((int)((shape)->size(0)) == (int)0) && (_3124_idx == (int)0)))
  {
    {
      return ::mosek::fusion::Constraint::t(_pubthis);
    }
  }
  else if(((int)((shape)->size(0)) != (int)1))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Variable shape and slice do not match"));
    }
  }
  else if(((_3124_idx < (int)0) || (_3124_idx > ((*shape)((int)0)))))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Index is out of bounds"));
    }
  }
  else
  {
    {
      return (::mosek::fusion::p_SliceConstraint::_new_SliceConstraint(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(((*con_nativeidxs)(_3124_idx)))}))).as<::mosek::fusion::Constraint>();
    }
  }
}
// End mosek.fusion.Constraint.index

// Begin mosek.fusion.Constraint.slice
// Method mosek.fusion.Constraint.slice @ bld/grindsted/final/default/src/fusion/Constraint.mbi:179:6-231:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint :: __mosek_2fusion_2Constraint__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _3125_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _3126_lasta) { return mosek::fusion::p_Constraint::_get_impl(this)->__mosek_2fusion_2Constraint__slice(_3125_firsta,_3126_lasta); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _3125_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _3126_lasta) { return __mosek_2fusion_2Constraint__slice(_3125_firsta,_3126_lasta); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::__mosek_2fusion_2Constraint__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _3125_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _3126_lasta)
{
  _checked_ptr_1<int32_t> _ptr__3125_firsta(_3125_firsta ? _3125_firsta->raw() : nullptr, _3125_firsta ? _3125_firsta->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3126_lasta(_3126_lasta ? _3126_lasta->raw() : nullptr, _3126_lasta ? _3126_lasta->size(0) : 0);
  if (((int)((_3125_firsta)->size(0)) != (int)((_3126_lasta)->size(0))))
  {
    {
      throw ::mosek::fusion::SliceError(std::string ("invalid slice"));
    }
  }
  else if(((int)((_3125_firsta)->size(0)) != (int)((shape)->size(0))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("variable shape and slice do not match"));
    }
  }
  else
  {
    {
      int32_t _10749_ = (int)0;
      int32_t _10750_ = (int)((shape)->size(0));
      for (int32_t _3127_i = _10749_; _3127_i < _10750_; ++_3127_i)
      {
        {
          if (((_ptr__3125_firsta[_3127_i] < (int)0) || (_ptr__3126_lasta[_3127_i] > ((*shape)(_3127_i)))))
          {
            {
              throw ::mosek::fusion::IndexError(std::string ("slice is out of bounds"));
            }
          }
          else if((_ptr__3125_firsta[_3127_i] > _ptr__3126_lasta[_3127_i]))
          {
            {
              throw ::mosek::fusion::SliceError(std::string ("invalid slice"));
            }
          }
          {}
        }
      }
      int32_t _3128_nd = (int)((shape)->size(0));
      std::vector<int32_t> _10751_;
      for (int32_t _3130_i = (int)0, _10752_ = _3128_nd; _3130_i < _10752_ ; ++_3130_i)
      {
        _10751_.push_back((_ptr__3126_lasta[_3130_i] - _ptr__3125_firsta[_3130_i]));
      }
      auto _10753_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10751_.size()),_10751_.begin(),_10751_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3129_sliceshape = _10753_;
      _checked_ptr_1<int32_t> _ptr__3129_sliceshape(_3129_sliceshape ? _3129_sliceshape->raw() : nullptr,_3129_sliceshape ? _3129_sliceshape->size(0) : 0);
      int32_t _3131_slicesize = (int)1;
      int32_t _10754_ = (int)0;
      int32_t _10755_ = _3128_nd;
      for (int32_t _3132_i = _10754_; _3132_i < _10755_; ++_3132_i)
      {
        {
          _3131_slicesize *= (_ptr__3126_lasta[_3132_i] - _ptr__3125_firsta[_3132_i]);
        }
      }
      if ((_3131_slicesize == (int)0))
      {
        {
          return (::mosek::fusion::p_SliceConstraint::_new_SliceConstraint(model,_3129_sliceshape,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))))).as<::mosek::fusion::Constraint>();
        }
      }
      else
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _3133_sliceidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3131_slicesize)));
          _checked_ptr_1<int32_t> _ptr__3133_sliceidxs(_3133_sliceidxs ? _3133_sliceidxs->raw() : nullptr,_3133_sliceidxs ? _3133_sliceidxs->size(0) : 0);
          {
            std::shared_ptr< monty::ndarray< int32_t,1 > > _3134_strides = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3128_nd)));
            _checked_ptr_1<int32_t> _ptr__3134_strides(_3134_strides ? _3134_strides->raw() : nullptr,_3134_strides ? _3134_strides->size(0) : 0);
            _ptr__3134_strides[(_3128_nd - (int)1)] = (int)1;
            int32_t _10756_ = (int)1;
            int32_t _10757_ = _3128_nd;
            for (int32_t _3135_i = _10756_; _3135_i < _10757_; ++_3135_i)
            {
              {
                _ptr__3134_strides[((_3128_nd - _3135_i) - (int)1)] = safe_mul( _ptr__3134_strides[(_3128_nd - _3135_i)],((*shape)((_3128_nd - _3135_i))) );
              }
            }
            int32_t _3136_start = (int)0;
            int32_t _10758_ = (int)0;
            int32_t _10759_ = _3128_nd;
            for (int32_t _3137_i = _10758_; _3137_i < _10759_; ++_3137_i)
            {
              {
                _3136_start += safe_mul( _ptr__3125_firsta[_3137_i],_ptr__3134_strides[_3137_i] );
              }
            }
            std::vector<int32_t> _10760_;
            for (int32_t _3139_i = (int)0, _10761_ = _3128_nd; _3139_i < _10761_ ; ++_3139_i)
            {
              _10760_.push_back(_3136_start);
            }
            auto _10762_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10760_.size()),_10760_.begin(),_10760_.end()));
            std::shared_ptr< monty::ndarray< int32_t,1 > > _3138_pp = _10762_;
            _checked_ptr_1<int32_t> _ptr__3138_pp(_3138_pp ? _3138_pp->raw() : nullptr,_3138_pp ? _3138_pp->size(0) : 0);
            std::vector<int32_t> _10763_;
            for (int32_t _3141_i = (int)0, _10764_ = _3128_nd; _3141_i < _10764_ ; ++_3141_i)
            {
              _10763_.push_back(_ptr__3125_firsta[_3141_i]);
            }
            auto _10765_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10763_.size()),_10763_.begin(),_10763_.end()));
            std::shared_ptr< monty::ndarray< int32_t,1 > > _3140_ii = _10765_;
            _checked_ptr_1<int32_t> _ptr__3140_ii(_3140_ii ? _3140_ii->raw() : nullptr,_3140_ii ? _3140_ii->size(0) : 0);
            int32_t _10766_ = (int)0;
            int32_t _10767_ = _3131_slicesize;
            for (int32_t _3142_i = _10766_; _3142_i < _10767_; ++_3142_i)
            {
              {
                _ptr__3133_sliceidxs[_3142_i] = ((*con_nativeidxs)(_ptr__3138_pp[(_3128_nd - (int)1)]));
                _ptr__3140_ii[(_3128_nd - (int)1)] += (int)1;
                _ptr__3138_pp[(_3128_nd - (int)1)] += _ptr__3134_strides[(_3128_nd - (int)1)];
                if ((_ptr__3140_ii[(_3128_nd - (int)1)] >= _ptr__3126_lasta[(_3128_nd - (int)1)]))
                {
                  {
                    int32_t _3143_k = (_3128_nd - (int)1);
                    while ( ((_3143_k > (int)0) && (_ptr__3140_ii[_3143_k] >= _ptr__3126_lasta[_3143_k])) )
                    {
                      {
                        _ptr__3140_ii[_3143_k] = _ptr__3125_firsta[_3143_k];
                        _ptr__3140_ii[(_3143_k - (int)1)] += (int)1;
                        _ptr__3138_pp[(_3143_k - (int)1)] += _ptr__3134_strides[(_3143_k - (int)1)];
                        -- _3143_k;
                      }
                    }
                    int32_t _10768_ = safe_add( _3143_k,(int)1 );
                    int32_t _10769_ = _3128_nd;
                    for (int32_t _3144_k2 = _10768_; _3144_k2 < _10769_; ++_3144_k2)
                    {
                      {
                        _ptr__3138_pp[_3144_k2] = _ptr__3138_pp[_3143_k];
                      }
                    }
                  }
                }
                {}
              }
            }
          }
          return (::mosek::fusion::p_SliceConstraint::_new_SliceConstraint(_pubthis->__mosek_2fusion_2Constraint__getModel(),_3129_sliceshape,_3133_sliceidxs)).as<::mosek::fusion::Constraint>();
        }
      }
    }
  }
}
// End mosek.fusion.Constraint.slice

// Begin mosek.fusion.Constraint.slice
// Method mosek.fusion.Constraint.slice @ bld/grindsted/final/default/src/fusion/Constraint.mbi:166:6-177:7
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint :: __mosek_2fusion_2Constraint__slice(int32_t _3145_first,int32_t _3146_last) { return mosek::fusion::p_Constraint::_get_impl(this)->__mosek_2fusion_2Constraint__slice(_3145_first,_3146_last); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::Constraint::slice(int32_t _3145_first,int32_t _3146_last) { return __mosek_2fusion_2Constraint__slice(_3145_first,_3146_last); }
monty::rc_ptr< ::mosek::fusion::Constraint > mosek::fusion::p_Constraint::__mosek_2fusion_2Constraint__slice(int32_t _3145_first,int32_t _3146_last)
{
  if (((int)((shape)->size(0)) != (int)1))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Variable shape and slice do not match"));
    }
  }
  {}
  if (((_3145_first == (int)0) && (_3146_last == ((*shape)((int)0)))))
  {
    {
      return ::mosek::fusion::Constraint::t(_pubthis);
    }
  }
  else if(((_3145_first < (int)0) || (_3146_last > ((*shape)((int)0)))))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Slice is out of bounds"));
    }
  }
  else if((_3145_first > _3146_last))
  {
    {
      throw ::mosek::fusion::SliceError(std::string ("Invalid slice"));
    }
  }
  else
  {
    {
      std::vector<int32_t> _10770_;
      for (int32_t _3147_i = _3145_first, _10771_ = _3146_last; _3147_i < _10771_ ; ++_3147_i)
      {
        _10770_.push_back(((*con_nativeidxs)(_3147_i)));
      }
      auto _10772_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10770_.size()),_10770_.begin(),_10770_.end()));
      return (::mosek::fusion::p_SliceConstraint::_new_SliceConstraint(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((_3146_last - _3145_first))}),_10772_)).as<::mosek::fusion::Constraint>();
    }
  }
}
// End mosek.fusion.Constraint.slice

// Begin mosek.fusion.Constraint.getND
// Method mosek.fusion.Constraint.getND @ bld/grindsted/final/default/src/fusion/Constraint.mbi:162:6-164:7
int32_t mosek::fusion::Constraint :: getND() { return mosek::fusion::p_Constraint::_get_impl(this)->getND(); }
int32_t mosek::fusion::p_Constraint::getND()
{
  return (int)((shape)->size(0));
}
// End mosek.fusion.Constraint.getND

// Begin mosek.fusion.Constraint.getSize
// Method mosek.fusion.Constraint.getSize @ bld/grindsted/final/default/src/fusion/Constraint.mbi:156:6-159:7
int32_t mosek::fusion::Constraint :: getSize() { return mosek::fusion::p_Constraint::_get_impl(this)->getSize(); }
int32_t mosek::fusion::p_Constraint::getSize()
{
  int32_t _3148_sz = (int)1;
  int32_t _10773_ = (int)0;
  int32_t _10774_ = (int)((shape)->size(0));
  for (int32_t _3149_i = _10773_; _3149_i < _10774_; ++_3149_i)
  {
    {
      _3148_sz *= ((*shape)(_3149_i));
    }
  }
  return _3148_sz;
}
// End mosek.fusion.Constraint.getSize

// Begin mosek.fusion.Constraint.getModel
// Method mosek.fusion.Constraint.getModel @ bld/grindsted/final/default/src/fusion/Constraint.mbi:153:6-55
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::Constraint :: __mosek_2fusion_2Constraint__getModel() { return mosek::fusion::p_Constraint::_get_impl(this)->__mosek_2fusion_2Constraint__getModel(); }
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::Constraint::getModel() { return __mosek_2fusion_2Constraint__getModel(); }
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::p_Constraint::__mosek_2fusion_2Constraint__getModel()
{
  return model;
}
// End mosek.fusion.Constraint.getModel

// Begin mosek.fusion.Constraint.getShape
// Method mosek.fusion.Constraint.getShape @ bld/grindsted/final/default/src/fusion/Constraint.mbi:147:6-150:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::Constraint :: getShape() { return mosek::fusion::p_Constraint::_get_impl(this)->getShape(); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_Constraint::getShape()
{
  std::vector<int32_t> _10775_;
  for (int32_t _3150_i = (int)0, _10776_ = (int)((shape)->size(0)); _3150_i < _10776_ ; ++_3150_i)
  {
    _10775_.push_back(((*shape)(_3150_i)));
  }
  auto _10777_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10775_.size()),_10775_.begin(),_10775_.end()));
  return _10777_;
}
// End mosek.fusion.Constraint.getShape

// Begin mosek.fusion.Constraint.getNativeidxs
// Method mosek.fusion.Constraint.getNativeidxs @ bld/grindsted/final/default/src/fusion/Constraint.mbi:142:6-144:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_Constraint::getNativeidxs()
{
  return con_nativeidxs;
}
// End mosek.fusion.Constraint.getNativeidxs

void mosek::fusion::p_Constraint::destroy()
{
  con_nativeidxs.reset();
  shape.reset();
  model.reset();
}
void mosek::fusion::Constraint::destroy() { mosek::fusion::p_Constraint::_get_impl(this)->destroy(); }
// } class Constraint
// class Set { // @ bld/grindsted/final/default/src/fusion/Set.mbi:34:4-207:5
mosek::fusion::Set::Set(mosek::fusion::p_Set *_impl) : _impl(_impl) { /*std::cout << "Set() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::Set::~Set() { delete _impl; _impl = nullptr; }
mosek::fusion::p_Set::p_Set
  (::mosek::fusion::Set * _pubthis) :     _pubthis(_pubthis)
{}
// Begin mosek.fusion.Set.size
// Method mosek.fusion.Set.size @ bld/grindsted/final/default/src/fusion/Set.mbi:204:6-206:7
int64_t mosek::fusion::Set::size
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3151_shape) { return mosek::fusion::p_Set::size(_3151_shape); }
int64_t mosek::fusion::p_Set::size(std::shared_ptr< monty::ndarray< int32_t,1 > > _3151_shape)
{
  _checked_ptr_1<int32_t> _ptr__3151_shape(_3151_shape ? _3151_shape->raw() : nullptr, _3151_shape ? _3151_shape->size(0) : 0);
  int64_t _3152_sz = (int64_t)1;
  int32_t _10778_ = (int)0;
  int32_t _10779_ = (int)((_3151_shape)->size(0));
  for (int32_t _3153_i = _10778_; _3153_i < _10779_; ++_3153_i)
  {
    {
      _3152_sz *= _ptr__3151_shape[_3153_i];
    }
  }
  return _3152_sz;
}
// End mosek.fusion.Set.size

// Begin mosek.fusion.Set.match
// Method mosek.fusion.Set.match @ bld/grindsted/final/default/src/fusion/Set.mbi:195:6-201:7
bool mosek::fusion::Set::match
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3154_s1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3155_s2) { return mosek::fusion::p_Set::match(_3154_s1,_3155_s2); }
bool mosek::fusion::p_Set::match(std::shared_ptr< monty::ndarray< int32_t,1 > > _3154_s1,std::shared_ptr< monty::ndarray< int32_t,1 > > _3155_s2)
{
  _checked_ptr_1<int32_t> _ptr__3154_s1(_3154_s1 ? _3154_s1->raw() : nullptr, _3154_s1 ? _3154_s1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3155_s2(_3155_s2 ? _3155_s2->raw() : nullptr, _3155_s2 ? _3155_s2->size(0) : 0);
  if (((int)((_3154_s1)->size(0)) != (int)((_3155_s2)->size(0))))
  {
    {
      return false;
    }
  }
  {}
  int32_t _10780_ = (int)0;
  int32_t _10781_ = (int)((_3154_s1)->size(0));
  for (int32_t _3156_i = _10780_; _3156_i < _10781_; ++_3156_i)
  {
    {
      if ((_ptr__3154_s1[_3156_i] != _ptr__3155_s2[_3156_i]))
      {
        {
          return false;
        }
      }
      {}
    }
  }
  return true;
}
// End mosek.fusion.Set.match

// Begin mosek.fusion.Set.linearidx
// Method mosek.fusion.Set.linearidx @ bld/grindsted/final/default/src/fusion/Set.mbi:186:6-192:7
int64_t mosek::fusion::Set::linearidx
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3157_shape,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3158_key) { return mosek::fusion::p_Set::linearidx(_3157_shape,_3158_key); }
int64_t mosek::fusion::p_Set::linearidx(std::shared_ptr< monty::ndarray< int32_t,1 > > _3157_shape,std::shared_ptr< monty::ndarray< int32_t,1 > > _3158_key)
{
  _checked_ptr_1<int32_t> _ptr__3157_shape(_3157_shape ? _3157_shape->raw() : nullptr, _3157_shape ? _3157_shape->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3158_key(_3158_key ? _3158_key->raw() : nullptr, _3158_key ? _3158_key->size(0) : 0);
  int64_t _3159_res = _ptr__3158_key[(int)0];
  int32_t _10782_ = (int)1;
  int32_t _10783_ = (int)((_3158_key)->size(0));
  for (int32_t _3160_i = _10782_; _3160_i < _10783_; ++_3160_i)
  {
    {
      _3159_res = safe_add( safe_mul( _3159_res,_ptr__3157_shape[_3160_i] ),_ptr__3158_key[_3160_i] );
    }
  }
  return _3159_res;
}
// End mosek.fusion.Set.linearidx

// Begin mosek.fusion.Set.idxtokey
// Method mosek.fusion.Set.idxtokey @ bld/grindsted/final/default/src/fusion/Set.mbi:169:6-174:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::Set::idxtokey
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3161_shape,
    int64_t _3162_idx) { return mosek::fusion::p_Set::idxtokey(_3161_shape,_3162_idx); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_Set::idxtokey(std::shared_ptr< monty::ndarray< int32_t,1 > > _3161_shape,int64_t _3162_idx)
{
  _checked_ptr_1<int32_t> _ptr__3161_shape(_3161_shape ? _3161_shape->raw() : nullptr, _3161_shape ? _3161_shape->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3163_res = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)((_3161_shape)->size(0)))));
  _checked_ptr_1<int32_t> _ptr__3163_res(_3163_res ? _3163_res->raw() : nullptr,_3163_res ? _3163_res->size(0) : 0);
  ::mosek::fusion::p_Set::idxtokey(_3161_shape,_3162_idx,_3163_res);
  return _3163_res;
}
// End mosek.fusion.Set.idxtokey

// Begin mosek.fusion.Set.idxtokey
// Method mosek.fusion.Set.idxtokey @ bld/grindsted/final/default/src/fusion/Set.mbi:154:6-167:7
void mosek::fusion::Set::idxtokey
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3164_shape,
    int64_t _3165_idx,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3166_dest) { mosek::fusion::p_Set::idxtokey(_3164_shape,_3165_idx,_3166_dest); }
void mosek::fusion::p_Set::idxtokey(std::shared_ptr< monty::ndarray< int32_t,1 > > _3164_shape,int64_t _3165_idx,std::shared_ptr< monty::ndarray< int32_t,1 > > _3166_dest)
{
  _checked_ptr_1<int32_t> _ptr__3164_shape(_3164_shape ? _3164_shape->raw() : nullptr, _3164_shape ? _3164_shape->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3166_dest(_3166_dest ? _3166_dest->raw() : nullptr, _3166_dest ? _3166_dest->size(0) : 0);
  int32_t _3167_nd = (int)((_3164_shape)->size(0));
  if ((_3167_nd > (int)0))
  {
    {
      int64_t _3168_ix = _3165_idx;
      int32_t _10784_ = (int)0;
      int32_t _10785_ = (_3167_nd - (int)1);
      for (int32_t _3169_i = _10784_; _3169_i < _10785_; ++_3169_i)
      {
        {
          _ptr__3166_dest[((_3167_nd - _3169_i) - (int)1)] = (int32_t)(_3168_ix % _ptr__3164_shape[((_3167_nd - _3169_i) - (int)1)]);
          _3168_ix /= _ptr__3164_shape[((_3167_nd - _3169_i) - (int)1)];
        }
      }
      _ptr__3166_dest[(int)0] = (int32_t)_3168_ix;
    }
  }
  {}
}
// End mosek.fusion.Set.idxtokey

// Begin mosek.fusion.Set.indexToString
// Method mosek.fusion.Set.indexToString @ bld/grindsted/final/default/src/fusion/Set.mbi:124:6-148:7
std::string mosek::fusion::Set::indexToString
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3170_shape,
    int64_t _3171_key) { return mosek::fusion::p_Set::indexToString(_3170_shape,_3171_key); }
std::string mosek::fusion::p_Set::indexToString(std::shared_ptr< monty::ndarray< int32_t,1 > > _3170_shape,int64_t _3171_key)
{
  _checked_ptr_1<int32_t> _ptr__3170_shape(_3170_shape ? _3170_shape->raw() : nullptr, _3170_shape ? _3170_shape->size(0) : 0);
  int32_t _3172_nd = (int)((_3170_shape)->size(0));
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _3173_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  if ((_3172_nd == (int)0))
  {
    {
      return std::string ("0");
    }
  }
  else if((_3172_nd == (int)1))
  {
    {
      return _3173_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_3171_key)->toString();
    }
  }
  else
  {
    {
      int64_t _3174_rem = _3171_key;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3175_k = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3172_nd)));
      _checked_ptr_1<int32_t> _ptr__3175_k(_3175_k ? _3175_k->raw() : nullptr,_3175_k ? _3175_k->size(0) : 0);
      int32_t _10786_ = (int)1;
      int32_t _10787_ = _3172_nd;
      for (int32_t _3176_i = _10786_; _3176_i < _10787_; ++_3176_i)
      {
        {
          _ptr__3175_k[(_3172_nd - _3176_i)] = (int32_t)(_3174_rem % _ptr__3170_shape[(_3172_nd - _3176_i)]);
          _3174_rem /= _ptr__3170_shape[(_3172_nd - _3176_i)];
        }
      }
      _ptr__3175_k[(int)0] = (int32_t)_3174_rem;
      _3173_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_ptr__3175_k[(int)0]);
      int32_t _10788_ = (int)1;
      int32_t _10789_ = _3172_nd;
      for (int32_t _3177_i = _10788_; _3177_i < _10789_; ++_3177_i)
      {
        {
          _3173_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(_ptr__3175_k[_3177_i]);
        }
      }
      return _3173_sb->toString();
    }
  }
}
// End mosek.fusion.Set.indexToString

// Begin mosek.fusion.Set.keyToString
// Method mosek.fusion.Set.keyToString @ bld/grindsted/final/default/src/fusion/Set.mbi:112:6-119:7
std::string mosek::fusion::Set::keyToString
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3178_key) { return mosek::fusion::p_Set::keyToString(_3178_key); }
std::string mosek::fusion::p_Set::keyToString(std::shared_ptr< monty::ndarray< int32_t,1 > > _3178_key)
{
  _checked_ptr_1<int32_t> _ptr__3178_key(_3178_key ? _3178_key->raw() : nullptr, _3178_key ? _3178_key->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _3179_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  _3179_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_ptr__3178_key[(int)0]);
  int32_t _10790_ = (int)1;
  int32_t _10791_ = (int)((_3178_key)->size(0));
  for (int32_t _3180_i = _10790_; _3180_i < _10791_; ++_3180_i)
  {
    {
      _3179_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(_ptr__3178_key[_3180_i]);
    }
  }
  return _3179_sb->toString();
}
// End mosek.fusion.Set.keyToString

// Begin mosek.fusion.Set.indexToKey
// Method mosek.fusion.Set.indexToKey @ bld/grindsted/final/default/src/fusion/Set.mbi:92:6-107:7
void mosek::fusion::Set::indexToKey
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3181_shape,
    int64_t _3182_key,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3183_res) { mosek::fusion::p_Set::indexToKey(_3181_shape,_3182_key,_3183_res); }
void mosek::fusion::p_Set::indexToKey(std::shared_ptr< monty::ndarray< int32_t,1 > > _3181_shape,int64_t _3182_key,std::shared_ptr< monty::ndarray< int32_t,1 > > _3183_res)
{
  _checked_ptr_1<int32_t> _ptr__3181_shape(_3181_shape ? _3181_shape->raw() : nullptr, _3181_shape ? _3181_shape->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3183_res(_3183_res ? _3183_res->raw() : nullptr, _3183_res ? _3183_res->size(0) : 0);
  int32_t _3184_nd = (int)((_3181_shape)->size(0));
  if ((_3184_nd == (int)1))
  {
    {
      _ptr__3183_res[(int)0] = (int32_t)_3182_key;
    }
  }
  else
  {
    {
      int64_t _3185_rem = _3182_key;
      int32_t _10792_ = (int)1;
      int32_t _10793_ = _3184_nd;
      for (int32_t _3186_i = _10792_; _3186_i < _10793_; ++_3186_i)
      {
        {
          _ptr__3183_res[(_3184_nd - _3186_i)] = (int32_t)(_3185_rem % _ptr__3181_shape[(_3184_nd - _3186_i)]);
          _3185_rem /= _ptr__3181_shape[(_3184_nd - _3186_i)];
        }
      }
      _ptr__3183_res[(int)0] = (int32_t)_3185_rem;
    }
  }
}
// End mosek.fusion.Set.indexToKey

// Begin mosek.fusion.Set.strides
// Method mosek.fusion.Set.strides @ bld/grindsted/final/default/src/fusion/Set.mbi:81:6-87:7
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::Set::strides
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3187_shape) { return mosek::fusion::p_Set::strides(_3187_shape); }
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::p_Set::strides(std::shared_ptr< monty::ndarray< int32_t,1 > > _3187_shape)
{
  _checked_ptr_1<int32_t> _ptr__3187_shape(_3187_shape ? _3187_shape->raw() : nullptr, _3187_shape ? _3187_shape->size(0) : 0);
  int32_t _3188_nd = (int)((_3187_shape)->size(0));
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3189_st = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_3188_nd)));
  _checked_ptr_1<int64_t> _ptr__3189_st(_3189_st ? _3189_st->raw() : nullptr,_3189_st ? _3189_st->size(0) : 0);
  _ptr__3189_st[(_3188_nd - (int)1)] = (int)1;
  int32_t _10794_ = (int)1;
  int32_t _10795_ = _3188_nd;
  for (int32_t _3190_i = _10794_; _3190_i < _10795_; ++_3190_i)
  {
    {
      _ptr__3189_st[((_3188_nd - _3190_i) - (int)1)] = safe_mul( _ptr__3189_st[(_3188_nd - _3190_i)],_ptr__3187_shape[(_3188_nd - _3190_i)] );
    }
  }
  return _3189_st;
}
// End mosek.fusion.Set.strides

// Begin mosek.fusion.Set.make
// Method mosek.fusion.Set.make @ bld/grindsted/final/default/src/fusion/Set.mbi:66:6-72:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::Set::make
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3191_set1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3192_set2) { return mosek::fusion::p_Set::make(_3191_set1,_3192_set2); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_Set::make(std::shared_ptr< monty::ndarray< int32_t,1 > > _3191_set1,std::shared_ptr< monty::ndarray< int32_t,1 > > _3192_set2)
{
  _checked_ptr_1<int32_t> _ptr__3191_set1(_3191_set1 ? _3191_set1->raw() : nullptr, _3191_set1 ? _3191_set1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3192_set2(_3192_set2 ? _3192_set2->raw() : nullptr, _3192_set2 ? _3192_set2->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3193_r = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( (int)((_3191_set1)->size(0)),(int)((_3192_set2)->size(0)) ))));
  _checked_ptr_1<int32_t> _ptr__3193_r(_3193_r ? _3193_r->raw() : nullptr,_3193_r ? _3193_r->size(0) : 0);
  int32_t _10796_ = (int)0;
  int32_t _10797_ = (int)((_3191_set1)->size(0));
  for (int32_t _3194_i = _10796_; _3194_i < _10797_; ++_3194_i)
  {
    {
      _ptr__3193_r[_3194_i] = _ptr__3191_set1[_3194_i];
    }
  }
  int32_t _10798_ = (int)0;
  int32_t _10799_ = (int)((_3192_set2)->size(0));
  for (int32_t _3195_i = _10798_; _3195_i < _10799_; ++_3195_i)
  {
    {
      _ptr__3193_r[safe_add( (int)((_3191_set1)->size(0)),_3195_i )] = _ptr__3192_set2[_3195_i];
    }
  }
  return _3193_r;
}
// End mosek.fusion.Set.make

// Begin mosek.fusion.Set.make
// Method mosek.fusion.Set.make @ bld/grindsted/final/default/src/fusion/Set.mbi:61:6-64:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::Set::make
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3196_sizes) { return mosek::fusion::p_Set::make(_3196_sizes); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_Set::make(std::shared_ptr< monty::ndarray< int32_t,1 > > _3196_sizes)
{
  _checked_ptr_1<int32_t> _ptr__3196_sizes(_3196_sizes ? _3196_sizes->raw() : nullptr, _3196_sizes ? _3196_sizes->size(0) : 0);
  std::vector<int32_t> _10800_;
  for (int32_t _3197_i = (int)0, _10801_ = (int)((_3196_sizes)->size(0)); _3197_i < _10801_ ; ++_3197_i)
  {
    _10800_.push_back(_ptr__3196_sizes[_3197_i]);
  }
  auto _10802_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10800_.size()),_10800_.begin(),_10800_.end()));
  return _10802_;
}
// End mosek.fusion.Set.make

// Begin mosek.fusion.Set.make
// Method mosek.fusion.Set.make @ bld/grindsted/final/default/src/fusion/Set.mbi:56:6-59:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::Set::make
  ( int32_t _3198_s1,
    int32_t _3199_s2,
    int32_t _3200_s3) { return mosek::fusion::p_Set::make(_3198_s1,_3199_s2,_3200_s3); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_Set::make(int32_t _3198_s1,int32_t _3199_s2,int32_t _3200_s3)
{
  return std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3198_s1),(int32_t)(_3199_s2),(int32_t)(_3200_s3)});
}
// End mosek.fusion.Set.make

// Begin mosek.fusion.Set.make
// Method mosek.fusion.Set.make @ bld/grindsted/final/default/src/fusion/Set.mbi:51:6-54:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::Set::make
  ( int32_t _3201_s1,
    int32_t _3202_s2) { return mosek::fusion::p_Set::make(_3201_s1,_3202_s2); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_Set::make(int32_t _3201_s1,int32_t _3202_s2)
{
  return std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3201_s1),(int32_t)(_3202_s2)});
}
// End mosek.fusion.Set.make

// Begin mosek.fusion.Set.make
// Method mosek.fusion.Set.make @ bld/grindsted/final/default/src/fusion/Set.mbi:46:6-49:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::Set::make
  ( int32_t _3203_sz) { return mosek::fusion::p_Set::make(_3203_sz); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_Set::make(int32_t _3203_sz)
{
  return std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3203_sz)});
}
// End mosek.fusion.Set.make

// Begin mosek.fusion.Set.scalar
// Method mosek.fusion.Set.scalar @ bld/grindsted/final/default/src/fusion/Set.mbi:44:6-67
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::Set::scalar
  ( ) { return mosek::fusion::p_Set::scalar(); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_Set::scalar()
{
  return std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0)));
}
// End mosek.fusion.Set.scalar

// Begin mosek.fusion.Set.make
// Method mosek.fusion.Set.make @ bld/grindsted/final/default/src/fusion/Set.mbi:36:6-39:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::Set::make
  ( std::shared_ptr< monty::ndarray< std::string,1 > > _3204_names) { return mosek::fusion::p_Set::make(_3204_names); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_Set::make(std::shared_ptr< monty::ndarray< std::string,1 > > _3204_names)
{
  return std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_3204_names)->size(0)))});
}
// End mosek.fusion.Set.make

void mosek::fusion::p_Set::destroy()
{
}
void mosek::fusion::Set::destroy() { mosek::fusion::p_Set::_get_impl(this)->destroy(); }
// } class Set
// class ConeDomain { // @ bld/grindsted/final/default/src/fusion/domain.mbi:1612:4-1767:5
mosek::fusion::ConeDomain::ConeDomain(mosek::fusion::p_ConeDomain *_impl) : _impl(_impl) { /*std::cout << "ConeDomain() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::ConeDomain::~ConeDomain() { delete _impl; _impl = nullptr; }
mosek::fusion::p_ConeDomain::p_ConeDomain
  (::mosek::fusion::ConeDomain * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.ConeDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:1706:6-1717:7
mosek::fusion::ConeDomain::t mosek::fusion::p_ConeDomain::_new_ConeDomain
  (mosek::fusion::QConeKey _3205_k,
    std::shared_ptr< monty::ndarray< double,1 > > _3206_alpha,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3207_d)
{ return new mosek::fusion::ConeDomain(_3205_k,_3206_alpha,_3207_d); }
mosek::fusion::ConeDomain::ConeDomain
  (mosek::fusion::QConeKey _3205_k,
    std::shared_ptr< monty::ndarray< double,1 > > _3206_alpha,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3207_d) : 
   ConeDomain(new mosek::fusion::p_ConeDomain(this))
{ mosek::fusion::p_ConeDomain::_get_impl(this)->_initialize(_3205_k,_3206_alpha,_3207_d); }
void mosek::fusion::p_ConeDomain::_initialize  (mosek::fusion::QConeKey _3205_k,
    std::shared_ptr< monty::ndarray< double,1 > > _3206_alpha,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3207_d)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__3206_alpha(_3206_alpha ? _3206_alpha->raw() : nullptr, _3206_alpha ? _3206_alpha->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__3207_d(_3207_d ? _3207_d->raw() : nullptr, _3207_d ? _3207_d->size(0) : 0);
    std::shared_ptr< monty::ndarray< int32_t,1 > > _10803_;
    bool _10804_ = (NULL != _3207_d.get());
    if (_10804_)
    {
      _10803_ = ::mosek::fusion::Utils::Tools::arraycopy(_3207_d);
    }
    else
    {
      _10803_ = nullptr;
    }
    shape = _10803_;
    domsize = (int)0;
    mosek::fusion::p_ConeDomain::_get_impl(::mosek::fusion::ConeDomain::t(_pubthis))->alpha = _3206_alpha;
    key = _3205_k;
    axisidx = (int)0;
    axisset = false;
    int_flag = false;
    domofs = nullptr;
    indexnames = nullptr;
  }
}
// mosek.fusion.ConeDomain.ctor

// mosek.fusion.ConeDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:1680:6-1682:7
mosek::fusion::ConeDomain::t mosek::fusion::p_ConeDomain::_new_ConeDomain
  (mosek::fusion::QConeKey _3208_k,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3209_d)
{ return new mosek::fusion::ConeDomain(_3208_k,_3209_d); }
mosek::fusion::ConeDomain::ConeDomain
  (mosek::fusion::QConeKey _3208_k,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3209_d) : 
   ConeDomain(new mosek::fusion::p_ConeDomain(this))
{ mosek::fusion::p_ConeDomain::_get_impl(this)->_initialize(_3208_k,_3209_d); }
void mosek::fusion::p_ConeDomain::_initialize  (mosek::fusion::QConeKey _3208_k,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3209_d)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__3209_d(_3209_d ? _3209_d->raw() : nullptr, _3209_d ? _3209_d->size(0) : 0);
    mosek::fusion::p_ConeDomain::_initialize(_3208_k,nullptr,_3209_d);
  }
}
// mosek.fusion.ConeDomain.ctor

// mosek.fusion.ConeDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:1626:6-1636:7
mosek::fusion::ConeDomain::t mosek::fusion::p_ConeDomain::_new_ConeDomain
  (monty::rc_ptr< ::mosek::fusion::ConeDomain > _3210_other)
{ return new mosek::fusion::ConeDomain(_3210_other); }
mosek::fusion::ConeDomain::ConeDomain
  (monty::rc_ptr< ::mosek::fusion::ConeDomain > _3210_other) : 
   ConeDomain(new mosek::fusion::p_ConeDomain(this))
{ mosek::fusion::p_ConeDomain::_get_impl(this)->_initialize(_3210_other); }
void mosek::fusion::p_ConeDomain::_initialize  (monty::rc_ptr< ::mosek::fusion::ConeDomain > _3210_other)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    key = mosek::fusion::p_ConeDomain::_get_impl(_3210_other)->key;
    axisidx = mosek::fusion::p_ConeDomain::_get_impl(_3210_other)->axisidx;
    axisset = mosek::fusion::p_ConeDomain::_get_impl(_3210_other)->axisset;
    int_flag = mosek::fusion::p_ConeDomain::_get_impl(_3210_other)->int_flag;
    shape = mosek::fusion::p_ConeDomain::_get_impl(_3210_other)->shape;
    alpha = mosek::fusion::p_ConeDomain::_get_impl(_3210_other)->alpha;
    domofs = mosek::fusion::p_ConeDomain::_get_impl(_3210_other)->domofs;
    domsize = mosek::fusion::p_ConeDomain::_get_impl(_3210_other)->domsize;
    indexnames = mosek::fusion::p_ConeDomain::_get_impl(_3210_other)->indexnames;
  }
}
// mosek.fusion.ConeDomain.ctor

// Begin mosek.fusion.ConeDomain.match_shape
// Method mosek.fusion.ConeDomain.match_shape @ bld/grindsted/final/default/src/fusion/domain.mbi:1762:6-1766:7
bool mosek::fusion::p_ConeDomain::match_shape(std::shared_ptr< monty::ndarray< int32_t,1 > > _3211_shp)
{
  _checked_ptr_1<int32_t> _ptr__3211_shp(_3211_shp ? _3211_shp->raw() : nullptr, _3211_shp ? _3211_shp->size(0) : 0);
  return ((NULL == shape.get()) || ::mosek::fusion::p_Set::match(_3211_shp,shape));
}
// End mosek.fusion.ConeDomain.match_shape

// Begin mosek.fusion.ConeDomain.integral
// Method mosek.fusion.ConeDomain.integral @ bld/grindsted/final/default/src/fusion/domain.mbi:1760:6-76
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain :: __mosek_2fusion_2ConeDomain__integral() { return mosek::fusion::p_ConeDomain::_get_impl(this)->__mosek_2fusion_2ConeDomain__integral(); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain::integral() { return __mosek_2fusion_2ConeDomain__integral(); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_ConeDomain::__mosek_2fusion_2ConeDomain__integral()
{
  int_flag = true;
  return ::mosek::fusion::ConeDomain::t(_pubthis);
}
// End mosek.fusion.ConeDomain.integral

// Begin mosek.fusion.ConeDomain.axisIsSet
// Method mosek.fusion.ConeDomain.axisIsSet @ bld/grindsted/final/default/src/fusion/domain.mbi:1753:6-66
bool mosek::fusion::ConeDomain :: axisIsSet() { return mosek::fusion::p_ConeDomain::_get_impl(this)->axisIsSet(); }
bool mosek::fusion::p_ConeDomain::axisIsSet()
{
  return axisset;
}
// End mosek.fusion.ConeDomain.axisIsSet

// Begin mosek.fusion.ConeDomain.getAxis
// Method mosek.fusion.ConeDomain.getAxis @ bld/grindsted/final/default/src/fusion/domain.mbi:1750:6-66
int32_t mosek::fusion::ConeDomain :: getAxis() { return mosek::fusion::p_ConeDomain::_get_impl(this)->getAxis(); }
int32_t mosek::fusion::p_ConeDomain::getAxis()
{
  return axisidx;
}
// End mosek.fusion.ConeDomain.getAxis

// Begin mosek.fusion.ConeDomain.axis
// Method mosek.fusion.ConeDomain.axis @ bld/grindsted/final/default/src/fusion/domain.mbi:1747:6-94
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain :: __mosek_2fusion_2ConeDomain__axis(int32_t _3212_a) { return mosek::fusion::p_ConeDomain::_get_impl(this)->__mosek_2fusion_2ConeDomain__axis(_3212_a); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain::axis(int32_t _3212_a) { return __mosek_2fusion_2ConeDomain__axis(_3212_a); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_ConeDomain::__mosek_2fusion_2ConeDomain__axis(int32_t _3212_a)
{
  axisidx = _3212_a;
  axisset = true;
  return ::mosek::fusion::ConeDomain::t(_pubthis);
}
// End mosek.fusion.ConeDomain.axis

// Begin mosek.fusion.ConeDomain.withShape
// Method mosek.fusion.ConeDomain.withShape @ bld/grindsted/final/default/src/fusion/domain.mbi:1743:6-121
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain :: __mosek_2fusion_2ConeDomain__withShape(int32_t _3213_dim0,int32_t _3214_dim1,int32_t _3215_dim2) { return mosek::fusion::p_ConeDomain::_get_impl(this)->__mosek_2fusion_2ConeDomain__withShape(_3213_dim0,_3214_dim1,_3215_dim2); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain::withShape(int32_t _3213_dim0,int32_t _3214_dim1,int32_t _3215_dim2) { return __mosek_2fusion_2ConeDomain__withShape(_3213_dim0,_3214_dim1,_3215_dim2); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_ConeDomain::__mosek_2fusion_2ConeDomain__withShape(int32_t _3213_dim0,int32_t _3214_dim1,int32_t _3215_dim2)
{
  return __mosek_2fusion_2ConeDomain__withShape_(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3213_dim0),(int32_t)(_3214_dim1),(int32_t)(_3215_dim2)}));
}
// End mosek.fusion.ConeDomain.withShape

// Begin mosek.fusion.ConeDomain.withShape
// Method mosek.fusion.ConeDomain.withShape @ bld/grindsted/final/default/src/fusion/domain.mbi:1742:6-105
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain :: __mosek_2fusion_2ConeDomain__withShape(int32_t _3216_dim0,int32_t _3217_dim1) { return mosek::fusion::p_ConeDomain::_get_impl(this)->__mosek_2fusion_2ConeDomain__withShape(_3216_dim0,_3217_dim1); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain::withShape(int32_t _3216_dim0,int32_t _3217_dim1) { return __mosek_2fusion_2ConeDomain__withShape(_3216_dim0,_3217_dim1); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_ConeDomain::__mosek_2fusion_2ConeDomain__withShape(int32_t _3216_dim0,int32_t _3217_dim1)
{
  return __mosek_2fusion_2ConeDomain__withShape_(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3216_dim0),(int32_t)(_3217_dim1)}));
}
// End mosek.fusion.ConeDomain.withShape

// Begin mosek.fusion.ConeDomain.withShape
// Method mosek.fusion.ConeDomain.withShape @ bld/grindsted/final/default/src/fusion/domain.mbi:1741:6-89
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain :: __mosek_2fusion_2ConeDomain__withShape(int32_t _3218_dim0) { return mosek::fusion::p_ConeDomain::_get_impl(this)->__mosek_2fusion_2ConeDomain__withShape(_3218_dim0); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain::withShape(int32_t _3218_dim0) { return __mosek_2fusion_2ConeDomain__withShape(_3218_dim0); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_ConeDomain::__mosek_2fusion_2ConeDomain__withShape(int32_t _3218_dim0)
{
  return __mosek_2fusion_2ConeDomain__withShape_(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3218_dim0)}));
}
// End mosek.fusion.ConeDomain.withShape

// Begin mosek.fusion.ConeDomain.withShape
// Method mosek.fusion.ConeDomain.withShape @ bld/grindsted/final/default/src/fusion/domain.mbi:1740:6-104
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain :: __mosek_2fusion_2ConeDomain__withShape(std::shared_ptr< monty::ndarray< int32_t,1 > > _3219_shp) { return mosek::fusion::p_ConeDomain::_get_impl(this)->__mosek_2fusion_2ConeDomain__withShape(_3219_shp); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain::withShape(std::shared_ptr< monty::ndarray< int32_t,1 > > _3219_shp) { return __mosek_2fusion_2ConeDomain__withShape(_3219_shp); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_ConeDomain::__mosek_2fusion_2ConeDomain__withShape(std::shared_ptr< monty::ndarray< int32_t,1 > > _3219_shp)
{
  _checked_ptr_1<int32_t> _ptr__3219_shp(_3219_shp ? _3219_shp->raw() : nullptr, _3219_shp ? _3219_shp->size(0) : 0);
  return __mosek_2fusion_2ConeDomain__withShape_(::mosek::fusion::Utils::Tools::arraycopy(_3219_shp));
}
// End mosek.fusion.ConeDomain.withShape

// Begin mosek.fusion.ConeDomain.withShape_
// Method mosek.fusion.ConeDomain.withShape_ @ bld/grindsted/final/default/src/fusion/domain.mbi:1739:6-85
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_ConeDomain::__mosek_2fusion_2ConeDomain__withShape_(std::shared_ptr< monty::ndarray< int32_t,1 > > _3220_shp)
{
  _checked_ptr_1<int32_t> _ptr__3220_shp(_3220_shp ? _3220_shp->raw() : nullptr, _3220_shp ? _3220_shp->size(0) : 0);
  shape = _3220_shp;
  return ::mosek::fusion::ConeDomain::t(_pubthis);
}
// End mosek.fusion.ConeDomain.withShape_

// Begin mosek.fusion.ConeDomain.withNamesOnAxis
// Method mosek.fusion.ConeDomain.withNamesOnAxis @ bld/grindsted/final/default/src/fusion/domain.mbi:1719:6-1732:7
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain :: __mosek_2fusion_2ConeDomain__withNamesOnAxis(std::shared_ptr< monty::ndarray< std::string,1 > > _3221_names,int32_t _3222_axis) { return mosek::fusion::p_ConeDomain::_get_impl(this)->__mosek_2fusion_2ConeDomain__withNamesOnAxis(_3221_names,_3222_axis); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ConeDomain::withNamesOnAxis(std::shared_ptr< monty::ndarray< std::string,1 > > _3221_names,int32_t _3222_axis) { return __mosek_2fusion_2ConeDomain__withNamesOnAxis(_3221_names,_3222_axis); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_ConeDomain::__mosek_2fusion_2ConeDomain__withNamesOnAxis(std::shared_ptr< monty::ndarray< std::string,1 > > _3221_names,int32_t _3222_axis)
{
  if ((NULL == indexnames.get()))
  {
    {
      std::vector<std::shared_ptr< monty::ndarray< std::string,1 > >> _10805_;
      for (int32_t _3223_i = (int)0, _10806_ = safe_add( _3222_axis,(int)1 ); _3223_i < _10806_ ; ++_3223_i)
      {
        _10805_.push_back(nullptr);
      }
      auto _10807_ = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape(_10805_.size()),_10805_.begin(),_10805_.end()));
      indexnames = _10807_;
      std::vector<std::string> _10808_;
      for (int32_t _3224_i = (int)0, _10809_ = (int)((_3221_names)->size(0)); _3224_i < _10809_ ; ++_3224_i)
      {
        _10808_.push_back(((*_3221_names)(_3224_i)));
      }
      auto _10810_ = std::shared_ptr< monty::ndarray< std::string,1 > >(new monty::ndarray< std::string,1 >(monty::shape(_10808_.size()),_10808_.begin(),_10808_.end()));
      ((*indexnames)(_3222_axis)) = _10810_;
    }
  }
  {}
  if (((int)((indexnames)->size(0)) < safe_add( _3222_axis,(int)1 )))
  {
    {
      std::vector<std::shared_ptr< monty::ndarray< std::string,1 > >> _10811_;
      for (int32_t _3226_i = (int)0, _10812_ = safe_add( _3222_axis,(int)1 ); _3226_i < _10812_ ; ++_3226_i)
      {
        _10811_.push_back(nullptr);
      }
      auto _10813_ = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape(_10811_.size()),_10811_.begin(),_10811_.end()));
      std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _3225_ixnames = _10813_;
      int32_t _10814_ = (int)0;
      int32_t _10815_ = (int)((indexnames)->size(0));
      for (int32_t _3227_i = _10814_; _3227_i < _10815_; ++_3227_i)
      {
        {
          ((*_3225_ixnames)(_3227_i)) = ((*indexnames)(_3227_i));
        }
      }
      indexnames = _3225_ixnames;
    }
  }
  {}
  std::vector<std::string> _10816_;
  for (int32_t _3228_i = (int)0, _10817_ = (int)((_3221_names)->size(0)); _3228_i < _10817_ ; ++_3228_i)
  {
    _10816_.push_back(((*_3221_names)(_3228_i)));
  }
  auto _10818_ = std::shared_ptr< monty::ndarray< std::string,1 > >(new monty::ndarray< std::string,1 >(monty::shape(_10816_.size()),_10816_.begin(),_10816_.end()));
  ((*indexnames)(_3222_axis)) = _10818_;
  return ::mosek::fusion::ConeDomain::t(_pubthis);
}
// End mosek.fusion.ConeDomain.withNamesOnAxis

// Begin mosek.fusion.ConeDomain.finalize_and_validate_inplace
// Method mosek.fusion.ConeDomain.finalize_and_validate_inplace @ bld/grindsted/final/default/src/fusion/domain.mbi:1644:6-1678:7
void mosek::fusion::p_ConeDomain::finalize_and_validate_inplace(std::shared_ptr< monty::ndarray< int32_t,1 > > _3229_shp)
{
  _checked_ptr_1<int32_t> _ptr__3229_shp(_3229_shp ? _3229_shp->raw() : nullptr, _3229_shp ? _3229_shp->size(0) : 0);
  domsize = (int)1;
  if ((NULL == shape.get()))
  {
    {
      if ((NULL != _3229_shp.get()))
      {
        {
          shape = _3229_shp;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Missing domain shape"));
        }
      }
    }
  }
  else if((NULL != _3229_shp.get()))
  {
    {
      if (((int)((_3229_shp)->size(0)) != (int)((shape)->size(0))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Conflicting shape definitions"));
        }
      }
      {}
      int32_t _10819_ = (int)0;
      int32_t _10820_ = (int)((_3229_shp)->size(0));
      for (int32_t _3230_i = _10819_; _3230_i < _10820_; ++_3230_i)
      {
        {
          if ((_ptr__3229_shp[_3230_i] != ((*shape)(_3230_i))))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Conflicting shape definitions"));
            }
          }
          {}
        }
      }
    }
  }
  {}
  int32_t _10821_ = (int)0;
  int32_t _10822_ = (int)((shape)->size(0));
  for (int32_t _3231_i = _10821_; _3231_i < _10822_; ++_3231_i)
  {
    {
      domsize *= ((*shape)(_3231_i));
    }
  }
  if ((NULL != indexnames.get()))
  {
    {
      if (((int)((indexnames)->size(0)) != (int)((shape)->size(0))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Index names do not match shape"));
        }
      }
      {}
      int32_t _10823_ = (int)0;
      int32_t _10824_ = (int)((shape)->size(0));
      for (int32_t _3232_i = _10823_; _3232_i < _10824_; ++_3232_i)
      {
        {
          if (((NULL != ((*indexnames)(_3232_i)).get()) && ((int)((((*indexnames)(_3232_i)))->size(0)) != ((*shape)(_3232_i)))))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Index names do not match shape"));
            }
          }
          {}
        }
      }
    }
  }
  {}
  if ((!axisset))
  {
    {
      axisset = true;
      axisidx = ((int)((shape)->size(0)) - (int)1);
    }
  }
  else if(((axisidx < (int)0) || (axisidx >= (int)((shape)->size(0)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Cone axis is invalid"));
    }
  }
  {}
  if (((NULL != domofs.get()) && ((int)((domofs)->size(0)) != domsize)))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Domain offset does not match shape"));
    }
  }
  {}
}
// End mosek.fusion.ConeDomain.finalize_and_validate_inplace

// Begin mosek.fusion.ConeDomain.finalize_and_validate
// Method mosek.fusion.ConeDomain.finalize_and_validate @ bld/grindsted/final/default/src/fusion/domain.mbi:1639:6-1643:7
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_ConeDomain::__mosek_2fusion_2ConeDomain__finalize_and_validate(std::shared_ptr< monty::ndarray< int32_t,1 > > _3233_shp)
{
  _checked_ptr_1<int32_t> _ptr__3233_shp(_3233_shp ? _3233_shp->raw() : nullptr, _3233_shp ? _3233_shp->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::ConeDomain > _3234_res = ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::ConeDomain::t(_pubthis));
  mosek::fusion::p_ConeDomain::_get_impl(_3234_res.get())->finalize_and_validate_inplace(_3233_shp);
  return _3234_res;
}
// End mosek.fusion.ConeDomain.finalize_and_validate

void mosek::fusion::p_ConeDomain::destroy()
{
  indexnames.reset();
  domofs.reset();
  alpha.reset();
  shape.reset();
}
void mosek::fusion::ConeDomain::destroy() { mosek::fusion::p_ConeDomain::_get_impl(this)->destroy(); }
// } class ConeDomain
// class PSDDomain { // @ bld/grindsted/final/default/src/fusion/domain.mbi:1408:4-1564:5
mosek::fusion::PSDDomain::PSDDomain(mosek::fusion::p_PSDDomain *_impl) : _impl(_impl) { /*std::cout << "PSDDomain() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::PSDDomain::~PSDDomain() { delete _impl; _impl = nullptr; }
mosek::fusion::p_PSDDomain::p_PSDDomain
  (::mosek::fusion::PSDDomain * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.PSDDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:1481:6-1498:7
mosek::fusion::PSDDomain::t mosek::fusion::p_PSDDomain::_new_PSDDomain
  (mosek::fusion::PSDKey _3235_k,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3236_shp,
    int32_t _3237_conedim1,
    int32_t _3238_conedim2)
{ return new mosek::fusion::PSDDomain(_3235_k,_3236_shp,_3237_conedim1,_3238_conedim2); }
mosek::fusion::PSDDomain::PSDDomain
  (mosek::fusion::PSDKey _3235_k,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3236_shp,
    int32_t _3237_conedim1,
    int32_t _3238_conedim2) : 
   PSDDomain(new mosek::fusion::p_PSDDomain(this))
{ mosek::fusion::p_PSDDomain::_get_impl(this)->_initialize(_3235_k,_3236_shp,_3237_conedim1,_3238_conedim2); }
void mosek::fusion::p_PSDDomain::_initialize  (mosek::fusion::PSDKey _3235_k,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3236_shp,
    int32_t _3237_conedim1,
    int32_t _3238_conedim2)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__3236_shp(_3236_shp ? _3236_shp->raw() : nullptr, _3236_shp ? _3236_shp->size(0) : 0);
    axisIsSet = true;
    shape = _3236_shp;
    key = _3235_k;
    mosek::fusion::p_PSDDomain::_get_impl(::mosek::fusion::PSDDomain::t(_pubthis))->conedim1 = _3237_conedim1;
    mosek::fusion::p_PSDDomain::_get_impl(::mosek::fusion::PSDDomain::t(_pubthis))->conedim2 = _3238_conedim2;
    indexnames = nullptr;
    int32_t _3239_nd = (int)((shape)->size(0));
    if (((!(((int)((shape)->size(0)) > _3237_conedim1) && (((int)((shape)->size(0)) > _3238_conedim2) && ((_3237_conedim1 >= (int)0) && ((_3238_conedim2 >= (int)0) && (_3237_conedim1 != _3238_conedim2)))))) && (((*shape)(_3237_conedim1)) == ((*shape)(_3238_conedim2)))))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching shape or cone dimensions"));
      }
    }
    {}
  }
}
// mosek.fusion.PSDDomain.ctor

// mosek.fusion.PSDDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:1477:6-1479:7
mosek::fusion::PSDDomain::t mosek::fusion::p_PSDDomain::_new_PSDDomain
  (mosek::fusion::PSDKey _3240_k,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3241_shp)
{ return new mosek::fusion::PSDDomain(_3240_k,_3241_shp); }
mosek::fusion::PSDDomain::PSDDomain
  (mosek::fusion::PSDKey _3240_k,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3241_shp) : 
   PSDDomain(new mosek::fusion::p_PSDDomain(this))
{ mosek::fusion::p_PSDDomain::_get_impl(this)->_initialize(_3240_k,_3241_shp); }
void mosek::fusion::p_PSDDomain::_initialize  (mosek::fusion::PSDKey _3240_k,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3241_shp)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__3241_shp(_3241_shp ? _3241_shp->raw() : nullptr, _3241_shp ? _3241_shp->size(0) : 0);
    mosek::fusion::p_PSDDomain::_initialize(_3240_k,_3241_shp,((int)((_3241_shp)->size(0)) - (int)2),((int)((_3241_shp)->size(0)) - (int)1));
  }
}
// mosek.fusion.PSDDomain.ctor

// mosek.fusion.PSDDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:1469:6-1476:7
mosek::fusion::PSDDomain::t mosek::fusion::p_PSDDomain::_new_PSDDomain
  (mosek::fusion::PSDKey _3242_k)
{ return new mosek::fusion::PSDDomain(_3242_k); }
mosek::fusion::PSDDomain::PSDDomain
  (mosek::fusion::PSDKey _3242_k) : 
   PSDDomain(new mosek::fusion::p_PSDDomain(this))
{ mosek::fusion::p_PSDDomain::_get_impl(this)->_initialize(_3242_k); }
void mosek::fusion::p_PSDDomain::_initialize  (mosek::fusion::PSDKey _3242_k)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    shape = nullptr;
    key = _3242_k;
    conedim1 = (int)0;
    conedim2 = (int)0;
    axisIsSet = false;
    indexnames = nullptr;
  }
}
// mosek.fusion.PSDDomain.ctor

// mosek.fusion.PSDDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:1416:6-1423:7
mosek::fusion::PSDDomain::t mosek::fusion::p_PSDDomain::_new_PSDDomain
  (monty::rc_ptr< ::mosek::fusion::PSDDomain > _3243_other)
{ return new mosek::fusion::PSDDomain(_3243_other); }
mosek::fusion::PSDDomain::PSDDomain
  (monty::rc_ptr< ::mosek::fusion::PSDDomain > _3243_other) : 
   PSDDomain(new mosek::fusion::p_PSDDomain(this))
{ mosek::fusion::p_PSDDomain::_get_impl(this)->_initialize(_3243_other); }
void mosek::fusion::p_PSDDomain::_initialize  (monty::rc_ptr< ::mosek::fusion::PSDDomain > _3243_other)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    shape = mosek::fusion::p_PSDDomain::_get_impl(_3243_other)->shape;
    key = mosek::fusion::p_PSDDomain::_get_impl(_3243_other)->key;
    conedim1 = mosek::fusion::p_PSDDomain::_get_impl(_3243_other)->conedim1;
    conedim2 = mosek::fusion::p_PSDDomain::_get_impl(_3243_other)->conedim2;
    axisIsSet = mosek::fusion::p_PSDDomain::_get_impl(_3243_other)->axisIsSet;
    indexnames = mosek::fusion::p_PSDDomain::_get_impl(_3243_other)->indexnames;
  }
}
// mosek.fusion.PSDDomain.ctor

// Begin mosek.fusion.PSDDomain.axis
// Method mosek.fusion.PSDDomain.axis @ bld/grindsted/final/default/src/fusion/domain.mbi:1526:6-1545:7
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::PSDDomain :: __mosek_2fusion_2PSDDomain__axis(int32_t _3244_conedim1,int32_t _3245_conedim2) { return mosek::fusion::p_PSDDomain::_get_impl(this)->__mosek_2fusion_2PSDDomain__axis(_3244_conedim1,_3245_conedim2); }
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::PSDDomain::axis(int32_t _3244_conedim1,int32_t _3245_conedim2) { return __mosek_2fusion_2PSDDomain__axis(_3244_conedim1,_3245_conedim2); }
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::p_PSDDomain::__mosek_2fusion_2PSDDomain__axis(int32_t _3244_conedim1,int32_t _3245_conedim2)
{
  mosek::fusion::p_PSDDomain::_get_impl(::mosek::fusion::PSDDomain::t(_pubthis))->conedim1 = _3244_conedim1;
  mosek::fusion::p_PSDDomain::_get_impl(::mosek::fusion::PSDDomain::t(_pubthis))->conedim2 = _3245_conedim2;
  axisIsSet = true;
  if (((NULL == shape.get()) && (!((_3244_conedim1 >= (int)0) && ((_3245_conedim2 >= (int)0) && (_3244_conedim1 != _3245_conedim2))))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching shape or cone dimensions"));
    }
  }
  else if(((NULL != shape.get()) && ((!(((int)((shape)->size(0)) > _3244_conedim1) && (((int)((shape)->size(0)) > _3245_conedim2) && ((_3244_conedim1 >= (int)0) && ((_3245_conedim2 >= (int)0) && (_3244_conedim1 != _3245_conedim2)))))) && (((*shape)(_3244_conedim1)) == ((*shape)(_3245_conedim2))))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching shape or cone dimensions"));
    }
  }
  {}
  return ::mosek::fusion::PSDDomain::t(_pubthis);
}
// End mosek.fusion.PSDDomain.axis

// Begin mosek.fusion.PSDDomain.withNamesOnAxis
// Method mosek.fusion.PSDDomain.withNamesOnAxis @ bld/grindsted/final/default/src/fusion/domain.mbi:1502:6-1515:7
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::PSDDomain :: __mosek_2fusion_2PSDDomain__withNamesOnAxis(std::shared_ptr< monty::ndarray< std::string,1 > > _3246_names,int32_t _3247_axis) { return mosek::fusion::p_PSDDomain::_get_impl(this)->__mosek_2fusion_2PSDDomain__withNamesOnAxis(_3246_names,_3247_axis); }
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::PSDDomain::withNamesOnAxis(std::shared_ptr< monty::ndarray< std::string,1 > > _3246_names,int32_t _3247_axis) { return __mosek_2fusion_2PSDDomain__withNamesOnAxis(_3246_names,_3247_axis); }
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::p_PSDDomain::__mosek_2fusion_2PSDDomain__withNamesOnAxis(std::shared_ptr< monty::ndarray< std::string,1 > > _3246_names,int32_t _3247_axis)
{
  if ((NULL == indexnames.get()))
  {
    {
      std::vector<std::shared_ptr< monty::ndarray< std::string,1 > >> _10825_;
      for (int32_t _3248_i = (int)0, _10826_ = safe_add( _3247_axis,(int)1 ); _3248_i < _10826_ ; ++_3248_i)
      {
        _10825_.push_back(nullptr);
      }
      auto _10827_ = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape(_10825_.size()),_10825_.begin(),_10825_.end()));
      indexnames = _10827_;
      std::vector<std::string> _10828_;
      for (int32_t _3249_i = (int)0, _10829_ = (int)((_3246_names)->size(0)); _3249_i < _10829_ ; ++_3249_i)
      {
        _10828_.push_back(((*_3246_names)(_3249_i)));
      }
      auto _10830_ = std::shared_ptr< monty::ndarray< std::string,1 > >(new monty::ndarray< std::string,1 >(monty::shape(_10828_.size()),_10828_.begin(),_10828_.end()));
      ((*indexnames)(_3247_axis)) = _10830_;
    }
  }
  {}
  if (((int)((indexnames)->size(0)) < safe_add( _3247_axis,(int)1 )))
  {
    {
      std::vector<std::shared_ptr< monty::ndarray< std::string,1 > >> _10831_;
      for (int32_t _3251_i = (int)0, _10832_ = safe_add( _3247_axis,(int)1 ); _3251_i < _10832_ ; ++_3251_i)
      {
        _10831_.push_back(nullptr);
      }
      auto _10833_ = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape(_10831_.size()),_10831_.begin(),_10831_.end()));
      std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _3250_ixnames = _10833_;
      int32_t _10834_ = (int)0;
      int32_t _10835_ = (int)((indexnames)->size(0));
      for (int32_t _3252_i = _10834_; _3252_i < _10835_; ++_3252_i)
      {
        {
          ((*_3250_ixnames)(_3252_i)) = ((*indexnames)(_3252_i));
        }
      }
      indexnames = _3250_ixnames;
    }
  }
  {}
  std::vector<std::string> _10836_;
  for (int32_t _3253_i = (int)0, _10837_ = (int)((_3246_names)->size(0)); _3253_i < _10837_ ; ++_3253_i)
  {
    _10836_.push_back(((*_3246_names)(_3253_i)));
  }
  auto _10838_ = std::shared_ptr< monty::ndarray< std::string,1 > >(new monty::ndarray< std::string,1 >(monty::shape(_10836_.size()),_10836_.begin(),_10836_.end()));
  ((*indexnames)(_3247_axis)) = _10838_;
  return ::mosek::fusion::PSDDomain::t(_pubthis);
}
// End mosek.fusion.PSDDomain.withNamesOnAxis

// Begin mosek.fusion.PSDDomain.finalize_and_validate_inplace
// Method mosek.fusion.PSDDomain.finalize_and_validate_inplace @ bld/grindsted/final/default/src/fusion/domain.mbi:1430:6-1466:7
void mosek::fusion::p_PSDDomain::finalize_and_validate_inplace(std::shared_ptr< monty::ndarray< int32_t,1 > > _3254_shp)
{
  _checked_ptr_1<int32_t> _ptr__3254_shp(_3254_shp ? _3254_shp->raw() : nullptr, _3254_shp ? _3254_shp->size(0) : 0);
  if ((NULL != _3254_shp.get()))
  {
    {
      if ((NULL == shape.get()))
      {
        {
          shape = _3254_shp;
        }
      }
      else
      {
        {
          if (((int)((_3254_shp)->size(0)) != (int)((shape)->size(0))))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Conflicting shape definitions"));
            }
          }
          {}
          int32_t _10839_ = (int)0;
          int32_t _10840_ = (int)((_3254_shp)->size(0));
          for (int32_t _3255_i = _10839_; _3255_i < _10840_; ++_3255_i)
          {
            {
              if ((_ptr__3254_shp[_3255_i] != ((*shape)(_3255_i))))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("Conflicting shape definitions"));
                }
              }
              {}
            }
          }
        }
      }
    }
  }
  {}
  if (((int)((shape)->size(0)) < (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Positive semidefinite domain must have at least two dimensions"));
    }
  }
  {}
  if ((!axisIsSet))
  {
    {
      conedim1 = ((int)((shape)->size(0)) - (int)2);
      conedim2 = ((int)((shape)->size(0)) - (int)1);
    }
  }
  {}
  if (((conedim1 < (int)0) || ((conedim1 >= (int)((shape)->size(0))) || ((conedim2 < (int)0) || ((conedim2 >= (int)((shape)->size(0))) || (conedim1 == conedim2))))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid cone dimension specification"));
    }
  }
  {}
  if ((((*shape)(conedim1)) != ((*shape)(conedim2))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Cone dimensions must have same size"));
    }
  }
  {}
  if ((NULL != indexnames.get()))
  {
    {
      if (((int)((indexnames)->size(0)) != (int)((shape)->size(0))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Index names do not match the domain shape"));
        }
      }
      else
      {
        {
          int32_t _10841_ = (int)0;
          int32_t _10842_ = (int)((shape)->size(0));
          for (int32_t _3256_i = _10841_; _3256_i < _10842_; ++_3256_i)
          {
            {
              if (((NULL != ((*indexnames)(_3256_i)).get()) && ((int)((((*indexnames)(_3256_i)))->size(0)) != ((*shape)(_3256_i)))))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("Index names do not match the domain shape"));
                }
              }
              {}
            }
          }
        }
      }
    }
  }
  {}
}
// End mosek.fusion.PSDDomain.finalize_and_validate_inplace

// Begin mosek.fusion.PSDDomain.finalize_and_validate
// Method mosek.fusion.PSDDomain.finalize_and_validate @ bld/grindsted/final/default/src/fusion/domain.mbi:1425:6-1429:7
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::p_PSDDomain::__mosek_2fusion_2PSDDomain__finalize_and_validate(std::shared_ptr< monty::ndarray< int32_t,1 > > _3257_shp)
{
  _checked_ptr_1<int32_t> _ptr__3257_shp(_3257_shp ? _3257_shp->raw() : nullptr, _3257_shp ? _3257_shp->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::PSDDomain > _3258_res = ::mosek::fusion::p_PSDDomain::_new_PSDDomain(::mosek::fusion::PSDDomain::t(_pubthis));
  mosek::fusion::p_PSDDomain::_get_impl(_3258_res.get())->finalize_and_validate_inplace(_3257_shp);
  return _3258_res;
}
// End mosek.fusion.PSDDomain.finalize_and_validate

void mosek::fusion::p_PSDDomain::destroy()
{
  indexnames.reset();
  shape.reset();
}
void mosek::fusion::PSDDomain::destroy() { mosek::fusion::p_PSDDomain::_get_impl(this)->destroy(); }
// } class PSDDomain
// class RangeDomain { // @ bld/grindsted/final/default/src/fusion/domain.mbi:1105:4-1380:5
mosek::fusion::RangeDomain::RangeDomain(mosek::fusion::p_RangeDomain *_impl) : _impl(_impl) { /*std::cout << "RangeDomain() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::RangeDomain::~RangeDomain() { delete _impl; _impl = nullptr; }
mosek::fusion::p_RangeDomain::p_RangeDomain
  (::mosek::fusion::RangeDomain * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.RangeDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:1276:6-1283:7
mosek::fusion::RangeDomain::t mosek::fusion::p_RangeDomain::_new_RangeDomain
  (bool _3259_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3260_lb,
    std::shared_ptr< monty::ndarray< double,1 > > _3261_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3262_dims)
{ return new mosek::fusion::RangeDomain(_3259_scalable,_3260_lb,_3261_ub,_3262_dims); }
mosek::fusion::RangeDomain::RangeDomain
  (bool _3259_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3260_lb,
    std::shared_ptr< monty::ndarray< double,1 > > _3261_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3262_dims) : 
   RangeDomain(new mosek::fusion::p_RangeDomain(this))
{ mosek::fusion::p_RangeDomain::_get_impl(this)->_initialize(_3259_scalable,_3260_lb,_3261_ub,_3262_dims); }
void mosek::fusion::p_RangeDomain::_initialize  (bool _3259_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3260_lb,
    std::shared_ptr< monty::ndarray< double,1 > > _3261_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3262_dims)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__3260_lb(_3260_lb ? _3260_lb->raw() : nullptr, _3260_lb ? _3260_lb->size(0) : 0);
    _checked_ptr_1<double> _ptr__3261_ub(_3261_ub ? _3261_ub->raw() : nullptr, _3261_ub ? _3261_ub->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__3262_dims(_3262_dims ? _3262_dims->raw() : nullptr, _3262_dims ? _3262_dims->size(0) : 0);
    mosek::fusion::p_RangeDomain::_initialize(_3259_scalable,_3260_lb,_3261_ub,_3262_dims,nullptr,(int)1);
  }
}
// mosek.fusion.RangeDomain.ctor

// mosek.fusion.RangeDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:1256:6-1274:7
mosek::fusion::RangeDomain::t mosek::fusion::p_RangeDomain::_new_RangeDomain
  (bool _3263_scalable,
    double _3264_lb,
    double _3265_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3266_dims)
{ return new mosek::fusion::RangeDomain(_3263_scalable,_3264_lb,_3265_ub,_3266_dims); }
mosek::fusion::RangeDomain::RangeDomain
  (bool _3263_scalable,
    double _3264_lb,
    double _3265_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3266_dims) : 
   RangeDomain(new mosek::fusion::p_RangeDomain(this))
{ mosek::fusion::p_RangeDomain::_get_impl(this)->_initialize(_3263_scalable,_3264_lb,_3265_ub,_3266_dims); }
void mosek::fusion::p_RangeDomain::_initialize  (bool _3263_scalable,
    double _3264_lb,
    double _3265_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3266_dims)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__3266_dims(_3266_dims ? _3266_dims->raw() : nullptr, _3266_dims ? _3266_dims->size(0) : 0);
    cardinal_flag = false;
    shape = _3266_dims;
    sparsity = nullptr;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->scalable = _3263_scalable;
    int32_t _3267_totalsize = (int)1;
    int32_t _10843_ = (int)0;
    int32_t _10844_ = (int)((_3266_dims)->size(0));
    for (int32_t _3268_i = _10843_; _3268_i < _10844_; ++_3268_i)
    {
      {
        _3267_totalsize *= _ptr__3266_dims[_3268_i];
      }
    }
    std::vector<double> _10845_;
    for (int32_t _3269_i = (int)0, _10846_ = _3267_totalsize; _3269_i < _10846_ ; ++_3269_i)
    {
      _10845_.push_back(_3265_ub);
    }
    auto _10847_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10845_.size()),_10845_.begin(),_10845_.end()));
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->ub = _10847_;
    std::vector<double> _10848_;
    for (int32_t _3270_i = (int)0, _10849_ = _3267_totalsize; _3270_i < _10849_ ; ++_3270_i)
    {
      _10848_.push_back(_3264_lb);
    }
    auto _10850_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10848_.size()),_10848_.begin(),_10848_.end()));
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->lb = _10850_;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->empty = false;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->indexnames = nullptr;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->domsize = (int)0;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->nelements = (int)0;
  }
}
// mosek.fusion.RangeDomain.ctor

// mosek.fusion.RangeDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:1246:6-1254:7
mosek::fusion::RangeDomain::t mosek::fusion::p_RangeDomain::_new_RangeDomain
  (bool _3271_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3272_lb,
    std::shared_ptr< monty::ndarray< double,1 > > _3273_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3274_dims,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _3275_sp)
{ return new mosek::fusion::RangeDomain(_3271_scalable,_3272_lb,_3273_ub,_3274_dims,_3275_sp); }
mosek::fusion::RangeDomain::RangeDomain
  (bool _3271_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3272_lb,
    std::shared_ptr< monty::ndarray< double,1 > > _3273_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3274_dims,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _3275_sp) : 
   RangeDomain(new mosek::fusion::p_RangeDomain(this))
{ mosek::fusion::p_RangeDomain::_get_impl(this)->_initialize(_3271_scalable,_3272_lb,_3273_ub,_3274_dims,_3275_sp); }
void mosek::fusion::p_RangeDomain::_initialize  (bool _3271_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3272_lb,
    std::shared_ptr< monty::ndarray< double,1 > > _3273_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3274_dims,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _3275_sp)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__3272_lb(_3272_lb ? _3272_lb->raw() : nullptr, _3272_lb ? _3272_lb->size(0) : 0);
    _checked_ptr_1<double> _ptr__3273_ub(_3273_ub ? _3273_ub->raw() : nullptr, _3273_ub ? _3273_ub->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__3274_dims(_3274_dims ? _3274_dims->raw() : nullptr, _3274_dims ? _3274_dims->size(0) : 0);
    mosek::fusion::p_RangeDomain::_initialize(_3271_scalable,_3272_lb,_3273_ub,_3274_dims,_3275_sp,(int)1);
  }
}
// mosek.fusion.RangeDomain.ctor

// mosek.fusion.RangeDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:1225:6-1244:7
mosek::fusion::RangeDomain::t mosek::fusion::p_RangeDomain::_new_RangeDomain
  (bool _3276_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3277_lb,
    std::shared_ptr< monty::ndarray< double,1 > > _3278_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3279_dims,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _3280_sp,
    int32_t _3281_steal)
{ return new mosek::fusion::RangeDomain(_3276_scalable,_3277_lb,_3278_ub,_3279_dims,_3280_sp,_3281_steal); }
mosek::fusion::RangeDomain::RangeDomain
  (bool _3276_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3277_lb,
    std::shared_ptr< monty::ndarray< double,1 > > _3278_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3279_dims,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _3280_sp,
    int32_t _3281_steal) : 
   RangeDomain(new mosek::fusion::p_RangeDomain(this))
{ mosek::fusion::p_RangeDomain::_get_impl(this)->_initialize(_3276_scalable,_3277_lb,_3278_ub,_3279_dims,_3280_sp,_3281_steal); }
void mosek::fusion::p_RangeDomain::_initialize  (bool _3276_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3277_lb,
    std::shared_ptr< monty::ndarray< double,1 > > _3278_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3279_dims,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _3280_sp,
    int32_t _3281_steal)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__3277_lb(_3277_lb ? _3277_lb->raw() : nullptr, _3277_lb ? _3277_lb->size(0) : 0);
    _checked_ptr_1<double> _ptr__3278_ub(_3278_ub ? _3278_ub->raw() : nullptr, _3278_ub ? _3278_ub->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__3279_dims(_3279_dims ? _3279_dims->raw() : nullptr, _3279_dims ? _3279_dims->size(0) : 0);
    cardinal_flag = false;
    shape = _3279_dims;
    sparsity = nullptr;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->scalable = _3276_scalable;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->ub = _3278_ub;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->lb = _3277_lb;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->sparsity = _3280_sp;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->empty = false;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->indexnames = nullptr;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->domsize = (int)0;
    mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->nelements = (int)0;
  }
}
// mosek.fusion.RangeDomain.ctor

// mosek.fusion.RangeDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:1210:6-1223:7
mosek::fusion::RangeDomain::t mosek::fusion::p_RangeDomain::_new_RangeDomain
  (monty::rc_ptr< ::mosek::fusion::RangeDomain > _3282_other)
{ return new mosek::fusion::RangeDomain(_3282_other); }
mosek::fusion::RangeDomain::RangeDomain
  (monty::rc_ptr< ::mosek::fusion::RangeDomain > _3282_other) : 
   RangeDomain(new mosek::fusion::p_RangeDomain(this))
{ mosek::fusion::p_RangeDomain::_get_impl(this)->_initialize(_3282_other); }
void mosek::fusion::p_RangeDomain::_initialize  (monty::rc_ptr< ::mosek::fusion::RangeDomain > _3282_other)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    cardinal_flag = mosek::fusion::p_RangeDomain::_get_impl(_3282_other)->cardinal_flag;
    sparsity = mosek::fusion::p_RangeDomain::_get_impl(_3282_other)->sparsity;
    scalable = mosek::fusion::p_RangeDomain::_get_impl(_3282_other)->scalable;
    shape = mosek::fusion::p_RangeDomain::_get_impl(_3282_other)->shape;
    ub = mosek::fusion::p_RangeDomain::_get_impl(_3282_other)->ub;
    lb = mosek::fusion::p_RangeDomain::_get_impl(_3282_other)->lb;
    domsize = mosek::fusion::p_RangeDomain::_get_impl(_3282_other)->domsize;
    nelements = mosek::fusion::p_RangeDomain::_get_impl(_3282_other)->nelements;
    empty = mosek::fusion::p_RangeDomain::_get_impl(_3282_other)->empty;
    std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _10851_;
    bool _10852_ = (NULL != mosek::fusion::p_RangeDomain::_get_impl(_3282_other)->indexnames.get());
    if (_10852_)
    {
      std::vector<std::shared_ptr< monty::ndarray< std::string,1 > >> _10853_;
      for (int32_t _3283_i = (int)0, _10854_ = (int)((mosek::fusion::p_RangeDomain::_get_impl(_3282_other)->indexnames)->size(0)); _3283_i < _10854_ ; ++_3283_i)
      {
        _10853_.push_back(((*mosek::fusion::p_RangeDomain::_get_impl(_3282_other)->indexnames)(_3283_i)));
      }
      auto _10855_ = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape(_10853_.size()),_10853_.begin(),_10853_.end()));
      _10851_ = _10855_;
    }
    else
    {
      _10851_ = nullptr;
    }
    indexnames = _10851_;
  }
}
// mosek.fusion.RangeDomain.ctor

// Begin mosek.fusion.RangeDomain.sparse
// Method mosek.fusion.RangeDomain.sparse @ bld/grindsted/final/default/src/fusion/domain.mbi:1372:6-1379:7
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain :: __mosek_2fusion_2RangeDomain__sparse(std::shared_ptr< monty::ndarray< int32_t,2 > > _3284_sparsity) { return mosek::fusion::p_RangeDomain::_get_impl(this)->__mosek_2fusion_2RangeDomain__sparse(_3284_sparsity); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain::sparse(std::shared_ptr< monty::ndarray< int32_t,2 > > _3284_sparsity) { return __mosek_2fusion_2RangeDomain__sparse(_3284_sparsity); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_RangeDomain::__mosek_2fusion_2RangeDomain__sparse(std::shared_ptr< monty::ndarray< int32_t,2 > > _3284_sparsity)
{
  mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->sparsity = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape((int)((_3284_sparsity)->size(0)),(int)((_3284_sparsity)->size(1)))));
  {
    int32_t _3285_i = (int)0;
    for(;(_3285_i < (int)((_3284_sparsity)->size(0)));++ _3285_i)
    {
      {
        {
          int32_t _3286_j = (int)0;
          for(;(_3286_j < (int)((_3284_sparsity)->size(1)));++ _3286_j)
          {
            {
              ((*mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->sparsity)(_3285_i,_3286_j)) = ((*_3284_sparsity)(_3285_i,_3286_j));
            }
          }
        }
      }
    }
  }
  return ::mosek::fusion::RangeDomain::t(_pubthis);
}
// End mosek.fusion.RangeDomain.sparse

// Begin mosek.fusion.RangeDomain.sparse
// Method mosek.fusion.RangeDomain.sparse @ bld/grindsted/final/default/src/fusion/domain.mbi:1358:6-1364:7
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain :: __mosek_2fusion_2RangeDomain__sparse(std::shared_ptr< monty::ndarray< int32_t,1 > > _3287_sparsity) { return mosek::fusion::p_RangeDomain::_get_impl(this)->__mosek_2fusion_2RangeDomain__sparse(_3287_sparsity); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain::sparse(std::shared_ptr< monty::ndarray< int32_t,1 > > _3287_sparsity) { return __mosek_2fusion_2RangeDomain__sparse(_3287_sparsity); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_RangeDomain::__mosek_2fusion_2RangeDomain__sparse(std::shared_ptr< monty::ndarray< int32_t,1 > > _3287_sparsity)
{
  _checked_ptr_1<int32_t> _ptr__3287_sparsity(_3287_sparsity ? _3287_sparsity->raw() : nullptr, _3287_sparsity ? _3287_sparsity->size(0) : 0);
  mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->sparsity = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape((int)((_3287_sparsity)->size(0)),(int)1)));
  int32_t _10856_ = (int)0;
  int32_t _10857_ = (int)((_3287_sparsity)->size(0));
  for (int32_t _3288_i = _10856_; _3288_i < _10857_; ++_3288_i)
  {
    {
      ((*mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->sparsity)(_3288_i,(int)0)) = _ptr__3287_sparsity[_3288_i];
    }
  }
  return ::mosek::fusion::RangeDomain::t(_pubthis);
}
// End mosek.fusion.RangeDomain.sparse

// Begin mosek.fusion.RangeDomain.sparse
// Method mosek.fusion.RangeDomain.sparse @ bld/grindsted/final/default/src/fusion/domain.mbi:1346:6-1351:7
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain :: __mosek_2fusion_2RangeDomain__sparse() { return mosek::fusion::p_RangeDomain::_get_impl(this)->__mosek_2fusion_2RangeDomain__sparse(); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain::sparse() { return __mosek_2fusion_2RangeDomain__sparse(); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_RangeDomain::__mosek_2fusion_2RangeDomain__sparse()
{
  mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->empty = true;
  mosek::fusion::p_RangeDomain::_get_impl(::mosek::fusion::RangeDomain::t(_pubthis))->sparsity = nullptr;
  return ::mosek::fusion::RangeDomain::t(_pubthis);
}
// End mosek.fusion.RangeDomain.sparse

// Begin mosek.fusion.RangeDomain.integral
// Method mosek.fusion.RangeDomain.integral @ bld/grindsted/final/default/src/fusion/domain.mbi:1338:6-83
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain :: __mosek_2fusion_2RangeDomain__integral() { return mosek::fusion::p_RangeDomain::_get_impl(this)->__mosek_2fusion_2RangeDomain__integral(); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain::integral() { return __mosek_2fusion_2RangeDomain__integral(); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_RangeDomain::__mosek_2fusion_2RangeDomain__integral()
{
  cardinal_flag = true;
  return ::mosek::fusion::RangeDomain::t(_pubthis);
}
// End mosek.fusion.RangeDomain.integral

// Begin mosek.fusion.RangeDomain.withShape
// Method mosek.fusion.RangeDomain.withShape @ bld/grindsted/final/default/src/fusion/domain.mbi:1325:6-124
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain :: __mosek_2fusion_2RangeDomain__withShape(int32_t _3289_dim0,int32_t _3290_dim1,int32_t _3291_dim2) { return mosek::fusion::p_RangeDomain::_get_impl(this)->__mosek_2fusion_2RangeDomain__withShape(_3289_dim0,_3290_dim1,_3291_dim2); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain::withShape(int32_t _3289_dim0,int32_t _3290_dim1,int32_t _3291_dim2) { return __mosek_2fusion_2RangeDomain__withShape(_3289_dim0,_3290_dim1,_3291_dim2); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_RangeDomain::__mosek_2fusion_2RangeDomain__withShape(int32_t _3289_dim0,int32_t _3290_dim1,int32_t _3291_dim2)
{
  shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3289_dim0),(int32_t)(_3290_dim1),(int32_t)(_3291_dim2)});
  return ::mosek::fusion::RangeDomain::t(_pubthis);
}
// End mosek.fusion.RangeDomain.withShape

// Begin mosek.fusion.RangeDomain.withShape
// Method mosek.fusion.RangeDomain.withShape @ bld/grindsted/final/default/src/fusion/domain.mbi:1324:6-108
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain :: __mosek_2fusion_2RangeDomain__withShape(int32_t _3292_dim0,int32_t _3293_dim1) { return mosek::fusion::p_RangeDomain::_get_impl(this)->__mosek_2fusion_2RangeDomain__withShape(_3292_dim0,_3293_dim1); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain::withShape(int32_t _3292_dim0,int32_t _3293_dim1) { return __mosek_2fusion_2RangeDomain__withShape(_3292_dim0,_3293_dim1); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_RangeDomain::__mosek_2fusion_2RangeDomain__withShape(int32_t _3292_dim0,int32_t _3293_dim1)
{
  shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3292_dim0),(int32_t)(_3293_dim1)});
  return ::mosek::fusion::RangeDomain::t(_pubthis);
}
// End mosek.fusion.RangeDomain.withShape

// Begin mosek.fusion.RangeDomain.withShape
// Method mosek.fusion.RangeDomain.withShape @ bld/grindsted/final/default/src/fusion/domain.mbi:1323:6-92
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain :: __mosek_2fusion_2RangeDomain__withShape(int32_t _3294_dim0) { return mosek::fusion::p_RangeDomain::_get_impl(this)->__mosek_2fusion_2RangeDomain__withShape(_3294_dim0); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain::withShape(int32_t _3294_dim0) { return __mosek_2fusion_2RangeDomain__withShape(_3294_dim0); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_RangeDomain::__mosek_2fusion_2RangeDomain__withShape(int32_t _3294_dim0)
{
  shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3294_dim0)});
  return ::mosek::fusion::RangeDomain::t(_pubthis);
}
// End mosek.fusion.RangeDomain.withShape

// Begin mosek.fusion.RangeDomain.withShape
// Method mosek.fusion.RangeDomain.withShape @ bld/grindsted/final/default/src/fusion/domain.mbi:1322:6-83
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain :: __mosek_2fusion_2RangeDomain__withShape(std::shared_ptr< monty::ndarray< int32_t,1 > > _3295_shp) { return mosek::fusion::p_RangeDomain::_get_impl(this)->__mosek_2fusion_2RangeDomain__withShape(_3295_shp); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain::withShape(std::shared_ptr< monty::ndarray< int32_t,1 > > _3295_shp) { return __mosek_2fusion_2RangeDomain__withShape(_3295_shp); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_RangeDomain::__mosek_2fusion_2RangeDomain__withShape(std::shared_ptr< monty::ndarray< int32_t,1 > > _3295_shp)
{
  _checked_ptr_1<int32_t> _ptr__3295_shp(_3295_shp ? _3295_shp->raw() : nullptr, _3295_shp ? _3295_shp->size(0) : 0);
  shape = _3295_shp;
  return ::mosek::fusion::RangeDomain::t(_pubthis);
}
// End mosek.fusion.RangeDomain.withShape

// Begin mosek.fusion.RangeDomain.withNamesOnAxis
// Method mosek.fusion.RangeDomain.withNamesOnAxis @ bld/grindsted/final/default/src/fusion/domain.mbi:1298:6-1311:7
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain :: __mosek_2fusion_2RangeDomain__withNamesOnAxis(std::shared_ptr< monty::ndarray< std::string,1 > > _3296_names,int32_t _3297_axis) { return mosek::fusion::p_RangeDomain::_get_impl(this)->__mosek_2fusion_2RangeDomain__withNamesOnAxis(_3296_names,_3297_axis); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::RangeDomain::withNamesOnAxis(std::shared_ptr< monty::ndarray< std::string,1 > > _3296_names,int32_t _3297_axis) { return __mosek_2fusion_2RangeDomain__withNamesOnAxis(_3296_names,_3297_axis); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_RangeDomain::__mosek_2fusion_2RangeDomain__withNamesOnAxis(std::shared_ptr< monty::ndarray< std::string,1 > > _3296_names,int32_t _3297_axis)
{
  if ((NULL == indexnames.get()))
  {
    {
      std::vector<std::shared_ptr< monty::ndarray< std::string,1 > >> _10858_;
      for (int32_t _3298_i = (int)0, _10859_ = safe_add( _3297_axis,(int)1 ); _3298_i < _10859_ ; ++_3298_i)
      {
        _10858_.push_back(nullptr);
      }
      auto _10860_ = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape(_10858_.size()),_10858_.begin(),_10858_.end()));
      indexnames = _10860_;
      std::vector<std::string> _10861_;
      for (int32_t _3299_i = (int)0, _10862_ = (int)((_3296_names)->size(0)); _3299_i < _10862_ ; ++_3299_i)
      {
        _10861_.push_back(((*_3296_names)(_3299_i)));
      }
      auto _10863_ = std::shared_ptr< monty::ndarray< std::string,1 > >(new monty::ndarray< std::string,1 >(monty::shape(_10861_.size()),_10861_.begin(),_10861_.end()));
      ((*indexnames)(_3297_axis)) = _10863_;
    }
  }
  {}
  if (((int)((indexnames)->size(0)) < safe_add( _3297_axis,(int)1 )))
  {
    {
      std::vector<std::shared_ptr< monty::ndarray< std::string,1 > >> _10864_;
      for (int32_t _3301_i = (int)0, _10865_ = safe_add( _3297_axis,(int)1 ); _3301_i < _10865_ ; ++_3301_i)
      {
        _10864_.push_back(nullptr);
      }
      auto _10866_ = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape(_10864_.size()),_10864_.begin(),_10864_.end()));
      std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _3300_ixnames = _10866_;
      int32_t _10867_ = (int)0;
      int32_t _10868_ = (int)((indexnames)->size(0));
      for (int32_t _3302_i = _10867_; _3302_i < _10868_; ++_3302_i)
      {
        {
          ((*_3300_ixnames)(_3302_i)) = ((*indexnames)(_3302_i));
        }
      }
      indexnames = _3300_ixnames;
    }
  }
  {}
  std::vector<std::string> _10869_;
  for (int32_t _3303_i = (int)0, _10870_ = (int)((_3296_names)->size(0)); _3303_i < _10870_ ; ++_3303_i)
  {
    _10869_.push_back(((*_3296_names)(_3303_i)));
  }
  auto _10871_ = std::shared_ptr< monty::ndarray< std::string,1 > >(new monty::ndarray< std::string,1 >(monty::shape(_10869_.size()),_10869_.begin(),_10869_.end()));
  ((*indexnames)(_3297_axis)) = _10871_;
  return ::mosek::fusion::RangeDomain::t(_pubthis);
}
// End mosek.fusion.RangeDomain.withNamesOnAxis

// Begin mosek.fusion.RangeDomain.match_shape
// Method mosek.fusion.RangeDomain.match_shape @ bld/grindsted/final/default/src/fusion/domain.mbi:1285:6-1296:7
bool mosek::fusion::p_RangeDomain::match_shape(std::shared_ptr< monty::ndarray< int32_t,1 > > _3304_shp)
{
  _checked_ptr_1<int32_t> _ptr__3304_shp(_3304_shp ? _3304_shp->raw() : nullptr, _3304_shp ? _3304_shp->size(0) : 0);
  if (scalable)
  {
    {
      return true;
    }
  }
  else if(((int)((shape)->size(0)) != (int)((_3304_shp)->size(0))))
  {
    {
      return false;
    }
  }
  else
  {
    {
      int32_t _10872_ = (int)0;
      int32_t _10873_ = (int)((shape)->size(0));
      for (int32_t _3305_i = _10872_; _3305_i < _10873_; ++_3305_i)
      {
        {
          if ((((*shape)(_3305_i)) != _ptr__3304_shp[_3305_i]))
          {
            {
              return false;
            }
          }
          {}
        }
      }
    }
  }
  return true;
}
// End mosek.fusion.RangeDomain.match_shape

// Begin mosek.fusion.RangeDomain.finalize_and_validate_inplace
// Method mosek.fusion.RangeDomain.finalize_and_validate_inplace @ bld/grindsted/final/default/src/fusion/domain.mbi:1142:6-1208:7
void mosek::fusion::p_RangeDomain::finalize_and_validate_inplace(std::shared_ptr< monty::ndarray< int32_t,1 > > _3306_shp)
{
  _checked_ptr_1<int32_t> _ptr__3306_shp(_3306_shp ? _3306_shp->raw() : nullptr, _3306_shp ? _3306_shp->size(0) : 0);
  domsize = (int)1;
  if (scalable)
  {
    {
      if ((NULL != _3306_shp.get()))
      {
        {
          shape = _3306_shp;
        }
      }
      else
      {
        {
          shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0)));
        }
      }
      int32_t _10874_ = (int)0;
      int32_t _10875_ = (int)((shape)->size(0));
      for (int32_t _3307_i = _10874_; _3307_i < _10875_; ++_3307_i)
      {
        {
          domsize *= ((*shape)(_3307_i));
        }
      }
    }
  }
  else
  {
    {
      if ((NULL != _3306_shp.get()))
      {
        {
          if (((int)((_3306_shp)->size(0)) != (int)((shape)->size(0))))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Conflicting shape definitions"));
            }
          }
          {}
          int32_t _10876_ = (int)0;
          int32_t _10877_ = (int)((_3306_shp)->size(0));
          for (int32_t _3308_i = _10876_; _3308_i < _10877_; ++_3308_i)
          {
            {
              if ((_ptr__3306_shp[_3308_i] != ((*shape)(_3308_i))))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("Conflicting shape definitions"));
                }
              }
              {}
            }
          }
        }
      }
      {}
      int32_t _10878_ = (int)0;
      int32_t _10879_ = (int)((shape)->size(0));
      for (int32_t _3309_i = _10878_; _3309_i < _10879_; ++_3309_i)
      {
        {
          domsize *= ((*shape)(_3309_i));
        }
      }
    }
  }
  if ((NULL != indexnames.get()))
  {
    {
      if (((int)((indexnames)->size(0)) != (int)((shape)->size(0))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Index names do not match shape"));
        }
      }
      {}
      int32_t _10880_ = (int)0;
      int32_t _10881_ = (int)((shape)->size(0));
      for (int32_t _3310_i = _10880_; _3310_i < _10881_; ++_3310_i)
      {
        {
          if (((NULL != ((*indexnames)(_3310_i)).get()) && ((int)((((*indexnames)(_3310_i)))->size(0)) != ((*shape)(_3310_i)))))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Index names do not match shape"));
            }
          }
          {}
        }
      }
    }
  }
  {}
  if ((NULL != sparsity.get()))
  {
    {
      nelements = (int)((sparsity)->size(0));
      if (((int)((shape)->size(0)) != (int)((sparsity)->size(1))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Mismatching shape and sparsity pattern"));
        }
      }
      {}
      int32_t _10882_ = (int)0;
      int64_t _10883_ = nelements;
      for (int64_t _3311_i = _10882_; _3311_i < _10883_; ++_3311_i)
      {
        {
          int32_t _10884_ = (int)0;
          int32_t _10885_ = (int)((sparsity)->size(1));
          for (int32_t _3312_j = _10884_; _3312_j < _10885_; ++_3312_j)
          {
            {
              if (((((*sparsity)(_3311_i,_3312_j)) < (int)0) || (((*sparsity)(_3311_i,_3312_j)) >= ((*shape)(_3312_j)))))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("Sparsity pattern entry is out of bounds"));
                }
              }
              {}
            }
          }
        }
      }
      if (((!scalable) && ((NULL != lb.get()) && ((int)((lb)->size(0)) != nelements))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Sparsity pattern does not match bound"));
        }
      }
      {}
      if (((!scalable) && ((NULL != ub.get()) && ((int)((ub)->size(0)) != nelements))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Sparsity pattern does not match bound"));
        }
      }
      {}
    }
  }
  else
  {
    {
      nelements = domsize;
      if (((NULL != lb.get()) && (!scalable)))
      {
        {
          if (((int)((lb)->size(0)) != nelements))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Domain bound does not match shape"));
            }
          }
          {}
        }
      }
      {}
      if (((NULL != ub.get()) && (!scalable)))
      {
        {
          if (((int)((ub)->size(0)) != nelements))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Domain bound does not match shape"));
            }
          }
          {}
        }
      }
      {}
    }
  }
}
// End mosek.fusion.RangeDomain.finalize_and_validate_inplace

// Begin mosek.fusion.RangeDomain.finalize_and_validate
// Method mosek.fusion.RangeDomain.finalize_and_validate @ bld/grindsted/final/default/src/fusion/domain.mbi:1136:6-1140:7
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_RangeDomain::__mosek_2fusion_2RangeDomain__finalize_and_validate(std::shared_ptr< monty::ndarray< int32_t,1 > > _3313_shp)
{
  _checked_ptr_1<int32_t> _ptr__3313_shp(_3313_shp ? _3313_shp->raw() : nullptr, _3313_shp ? _3313_shp->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::RangeDomain > _3314_res = ::mosek::fusion::p_RangeDomain::_new_RangeDomain(::mosek::fusion::RangeDomain::t(_pubthis));
  mosek::fusion::p_RangeDomain::_get_impl(_3314_res.get())->finalize_and_validate_inplace(_3313_shp);
  return _3314_res;
}
// End mosek.fusion.RangeDomain.finalize_and_validate

void mosek::fusion::p_RangeDomain::destroy()
{
  indexnames.reset();
  ub.reset();
  lb.reset();
  sparsity.reset();
  shape.reset();
}
void mosek::fusion::RangeDomain::destroy() { mosek::fusion::p_RangeDomain::_get_impl(this)->destroy(); }
// } class RangeDomain
// class LinearDomain { // @ bld/grindsted/final/default/src/fusion/domain.mbi:832:4-1079:5
mosek::fusion::LinearDomain::LinearDomain(mosek::fusion::p_LinearDomain *_impl) : _impl(_impl) { /*std::cout << "LinearDomain() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::LinearDomain::~LinearDomain() { delete _impl; _impl = nullptr; }
mosek::fusion::p_LinearDomain::p_LinearDomain
  (::mosek::fusion::LinearDomain * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.LinearDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:976:6-982:6
mosek::fusion::LinearDomain::t mosek::fusion::p_LinearDomain::_new_LinearDomain
  (mosek::fusion::RelationKey _3315_k,
    bool _3316_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3317_rhs,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3318_dims)
{ return new mosek::fusion::LinearDomain(_3315_k,_3316_scalable,_3317_rhs,_3318_dims); }
mosek::fusion::LinearDomain::LinearDomain
  (mosek::fusion::RelationKey _3315_k,
    bool _3316_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3317_rhs,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3318_dims) : 
   LinearDomain(new mosek::fusion::p_LinearDomain(this))
{ mosek::fusion::p_LinearDomain::_get_impl(this)->_initialize(_3315_k,_3316_scalable,_3317_rhs,_3318_dims); }
void mosek::fusion::p_LinearDomain::_initialize  (mosek::fusion::RelationKey _3315_k,
    bool _3316_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3317_rhs,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3318_dims)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__3317_rhs(_3317_rhs ? _3317_rhs->raw() : nullptr, _3317_rhs ? _3317_rhs->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__3318_dims(_3318_dims ? _3318_dims->raw() : nullptr, _3318_dims ? _3318_dims->size(0) : 0);
    mosek::fusion::p_LinearDomain::_initialize(_3315_k,_3316_scalable,_3317_rhs,_3318_dims,nullptr,(int)1);
  }
}
// mosek.fusion.LinearDomain.ctor

// mosek.fusion.LinearDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:957:6-974:7
mosek::fusion::LinearDomain::t mosek::fusion::p_LinearDomain::_new_LinearDomain
  (mosek::fusion::RelationKey _3319_k,
    bool _3320_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3321_rhs,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3322_dims,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _3323_sp,
    int32_t _3324_steal)
{ return new mosek::fusion::LinearDomain(_3319_k,_3320_scalable,_3321_rhs,_3322_dims,_3323_sp,_3324_steal); }
mosek::fusion::LinearDomain::LinearDomain
  (mosek::fusion::RelationKey _3319_k,
    bool _3320_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3321_rhs,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3322_dims,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _3323_sp,
    int32_t _3324_steal) : 
   LinearDomain(new mosek::fusion::p_LinearDomain(this))
{ mosek::fusion::p_LinearDomain::_get_impl(this)->_initialize(_3319_k,_3320_scalable,_3321_rhs,_3322_dims,_3323_sp,_3324_steal); }
void mosek::fusion::p_LinearDomain::_initialize  (mosek::fusion::RelationKey _3319_k,
    bool _3320_scalable,
    std::shared_ptr< monty::ndarray< double,1 > > _3321_rhs,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3322_dims,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _3323_sp,
    int32_t _3324_steal)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__3321_rhs(_3321_rhs ? _3321_rhs->raw() : nullptr, _3321_rhs ? _3321_rhs->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__3322_dims(_3322_dims ? _3322_dims->raw() : nullptr, _3322_dims ? _3322_dims->size(0) : 0);
    mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->scalable = _3320_scalable;
    mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->shape = _3322_dims;
    mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->key = _3319_k;
    mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->bnd = _3321_rhs;
    mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->sparsity = _3323_sp;
    mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->cardinal_flag = false;
    mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->empty = false;
    indexnames = nullptr;
    mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->domsize = (int)0;
    mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->nelements = (int)0;
  }
}
// mosek.fusion.LinearDomain.ctor

// mosek.fusion.LinearDomain.ctor @ bld/grindsted/final/default/src/fusion/domain.mbi:942:6-955:7
mosek::fusion::LinearDomain::t mosek::fusion::p_LinearDomain::_new_LinearDomain
  (monty::rc_ptr< ::mosek::fusion::LinearDomain > _3325_other)
{ return new mosek::fusion::LinearDomain(_3325_other); }
mosek::fusion::LinearDomain::LinearDomain
  (monty::rc_ptr< ::mosek::fusion::LinearDomain > _3325_other) : 
   LinearDomain(new mosek::fusion::p_LinearDomain(this))
{ mosek::fusion::p_LinearDomain::_get_impl(this)->_initialize(_3325_other); }
void mosek::fusion::p_LinearDomain::_initialize  (monty::rc_ptr< ::mosek::fusion::LinearDomain > _3325_other)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    scalable = mosek::fusion::p_LinearDomain::_get_impl(_3325_other)->scalable;
    nelements = mosek::fusion::p_LinearDomain::_get_impl(_3325_other)->nelements;
    domsize = mosek::fusion::p_LinearDomain::_get_impl(_3325_other)->domsize;
    shape = mosek::fusion::p_LinearDomain::_get_impl(_3325_other)->shape;
    key = mosek::fusion::p_LinearDomain::_get_impl(_3325_other)->key;
    bnd = mosek::fusion::p_LinearDomain::_get_impl(_3325_other)->bnd;
    sparsity = mosek::fusion::p_LinearDomain::_get_impl(_3325_other)->sparsity;
    cardinal_flag = mosek::fusion::p_LinearDomain::_get_impl(_3325_other)->cardinal_flag;
    empty = mosek::fusion::p_LinearDomain::_get_impl(_3325_other)->empty;
    indexnames = mosek::fusion::p_LinearDomain::_get_impl(_3325_other)->indexnames;
  }
}
// mosek.fusion.LinearDomain.ctor

// Begin mosek.fusion.LinearDomain.sparse
// Method mosek.fusion.LinearDomain.sparse @ bld/grindsted/final/default/src/fusion/domain.mbi:1070:6-1078:7
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain :: __mosek_2fusion_2LinearDomain__sparse(std::shared_ptr< monty::ndarray< int32_t,2 > > _3326_sparsity) { return mosek::fusion::p_LinearDomain::_get_impl(this)->__mosek_2fusion_2LinearDomain__sparse(_3326_sparsity); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain::sparse(std::shared_ptr< monty::ndarray< int32_t,2 > > _3326_sparsity) { return __mosek_2fusion_2LinearDomain__sparse(_3326_sparsity); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_LinearDomain::__mosek_2fusion_2LinearDomain__sparse(std::shared_ptr< monty::ndarray< int32_t,2 > > _3326_sparsity)
{
  mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->sparsity = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape((int)((_3326_sparsity)->size(0)),(int)((_3326_sparsity)->size(1)))));
  mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->empty = false;
  {
    int32_t _3327_i = (int)0;
    for(;(_3327_i < (int)((_3326_sparsity)->size(0)));++ _3327_i)
    {
      {
        {
          int32_t _3328_j = (int)0;
          for(;(_3328_j < (int)((_3326_sparsity)->size(1)));++ _3328_j)
          {
            {
              ((*mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->sparsity)(_3327_i,_3328_j)) = ((*_3326_sparsity)(_3327_i,_3328_j));
            }
          }
        }
      }
    }
  }
  return ::mosek::fusion::LinearDomain::t(_pubthis);
}
// End mosek.fusion.LinearDomain.sparse

// Begin mosek.fusion.LinearDomain.sparse
// Method mosek.fusion.LinearDomain.sparse @ bld/grindsted/final/default/src/fusion/domain.mbi:1055:6-1062:7
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain :: __mosek_2fusion_2LinearDomain__sparse(std::shared_ptr< monty::ndarray< int32_t,1 > > _3329_sparsity) { return mosek::fusion::p_LinearDomain::_get_impl(this)->__mosek_2fusion_2LinearDomain__sparse(_3329_sparsity); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain::sparse(std::shared_ptr< monty::ndarray< int32_t,1 > > _3329_sparsity) { return __mosek_2fusion_2LinearDomain__sparse(_3329_sparsity); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_LinearDomain::__mosek_2fusion_2LinearDomain__sparse(std::shared_ptr< monty::ndarray< int32_t,1 > > _3329_sparsity)
{
  _checked_ptr_1<int32_t> _ptr__3329_sparsity(_3329_sparsity ? _3329_sparsity->raw() : nullptr, _3329_sparsity ? _3329_sparsity->size(0) : 0);
  mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->sparsity = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape((int)((_3329_sparsity)->size(0)),(int)1)));
  mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->empty = false;
  int32_t _10886_ = (int)0;
  int32_t _10887_ = (int)((_3329_sparsity)->size(0));
  for (int32_t _3330_i = _10886_; _3330_i < _10887_; ++_3330_i)
  {
    {
      ((*mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->sparsity)(_3330_i,(int)0)) = _ptr__3329_sparsity[_3330_i];
    }
  }
  return ::mosek::fusion::LinearDomain::t(_pubthis);
}
// End mosek.fusion.LinearDomain.sparse

// Begin mosek.fusion.LinearDomain.sparse
// Method mosek.fusion.LinearDomain.sparse @ bld/grindsted/final/default/src/fusion/domain.mbi:1043:6-1048:7
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain :: __mosek_2fusion_2LinearDomain__sparse() { return mosek::fusion::p_LinearDomain::_get_impl(this)->__mosek_2fusion_2LinearDomain__sparse(); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain::sparse() { return __mosek_2fusion_2LinearDomain__sparse(); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_LinearDomain::__mosek_2fusion_2LinearDomain__sparse()
{
  mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->empty = true;
  mosek::fusion::p_LinearDomain::_get_impl(::mosek::fusion::LinearDomain::t(_pubthis))->sparsity = nullptr;
  return ::mosek::fusion::LinearDomain::t(_pubthis);
}
// End mosek.fusion.LinearDomain.sparse

// Begin mosek.fusion.LinearDomain.integral
// Method mosek.fusion.LinearDomain.integral @ bld/grindsted/final/default/src/fusion/domain.mbi:1033:6-83
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain :: __mosek_2fusion_2LinearDomain__integral() { return mosek::fusion::p_LinearDomain::_get_impl(this)->__mosek_2fusion_2LinearDomain__integral(); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain::integral() { return __mosek_2fusion_2LinearDomain__integral(); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_LinearDomain::__mosek_2fusion_2LinearDomain__integral()
{
  cardinal_flag = true;
  return ::mosek::fusion::LinearDomain::t(_pubthis);
}
// End mosek.fusion.LinearDomain.integral

// Begin mosek.fusion.LinearDomain.withShape
// Method mosek.fusion.LinearDomain.withShape @ bld/grindsted/final/default/src/fusion/domain.mbi:1025:6-125
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain :: __mosek_2fusion_2LinearDomain__withShape(int32_t _3331_dim0,int32_t _3332_dim1,int32_t _3333_dim2) { return mosek::fusion::p_LinearDomain::_get_impl(this)->__mosek_2fusion_2LinearDomain__withShape(_3331_dim0,_3332_dim1,_3333_dim2); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain::withShape(int32_t _3331_dim0,int32_t _3332_dim1,int32_t _3333_dim2) { return __mosek_2fusion_2LinearDomain__withShape(_3331_dim0,_3332_dim1,_3333_dim2); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_LinearDomain::__mosek_2fusion_2LinearDomain__withShape(int32_t _3331_dim0,int32_t _3332_dim1,int32_t _3333_dim2)
{
  shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3331_dim0),(int32_t)(_3332_dim1),(int32_t)(_3333_dim2)});
  return ::mosek::fusion::LinearDomain::t(_pubthis);
}
// End mosek.fusion.LinearDomain.withShape

// Begin mosek.fusion.LinearDomain.withShape
// Method mosek.fusion.LinearDomain.withShape @ bld/grindsted/final/default/src/fusion/domain.mbi:1024:6-109
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain :: __mosek_2fusion_2LinearDomain__withShape(int32_t _3334_dim0,int32_t _3335_dim1) { return mosek::fusion::p_LinearDomain::_get_impl(this)->__mosek_2fusion_2LinearDomain__withShape(_3334_dim0,_3335_dim1); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain::withShape(int32_t _3334_dim0,int32_t _3335_dim1) { return __mosek_2fusion_2LinearDomain__withShape(_3334_dim0,_3335_dim1); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_LinearDomain::__mosek_2fusion_2LinearDomain__withShape(int32_t _3334_dim0,int32_t _3335_dim1)
{
  shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3334_dim0),(int32_t)(_3335_dim1)});
  return ::mosek::fusion::LinearDomain::t(_pubthis);
}
// End mosek.fusion.LinearDomain.withShape

// Begin mosek.fusion.LinearDomain.withShape
// Method mosek.fusion.LinearDomain.withShape @ bld/grindsted/final/default/src/fusion/domain.mbi:1023:6-93
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain :: __mosek_2fusion_2LinearDomain__withShape(int32_t _3336_dim0) { return mosek::fusion::p_LinearDomain::_get_impl(this)->__mosek_2fusion_2LinearDomain__withShape(_3336_dim0); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain::withShape(int32_t _3336_dim0) { return __mosek_2fusion_2LinearDomain__withShape(_3336_dim0); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_LinearDomain::__mosek_2fusion_2LinearDomain__withShape(int32_t _3336_dim0)
{
  shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3336_dim0)});
  return ::mosek::fusion::LinearDomain::t(_pubthis);
}
// End mosek.fusion.LinearDomain.withShape

// Begin mosek.fusion.LinearDomain.withShape
// Method mosek.fusion.LinearDomain.withShape @ bld/grindsted/final/default/src/fusion/domain.mbi:1022:6-85
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain :: __mosek_2fusion_2LinearDomain__withShape(std::shared_ptr< monty::ndarray< int32_t,1 > > _3337_shp) { return mosek::fusion::p_LinearDomain::_get_impl(this)->__mosek_2fusion_2LinearDomain__withShape(_3337_shp); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain::withShape(std::shared_ptr< monty::ndarray< int32_t,1 > > _3337_shp) { return __mosek_2fusion_2LinearDomain__withShape(_3337_shp); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_LinearDomain::__mosek_2fusion_2LinearDomain__withShape(std::shared_ptr< monty::ndarray< int32_t,1 > > _3337_shp)
{
  _checked_ptr_1<int32_t> _ptr__3337_shp(_3337_shp ? _3337_shp->raw() : nullptr, _3337_shp ? _3337_shp->size(0) : 0);
  shape = _3337_shp;
  return ::mosek::fusion::LinearDomain::t(_pubthis);
}
// End mosek.fusion.LinearDomain.withShape

// Begin mosek.fusion.LinearDomain.withNamesOnAxis
// Method mosek.fusion.LinearDomain.withNamesOnAxis @ bld/grindsted/final/default/src/fusion/domain.mbi:996:6-1009:7
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain :: __mosek_2fusion_2LinearDomain__withNamesOnAxis(std::shared_ptr< monty::ndarray< std::string,1 > > _3338_names,int32_t _3339_axis) { return mosek::fusion::p_LinearDomain::_get_impl(this)->__mosek_2fusion_2LinearDomain__withNamesOnAxis(_3338_names,_3339_axis); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::LinearDomain::withNamesOnAxis(std::shared_ptr< monty::ndarray< std::string,1 > > _3338_names,int32_t _3339_axis) { return __mosek_2fusion_2LinearDomain__withNamesOnAxis(_3338_names,_3339_axis); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_LinearDomain::__mosek_2fusion_2LinearDomain__withNamesOnAxis(std::shared_ptr< monty::ndarray< std::string,1 > > _3338_names,int32_t _3339_axis)
{
  if ((NULL == indexnames.get()))
  {
    {
      std::vector<std::shared_ptr< monty::ndarray< std::string,1 > >> _10888_;
      for (int32_t _3340_i = (int)0, _10889_ = safe_add( _3339_axis,(int)1 ); _3340_i < _10889_ ; ++_3340_i)
      {
        _10888_.push_back(nullptr);
      }
      auto _10890_ = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape(_10888_.size()),_10888_.begin(),_10888_.end()));
      indexnames = _10890_;
      std::vector<std::string> _10891_;
      for (int32_t _3341_i = (int)0, _10892_ = (int)((_3338_names)->size(0)); _3341_i < _10892_ ; ++_3341_i)
      {
        _10891_.push_back(((*_3338_names)(_3341_i)));
      }
      auto _10893_ = std::shared_ptr< monty::ndarray< std::string,1 > >(new monty::ndarray< std::string,1 >(monty::shape(_10891_.size()),_10891_.begin(),_10891_.end()));
      ((*indexnames)(_3339_axis)) = _10893_;
    }
  }
  {}
  if (((int)((indexnames)->size(0)) < safe_add( _3339_axis,(int)1 )))
  {
    {
      std::vector<std::shared_ptr< monty::ndarray< std::string,1 > >> _10894_;
      for (int32_t _3343_i = (int)0, _10895_ = safe_add( _3339_axis,(int)1 ); _3343_i < _10895_ ; ++_3343_i)
      {
        _10894_.push_back(nullptr);
      }
      auto _10896_ = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape(_10894_.size()),_10894_.begin(),_10894_.end()));
      std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _3342_ixnames = _10896_;
      int32_t _10897_ = (int)0;
      int32_t _10898_ = (int)((indexnames)->size(0));
      for (int32_t _3344_i = _10897_; _3344_i < _10898_; ++_3344_i)
      {
        {
          ((*_3342_ixnames)(_3344_i)) = ((*indexnames)(_3344_i));
        }
      }
      indexnames = _3342_ixnames;
    }
  }
  {}
  std::vector<std::string> _10899_;
  for (int32_t _3345_i = (int)0, _10900_ = (int)((_3338_names)->size(0)); _3345_i < _10900_ ; ++_3345_i)
  {
    _10899_.push_back(((*_3338_names)(_3345_i)));
  }
  auto _10901_ = std::shared_ptr< monty::ndarray< std::string,1 > >(new monty::ndarray< std::string,1 >(monty::shape(_10899_.size()),_10899_.begin(),_10899_.end()));
  ((*indexnames)(_3339_axis)) = _10901_;
  return ::mosek::fusion::LinearDomain::t(_pubthis);
}
// End mosek.fusion.LinearDomain.withNamesOnAxis

// Begin mosek.fusion.LinearDomain.match_shape
// Method mosek.fusion.LinearDomain.match_shape @ bld/grindsted/final/default/src/fusion/domain.mbi:984:6-992:7
bool mosek::fusion::p_LinearDomain::match_shape(std::shared_ptr< monty::ndarray< int32_t,1 > > _3346_shp)
{
  _checked_ptr_1<int32_t> _ptr__3346_shp(_3346_shp ? _3346_shp->raw() : nullptr, _3346_shp ? _3346_shp->size(0) : 0);
  if ((!scalable))
  {
    {
      int32_t _10902_ = (int)0;
      int32_t _10903_ = (int)((_3346_shp)->size(0));
      for (int32_t _3347_i = _10902_; _3347_i < _10903_; ++_3347_i)
      {
        {
          if ((_ptr__3346_shp[_3347_i] == ((*shape)(_3347_i))))
          {
            {
              return false;
            }
          }
          {}
        }
      }
    }
  }
  {}
  return true;
}
// End mosek.fusion.LinearDomain.match_shape

// Begin mosek.fusion.LinearDomain.finalize_and_validate_inplace
// Method mosek.fusion.LinearDomain.finalize_and_validate_inplace @ bld/grindsted/final/default/src/fusion/domain.mbi:871:6-939:7
void mosek::fusion::p_LinearDomain::finalize_and_validate_inplace(std::shared_ptr< monty::ndarray< int32_t,1 > > _3348_shp)
{
  _checked_ptr_1<int32_t> _ptr__3348_shp(_3348_shp ? _3348_shp->raw() : nullptr, _3348_shp ? _3348_shp->size(0) : 0);
  if (scalable)
  {
    {
      if ((NULL == shape.get()))
      {
        {
          if (((NULL != sparsity.get()) && (NULL == _3348_shp.get())))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Sparse domain requires a fixed shape"));
            }
          }
          {}
          if ((NULL != _3348_shp.get()))
          {
            {
              shape = _3348_shp;
            }
          }
          else
          {
            {
              shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0)));
            }
          }
        }
      }
      {}
    }
  }
  else
  {
    {
      if ((NULL != _3348_shp.get()))
      {
        {
          if (((int)((_3348_shp)->size(0)) != (int)((shape)->size(0))))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Conflicting shape definitions"));
            }
          }
          {}
          int32_t _10904_ = (int)0;
          int32_t _10905_ = (int)((_3348_shp)->size(0));
          for (int32_t _3349_i = _10904_; _3349_i < _10905_; ++_3349_i)
          {
            {
              if ((_ptr__3348_shp[_3349_i] != ((*shape)(_3349_i))))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("Conflicting shape definitions"));
                }
              }
              {}
            }
          }
        }
      }
      {}
    }
  }
  if ((NULL != indexnames.get()))
  {
    {
      if (((int)((indexnames)->size(0)) > (int)((shape)->size(0))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Index names do not match shape"));
        }
      }
      {}
      int32_t _10906_ = (int)0;
      int32_t _10907_ = (int)((indexnames)->size(0));
      for (int32_t _3350_i = _10906_; _3350_i < _10907_; ++_3350_i)
      {
        {
          if (((NULL != ((*indexnames)(_3350_i)).get()) && ((int)((((*indexnames)(_3350_i)))->size(0)) != ((*shape)(_3350_i)))))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Index names do not match shape"));
            }
          }
          {}
        }
      }
      if (((int)((indexnames)->size(0)) < (int)((shape)->size(0))))
      {
        {
          std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > > _3351_tmpindexnames = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< std::string,1 > >,1 >(monty::shape((int)((shape)->size(0)))));
          int32_t _10908_ = (int)0;
          int32_t _10909_ = (int)((indexnames)->size(0));
          for (int32_t _3352_i = _10908_; _3352_i < _10909_; ++_3352_i)
          {
            {
              ((*_3351_tmpindexnames)(_3352_i)) = ((*indexnames)(_3352_i));
            }
          }
          indexnames = _3351_tmpindexnames;
        }
      }
      {}
    }
  }
  {}
  domsize = (int)1;
  int32_t _10910_ = (int)0;
  int32_t _10911_ = (int)((shape)->size(0));
  for (int32_t _3353_i = _10910_; _3353_i < _10911_; ++_3353_i)
  {
    {
      domsize *= ((*shape)(_3353_i));
    }
  }
  if ((NULL != sparsity.get()))
  {
    {
      nelements = (int)((sparsity)->size(0));
      if (((int)((shape)->size(0)) != (int)((sparsity)->size(1))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Mismatching shape and sparsity pattern"));
        }
      }
      {}
      int32_t _10912_ = (int)0;
      int64_t _10913_ = nelements;
      for (int64_t _3354_i = _10912_; _3354_i < _10913_; ++_3354_i)
      {
        {
          int32_t _10914_ = (int)0;
          int32_t _10915_ = (int)((sparsity)->size(1));
          for (int32_t _3355_j = _10914_; _3355_j < _10915_; ++_3355_j)
          {
            {
              if (((((*sparsity)(_3354_i,_3355_j)) < (int)0) || (((*sparsity)(_3354_i,_3355_j)) >= ((*shape)(_3355_j)))))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("Sparsity pattern entry is out of bounds"));
                }
              }
              {}
            }
          }
        }
      }
      if (((!scalable) && ((NULL != bnd.get()) && ((int)((bnd)->size(0)) != nelements))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Sparsity pattern does not match bound"));
        }
      }
      {}
    }
  }
  else
  {
    {
      nelements = domsize;
      if (((NULL != bnd.get()) && (!scalable)))
      {
        {
          if (((int)((bnd)->size(0)) != nelements))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Domain bound does not match shape"));
            }
          }
          {}
        }
      }
      {}
    }
  }
}
// End mosek.fusion.LinearDomain.finalize_and_validate_inplace

// Begin mosek.fusion.LinearDomain.finalize_and_validate
// Method mosek.fusion.LinearDomain.finalize_and_validate @ bld/grindsted/final/default/src/fusion/domain.mbi:866:6-870:7
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_LinearDomain::__mosek_2fusion_2LinearDomain__finalize_and_validate(std::shared_ptr< monty::ndarray< int32_t,1 > > _3356_shp)
{
  _checked_ptr_1<int32_t> _ptr__3356_shp(_3356_shp ? _3356_shp->raw() : nullptr, _3356_shp ? _3356_shp->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::LinearDomain > _3357_res = ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::LinearDomain::t(_pubthis));
  mosek::fusion::p_LinearDomain::_get_impl(_3357_res.get())->finalize_and_validate_inplace(_3356_shp);
  return _3357_res;
}
// End mosek.fusion.LinearDomain.finalize_and_validate

void mosek::fusion::p_LinearDomain::destroy()
{
  indexnames.reset();
  sparsity.reset();
  bnd.reset();
  shape.reset();
}
void mosek::fusion::LinearDomain::destroy() { mosek::fusion::p_LinearDomain::_get_impl(this)->destroy(); }
// } class LinearDomain
// class Domain { // @ bld/grindsted/final/default/src/fusion/domain.mbi:423:4-811:5
mosek::fusion::Domain::Domain(mosek::fusion::p_Domain *_impl) : _impl(_impl) { /*std::cout << "Domain() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::Domain::~Domain() { delete _impl; _impl = nullptr; }
mosek::fusion::p_Domain::p_Domain
  (::mosek::fusion::Domain * _pubthis) :     _pubthis(_pubthis)
{}
// Begin mosek.fusion.Domain.dimsize
// Method mosek.fusion.Domain.dimsize @ bld/grindsted/final/default/src/fusion/domain.mbi:810:6-126
int64_t mosek::fusion::p_Domain::dimsize(std::shared_ptr< monty::ndarray< int32_t,1 > > _3358_dims)
{
  _checked_ptr_1<int32_t> _ptr__3358_dims(_3358_dims ? _3358_dims->raw() : nullptr, _3358_dims ? _3358_dims->size(0) : 0);
  int64_t _3359_sz = (int64_t)1;
  int32_t _10916_ = (int)0;
  int32_t _10917_ = (int)((_3358_dims)->size(0));
  for (int32_t _3360_i = _10916_; _3360_i < _10917_; ++_3360_i)
  {
    {
      _3359_sz *= _ptr__3358_dims[_3360_i];
    }
  }
  return _3359_sz;
}
// End mosek.fusion.Domain.dimsize

// Begin mosek.fusion.Domain.mkRangedDomain
// Method mosek.fusion.Domain.mkRangedDomain @ bld/grindsted/final/default/src/fusion/domain.mbi:691:6-808:7
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::mkRangedDomain(monty::rc_ptr< ::mosek::fusion::Matrix > _3361_lb,monty::rc_ptr< ::mosek::fusion::Matrix > _3362_ub)
{
  if (((mosek::fusion::p_Matrix::_get_impl(_3361_lb)->dimi != mosek::fusion::p_Matrix::_get_impl(_3362_ub)->dimi) || (mosek::fusion::p_Matrix::_get_impl(_3361_lb)->dimj != mosek::fusion::p_Matrix::_get_impl(_3362_ub)->dimj)))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching dimensions in domain"));
    }
  }
  {}
  if ((_3361_lb->isSparse() && _3362_ub->isSparse()))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3363_lsubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3361_lb->numNonzeros())));
      _checked_ptr_1<int32_t> _ptr__3363_lsubi(_3363_lsubi ? _3363_lsubi->raw() : nullptr,_3363_lsubi ? _3363_lsubi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3364_lsubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3361_lb->numNonzeros())));
      _checked_ptr_1<int32_t> _ptr__3364_lsubj(_3364_lsubj ? _3364_lsubj->raw() : nullptr,_3364_lsubj ? _3364_lsubj->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _3365_lval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_3361_lb->numNonzeros())));
      _checked_ptr_1<double> _ptr__3365_lval(_3365_lval ? _3365_lval->raw() : nullptr,_3365_lval ? _3365_lval->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3366_usubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3362_ub->numNonzeros())));
      _checked_ptr_1<int32_t> _ptr__3366_usubi(_3366_usubi ? _3366_usubi->raw() : nullptr,_3366_usubi ? _3366_usubi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3367_usubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3362_ub->numNonzeros())));
      _checked_ptr_1<int32_t> _ptr__3367_usubj(_3367_usubj ? _3367_usubj->raw() : nullptr,_3367_usubj ? _3367_usubj->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _3368_uval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_3362_ub->numNonzeros())));
      _checked_ptr_1<double> _ptr__3368_uval(_3368_uval ? _3368_uval->raw() : nullptr,_3368_uval ? _3368_uval->size(0) : 0);
      _3361_lb->getDataAsTriplets(_3363_lsubi,_3364_lsubj,_3365_lval);
      _3362_ub->getDataAsTriplets(_3366_usubi,_3367_usubj,_3368_uval);
      int64_t _3369_n = (int)0;
      {
        int32_t _3370_ui = (int)0;
        int32_t _3371_li = (int)0;
        while ( ((_3371_li < (int)((_3363_lsubi)->size(0))) && (_3370_ui < (int)((_3366_usubi)->size(0)))) )
        {
          {
            if (((_ptr__3363_lsubi[_3371_li] < _ptr__3366_usubi[_3370_ui]) || ((_ptr__3363_lsubi[_3371_li] == _ptr__3366_usubi[_3370_ui]) && (_ptr__3364_lsubj[_3371_li] < _ptr__3367_usubj[_3370_ui]))))
            {
              {
                ++ _3369_n;
                ++ _3371_li;
              }
            }
            else
            {
              {
                if (((_ptr__3363_lsubi[_3371_li] > _ptr__3366_usubi[_3370_ui]) || ((_ptr__3363_lsubi[_3371_li] == _ptr__3366_usubi[_3370_ui]) && (_ptr__3364_lsubj[_3371_li] > _ptr__3367_usubj[_3370_ui]))))
                {
                  {
                    ++ _3369_n;
                    ++ _3370_ui;
                  }
                }
                else
                {
                  {
                    ++ _3369_n;
                    ++ _3371_li;
                    ++ _3370_ui;
                  }
                }
              }
            }
          }
        }
        _3369_n += ((int)((_3363_lsubi)->size(0)) - _3371_li);
        _3369_n += ((int)((_3366_usubi)->size(0)) - _3370_ui);
      }
      std::shared_ptr< monty::ndarray< int32_t,2 > > _3372_inst = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape(_3369_n,(int)2)));
      std::shared_ptr< monty::ndarray< double,1 > > _3373_lbv = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_3369_n)));
      _checked_ptr_1<double> _ptr__3373_lbv(_3373_lbv ? _3373_lbv->raw() : nullptr,_3373_lbv ? _3373_lbv->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _3374_ubv = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_3369_n)));
      _checked_ptr_1<double> _ptr__3374_ubv(_3374_ubv ? _3374_ubv->raw() : nullptr,_3374_ubv ? _3374_ubv->size(0) : 0);
      {
        int32_t _3375_k = (int)0;
        int32_t _3376_ui = (int)0;
        int32_t _3377_li = (int)0;
        while ( ((_3377_li < (int)((_3363_lsubi)->size(0))) && (_3376_ui < (int)((_3366_usubi)->size(0)))) )
        {
          {
            if (((_ptr__3363_lsubi[_3377_li] < _ptr__3366_usubi[_3376_ui]) || ((_ptr__3363_lsubi[_3377_li] == _ptr__3366_usubi[_3376_ui]) && (_ptr__3364_lsubj[_3377_li] < _ptr__3367_usubj[_3376_ui]))))
            {
              {
                ((*_3372_inst)(_3375_k,(int)0)) = _ptr__3363_lsubi[_3377_li];
                ((*_3372_inst)(_3375_k,(int)1)) = _ptr__3364_lsubj[_3377_li];
                _ptr__3373_lbv[_3375_k] = _ptr__3365_lval[_3377_li];
                _ptr__3374_ubv[_3375_k] = 0.0;
                ++ _3375_k;
                ++ _3377_li;
              }
            }
            else
            {
              {
                if (((_ptr__3363_lsubi[_3377_li] > _ptr__3366_usubi[_3376_ui]) || ((_ptr__3363_lsubi[_3377_li] == _ptr__3366_usubi[_3376_ui]) && (_ptr__3364_lsubj[_3377_li] > _ptr__3367_usubj[_3376_ui]))))
                {
                  {
                    ((*_3372_inst)(_3375_k,(int)0)) = _ptr__3366_usubi[_3376_ui];
                    ((*_3372_inst)(_3375_k,(int)1)) = _ptr__3367_usubj[_3376_ui];
                    _ptr__3373_lbv[_3375_k] = 0.0;
                    _ptr__3374_ubv[_3375_k] = _ptr__3368_uval[_3376_ui];
                    ++ _3375_k;
                    ++ _3376_ui;
                  }
                }
                else
                {
                  {
                    ((*_3372_inst)(_3375_k,(int)0)) = _ptr__3366_usubi[_3376_ui];
                    ((*_3372_inst)(_3375_k,(int)1)) = _ptr__3367_usubj[_3376_ui];
                    _ptr__3373_lbv[_3375_k] = _ptr__3365_lval[_3376_ui];
                    _ptr__3374_ubv[_3375_k] = _ptr__3368_uval[_3376_ui];
                    ++ _3375_k;
                    ++ _3377_li;
                    ++ _3376_ui;
                  }
                }
              }
            }
          }
        }
        while ( (_3377_li < (int)((_3363_lsubi)->size(0))) )
        {
          {
            ((*_3372_inst)(_3375_k,(int)0)) = _ptr__3363_lsubi[_3377_li];
            ((*_3372_inst)(_3375_k,(int)1)) = _ptr__3364_lsubj[_3377_li];
            _ptr__3373_lbv[_3375_k] = _ptr__3365_lval[_3377_li];
            _ptr__3374_ubv[_3375_k] = 0.0;
            ++ _3375_k;
            ++ _3377_li;
          }
        }
        while ( (_3376_ui < (int)((_3366_usubi)->size(0))) )
        {
          {
            ((*_3372_inst)(_3375_k,(int)0)) = _ptr__3366_usubi[_3376_ui];
            ((*_3372_inst)(_3375_k,(int)1)) = _ptr__3367_usubj[_3376_ui];
            _ptr__3373_lbv[_3375_k] = 0.0;
            _ptr__3374_ubv[_3375_k] = _ptr__3368_uval[_3376_ui];
            ++ _3375_k;
            ++ _3376_ui;
          }
        }
      }
      return ::mosek::fusion::p_RangeDomain::_new_RangeDomain(false,_3373_lbv,_3374_ubv,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(mosek::fusion::p_Matrix::_get_impl(_3361_lb)->dimi),(int32_t)(mosek::fusion::p_Matrix::_get_impl(_3361_lb)->dimj)}),_3372_inst,(int)1);
    }
  }
  else
  {
    {
      int32_t _3378_dimj = mosek::fusion::p_Matrix::_get_impl(_3361_lb)->dimj;
      int32_t _3379_dimi = mosek::fusion::p_Matrix::_get_impl(_3361_lb)->dimi;
      int32_t _3380_n = safe_mul( _3379_dimi,_3378_dimj );
      std::shared_ptr< monty::ndarray< double,1 > > _3381_lval;
      _checked_ptr_1<double> _ptr__3381_lval(_3381_lval ? _3381_lval->raw() : nullptr,_3381_lval ? _3381_lval->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _3382_uval;
      _checked_ptr_1<double> _ptr__3382_uval(_3382_uval ? _3382_uval->raw() : nullptr,_3382_uval ? _3382_uval->size(0) : 0);
      if (_3361_lb->isSparse())
      {
        {
          _3381_lval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_3380_n)));
          _ptr__3381_lval.update(_3381_lval ? _3381_lval->raw() : nullptr, _3381_lval ? _3381_lval->size(0) : 0);
          std::shared_ptr< monty::ndarray< int32_t,1 > > _3383_subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3361_lb->numNonzeros())));
          _checked_ptr_1<int32_t> _ptr__3383_subi(_3383_subi ? _3383_subi->raw() : nullptr,_3383_subi ? _3383_subi->size(0) : 0);
          std::shared_ptr< monty::ndarray< int32_t,1 > > _3384_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3361_lb->numNonzeros())));
          _checked_ptr_1<int32_t> _ptr__3384_subj(_3384_subj ? _3384_subj->raw() : nullptr,_3384_subj ? _3384_subj->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _3385_v = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_3361_lb->numNonzeros())));
          _checked_ptr_1<double> _ptr__3385_v(_3385_v ? _3385_v->raw() : nullptr,_3385_v ? _3385_v->size(0) : 0);
          _3361_lb->getDataAsTriplets(_3383_subi,_3384_subj,_3385_v);
          int32_t _10918_ = (int)0;
          int32_t _10919_ = (int)((_3383_subi)->size(0));
          for (int32_t _3386_i = _10918_; _3386_i < _10919_; ++_3386_i)
          {
            {
              _ptr__3381_lval[safe_add( safe_mul( _ptr__3383_subi[_3386_i],_3378_dimj ),_ptr__3384_subj[_3386_i] )] = _ptr__3385_v[_3386_i];
            }
          }
        }
      }
      else
      {
        {
          _3381_lval = _3361_lb->getDataAsArray();
          _ptr__3381_lval.update(_3381_lval ? _3381_lval->raw() : nullptr, _3381_lval ? _3381_lval->size(0) : 0);
        }
      }
      if (_3362_ub->isSparse())
      {
        {
          _3382_uval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_3380_n)));
          _ptr__3382_uval.update(_3382_uval ? _3382_uval->raw() : nullptr, _3382_uval ? _3382_uval->size(0) : 0);
          std::shared_ptr< monty::ndarray< int32_t,1 > > _3387_subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3362_ub->numNonzeros())));
          _checked_ptr_1<int32_t> _ptr__3387_subi(_3387_subi ? _3387_subi->raw() : nullptr,_3387_subi ? _3387_subi->size(0) : 0);
          std::shared_ptr< monty::ndarray< int32_t,1 > > _3388_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3362_ub->numNonzeros())));
          _checked_ptr_1<int32_t> _ptr__3388_subj(_3388_subj ? _3388_subj->raw() : nullptr,_3388_subj ? _3388_subj->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _3389_v = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_3362_ub->numNonzeros())));
          _checked_ptr_1<double> _ptr__3389_v(_3389_v ? _3389_v->raw() : nullptr,_3389_v ? _3389_v->size(0) : 0);
          _3362_ub->getDataAsTriplets(_3387_subi,_3388_subj,_3389_v);
          int32_t _10920_ = (int)0;
          int32_t _10921_ = (int)((_3387_subi)->size(0));
          for (int32_t _3390_i = _10920_; _3390_i < _10921_; ++_3390_i)
          {
            {
              _ptr__3382_uval[safe_add( safe_mul( _ptr__3387_subi[_3390_i],_3378_dimj ),_ptr__3388_subj[_3390_i] )] = _ptr__3389_v[_3390_i];
            }
          }
        }
      }
      else
      {
        {
          _3382_uval = _3362_ub->getDataAsArray();
          _ptr__3382_uval.update(_3382_uval ? _3382_uval->raw() : nullptr, _3382_uval ? _3382_uval->size(0) : 0);
        }
      }
      return ::mosek::fusion::p_RangeDomain::_new_RangeDomain(false,_3381_lval,_3382_uval,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(mosek::fusion::p_Matrix::_get_impl(_3361_lb)->dimi),(int32_t)(mosek::fusion::p_Matrix::_get_impl(_3361_lb)->dimj)}),nullptr,(int)1);
    }
  }
}
// End mosek.fusion.Domain.mkRangedDomain

// Begin mosek.fusion.Domain.mkRangedDomain
// Method mosek.fusion.Domain.mkRangedDomain @ bld/grindsted/final/default/src/fusion/domain.mbi:670:6-689:7
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::mkRangedDomain(std::shared_ptr< monty::ndarray< double,2 > > _3391_lb,std::shared_ptr< monty::ndarray< double,2 > > _3392_ub)
{
  if ((((int)((_3391_lb)->size(0)) != (int)((_3392_ub)->size(0))) || ((int)((_3391_lb)->size(1)) != (int)((_3392_ub)->size(1)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching dimensions in domain"));
    }
  }
  {}
  int32_t _3393_dimj = (int)((_3391_lb)->size(1));
  int32_t _3394_dimi = (int)((_3391_lb)->size(0));
  int32_t _3395_n = safe_mul( _3394_dimi,_3393_dimj );
  std::shared_ptr< monty::ndarray< double,1 > > _3396_lval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_3395_n)));
  _checked_ptr_1<double> _ptr__3396_lval(_3396_lval ? _3396_lval->raw() : nullptr,_3396_lval ? _3396_lval->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _3397_uval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_3395_n)));
  _checked_ptr_1<double> _ptr__3397_uval(_3397_uval ? _3397_uval->raw() : nullptr,_3397_uval ? _3397_uval->size(0) : 0);
  int32_t _3398_k = (int)0;
  int32_t _10922_ = (int)0;
  int32_t _10923_ = _3394_dimi;
  for (int32_t _3399_i = _10922_; _3399_i < _10923_; ++_3399_i)
  {
    {
      int32_t _10924_ = (int)0;
      int32_t _10925_ = _3393_dimj;
      for (int32_t _3400_j = _10924_; _3400_j < _10925_; ++_3400_j)
      {
        {
          _ptr__3396_lval[_3398_k] = ((*_3391_lb)(_3399_i,_3400_j));
          _ptr__3397_uval[_3398_k] = ((*_3392_ub)(_3399_i,_3400_j));
          ++ _3398_k;
        }
      }
    }
  }
  return ::mosek::fusion::p_RangeDomain::_new_RangeDomain(false,_3396_lval,_3397_uval,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3394_dimi),(int32_t)(_3393_dimj)}),nullptr,(int)1);
}
// End mosek.fusion.Domain.mkRangedDomain

// Begin mosek.fusion.Domain.mkLinearDomain
// Method mosek.fusion.Domain.mkLinearDomain @ bld/grindsted/final/default/src/fusion/domain.mbi:650:6-668:7
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::mkLinearDomain(mosek::fusion::RelationKey _3401_k,monty::rc_ptr< ::mosek::fusion::Matrix > _3402_mx)
{
  if (_3402_mx->isSparse())
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3403_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3402_mx->numNonzeros())));
      _checked_ptr_1<int32_t> _ptr__3403_msubi(_3403_msubi ? _3403_msubi->raw() : nullptr,_3403_msubi ? _3403_msubi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3404_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3402_mx->numNonzeros())));
      _checked_ptr_1<int32_t> _ptr__3404_msubj(_3404_msubj ? _3404_msubj->raw() : nullptr,_3404_msubj ? _3404_msubj->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _3405_mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_3402_mx->numNonzeros())));
      _checked_ptr_1<double> _ptr__3405_mval(_3405_mval ? _3405_mval->raw() : nullptr,_3405_mval ? _3405_mval->size(0) : 0);
      _3402_mx->getDataAsTriplets(_3403_msubi,_3404_msubj,_3405_mval);
      std::shared_ptr< monty::ndarray< int32_t,2 > > _3406_inst = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape((int)((_3403_msubi)->size(0)),(int)2)));
      int32_t _10926_ = (int)0;
      int32_t _10927_ = (int)((_3403_msubi)->size(0));
      for (int32_t _3407_i = _10926_; _3407_i < _10927_; ++_3407_i)
      {
        {
          ((*_3406_inst)(_3407_i,(int)0)) = _ptr__3403_msubi[_3407_i];
          ((*_3406_inst)(_3407_i,(int)1)) = _ptr__3404_msubj[_3407_i];
        }
      }
      return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(_3401_k,false,_3405_mval,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(mosek::fusion::p_Matrix::_get_impl(_3402_mx)->dimi),(int32_t)(mosek::fusion::p_Matrix::_get_impl(_3402_mx)->dimj)}),_3406_inst,(int)1);
    }
  }
  else
  {
    {
      return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(_3401_k,false,_3402_mx->getDataAsArray(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(mosek::fusion::p_Matrix::_get_impl(_3402_mx)->dimi),(int32_t)(mosek::fusion::p_Matrix::_get_impl(_3402_mx)->dimj)}),nullptr,(int)1);
    }
  }
}
// End mosek.fusion.Domain.mkLinearDomain

// Begin mosek.fusion.Domain.prod
// Method mosek.fusion.Domain.prod @ bld/grindsted/final/default/src/fusion/domain.mbi:648:6-121
int64_t mosek::fusion::p_Domain::prod(std::shared_ptr< monty::ndarray< int32_t,1 > > _3408_dim)
{
  _checked_ptr_1<int32_t> _ptr__3408_dim(_3408_dim ? _3408_dim->raw() : nullptr, _3408_dim ? _3408_dim->size(0) : 0);
  int64_t _3409_r = (int)1;
  int32_t _10928_ = (int)0;
  int32_t _10929_ = (int)((_3408_dim)->size(0));
  for (int32_t _3410_i = _10928_; _3410_i < _10929_; ++_3410_i)
  {
    {
      _3409_r *= _ptr__3408_dim[_3410_i];
    }
  }
  return _3409_r;
}
// End mosek.fusion.Domain.prod

// Begin mosek.fusion.Domain.inRange
// Method mosek.fusion.Domain.inRange @ bld/grindsted/final/default/src/fusion/domain.mbi:631:6-646:7
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::inRange(bool _3411_scalable,std::shared_ptr< monty::ndarray< double,1 > > _3412_lb,std::shared_ptr< monty::ndarray< double,1 > > _3413_ub,std::shared_ptr< monty::ndarray< int32_t,2 > > _3414_sp,std::shared_ptr< monty::ndarray< int32_t,1 > > _3415_dims)
{
  _checked_ptr_1<double> _ptr__3412_lb(_3412_lb ? _3412_lb->raw() : nullptr, _3412_lb ? _3412_lb->size(0) : 0);
  _checked_ptr_1<double> _ptr__3413_ub(_3413_ub ? _3413_ub->raw() : nullptr, _3413_ub ? _3413_ub->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3415_dims(_3415_dims ? _3415_dims->raw() : nullptr, _3415_dims ? _3415_dims->size(0) : 0);
  if (((!_3411_scalable) && ((int)((_3412_lb)->size(0)) != (int)((_3413_ub)->size(0)))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Mismatching lengths of upper and lower bounds."));
    }
  }
  {}
  if (((NULL != _3414_sp.get()) && ((int)((_3414_sp)->size(0)) != (int)((_3412_lb)->size(0)))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Mismatching lengths of upper/lower bounds and sparsity."));
    }
  }
  {}
  int32_t _10930_ = (int)0;
  int32_t _10931_ = (int)((_3413_ub)->size(0));
  for (int32_t _3416_i = _10930_; _3416_i < _10931_; ++_3416_i)
  {
    {
      if ((_ptr__3412_lb[_3416_i] > _ptr__3413_ub[_3416_i]))
      {
        {
          throw ::mosek::fusion::DomainError(std::string ("Invalid range specified"));
        }
      }
      {}
    }
  }
  if (((NULL != _3415_dims.get()) && (::mosek::fusion::p_Domain::dimsize(_3415_dims) != (int)((_3412_lb)->size(0)))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Mismatching dimensions."));
    }
  }
  {}
  return ::mosek::fusion::p_RangeDomain::_new_RangeDomain(_3411_scalable,_3412_lb,_3413_ub,_3415_dims)->__mosek_2fusion_2RangeDomain__sparse(_3414_sp);
}
// End mosek.fusion.Domain.inRange

// Begin mosek.fusion.Domain.sparse
// Method mosek.fusion.Domain.sparse @ bld/grindsted/final/default/src/fusion/domain.mbi:628:6-118
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::sparse
  ( monty::rc_ptr< ::mosek::fusion::RangeDomain > _3417_rd,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _3418_sparsity) { return mosek::fusion::p_Domain::sparse(_3417_rd,_3418_sparsity); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::sparse(monty::rc_ptr< ::mosek::fusion::RangeDomain > _3417_rd,std::shared_ptr< monty::ndarray< int32_t,2 > > _3418_sparsity)
{
  return _3417_rd->__mosek_2fusion_2RangeDomain__sparse(_3418_sparsity);
}
// End mosek.fusion.Domain.sparse

// Begin mosek.fusion.Domain.sparse
// Method mosek.fusion.Domain.sparse @ bld/grindsted/final/default/src/fusion/domain.mbi:627:6-118
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::sparse
  ( monty::rc_ptr< ::mosek::fusion::RangeDomain > _3419_rd,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3420_sparsity) { return mosek::fusion::p_Domain::sparse(_3419_rd,_3420_sparsity); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::sparse(monty::rc_ptr< ::mosek::fusion::RangeDomain > _3419_rd,std::shared_ptr< monty::ndarray< int32_t,1 > > _3420_sparsity)
{
  _checked_ptr_1<int32_t> _ptr__3420_sparsity(_3420_sparsity ? _3420_sparsity->raw() : nullptr, _3420_sparsity ? _3420_sparsity->size(0) : 0);
  return _3419_rd->__mosek_2fusion_2RangeDomain__sparse(_3420_sparsity);
}
// End mosek.fusion.Domain.sparse

// Begin mosek.fusion.Domain.sparse
// Method mosek.fusion.Domain.sparse @ bld/grindsted/final/default/src/fusion/domain.mbi:626:6-118
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::sparse
  ( monty::rc_ptr< ::mosek::fusion::LinearDomain > _3421_ld,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _3422_sparsity) { return mosek::fusion::p_Domain::sparse(_3421_ld,_3422_sparsity); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::sparse(monty::rc_ptr< ::mosek::fusion::LinearDomain > _3421_ld,std::shared_ptr< monty::ndarray< int32_t,2 > > _3422_sparsity)
{
  return _3421_ld->__mosek_2fusion_2LinearDomain__sparse(_3422_sparsity);
}
// End mosek.fusion.Domain.sparse

// Begin mosek.fusion.Domain.sparse
// Method mosek.fusion.Domain.sparse @ bld/grindsted/final/default/src/fusion/domain.mbi:625:6-118
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::sparse
  ( monty::rc_ptr< ::mosek::fusion::LinearDomain > _3423_ld,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3424_sparsity) { return mosek::fusion::p_Domain::sparse(_3423_ld,_3424_sparsity); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::sparse(monty::rc_ptr< ::mosek::fusion::LinearDomain > _3423_ld,std::shared_ptr< monty::ndarray< int32_t,1 > > _3424_sparsity)
{
  _checked_ptr_1<int32_t> _ptr__3424_sparsity(_3424_sparsity ? _3424_sparsity->raw() : nullptr, _3424_sparsity ? _3424_sparsity->size(0) : 0);
  return _3423_ld->__mosek_2fusion_2LinearDomain__sparse(_3424_sparsity);
}
// End mosek.fusion.Domain.sparse

// Begin mosek.fusion.Domain.integral
// Method mosek.fusion.Domain.integral @ bld/grindsted/final/default/src/fusion/domain.mbi:623:6-92
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::integral
  ( monty::rc_ptr< ::mosek::fusion::RangeDomain > _3425_rd) { return mosek::fusion::p_Domain::integral(_3425_rd); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::integral(monty::rc_ptr< ::mosek::fusion::RangeDomain > _3425_rd)
{
  return _3425_rd->__mosek_2fusion_2RangeDomain__integral();
}
// End mosek.fusion.Domain.integral

// Begin mosek.fusion.Domain.integral
// Method mosek.fusion.Domain.integral @ bld/grindsted/final/default/src/fusion/domain.mbi:622:6-92
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::integral
  ( monty::rc_ptr< ::mosek::fusion::LinearDomain > _3426_ld) { return mosek::fusion::p_Domain::integral(_3426_ld); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::integral(monty::rc_ptr< ::mosek::fusion::LinearDomain > _3426_ld)
{
  return _3426_ld->__mosek_2fusion_2LinearDomain__integral();
}
// End mosek.fusion.Domain.integral

// Begin mosek.fusion.Domain.integral
// Method mosek.fusion.Domain.integral @ bld/grindsted/final/default/src/fusion/domain.mbi:621:6-88
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::integral
  ( monty::rc_ptr< ::mosek::fusion::ConeDomain > _3427_c) { return mosek::fusion::p_Domain::integral(_3427_c); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::integral(monty::rc_ptr< ::mosek::fusion::ConeDomain > _3427_c)
{
  return _3427_c->__mosek_2fusion_2ConeDomain__integral();
}
// End mosek.fusion.Domain.integral

// Begin mosek.fusion.Domain.axis
// Method mosek.fusion.Domain.axis @ bld/grindsted/final/default/src/fusion/domain.mbi:619:6-93
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::axis
  ( monty::rc_ptr< ::mosek::fusion::ConeDomain > _3428_c,
    int32_t _3429_a) { return mosek::fusion::p_Domain::axis(_3428_c,_3429_a); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::axis(monty::rc_ptr< ::mosek::fusion::ConeDomain > _3428_c,int32_t _3429_a)
{
  return _3428_c->__mosek_2fusion_2ConeDomain__axis(_3429_a);
}
// End mosek.fusion.Domain.axis

// Begin mosek.fusion.Domain.inDPowerConeSeq
// Method mosek.fusion.Domain.inDPowerConeSeq @ bld/grindsted/final/default/src/fusion/domain.mbi:603:6-616:7
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDPowerConeSeq
  ( std::shared_ptr< monty::ndarray< double,2 > > _3430_alphas) { return mosek::fusion::p_Domain::inDPowerConeSeq(_3430_alphas); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDPowerConeSeq(std::shared_ptr< monty::ndarray< double,2 > > _3430_alphas)
{
  int32_t _3431_n = (int)((_3430_alphas)->size(0));
  int32_t _3432_nleft = (int)((_3430_alphas)->size(1));
  std::shared_ptr< monty::ndarray< double,1 > > _3433_a = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(safe_mul( _3432_nleft,_3431_n ))));
  _checked_ptr_1<double> _ptr__3433_a(_3433_a ? _3433_a->raw() : nullptr,_3433_a ? _3433_a->size(0) : 0);
  int64_t _3434_k = (int)0;
  int32_t _10932_ = (int)0;
  int32_t _10933_ = _3431_n;
  for (int32_t _3435_i = _10932_; _3435_i < _10933_; ++_3435_i)
  {
    {
      int32_t _10934_ = (int)0;
      int32_t _10935_ = _3432_nleft;
      for (int32_t _3436_j = _10934_; _3436_j < _10935_; ++_3436_j)
      {
        {
          _ptr__3433_a[_3434_k] = ((*_3430_alphas)(_3435_i,_3436_j));
          _3434_k += (int)1;
        }
      }
    }
  }
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDPowConeSeq,_3433_a,nullptr);
}
// End mosek.fusion.Domain.inDPowerConeSeq

// Begin mosek.fusion.Domain.inDPowerConeSeq
// Method mosek.fusion.Domain.inDPowerConeSeq @ bld/grindsted/final/default/src/fusion/domain.mbi:593:6-602:7
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDPowerConeSeq
  ( std::shared_ptr< monty::ndarray< double,1 > > _3437_alpha) { return mosek::fusion::p_Domain::inDPowerConeSeq(_3437_alpha); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDPowerConeSeq(std::shared_ptr< monty::ndarray< double,1 > > _3437_alpha)
{
  _checked_ptr_1<double> _ptr__3437_alpha(_3437_alpha ? _3437_alpha->raw() : nullptr, _3437_alpha ? _3437_alpha->size(0) : 0);
  int32_t _3438_n = (int)((_3437_alpha)->size(0));
  std::shared_ptr< monty::ndarray< double,1 > > _3439_a = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(safe_mul( (int)2,_3438_n ))));
  _checked_ptr_1<double> _ptr__3439_a(_3439_a ? _3439_a->raw() : nullptr,_3439_a ? _3439_a->size(0) : 0);
  int32_t _10936_ = (int)0;
  int32_t _10937_ = _3438_n;
  for (int32_t _3440_i = _10936_; _3440_i < _10937_; ++_3440_i)
  {
    {
      _ptr__3439_a[safe_mul( (int)2,_3440_i )] = _ptr__3437_alpha[_3440_i];
      _ptr__3439_a[safe_add( safe_mul( (int)2,_3440_i ),(int)1 )] = (1.0 - _ptr__3437_alpha[_3440_i]);
    }
  }
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDPowConeSeq,_3439_a,nullptr);
}
// End mosek.fusion.Domain.inDPowerConeSeq

// Begin mosek.fusion.Domain.inDPowerCone
// Method mosek.fusion.Domain.inDPowerCone @ bld/grindsted/final/default/src/fusion/domain.mbi:591:6-178
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDPowerCone
  ( std::shared_ptr< monty::ndarray< double,1 > > _3441_alphas,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3442_dims) { return mosek::fusion::p_Domain::inDPowerCone(_3441_alphas,_3442_dims); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDPowerCone(std::shared_ptr< monty::ndarray< double,1 > > _3441_alphas,std::shared_ptr< monty::ndarray< int32_t,1 > > _3442_dims)
{
  _checked_ptr_1<double> _ptr__3441_alphas(_3441_alphas ? _3441_alphas->raw() : nullptr, _3441_alphas ? _3441_alphas->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3442_dims(_3442_dims ? _3442_dims->raw() : nullptr, _3442_dims ? _3442_dims->size(0) : 0);
  std::vector<int32_t> _10938_;
  for (int32_t _3443_i = (int)0, _10939_ = (int)((_3442_dims)->size(0)); _3443_i < _10939_ ; ++_3443_i)
  {
    _10938_.push_back(_ptr__3442_dims[_3443_i]);
  }
  auto _10940_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10938_.size()),_10938_.begin(),_10938_.end()));
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDPowCone,_3441_alphas,_10940_);
}
// End mosek.fusion.Domain.inDPowerCone

// Begin mosek.fusion.Domain.inDPowerCone
// Method mosek.fusion.Domain.inDPowerCone @ bld/grindsted/final/default/src/fusion/domain.mbi:590:6-153
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDPowerCone
  ( std::shared_ptr< monty::ndarray< double,1 > > _3444_alphas,
    int32_t _3445_m) { return mosek::fusion::p_Domain::inDPowerCone(_3444_alphas,_3445_m); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDPowerCone(std::shared_ptr< monty::ndarray< double,1 > > _3444_alphas,int32_t _3445_m)
{
  _checked_ptr_1<double> _ptr__3444_alphas(_3444_alphas ? _3444_alphas->raw() : nullptr, _3444_alphas ? _3444_alphas->size(0) : 0);
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDPowCone,_3444_alphas,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3445_m),(int32_t)((int)3)}));
}
// End mosek.fusion.Domain.inDPowerCone

// Begin mosek.fusion.Domain.inDPowerCone
// Method mosek.fusion.Domain.inDPowerCone @ bld/grindsted/final/default/src/fusion/domain.mbi:589:6-147
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDPowerCone
  ( std::shared_ptr< monty::ndarray< double,1 > > _3446_alphas) { return mosek::fusion::p_Domain::inDPowerCone(_3446_alphas); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDPowerCone(std::shared_ptr< monty::ndarray< double,1 > > _3446_alphas)
{
  _checked_ptr_1<double> _ptr__3446_alphas(_3446_alphas ? _3446_alphas->raw() : nullptr, _3446_alphas ? _3446_alphas->size(0) : 0);
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDPowCone,_3446_alphas,nullptr);
}
// End mosek.fusion.Domain.inDPowerCone

// Begin mosek.fusion.Domain.inDPowerCone
// Method mosek.fusion.Domain.inDPowerCone @ bld/grindsted/final/default/src/fusion/domain.mbi:587:6-191
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDPowerCone
  ( double _3447_alpha,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3448_dims) { return mosek::fusion::p_Domain::inDPowerCone(_3447_alpha,_3448_dims); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDPowerCone(double _3447_alpha,std::shared_ptr< monty::ndarray< int32_t,1 > > _3448_dims)
{
  _checked_ptr_1<int32_t> _ptr__3448_dims(_3448_dims ? _3448_dims->raw() : nullptr, _3448_dims ? _3448_dims->size(0) : 0);
  std::vector<int32_t> _10941_;
  for (int32_t _3449_i = (int)0, _10942_ = (int)((_3448_dims)->size(0)); _3449_i < _10942_ ; ++_3449_i)
  {
    _10941_.push_back(_ptr__3448_dims[_3449_i]);
  }
  auto _10943_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10941_.size()),_10941_.begin(),_10941_.end()));
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDPowCone,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3447_alpha),(double)((1.0 - _3447_alpha))}),_10943_);
}
// End mosek.fusion.Domain.inDPowerCone

// Begin mosek.fusion.Domain.inDPowerCone
// Method mosek.fusion.Domain.inDPowerCone @ bld/grindsted/final/default/src/fusion/domain.mbi:586:6-166
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDPowerCone
  ( double _3450_alpha,
    int32_t _3451_m) { return mosek::fusion::p_Domain::inDPowerCone(_3450_alpha,_3451_m); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDPowerCone(double _3450_alpha,int32_t _3451_m)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDPowCone,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3450_alpha),(double)((1.0 - _3450_alpha))}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3451_m),(int32_t)((int)3)}));
}
// End mosek.fusion.Domain.inDPowerCone

// Begin mosek.fusion.Domain.inDPowerCone
// Method mosek.fusion.Domain.inDPowerCone @ bld/grindsted/final/default/src/fusion/domain.mbi:585:6-160
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDPowerCone
  ( double _3452_alpha) { return mosek::fusion::p_Domain::inDPowerCone(_3452_alpha); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDPowerCone(double _3452_alpha)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDPowCone,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3452_alpha),(double)((1.0 - _3452_alpha))}),nullptr);
}
// End mosek.fusion.Domain.inDPowerCone

// Begin mosek.fusion.Domain.inPPowerConeSeq
// Method mosek.fusion.Domain.inPPowerConeSeq @ bld/grindsted/final/default/src/fusion/domain.mbi:569:6-582:7
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPPowerConeSeq
  ( std::shared_ptr< monty::ndarray< double,2 > > _3453_alphas) { return mosek::fusion::p_Domain::inPPowerConeSeq(_3453_alphas); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPPowerConeSeq(std::shared_ptr< monty::ndarray< double,2 > > _3453_alphas)
{
  int32_t _3454_n = (int)((_3453_alphas)->size(0));
  int32_t _3455_nleft = (int)((_3453_alphas)->size(1));
  std::shared_ptr< monty::ndarray< double,1 > > _3456_a = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(safe_mul( _3455_nleft,_3454_n ))));
  _checked_ptr_1<double> _ptr__3456_a(_3456_a ? _3456_a->raw() : nullptr,_3456_a ? _3456_a->size(0) : 0);
  int64_t _3457_k = (int)0;
  int32_t _10944_ = (int)0;
  int32_t _10945_ = _3454_n;
  for (int32_t _3458_i = _10944_; _3458_i < _10945_; ++_3458_i)
  {
    {
      int32_t _10946_ = (int)0;
      int32_t _10947_ = _3455_nleft;
      for (int32_t _3459_j = _10946_; _3459_j < _10947_; ++_3459_j)
      {
        {
          _ptr__3456_a[_3457_k] = ((*_3453_alphas)(_3458_i,_3459_j));
          _3457_k += (int)1;
        }
      }
    }
  }
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPPowConeSeq,_3456_a,nullptr);
}
// End mosek.fusion.Domain.inPPowerConeSeq

// Begin mosek.fusion.Domain.inPPowerConeSeq
// Method mosek.fusion.Domain.inPPowerConeSeq @ bld/grindsted/final/default/src/fusion/domain.mbi:559:6-568:7
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPPowerConeSeq
  ( std::shared_ptr< monty::ndarray< double,1 > > _3460_alpha) { return mosek::fusion::p_Domain::inPPowerConeSeq(_3460_alpha); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPPowerConeSeq(std::shared_ptr< monty::ndarray< double,1 > > _3460_alpha)
{
  _checked_ptr_1<double> _ptr__3460_alpha(_3460_alpha ? _3460_alpha->raw() : nullptr, _3460_alpha ? _3460_alpha->size(0) : 0);
  int32_t _3461_n = (int)((_3460_alpha)->size(0));
  std::shared_ptr< monty::ndarray< double,1 > > _3462_a = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(safe_mul( (int)2,_3461_n ))));
  _checked_ptr_1<double> _ptr__3462_a(_3462_a ? _3462_a->raw() : nullptr,_3462_a ? _3462_a->size(0) : 0);
  int32_t _10948_ = (int)0;
  int32_t _10949_ = _3461_n;
  for (int32_t _3463_i = _10948_; _3463_i < _10949_; ++_3463_i)
  {
    {
      _ptr__3462_a[safe_mul( (int)2,_3463_i )] = _ptr__3460_alpha[_3463_i];
      _ptr__3462_a[safe_add( safe_mul( (int)2,_3463_i ),(int)1 )] = (1.0 - _ptr__3460_alpha[_3463_i]);
    }
  }
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPPowConeSeq,_3462_a,nullptr);
}
// End mosek.fusion.Domain.inPPowerConeSeq

// Begin mosek.fusion.Domain.inPPowerCone
// Method mosek.fusion.Domain.inPPowerCone @ bld/grindsted/final/default/src/fusion/domain.mbi:557:6-178
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPPowerCone
  ( std::shared_ptr< monty::ndarray< double,1 > > _3464_alphas,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3465_dims) { return mosek::fusion::p_Domain::inPPowerCone(_3464_alphas,_3465_dims); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPPowerCone(std::shared_ptr< monty::ndarray< double,1 > > _3464_alphas,std::shared_ptr< monty::ndarray< int32_t,1 > > _3465_dims)
{
  _checked_ptr_1<double> _ptr__3464_alphas(_3464_alphas ? _3464_alphas->raw() : nullptr, _3464_alphas ? _3464_alphas->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3465_dims(_3465_dims ? _3465_dims->raw() : nullptr, _3465_dims ? _3465_dims->size(0) : 0);
  std::vector<int32_t> _10950_;
  for (int32_t _3466_i = (int)0, _10951_ = (int)((_3465_dims)->size(0)); _3466_i < _10951_ ; ++_3466_i)
  {
    _10950_.push_back(_ptr__3465_dims[_3466_i]);
  }
  auto _10952_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10950_.size()),_10950_.begin(),_10950_.end()));
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPPowCone,_3464_alphas,_10952_);
}
// End mosek.fusion.Domain.inPPowerCone

// Begin mosek.fusion.Domain.inPPowerCone
// Method mosek.fusion.Domain.inPPowerCone @ bld/grindsted/final/default/src/fusion/domain.mbi:556:6-153
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPPowerCone
  ( std::shared_ptr< monty::ndarray< double,1 > > _3467_alphas,
    int32_t _3468_m) { return mosek::fusion::p_Domain::inPPowerCone(_3467_alphas,_3468_m); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPPowerCone(std::shared_ptr< monty::ndarray< double,1 > > _3467_alphas,int32_t _3468_m)
{
  _checked_ptr_1<double> _ptr__3467_alphas(_3467_alphas ? _3467_alphas->raw() : nullptr, _3467_alphas ? _3467_alphas->size(0) : 0);
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPPowCone,_3467_alphas,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3468_m),(int32_t)((int)3)}));
}
// End mosek.fusion.Domain.inPPowerCone

// Begin mosek.fusion.Domain.inPPowerCone
// Method mosek.fusion.Domain.inPPowerCone @ bld/grindsted/final/default/src/fusion/domain.mbi:555:6-147
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPPowerCone
  ( std::shared_ptr< monty::ndarray< double,1 > > _3469_alphas) { return mosek::fusion::p_Domain::inPPowerCone(_3469_alphas); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPPowerCone(std::shared_ptr< monty::ndarray< double,1 > > _3469_alphas)
{
  _checked_ptr_1<double> _ptr__3469_alphas(_3469_alphas ? _3469_alphas->raw() : nullptr, _3469_alphas ? _3469_alphas->size(0) : 0);
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPPowCone,_3469_alphas,nullptr);
}
// End mosek.fusion.Domain.inPPowerCone

// Begin mosek.fusion.Domain.inPPowerCone
// Method mosek.fusion.Domain.inPPowerCone @ bld/grindsted/final/default/src/fusion/domain.mbi:553:6-191
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPPowerCone
  ( double _3470_alpha,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3471_dims) { return mosek::fusion::p_Domain::inPPowerCone(_3470_alpha,_3471_dims); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPPowerCone(double _3470_alpha,std::shared_ptr< monty::ndarray< int32_t,1 > > _3471_dims)
{
  _checked_ptr_1<int32_t> _ptr__3471_dims(_3471_dims ? _3471_dims->raw() : nullptr, _3471_dims ? _3471_dims->size(0) : 0);
  std::vector<int32_t> _10953_;
  for (int32_t _3472_i = (int)0, _10954_ = (int)((_3471_dims)->size(0)); _3472_i < _10954_ ; ++_3472_i)
  {
    _10953_.push_back(_ptr__3471_dims[_3472_i]);
  }
  auto _10955_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10953_.size()),_10953_.begin(),_10953_.end()));
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPPowCone,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3470_alpha),(double)((1.0 - _3470_alpha))}),_10955_);
}
// End mosek.fusion.Domain.inPPowerCone

// Begin mosek.fusion.Domain.inPPowerCone
// Method mosek.fusion.Domain.inPPowerCone @ bld/grindsted/final/default/src/fusion/domain.mbi:552:6-166
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPPowerCone
  ( double _3473_alpha,
    int32_t _3474_m) { return mosek::fusion::p_Domain::inPPowerCone(_3473_alpha,_3474_m); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPPowerCone(double _3473_alpha,int32_t _3474_m)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPPowCone,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3473_alpha),(double)((1.0 - _3473_alpha))}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3474_m),(int32_t)((int)3)}));
}
// End mosek.fusion.Domain.inPPowerCone

// Begin mosek.fusion.Domain.inPPowerCone
// Method mosek.fusion.Domain.inPPowerCone @ bld/grindsted/final/default/src/fusion/domain.mbi:551:6-160
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPPowerCone
  ( double _3475_alpha) { return mosek::fusion::p_Domain::inPPowerCone(_3475_alpha); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPPowerCone(double _3475_alpha)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPPowCone,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3475_alpha),(double)((1.0 - _3475_alpha))}),nullptr);
}
// End mosek.fusion.Domain.inPPowerCone

// Begin mosek.fusion.Domain.inDExpCone
// Method mosek.fusion.Domain.inDExpCone @ bld/grindsted/final/default/src/fusion/domain.mbi:548:6-160
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDExpCone
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3476_dims) { return mosek::fusion::p_Domain::inDExpCone(_3476_dims); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDExpCone(std::shared_ptr< monty::ndarray< int32_t,1 > > _3476_dims)
{
  _checked_ptr_1<int32_t> _ptr__3476_dims(_3476_dims ? _3476_dims->raw() : nullptr, _3476_dims ? _3476_dims->size(0) : 0);
  std::vector<int32_t> _10956_;
  for (int32_t _3477_i = (int)0, _10957_ = (int)((_3476_dims)->size(0)); _3477_i < _10957_ ; ++_3477_i)
  {
    _10956_.push_back(_ptr__3476_dims[_3477_i]);
  }
  auto _10958_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10956_.size()),_10956_.begin(),_10956_.end()));
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDExpCone,_10958_);
}
// End mosek.fusion.Domain.inDExpCone

// Begin mosek.fusion.Domain.inDExpCone
// Method mosek.fusion.Domain.inDExpCone @ bld/grindsted/final/default/src/fusion/domain.mbi:547:6-135
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDExpCone
  ( int32_t _3478_m) { return mosek::fusion::p_Domain::inDExpCone(_3478_m); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDExpCone(int32_t _3478_m)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDExpCone,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3478_m),(int32_t)((int)3)}));
}
// End mosek.fusion.Domain.inDExpCone

// Begin mosek.fusion.Domain.inDExpCone
// Method mosek.fusion.Domain.inDExpCone @ bld/grindsted/final/default/src/fusion/domain.mbi:546:6-129
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDExpCone
  ( ) { return mosek::fusion::p_Domain::inDExpCone(); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDExpCone()
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDExpCone,nullptr);
}
// End mosek.fusion.Domain.inDExpCone

// Begin mosek.fusion.Domain.inPExpCone
// Method mosek.fusion.Domain.inPExpCone @ bld/grindsted/final/default/src/fusion/domain.mbi:543:6-160
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPExpCone
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3479_dims) { return mosek::fusion::p_Domain::inPExpCone(_3479_dims); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPExpCone(std::shared_ptr< monty::ndarray< int32_t,1 > > _3479_dims)
{
  _checked_ptr_1<int32_t> _ptr__3479_dims(_3479_dims ? _3479_dims->raw() : nullptr, _3479_dims ? _3479_dims->size(0) : 0);
  std::vector<int32_t> _10959_;
  for (int32_t _3480_i = (int)0, _10960_ = (int)((_3479_dims)->size(0)); _3480_i < _10960_ ; ++_3480_i)
  {
    _10959_.push_back(_ptr__3479_dims[_3480_i]);
  }
  auto _10961_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10959_.size()),_10959_.begin(),_10959_.end()));
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPExpCone,_10961_);
}
// End mosek.fusion.Domain.inPExpCone

// Begin mosek.fusion.Domain.inPExpCone
// Method mosek.fusion.Domain.inPExpCone @ bld/grindsted/final/default/src/fusion/domain.mbi:542:6-135
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPExpCone
  ( int32_t _3481_m) { return mosek::fusion::p_Domain::inPExpCone(_3481_m); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPExpCone(int32_t _3481_m)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPExpCone,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3481_m),(int32_t)((int)3)}));
}
// End mosek.fusion.Domain.inPExpCone

// Begin mosek.fusion.Domain.inPExpCone
// Method mosek.fusion.Domain.inPExpCone @ bld/grindsted/final/default/src/fusion/domain.mbi:541:6-129
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPExpCone
  ( ) { return mosek::fusion::p_Domain::inPExpCone(); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPExpCone()
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPExpCone,nullptr);
}
// End mosek.fusion.Domain.inPExpCone

// Begin mosek.fusion.Domain.inDGeoMeanCone
// Method mosek.fusion.Domain.inDGeoMeanCone @ bld/grindsted/final/default/src/fusion/domain.mbi:537:6-160
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDGeoMeanCone
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3482_dims) { return mosek::fusion::p_Domain::inDGeoMeanCone(_3482_dims); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDGeoMeanCone(std::shared_ptr< monty::ndarray< int32_t,1 > > _3482_dims)
{
  _checked_ptr_1<int32_t> _ptr__3482_dims(_3482_dims ? _3482_dims->raw() : nullptr, _3482_dims ? _3482_dims->size(0) : 0);
  std::vector<int32_t> _10962_;
  for (int32_t _3483_i = (int)0, _10963_ = (int)((_3482_dims)->size(0)); _3483_i < _10963_ ; ++_3483_i)
  {
    _10962_.push_back(_ptr__3482_dims[_3483_i]);
  }
  auto _10964_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10962_.size()),_10962_.begin(),_10962_.end()));
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDGeoMeanCone,_10964_);
}
// End mosek.fusion.Domain.inDGeoMeanCone

// Begin mosek.fusion.Domain.inDGeoMeanCone
// Method mosek.fusion.Domain.inDGeoMeanCone @ bld/grindsted/final/default/src/fusion/domain.mbi:536:6-135
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDGeoMeanCone
  ( int32_t _3484_m,
    int32_t _3485_n) { return mosek::fusion::p_Domain::inDGeoMeanCone(_3484_m,_3485_n); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDGeoMeanCone(int32_t _3484_m,int32_t _3485_n)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDGeoMeanCone,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3484_m),(int32_t)(_3485_n)}));
}
// End mosek.fusion.Domain.inDGeoMeanCone

// Begin mosek.fusion.Domain.inDGeoMeanCone
// Method mosek.fusion.Domain.inDGeoMeanCone @ bld/grindsted/final/default/src/fusion/domain.mbi:535:6-133
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDGeoMeanCone
  ( int32_t _3486_n) { return mosek::fusion::p_Domain::inDGeoMeanCone(_3486_n); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDGeoMeanCone(int32_t _3486_n)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDGeoMeanCone,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3486_n)}));
}
// End mosek.fusion.Domain.inDGeoMeanCone

// Begin mosek.fusion.Domain.inDGeoMeanCone
// Method mosek.fusion.Domain.inDGeoMeanCone @ bld/grindsted/final/default/src/fusion/domain.mbi:534:6-129
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inDGeoMeanCone
  ( ) { return mosek::fusion::p_Domain::inDGeoMeanCone(); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inDGeoMeanCone()
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InDGeoMeanCone,nullptr);
}
// End mosek.fusion.Domain.inDGeoMeanCone

// Begin mosek.fusion.Domain.inPGeoMeanCone
// Method mosek.fusion.Domain.inPGeoMeanCone @ bld/grindsted/final/default/src/fusion/domain.mbi:532:6-160
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPGeoMeanCone
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3487_dims) { return mosek::fusion::p_Domain::inPGeoMeanCone(_3487_dims); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPGeoMeanCone(std::shared_ptr< monty::ndarray< int32_t,1 > > _3487_dims)
{
  _checked_ptr_1<int32_t> _ptr__3487_dims(_3487_dims ? _3487_dims->raw() : nullptr, _3487_dims ? _3487_dims->size(0) : 0);
  std::vector<int32_t> _10965_;
  for (int32_t _3488_i = (int)0, _10966_ = (int)((_3487_dims)->size(0)); _3488_i < _10966_ ; ++_3488_i)
  {
    _10965_.push_back(_ptr__3487_dims[_3488_i]);
  }
  auto _10967_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10965_.size()),_10965_.begin(),_10965_.end()));
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPGeoMeanCone,_10967_);
}
// End mosek.fusion.Domain.inPGeoMeanCone

// Begin mosek.fusion.Domain.inPGeoMeanCone
// Method mosek.fusion.Domain.inPGeoMeanCone @ bld/grindsted/final/default/src/fusion/domain.mbi:531:6-135
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPGeoMeanCone
  ( int32_t _3489_m,
    int32_t _3490_n) { return mosek::fusion::p_Domain::inPGeoMeanCone(_3489_m,_3490_n); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPGeoMeanCone(int32_t _3489_m,int32_t _3490_n)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPGeoMeanCone,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3489_m),(int32_t)(_3490_n)}));
}
// End mosek.fusion.Domain.inPGeoMeanCone

// Begin mosek.fusion.Domain.inPGeoMeanCone
// Method mosek.fusion.Domain.inPGeoMeanCone @ bld/grindsted/final/default/src/fusion/domain.mbi:530:6-133
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPGeoMeanCone
  ( int32_t _3491_n) { return mosek::fusion::p_Domain::inPGeoMeanCone(_3491_n); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPGeoMeanCone(int32_t _3491_n)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPGeoMeanCone,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3491_n)}));
}
// End mosek.fusion.Domain.inPGeoMeanCone

// Begin mosek.fusion.Domain.inPGeoMeanCone
// Method mosek.fusion.Domain.inPGeoMeanCone @ bld/grindsted/final/default/src/fusion/domain.mbi:529:6-129
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inPGeoMeanCone
  ( ) { return mosek::fusion::p_Domain::inPGeoMeanCone(); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inPGeoMeanCone()
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InPGeoMeanCone,nullptr);
}
// End mosek.fusion.Domain.inPGeoMeanCone

// Begin mosek.fusion.Domain.inRotatedQCone
// Method mosek.fusion.Domain.inRotatedQCone @ bld/grindsted/final/default/src/fusion/domain.mbi:514:6-160
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inRotatedQCone
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3492_dims) { return mosek::fusion::p_Domain::inRotatedQCone(_3492_dims); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inRotatedQCone(std::shared_ptr< monty::ndarray< int32_t,1 > > _3492_dims)
{
  _checked_ptr_1<int32_t> _ptr__3492_dims(_3492_dims ? _3492_dims->raw() : nullptr, _3492_dims ? _3492_dims->size(0) : 0);
  std::vector<int32_t> _10968_;
  for (int32_t _3493_i = (int)0, _10969_ = (int)((_3492_dims)->size(0)); _3493_i < _10969_ ; ++_3493_i)
  {
    _10968_.push_back(_ptr__3492_dims[_3493_i]);
  }
  auto _10970_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10968_.size()),_10968_.begin(),_10968_.end()));
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InRotatedQCone,_10970_);
}
// End mosek.fusion.Domain.inRotatedQCone

// Begin mosek.fusion.Domain.inRotatedQCone
// Method mosek.fusion.Domain.inRotatedQCone @ bld/grindsted/final/default/src/fusion/domain.mbi:513:6-135
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inRotatedQCone
  ( int32_t _3494_m,
    int32_t _3495_n) { return mosek::fusion::p_Domain::inRotatedQCone(_3494_m,_3495_n); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inRotatedQCone(int32_t _3494_m,int32_t _3495_n)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InRotatedQCone,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3494_m),(int32_t)(_3495_n)}));
}
// End mosek.fusion.Domain.inRotatedQCone

// Begin mosek.fusion.Domain.inRotatedQCone
// Method mosek.fusion.Domain.inRotatedQCone @ bld/grindsted/final/default/src/fusion/domain.mbi:512:6-133
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inRotatedQCone
  ( int32_t _3496_n) { return mosek::fusion::p_Domain::inRotatedQCone(_3496_n); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inRotatedQCone(int32_t _3496_n)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InRotatedQCone,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3496_n)}));
}
// End mosek.fusion.Domain.inRotatedQCone

// Begin mosek.fusion.Domain.inRotatedQCone
// Method mosek.fusion.Domain.inRotatedQCone @ bld/grindsted/final/default/src/fusion/domain.mbi:511:6-129
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inRotatedQCone
  ( ) { return mosek::fusion::p_Domain::inRotatedQCone(); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inRotatedQCone()
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InRotatedQCone,nullptr);
}
// End mosek.fusion.Domain.inRotatedQCone

// Begin mosek.fusion.Domain.inQCone
// Method mosek.fusion.Domain.inQCone @ bld/grindsted/final/default/src/fusion/domain.mbi:509:6-160
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inQCone
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3497_dims) { return mosek::fusion::p_Domain::inQCone(_3497_dims); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inQCone(std::shared_ptr< monty::ndarray< int32_t,1 > > _3497_dims)
{
  _checked_ptr_1<int32_t> _ptr__3497_dims(_3497_dims ? _3497_dims->raw() : nullptr, _3497_dims ? _3497_dims->size(0) : 0);
  std::vector<int32_t> _10971_;
  for (int32_t _3498_i = (int)0, _10972_ = (int)((_3497_dims)->size(0)); _3498_i < _10972_ ; ++_3498_i)
  {
    _10971_.push_back(_ptr__3497_dims[_3498_i]);
  }
  auto _10973_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_10971_.size()),_10971_.begin(),_10971_.end()));
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InQCone,_10973_);
}
// End mosek.fusion.Domain.inQCone

// Begin mosek.fusion.Domain.inQCone
// Method mosek.fusion.Domain.inQCone @ bld/grindsted/final/default/src/fusion/domain.mbi:508:6-135
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inQCone
  ( int32_t _3499_m,
    int32_t _3500_n) { return mosek::fusion::p_Domain::inQCone(_3499_m,_3500_n); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inQCone(int32_t _3499_m,int32_t _3500_n)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InQCone,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3499_m),(int32_t)(_3500_n)}));
}
// End mosek.fusion.Domain.inQCone

// Begin mosek.fusion.Domain.inQCone
// Method mosek.fusion.Domain.inQCone @ bld/grindsted/final/default/src/fusion/domain.mbi:507:6-133
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inQCone
  ( int32_t _3501_n) { return mosek::fusion::p_Domain::inQCone(_3501_n); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inQCone(int32_t _3501_n)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InQCone,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3501_n)}));
}
// End mosek.fusion.Domain.inQCone

// Begin mosek.fusion.Domain.inQCone
// Method mosek.fusion.Domain.inQCone @ bld/grindsted/final/default/src/fusion/domain.mbi:506:6-129
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inQCone
  ( ) { return mosek::fusion::p_Domain::inQCone(); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inQCone()
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InQCone,nullptr);
}
// End mosek.fusion.Domain.inQCone

// Begin mosek.fusion.Domain.inSVecPSDCone
// Method mosek.fusion.Domain.inSVecPSDCone @ bld/grindsted/final/default/src/fusion/domain.mbi:503:6-128
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inSVecPSDCone
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3502_dims) { return mosek::fusion::p_Domain::inSVecPSDCone(_3502_dims); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inSVecPSDCone(std::shared_ptr< monty::ndarray< int32_t,1 > > _3502_dims)
{
  _checked_ptr_1<int32_t> _ptr__3502_dims(_3502_dims ? _3502_dims->raw() : nullptr, _3502_dims ? _3502_dims->size(0) : 0);
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InSVecPSDCone,_3502_dims);
}
// End mosek.fusion.Domain.inSVecPSDCone

// Begin mosek.fusion.Domain.inSVecPSDCone
// Method mosek.fusion.Domain.inSVecPSDCone @ bld/grindsted/final/default/src/fusion/domain.mbi:502:6-136
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inSVecPSDCone
  ( int32_t _3503_d1,
    int32_t _3504_d2) { return mosek::fusion::p_Domain::inSVecPSDCone(_3503_d1,_3504_d2); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inSVecPSDCone(int32_t _3503_d1,int32_t _3504_d2)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InSVecPSDCone,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3503_d1),(int32_t)(_3504_d2)}));
}
// End mosek.fusion.Domain.inSVecPSDCone

// Begin mosek.fusion.Domain.inSVecPSDCone
// Method mosek.fusion.Domain.inSVecPSDCone @ bld/grindsted/final/default/src/fusion/domain.mbi:501:6-132
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inSVecPSDCone
  ( int32_t _3505_n) { return mosek::fusion::p_Domain::inSVecPSDCone(_3505_n); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inSVecPSDCone(int32_t _3505_n)
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InSVecPSDCone,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3505_n)}));
}
// End mosek.fusion.Domain.inSVecPSDCone

// Begin mosek.fusion.Domain.inSVecPSDCone
// Method mosek.fusion.Domain.inSVecPSDCone @ bld/grindsted/final/default/src/fusion/domain.mbi:500:6-128
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::Domain::inSVecPSDCone
  ( ) { return mosek::fusion::p_Domain::inSVecPSDCone(); }
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::p_Domain::inSVecPSDCone()
{
  return ::mosek::fusion::p_ConeDomain::_new_ConeDomain(::mosek::fusion::QConeKey::InSVecPSDCone,nullptr);
}
// End mosek.fusion.Domain.inSVecPSDCone

// Begin mosek.fusion.Domain.isTrilPSD
// Method mosek.fusion.Domain.isTrilPSD @ bld/grindsted/final/default/src/fusion/domain.mbi:490:6-130
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::Domain::isTrilPSD
  ( int32_t _3506_n,
    int32_t _3507_m) { return mosek::fusion::p_Domain::isTrilPSD(_3506_n,_3507_m); }
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::p_Domain::isTrilPSD(int32_t _3506_n,int32_t _3507_m)
{
  return ::mosek::fusion::p_PSDDomain::_new_PSDDomain(::mosek::fusion::PSDKey::IsTrilPSD,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3507_m),(int32_t)(_3506_n),(int32_t)(_3506_n)}),(int)1,(int)2);
}
// End mosek.fusion.Domain.isTrilPSD

// Begin mosek.fusion.Domain.isTrilPSD
// Method mosek.fusion.Domain.isTrilPSD @ bld/grindsted/final/default/src/fusion/domain.mbi:489:6-128
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::Domain::isTrilPSD
  ( int32_t _3508_n) { return mosek::fusion::p_Domain::isTrilPSD(_3508_n); }
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::p_Domain::isTrilPSD(int32_t _3508_n)
{
  return ::mosek::fusion::p_PSDDomain::_new_PSDDomain(::mosek::fusion::PSDKey::IsTrilPSD,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3508_n),(int32_t)(_3508_n)}),(int)0,(int)1);
}
// End mosek.fusion.Domain.isTrilPSD

// Begin mosek.fusion.Domain.isTrilPSD
// Method mosek.fusion.Domain.isTrilPSD @ bld/grindsted/final/default/src/fusion/domain.mbi:488:6-112
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::Domain::isTrilPSD
  ( ) { return mosek::fusion::p_Domain::isTrilPSD(); }
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::p_Domain::isTrilPSD()
{
  return ::mosek::fusion::p_PSDDomain::_new_PSDDomain(::mosek::fusion::PSDKey::IsTrilPSD);
}
// End mosek.fusion.Domain.isTrilPSD

// Begin mosek.fusion.Domain.inPSDCone
// Method mosek.fusion.Domain.inPSDCone @ bld/grindsted/final/default/src/fusion/domain.mbi:486:6-126
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::Domain::inPSDCone
  ( int32_t _3509_n,
    int32_t _3510_m) { return mosek::fusion::p_Domain::inPSDCone(_3509_n,_3510_m); }
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::p_Domain::inPSDCone(int32_t _3509_n,int32_t _3510_m)
{
  return ::mosek::fusion::p_PSDDomain::_new_PSDDomain(::mosek::fusion::PSDKey::IsSymPSD,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3510_m),(int32_t)(_3509_n),(int32_t)(_3509_n)}));
}
// End mosek.fusion.Domain.inPSDCone

// Begin mosek.fusion.Domain.inPSDCone
// Method mosek.fusion.Domain.inPSDCone @ bld/grindsted/final/default/src/fusion/domain.mbi:485:6-124
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::Domain::inPSDCone
  ( int32_t _3511_n) { return mosek::fusion::p_Domain::inPSDCone(_3511_n); }
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::p_Domain::inPSDCone(int32_t _3511_n)
{
  return ::mosek::fusion::p_PSDDomain::_new_PSDDomain(::mosek::fusion::PSDKey::IsSymPSD,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3511_n),(int32_t)(_3511_n)}));
}
// End mosek.fusion.Domain.inPSDCone

// Begin mosek.fusion.Domain.inPSDCone
// Method mosek.fusion.Domain.inPSDCone @ bld/grindsted/final/default/src/fusion/domain.mbi:484:6-111
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::Domain::inPSDCone
  ( ) { return mosek::fusion::p_Domain::inPSDCone(); }
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::p_Domain::inPSDCone()
{
  return ::mosek::fusion::p_PSDDomain::_new_PSDDomain(::mosek::fusion::PSDKey::IsSymPSD);
}
// End mosek.fusion.Domain.inPSDCone

// Begin mosek.fusion.Domain.binary
// Method mosek.fusion.Domain.binary @ bld/grindsted/final/default/src/fusion/domain.mbi:481:6-123
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::binary
  ( ) { return mosek::fusion::p_Domain::binary(); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::binary()
{
  return ::mosek::fusion::p_Domain::inRange(0.0,1.0)->__mosek_2fusion_2RangeDomain__integral();
}
// End mosek.fusion.Domain.binary

// Begin mosek.fusion.Domain.binary
// Method mosek.fusion.Domain.binary @ bld/grindsted/final/default/src/fusion/domain.mbi:480:6-128
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::binary
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3512_dims) { return mosek::fusion::p_Domain::binary(_3512_dims); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::binary(std::shared_ptr< monty::ndarray< int32_t,1 > > _3512_dims)
{
  _checked_ptr_1<int32_t> _ptr__3512_dims(_3512_dims ? _3512_dims->raw() : nullptr, _3512_dims ? _3512_dims->size(0) : 0);
  return ::mosek::fusion::p_Domain::inRange(0.0,1.0,_3512_dims)->__mosek_2fusion_2RangeDomain__integral();
}
// End mosek.fusion.Domain.binary

// Begin mosek.fusion.Domain.binary
// Method mosek.fusion.Domain.binary @ bld/grindsted/final/default/src/fusion/domain.mbi:479:6-134
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::binary
  ( int32_t _3513_m,
    int32_t _3514_n) { return mosek::fusion::p_Domain::binary(_3513_m,_3514_n); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::binary(int32_t _3513_m,int32_t _3514_n)
{
  return ::mosek::fusion::p_Domain::inRange(0.0,1.0,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3513_m),(int32_t)(_3514_n)}))->__mosek_2fusion_2RangeDomain__integral();
}
// End mosek.fusion.Domain.binary

// Begin mosek.fusion.Domain.binary
// Method mosek.fusion.Domain.binary @ bld/grindsted/final/default/src/fusion/domain.mbi:478:6-132
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::binary
  ( int32_t _3515_n) { return mosek::fusion::p_Domain::binary(_3515_n); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::binary(int32_t _3515_n)
{
  return ::mosek::fusion::p_Domain::inRange(0.0,1.0,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3515_n)}))->__mosek_2fusion_2RangeDomain__integral();
}
// End mosek.fusion.Domain.binary

// Begin mosek.fusion.Domain.inRange
// Method mosek.fusion.Domain.inRange @ bld/grindsted/final/default/src/fusion/domain.mbi:472:6-120
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::inRange
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _3516_lbm,
    monty::rc_ptr< ::mosek::fusion::Matrix > _3517_ubm) { return mosek::fusion::p_Domain::inRange(_3516_lbm,_3517_ubm); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::inRange(monty::rc_ptr< ::mosek::fusion::Matrix > _3516_lbm,monty::rc_ptr< ::mosek::fusion::Matrix > _3517_ubm)
{
  return ::mosek::fusion::p_Domain::mkRangedDomain(_3516_lbm,_3517_ubm);
}
// End mosek.fusion.Domain.inRange

// Begin mosek.fusion.Domain.inRange
// Method mosek.fusion.Domain.inRange @ bld/grindsted/final/default/src/fusion/domain.mbi:471:6-120
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::inRange
  ( std::shared_ptr< monty::ndarray< double,2 > > _3518_lba,
    std::shared_ptr< monty::ndarray< double,2 > > _3519_uba) { return mosek::fusion::p_Domain::inRange(_3518_lba,_3519_uba); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::inRange(std::shared_ptr< monty::ndarray< double,2 > > _3518_lba,std::shared_ptr< monty::ndarray< double,2 > > _3519_uba)
{
  return ::mosek::fusion::p_Domain::mkRangedDomain(_3518_lba,_3519_uba);
}
// End mosek.fusion.Domain.inRange

// Begin mosek.fusion.Domain.inRange
// Method mosek.fusion.Domain.inRange @ bld/grindsted/final/default/src/fusion/domain.mbi:469:6-147
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::inRange
  ( std::shared_ptr< monty::ndarray< double,1 > > _3520_lba,
    std::shared_ptr< monty::ndarray< double,1 > > _3521_uba,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3522_dims) { return mosek::fusion::p_Domain::inRange(_3520_lba,_3521_uba,_3522_dims); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::inRange(std::shared_ptr< monty::ndarray< double,1 > > _3520_lba,std::shared_ptr< monty::ndarray< double,1 > > _3521_uba,std::shared_ptr< monty::ndarray< int32_t,1 > > _3522_dims)
{
  _checked_ptr_1<double> _ptr__3520_lba(_3520_lba ? _3520_lba->raw() : nullptr, _3520_lba ? _3520_lba->size(0) : 0);
  _checked_ptr_1<double> _ptr__3521_uba(_3521_uba ? _3521_uba->raw() : nullptr, _3521_uba ? _3521_uba->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3522_dims(_3522_dims ? _3522_dims->raw() : nullptr, _3522_dims ? _3522_dims->size(0) : 0);
  return ::mosek::fusion::p_RangeDomain::_new_RangeDomain(false,_3520_lba,_3521_uba,_3522_dims);
}
// End mosek.fusion.Domain.inRange

// Begin mosek.fusion.Domain.inRange
// Method mosek.fusion.Domain.inRange @ bld/grindsted/final/default/src/fusion/domain.mbi:468:6-174
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::inRange
  ( std::shared_ptr< monty::ndarray< double,1 > > _3523_lba,
    double _3524_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3525_dims) { return mosek::fusion::p_Domain::inRange(_3523_lba,_3524_ub,_3525_dims); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::inRange(std::shared_ptr< monty::ndarray< double,1 > > _3523_lba,double _3524_ub,std::shared_ptr< monty::ndarray< int32_t,1 > > _3525_dims)
{
  _checked_ptr_1<double> _ptr__3523_lba(_3523_lba ? _3523_lba->raw() : nullptr, _3523_lba ? _3523_lba->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3525_dims(_3525_dims ? _3525_dims->raw() : nullptr, _3525_dims ? _3525_dims->size(0) : 0);
  std::vector<double> _10974_;
  for (int32_t _3526_i = (int)0, _10975_ = (int)((_3523_lba)->size(0)); _3526_i < _10975_ ; ++_3526_i)
  {
    _10974_.push_back(_3524_ub);
  }
  auto _10976_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10974_.size()),_10974_.begin(),_10974_.end()));
  return ::mosek::fusion::p_RangeDomain::_new_RangeDomain(false,_3523_lba,_10976_,_3525_dims);
}
// End mosek.fusion.Domain.inRange

// Begin mosek.fusion.Domain.inRange
// Method mosek.fusion.Domain.inRange @ bld/grindsted/final/default/src/fusion/domain.mbi:467:6-201
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::inRange
  ( double _3527_lb,
    std::shared_ptr< monty::ndarray< double,1 > > _3528_uba,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3529_dims) { return mosek::fusion::p_Domain::inRange(_3527_lb,_3528_uba,_3529_dims); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::inRange(double _3527_lb,std::shared_ptr< monty::ndarray< double,1 > > _3528_uba,std::shared_ptr< monty::ndarray< int32_t,1 > > _3529_dims)
{
  _checked_ptr_1<double> _ptr__3528_uba(_3528_uba ? _3528_uba->raw() : nullptr, _3528_uba ? _3528_uba->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3529_dims(_3529_dims ? _3529_dims->raw() : nullptr, _3529_dims ? _3529_dims->size(0) : 0);
  std::vector<double> _10977_;
  for (int32_t _3530_i = (int)0, _10978_ = (int)((_3528_uba)->size(0)); _3530_i < _10978_ ; ++_3530_i)
  {
    _10977_.push_back(_3527_lb);
  }
  auto _10979_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10977_.size()),_10977_.begin(),_10977_.end()));
  return ::mosek::fusion::p_RangeDomain::_new_RangeDomain(false,_10979_,_3528_uba,_3529_dims);
}
// End mosek.fusion.Domain.inRange

// Begin mosek.fusion.Domain.inRange
// Method mosek.fusion.Domain.inRange @ bld/grindsted/final/default/src/fusion/domain.mbi:466:6-145
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::inRange
  ( double _3531_lb,
    double _3532_ub,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3533_dims) { return mosek::fusion::p_Domain::inRange(_3531_lb,_3532_ub,_3533_dims); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::inRange(double _3531_lb,double _3532_ub,std::shared_ptr< monty::ndarray< int32_t,1 > > _3533_dims)
{
  _checked_ptr_1<int32_t> _ptr__3533_dims(_3533_dims ? _3533_dims->raw() : nullptr, _3533_dims ? _3533_dims->size(0) : 0);
  return ::mosek::fusion::p_RangeDomain::_new_RangeDomain(false,_3531_lb,_3532_ub,_3533_dims);
}
// End mosek.fusion.Domain.inRange

// Begin mosek.fusion.Domain.inRange
// Method mosek.fusion.Domain.inRange @ bld/grindsted/final/default/src/fusion/domain.mbi:464:6-198
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::inRange
  ( std::shared_ptr< monty::ndarray< double,1 > > _3534_lba,
    std::shared_ptr< monty::ndarray< double,1 > > _3535_uba) { return mosek::fusion::p_Domain::inRange(_3534_lba,_3535_uba); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::inRange(std::shared_ptr< monty::ndarray< double,1 > > _3534_lba,std::shared_ptr< monty::ndarray< double,1 > > _3535_uba)
{
  _checked_ptr_1<double> _ptr__3534_lba(_3534_lba ? _3534_lba->raw() : nullptr, _3534_lba ? _3534_lba->size(0) : 0);
  _checked_ptr_1<double> _ptr__3535_uba(_3535_uba ? _3535_uba->raw() : nullptr, _3535_uba ? _3535_uba->size(0) : 0);
  return ::mosek::fusion::p_RangeDomain::_new_RangeDomain(false,_3534_lba,_3535_uba,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_3534_lba)->size(0)))}));
}
// End mosek.fusion.Domain.inRange

// Begin mosek.fusion.Domain.inRange
// Method mosek.fusion.Domain.inRange @ bld/grindsted/final/default/src/fusion/domain.mbi:463:6-198
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::inRange
  ( std::shared_ptr< monty::ndarray< double,1 > > _3536_lba,
    double _3537_ub) { return mosek::fusion::p_Domain::inRange(_3536_lba,_3537_ub); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::inRange(std::shared_ptr< monty::ndarray< double,1 > > _3536_lba,double _3537_ub)
{
  _checked_ptr_1<double> _ptr__3536_lba(_3536_lba ? _3536_lba->raw() : nullptr, _3536_lba ? _3536_lba->size(0) : 0);
  std::vector<double> _10980_;
  for (int32_t _3538_i = (int)0, _10981_ = (int)((_3536_lba)->size(0)); _3538_i < _10981_ ; ++_3538_i)
  {
    _10980_.push_back(_3537_ub);
  }
  auto _10982_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10980_.size()),_10980_.begin(),_10980_.end()));
  return ::mosek::fusion::p_RangeDomain::_new_RangeDomain(false,_3536_lba,_10982_,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_3536_lba)->size(0)))}));
}
// End mosek.fusion.Domain.inRange

// Begin mosek.fusion.Domain.inRange
// Method mosek.fusion.Domain.inRange @ bld/grindsted/final/default/src/fusion/domain.mbi:462:6-198
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::inRange
  ( double _3539_lb,
    std::shared_ptr< monty::ndarray< double,1 > > _3540_uba) { return mosek::fusion::p_Domain::inRange(_3539_lb,_3540_uba); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::inRange(double _3539_lb,std::shared_ptr< monty::ndarray< double,1 > > _3540_uba)
{
  _checked_ptr_1<double> _ptr__3540_uba(_3540_uba ? _3540_uba->raw() : nullptr, _3540_uba ? _3540_uba->size(0) : 0);
  std::vector<double> _10983_;
  for (int32_t _3541_i = (int)0, _10984_ = (int)((_3540_uba)->size(0)); _3541_i < _10984_ ; ++_3541_i)
  {
    _10983_.push_back(_3539_lb);
  }
  auto _10985_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10983_.size()),_10983_.begin(),_10983_.end()));
  return ::mosek::fusion::p_RangeDomain::_new_RangeDomain(false,_10985_,_3540_uba,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_3540_uba)->size(0)))}));
}
// End mosek.fusion.Domain.inRange

// Begin mosek.fusion.Domain.inRange
// Method mosek.fusion.Domain.inRange @ bld/grindsted/final/default/src/fusion/domain.mbi:461:6-187
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::Domain::inRange
  ( double _3542_lb,
    double _3543_ub) { return mosek::fusion::p_Domain::inRange(_3542_lb,_3543_ub); }
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::p_Domain::inRange(double _3542_lb,double _3543_ub)
{
  return ::mosek::fusion::p_RangeDomain::_new_RangeDomain(true,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3542_lb)}),std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3543_ub)}),nullptr);
}
// End mosek.fusion.Domain.inRange

// Begin mosek.fusion.Domain.greaterThan
// Method mosek.fusion.Domain.greaterThan @ bld/grindsted/final/default/src/fusion/domain.mbi:458:6-138
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::greaterThan
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _3544_mx) { return mosek::fusion::p_Domain::greaterThan(_3544_mx); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::greaterThan(monty::rc_ptr< ::mosek::fusion::Matrix > _3544_mx)
{
  return ::mosek::fusion::p_Domain::mkLinearDomain(::mosek::fusion::RelationKey::GreaterThan,_3544_mx);
}
// End mosek.fusion.Domain.greaterThan

// Begin mosek.fusion.Domain.greaterThan
// Method mosek.fusion.Domain.greaterThan @ bld/grindsted/final/default/src/fusion/domain.mbi:457:6-177
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::greaterThan
  ( std::shared_ptr< monty::ndarray< double,1 > > _3545_a1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3546_dims) { return mosek::fusion::p_Domain::greaterThan(_3545_a1,_3546_dims); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::greaterThan(std::shared_ptr< monty::ndarray< double,1 > > _3545_a1,std::shared_ptr< monty::ndarray< int32_t,1 > > _3546_dims)
{
  _checked_ptr_1<double> _ptr__3545_a1(_3545_a1 ? _3545_a1->raw() : nullptr, _3545_a1 ? _3545_a1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3546_dims(_3546_dims ? _3546_dims->raw() : nullptr, _3546_dims ? _3546_dims->size(0) : 0);
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::GreaterThan,false,::mosek::fusion::Utils::Tools::arraycopy(_3545_a1),_3546_dims);
}
// End mosek.fusion.Domain.greaterThan

// Begin mosek.fusion.Domain.greaterThan
// Method mosek.fusion.Domain.greaterThan @ bld/grindsted/final/default/src/fusion/domain.mbi:456:6-230
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::greaterThan
  ( std::shared_ptr< monty::ndarray< double,2 > > _3547_a2) { return mosek::fusion::p_Domain::greaterThan(_3547_a2); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::greaterThan(std::shared_ptr< monty::ndarray< double,2 > > _3547_a2)
{
  std::vector<double> _10986_;
  for (int32_t _3548_i = (int)0, _10987_ = (int)((_3547_a2)->size(0)); _3548_i < _10987_ ; ++_3548_i)
  {
    for (int32_t _3549_j = (int)0, _10988_ = (int)((_3547_a2)->size(1)); _3549_j < _10988_ ; ++_3549_j)
    {
      _10986_.push_back(((*_3547_a2)(_3548_i,_3549_j)));
    }
  }
  auto _10989_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10986_.size()),_10986_.begin(),_10986_.end()));
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::GreaterThan,false,_10989_,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_3547_a2)->size(0))),(int32_t)((int)((_3547_a2)->size(1)))}));
}
// End mosek.fusion.Domain.greaterThan

// Begin mosek.fusion.Domain.greaterThan
// Method mosek.fusion.Domain.greaterThan @ bld/grindsted/final/default/src/fusion/domain.mbi:455:6-187
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::greaterThan
  ( std::shared_ptr< monty::ndarray< double,1 > > _3550_a1) { return mosek::fusion::p_Domain::greaterThan(_3550_a1); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::greaterThan(std::shared_ptr< monty::ndarray< double,1 > > _3550_a1)
{
  _checked_ptr_1<double> _ptr__3550_a1(_3550_a1 ? _3550_a1->raw() : nullptr, _3550_a1 ? _3550_a1->size(0) : 0);
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::GreaterThan,false,::mosek::fusion::Utils::Tools::arraycopy(_3550_a1),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_3550_a1)->size(0)))}));
}
// End mosek.fusion.Domain.greaterThan

// Begin mosek.fusion.Domain.greaterThan
// Method mosek.fusion.Domain.greaterThan @ bld/grindsted/final/default/src/fusion/domain.mbi:454:6-184
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::greaterThan
  ( double _3551_b,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3552_dims) { return mosek::fusion::p_Domain::greaterThan(_3551_b,_3552_dims); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::greaterThan(double _3551_b,std::shared_ptr< monty::ndarray< int32_t,1 > > _3552_dims)
{
  _checked_ptr_1<int32_t> _ptr__3552_dims(_3552_dims ? _3552_dims->raw() : nullptr, _3552_dims ? _3552_dims->size(0) : 0);
  std::vector<double> _10990_;
  for (int64_t _3553_i = (int)0, _10991_ = ::mosek::fusion::p_Domain::prod(_3552_dims); _3553_i < _10991_ ; ++_3553_i)
  {
    _10990_.push_back(_3551_b);
  }
  auto _10992_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10990_.size()),_10990_.begin(),_10990_.end()));
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::GreaterThan,false,_10992_,_3552_dims);
}
// End mosek.fusion.Domain.greaterThan

// Begin mosek.fusion.Domain.greaterThan
// Method mosek.fusion.Domain.greaterThan @ bld/grindsted/final/default/src/fusion/domain.mbi:453:6-183
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::greaterThan
  ( double _3554_b,
    int32_t _3555_m,
    int32_t _3556_n) { return mosek::fusion::p_Domain::greaterThan(_3554_b,_3555_m,_3556_n); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::greaterThan(double _3554_b,int32_t _3555_m,int32_t _3556_n)
{
  std::vector<double> _10993_;
  for (int32_t _3557_i = (int)0, _10994_ = safe_mul( _3556_n,_3555_m ); _3557_i < _10994_ ; ++_3557_i)
  {
    _10993_.push_back(_3554_b);
  }
  auto _10995_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10993_.size()),_10993_.begin(),_10993_.end()));
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::GreaterThan,false,_10995_,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3555_m),(int32_t)(_3556_n)}));
}
// End mosek.fusion.Domain.greaterThan

// Begin mosek.fusion.Domain.greaterThan
// Method mosek.fusion.Domain.greaterThan @ bld/grindsted/final/default/src/fusion/domain.mbi:452:6-179
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::greaterThan
  ( double _3558_b,
    int32_t _3559_n) { return mosek::fusion::p_Domain::greaterThan(_3558_b,_3559_n); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::greaterThan(double _3558_b,int32_t _3559_n)
{
  std::vector<double> _10996_;
  for (int32_t _3560_i = (int)0, _10997_ = _3559_n; _3560_i < _10997_ ; ++_3560_i)
  {
    _10996_.push_back(_3558_b);
  }
  auto _10998_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10996_.size()),_10996_.begin(),_10996_.end()));
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::GreaterThan,false,_10998_,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3559_n)}));
}
// End mosek.fusion.Domain.greaterThan

// Begin mosek.fusion.Domain.greaterThan
// Method mosek.fusion.Domain.greaterThan @ bld/grindsted/final/default/src/fusion/domain.mbi:451:6-161
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::greaterThan
  ( double _3561_b) { return mosek::fusion::p_Domain::greaterThan(_3561_b); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::greaterThan(double _3561_b)
{
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::GreaterThan,true,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3561_b)}),nullptr);
}
// End mosek.fusion.Domain.greaterThan

// Begin mosek.fusion.Domain.lessThan
// Method mosek.fusion.Domain.lessThan @ bld/grindsted/final/default/src/fusion/domain.mbi:449:6-135
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::lessThan
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _3562_mx) { return mosek::fusion::p_Domain::lessThan(_3562_mx); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::lessThan(monty::rc_ptr< ::mosek::fusion::Matrix > _3562_mx)
{
  return ::mosek::fusion::p_Domain::mkLinearDomain(::mosek::fusion::RelationKey::LessThan,_3562_mx);
}
// End mosek.fusion.Domain.lessThan

// Begin mosek.fusion.Domain.lessThan
// Method mosek.fusion.Domain.lessThan @ bld/grindsted/final/default/src/fusion/domain.mbi:448:6-177
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::lessThan
  ( std::shared_ptr< monty::ndarray< double,1 > > _3563_a1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3564_dims) { return mosek::fusion::p_Domain::lessThan(_3563_a1,_3564_dims); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::lessThan(std::shared_ptr< monty::ndarray< double,1 > > _3563_a1,std::shared_ptr< monty::ndarray< int32_t,1 > > _3564_dims)
{
  _checked_ptr_1<double> _ptr__3563_a1(_3563_a1 ? _3563_a1->raw() : nullptr, _3563_a1 ? _3563_a1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3564_dims(_3564_dims ? _3564_dims->raw() : nullptr, _3564_dims ? _3564_dims->size(0) : 0);
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::LessThan,false,::mosek::fusion::Utils::Tools::arraycopy(_3563_a1),_3564_dims);
}
// End mosek.fusion.Domain.lessThan

// Begin mosek.fusion.Domain.lessThan
// Method mosek.fusion.Domain.lessThan @ bld/grindsted/final/default/src/fusion/domain.mbi:447:6-230
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::lessThan
  ( std::shared_ptr< monty::ndarray< double,2 > > _3565_a2) { return mosek::fusion::p_Domain::lessThan(_3565_a2); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::lessThan(std::shared_ptr< monty::ndarray< double,2 > > _3565_a2)
{
  std::vector<double> _10999_;
  for (int32_t _3566_i = (int)0, _11000_ = (int)((_3565_a2)->size(0)); _3566_i < _11000_ ; ++_3566_i)
  {
    for (int32_t _3567_j = (int)0, _11001_ = (int)((_3565_a2)->size(1)); _3567_j < _11001_ ; ++_3567_j)
    {
      _10999_.push_back(((*_3565_a2)(_3566_i,_3567_j)));
    }
  }
  auto _11002_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_10999_.size()),_10999_.begin(),_10999_.end()));
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::LessThan,false,_11002_,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_3565_a2)->size(0))),(int32_t)((int)((_3565_a2)->size(1)))}));
}
// End mosek.fusion.Domain.lessThan

// Begin mosek.fusion.Domain.lessThan
// Method mosek.fusion.Domain.lessThan @ bld/grindsted/final/default/src/fusion/domain.mbi:446:6-187
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::lessThan
  ( std::shared_ptr< monty::ndarray< double,1 > > _3568_a1) { return mosek::fusion::p_Domain::lessThan(_3568_a1); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::lessThan(std::shared_ptr< monty::ndarray< double,1 > > _3568_a1)
{
  _checked_ptr_1<double> _ptr__3568_a1(_3568_a1 ? _3568_a1->raw() : nullptr, _3568_a1 ? _3568_a1->size(0) : 0);
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::LessThan,false,::mosek::fusion::Utils::Tools::arraycopy(_3568_a1),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_3568_a1)->size(0)))}));
}
// End mosek.fusion.Domain.lessThan

// Begin mosek.fusion.Domain.lessThan
// Method mosek.fusion.Domain.lessThan @ bld/grindsted/final/default/src/fusion/domain.mbi:445:6-160
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::lessThan
  ( double _3569_b,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3570_dims) { return mosek::fusion::p_Domain::lessThan(_3569_b,_3570_dims); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::lessThan(double _3569_b,std::shared_ptr< monty::ndarray< int32_t,1 > > _3570_dims)
{
  _checked_ptr_1<int32_t> _ptr__3570_dims(_3570_dims ? _3570_dims->raw() : nullptr, _3570_dims ? _3570_dims->size(0) : 0);
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::LessThan,false,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3569_b)}),_3570_dims);
}
// End mosek.fusion.Domain.lessThan

// Begin mosek.fusion.Domain.lessThan
// Method mosek.fusion.Domain.lessThan @ bld/grindsted/final/default/src/fusion/domain.mbi:444:6-166
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::lessThan
  ( double _3571_b,
    int32_t _3572_m,
    int32_t _3573_n) { return mosek::fusion::p_Domain::lessThan(_3571_b,_3572_m,_3573_n); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::lessThan(double _3571_b,int32_t _3572_m,int32_t _3573_n)
{
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::LessThan,false,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3571_b)}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3572_m),(int32_t)(_3573_n)}));
}
// End mosek.fusion.Domain.lessThan

// Begin mosek.fusion.Domain.lessThan
// Method mosek.fusion.Domain.lessThan @ bld/grindsted/final/default/src/fusion/domain.mbi:443:6-164
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::lessThan
  ( double _3574_b,
    int32_t _3575_n) { return mosek::fusion::p_Domain::lessThan(_3574_b,_3575_n); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::lessThan(double _3574_b,int32_t _3575_n)
{
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::LessThan,false,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3574_b)}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3575_n)}));
}
// End mosek.fusion.Domain.lessThan

// Begin mosek.fusion.Domain.lessThan
// Method mosek.fusion.Domain.lessThan @ bld/grindsted/final/default/src/fusion/domain.mbi:442:6-159
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::lessThan
  ( double _3576_b) { return mosek::fusion::p_Domain::lessThan(_3576_b); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::lessThan(double _3576_b)
{
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::LessThan,true,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3576_b)}),nullptr);
}
// End mosek.fusion.Domain.lessThan

// Begin mosek.fusion.Domain.equalsTo
// Method mosek.fusion.Domain.equalsTo @ bld/grindsted/final/default/src/fusion/domain.mbi:439:6-137
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::equalsTo
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _3577_mx) { return mosek::fusion::p_Domain::equalsTo(_3577_mx); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::equalsTo(monty::rc_ptr< ::mosek::fusion::Matrix > _3577_mx)
{
  return ::mosek::fusion::p_Domain::mkLinearDomain(::mosek::fusion::RelationKey::EqualsTo,_3577_mx);
}
// End mosek.fusion.Domain.equalsTo

// Begin mosek.fusion.Domain.equalsTo
// Method mosek.fusion.Domain.equalsTo @ bld/grindsted/final/default/src/fusion/domain.mbi:438:6-177
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::equalsTo
  ( std::shared_ptr< monty::ndarray< double,1 > > _3578_a1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3579_dims) { return mosek::fusion::p_Domain::equalsTo(_3578_a1,_3579_dims); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::equalsTo(std::shared_ptr< monty::ndarray< double,1 > > _3578_a1,std::shared_ptr< monty::ndarray< int32_t,1 > > _3579_dims)
{
  _checked_ptr_1<double> _ptr__3578_a1(_3578_a1 ? _3578_a1->raw() : nullptr, _3578_a1 ? _3578_a1->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3579_dims(_3579_dims ? _3579_dims->raw() : nullptr, _3579_dims ? _3579_dims->size(0) : 0);
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::EqualsTo,false,::mosek::fusion::Utils::Tools::arraycopy(_3578_a1),_3579_dims);
}
// End mosek.fusion.Domain.equalsTo

// Begin mosek.fusion.Domain.equalsTo
// Method mosek.fusion.Domain.equalsTo @ bld/grindsted/final/default/src/fusion/domain.mbi:437:6-230
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::equalsTo
  ( std::shared_ptr< monty::ndarray< double,2 > > _3580_a2) { return mosek::fusion::p_Domain::equalsTo(_3580_a2); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::equalsTo(std::shared_ptr< monty::ndarray< double,2 > > _3580_a2)
{
  std::vector<double> _11003_;
  for (int32_t _3581_i = (int)0, _11004_ = (int)((_3580_a2)->size(0)); _3581_i < _11004_ ; ++_3581_i)
  {
    for (int32_t _3582_j = (int)0, _11005_ = (int)((_3580_a2)->size(1)); _3582_j < _11005_ ; ++_3582_j)
    {
      _11003_.push_back(((*_3580_a2)(_3581_i,_3582_j)));
    }
  }
  auto _11006_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_11003_.size()),_11003_.begin(),_11003_.end()));
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::EqualsTo,false,_11006_,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_3580_a2)->size(0))),(int32_t)((int)((_3580_a2)->size(1)))}));
}
// End mosek.fusion.Domain.equalsTo

// Begin mosek.fusion.Domain.equalsTo
// Method mosek.fusion.Domain.equalsTo @ bld/grindsted/final/default/src/fusion/domain.mbi:436:6-187
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::equalsTo
  ( std::shared_ptr< monty::ndarray< double,1 > > _3583_a1) { return mosek::fusion::p_Domain::equalsTo(_3583_a1); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::equalsTo(std::shared_ptr< monty::ndarray< double,1 > > _3583_a1)
{
  _checked_ptr_1<double> _ptr__3583_a1(_3583_a1 ? _3583_a1->raw() : nullptr, _3583_a1 ? _3583_a1->size(0) : 0);
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::EqualsTo,false,::mosek::fusion::Utils::Tools::arraycopy(_3583_a1),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_3583_a1)->size(0)))}));
}
// End mosek.fusion.Domain.equalsTo

// Begin mosek.fusion.Domain.equalsTo
// Method mosek.fusion.Domain.equalsTo @ bld/grindsted/final/default/src/fusion/domain.mbi:435:6-160
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::equalsTo
  ( double _3584_b,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _3585_dims) { return mosek::fusion::p_Domain::equalsTo(_3584_b,_3585_dims); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::equalsTo(double _3584_b,std::shared_ptr< monty::ndarray< int32_t,1 > > _3585_dims)
{
  _checked_ptr_1<int32_t> _ptr__3585_dims(_3585_dims ? _3585_dims->raw() : nullptr, _3585_dims ? _3585_dims->size(0) : 0);
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::EqualsTo,false,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3584_b)}),_3585_dims);
}
// End mosek.fusion.Domain.equalsTo

// Begin mosek.fusion.Domain.equalsTo
// Method mosek.fusion.Domain.equalsTo @ bld/grindsted/final/default/src/fusion/domain.mbi:434:6-166
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::equalsTo
  ( double _3586_b,
    int32_t _3587_m,
    int32_t _3588_n) { return mosek::fusion::p_Domain::equalsTo(_3586_b,_3587_m,_3588_n); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::equalsTo(double _3586_b,int32_t _3587_m,int32_t _3588_n)
{
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::EqualsTo,false,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3586_b)}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3587_m),(int32_t)(_3588_n)}));
}
// End mosek.fusion.Domain.equalsTo

// Begin mosek.fusion.Domain.equalsTo
// Method mosek.fusion.Domain.equalsTo @ bld/grindsted/final/default/src/fusion/domain.mbi:433:6-164
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::equalsTo
  ( double _3589_b,
    int32_t _3590_n) { return mosek::fusion::p_Domain::equalsTo(_3589_b,_3590_n); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::equalsTo(double _3589_b,int32_t _3590_n)
{
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::EqualsTo,false,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3589_b)}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3590_n)}));
}
// End mosek.fusion.Domain.equalsTo

// Begin mosek.fusion.Domain.equalsTo
// Method mosek.fusion.Domain.equalsTo @ bld/grindsted/final/default/src/fusion/domain.mbi:432:6-159
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::equalsTo
  ( double _3591_b) { return mosek::fusion::p_Domain::equalsTo(_3591_b); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::equalsTo(double _3591_b)
{
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::EqualsTo,true,std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >{(double)(_3591_b)}),nullptr);
}
// End mosek.fusion.Domain.equalsTo

// Begin mosek.fusion.Domain.unbounded
// Method mosek.fusion.Domain.unbounded @ bld/grindsted/final/default/src/fusion/domain.mbi:429:6-188
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::unbounded
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _3592_dims) { return mosek::fusion::p_Domain::unbounded(_3592_dims); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::unbounded(std::shared_ptr< monty::ndarray< int32_t,1 > > _3592_dims)
{
  _checked_ptr_1<int32_t> _ptr__3592_dims(_3592_dims ? _3592_dims->raw() : nullptr, _3592_dims ? _3592_dims->size(0) : 0);
  std::vector<int32_t> _11007_;
  for (int32_t _3593_i = (int)0, _11008_ = (int)((_3592_dims)->size(0)); _3593_i < _11008_ ; ++_3593_i)
  {
    _11007_.push_back(_ptr__3592_dims[_3593_i]);
  }
  auto _11009_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11007_.size()),_11007_.begin(),_11007_.end()));
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::IsFree,false,nullptr,_11009_);
}
// End mosek.fusion.Domain.unbounded

// Begin mosek.fusion.Domain.unbounded
// Method mosek.fusion.Domain.unbounded @ bld/grindsted/final/default/src/fusion/domain.mbi:428:6-163
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::unbounded
  ( int32_t _3594_m,
    int32_t _3595_n) { return mosek::fusion::p_Domain::unbounded(_3594_m,_3595_n); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::unbounded(int32_t _3594_m,int32_t _3595_n)
{
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::IsFree,false,nullptr,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3594_m),(int32_t)(_3595_n)}));
}
// End mosek.fusion.Domain.unbounded

// Begin mosek.fusion.Domain.unbounded
// Method mosek.fusion.Domain.unbounded @ bld/grindsted/final/default/src/fusion/domain.mbi:427:6-161
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::unbounded
  ( int32_t _3596_n) { return mosek::fusion::p_Domain::unbounded(_3596_n); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::unbounded(int32_t _3596_n)
{
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::IsFree,false,nullptr,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3596_n)}));
}
// End mosek.fusion.Domain.unbounded

// Begin mosek.fusion.Domain.unbounded
// Method mosek.fusion.Domain.unbounded @ bld/grindsted/final/default/src/fusion/domain.mbi:426:6-156
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::Domain::unbounded
  ( ) { return mosek::fusion::p_Domain::unbounded(); }
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::p_Domain::unbounded()
{
  return ::mosek::fusion::p_LinearDomain::_new_LinearDomain(::mosek::fusion::RelationKey::IsFree,true,nullptr,nullptr);
}
// End mosek.fusion.Domain.unbounded

void mosek::fusion::p_Domain::destroy()
{
}
void mosek::fusion::Domain::destroy() { mosek::fusion::p_Domain::_get_impl(this)->destroy(); }
// } class Domain
// class ExprParameter { // @ bld/grindsted/final/default/src/fusion/Parameter.monty:3547:4-3564:5
mosek::fusion::ExprParameter::ExprParameter(mosek::fusion::p_ExprParameter *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprParameter()" << this << std::endl; */ }
mosek::fusion::ExprParameter::~ExprParameter() {  /* std::cout << "~ExprParameter()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprParameter::p_ExprParameter
  (::mosek::fusion::ExprParameter * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprParameter.ctor @ bld/grindsted/final/default/src/fusion/Parameter.monty:3551:6-3554:7
mosek::fusion::ExprParameter::t mosek::fusion::p_ExprParameter::_new_ExprParameter
  (monty::rc_ptr< ::mosek::fusion::Parameter > _3597_p)
{ return new mosek::fusion::ExprParameter(_3597_p); }
mosek::fusion::ExprParameter::ExprParameter
  (monty::rc_ptr< ::mosek::fusion::Parameter > _3597_p) : 
   ExprParameter(new mosek::fusion::p_ExprParameter(this))
{ mosek::fusion::p_ExprParameter::_get_impl(this)->_initialize(_3597_p); }
void mosek::fusion::p_ExprParameter::_initialize  (monty::rc_ptr< ::mosek::fusion::Parameter > _3597_p)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_3597_p->__mosek_2fusion_2Expression__getModel(),_3597_p->getShape());
    mosek::fusion::p_ExprParameter::_get_impl(::mosek::fusion::ExprParameter::t(_pubthis))->p = _3597_p;
  }
}
// mosek.fusion.ExprParameter.ctor

// Begin mosek.fusion.ExprParameter.eval
// Method mosek.fusion.ExprParameter.eval @ bld/grindsted/final/default/src/fusion/Parameter.monty:3561:6-3563:7
void mosek::fusion::ExprParameter :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _3598_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _3599_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _3600_xs,bool _3601_cache_eval) { mosek::fusion::p_ExprParameter::_get_impl(this)->eval(_3598_rs,_3599_ws,_3600_xs,_3601_cache_eval); }
void mosek::fusion::p_ExprParameter::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _3598_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _3599_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _3600_xs,bool _3601_cache_eval)
{
  p->recursive_eval(_3598_rs,_3599_ws,_3600_xs,_3601_cache_eval);
}
// End mosek.fusion.ExprParameter.eval

// Begin mosek.fusion.ExprParameter.slice
// Method mosek.fusion.ExprParameter.slice @ bld/grindsted/final/default/src/fusion/Parameter.monty:3559:6-116
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ExprParameter :: __mosek_2fusion_2ExprParameter__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _3602_start,std::shared_ptr< monty::ndarray< int32_t,1 > > _3603_stop) { return mosek::fusion::p_ExprParameter::_get_impl(this)->__mosek_2fusion_2ExprParameter__slice(_3602_start,_3603_stop); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ExprParameter::slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _3602_start,std::shared_ptr< monty::ndarray< int32_t,1 > > _3603_stop) { return __mosek_2fusion_2ExprParameter__slice(_3602_start,_3603_stop); }
/* override: mosek.fusion.BaseExpression.slice*/
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ExprParameter::__mosek_2fusion_2BaseExpression__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _3602_start,std::shared_ptr< monty::ndarray< int32_t,1 > > _3603_stop) { return __mosek_2fusion_2ExprParameter__slice(_3602_start,_3603_stop); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_ExprParameter::__mosek_2fusion_2ExprParameter__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _3602_start,std::shared_ptr< monty::ndarray< int32_t,1 > > _3603_stop)
{
  _checked_ptr_1<int32_t> _ptr__3602_start(_3602_start ? _3602_start->raw() : nullptr, _3602_start ? _3602_start->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__3603_stop(_3603_stop ? _3603_stop->raw() : nullptr, _3603_stop ? _3603_stop->size(0) : 0);
  return (::mosek::fusion::p_ExprParameter::_new_ExprParameter(p->__mosek_2fusion_2Parameter__slice(_3602_start,_3603_stop))).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.ExprParameter.slice

// Begin mosek.fusion.ExprParameter.slice
// Method mosek.fusion.ExprParameter.slice @ bld/grindsted/final/default/src/fusion/Parameter.monty:3558:6-112
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ExprParameter :: __mosek_2fusion_2ExprParameter__slice(int32_t _3604_start,int32_t _3605_stop) { return mosek::fusion::p_ExprParameter::_get_impl(this)->__mosek_2fusion_2ExprParameter__slice(_3604_start,_3605_stop); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ExprParameter::slice(int32_t _3604_start,int32_t _3605_stop) { return __mosek_2fusion_2ExprParameter__slice(_3604_start,_3605_stop); }
/* override: mosek.fusion.BaseExpression.slice*/
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ExprParameter::__mosek_2fusion_2BaseExpression__slice(int32_t _3604_start,int32_t _3605_stop) { return __mosek_2fusion_2ExprParameter__slice(_3604_start,_3605_stop); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_ExprParameter::__mosek_2fusion_2ExprParameter__slice(int32_t _3604_start,int32_t _3605_stop)
{
  return (::mosek::fusion::p_ExprParameter::_new_ExprParameter(p->__mosek_2fusion_2Parameter__slice(_3604_start,_3605_stop))).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.ExprParameter.slice

// Begin mosek.fusion.ExprParameter.toString
// Method mosek.fusion.ExprParameter.toString @ bld/grindsted/final/default/src/fusion/Parameter.monty:3556:6-128
std::string mosek::fusion::ExprParameter :: toString() { return mosek::fusion::p_ExprParameter::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprParameter::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprParameter("))->__mosek_2fusion_2Utils_2StringBuffer__a(p->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprParameter.toString

void mosek::fusion::p_ExprParameter::destroy()
{
  p.reset();
}
void mosek::fusion::ExprParameter::destroy() { mosek::fusion::p_ExprParameter::_get_impl(this)->destroy(); }
// } class ExprParameter
// class Param { // @ bld/grindsted/final/default/src/fusion/Parameter.monty:3421:4-3544:5
mosek::fusion::Param::Param(mosek::fusion::p_Param *_impl) : _impl(_impl) { /*std::cout << "Param() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::Param::~Param() { delete _impl; _impl = nullptr; }
mosek::fusion::p_Param::p_Param
  (::mosek::fusion::Param * _pubthis) :     _pubthis(_pubthis)
{}
// Begin mosek.fusion.Param.repeat
// Method mosek.fusion.Param.repeat @ bld/grindsted/final/default/src/fusion/Parameter.monty:3543:6-122
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Param::repeat
  ( monty::rc_ptr< ::mosek::fusion::Parameter > _3606_p,
    int32_t _3607_n,
    int32_t _3608_dim) { return mosek::fusion::p_Param::repeat(_3606_p,_3607_n,_3608_dim); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Param::repeat(monty::rc_ptr< ::mosek::fusion::Parameter > _3606_p,int32_t _3607_n,int32_t _3608_dim)
{
  std::vector<monty::rc_ptr< ::mosek::fusion::Parameter >> _11010_;
  for (int32_t _3609_i = (int)0, _11011_ = _3607_n; _3609_i < _11011_ ; ++_3609_i)
  {
    _11010_.push_back(_3606_p);
  }
  auto _11012_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 >(monty::shape(_11010_.size()),_11010_.begin(),_11010_.end()));
  return ::mosek::fusion::p_Param::stack(_3608_dim,_11012_);
}
// End mosek.fusion.Param.repeat

// Begin mosek.fusion.Param.stack
// Method mosek.fusion.Param.stack @ bld/grindsted/final/default/src/fusion/Parameter.monty:3542:6-136
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Param::stack
  ( int32_t _3610_dim,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3611_p1,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3612_p2,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3613_p3) { return mosek::fusion::p_Param::stack(_3610_dim,_3611_p1,_3612_p2,_3613_p3); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Param::stack(int32_t _3610_dim,monty::rc_ptr< ::mosek::fusion::Parameter > _3611_p1,monty::rc_ptr< ::mosek::fusion::Parameter > _3612_p2,monty::rc_ptr< ::mosek::fusion::Parameter > _3613_p3)
{
  return ::mosek::fusion::p_Param::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 >{::monty::rc_ptr<::mosek::fusion::Parameter>(_3611_p1.get()),::monty::rc_ptr<::mosek::fusion::Parameter>(_3612_p2.get()),::monty::rc_ptr<::mosek::fusion::Parameter>(_3613_p3.get())}),_3610_dim);
}
// End mosek.fusion.Param.stack

// Begin mosek.fusion.Param.stack
// Method mosek.fusion.Param.stack @ bld/grindsted/final/default/src/fusion/Parameter.monty:3541:6-119
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Param::stack
  ( int32_t _3614_dim,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3615_p1,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3616_p2) { return mosek::fusion::p_Param::stack(_3614_dim,_3615_p1,_3616_p2); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Param::stack(int32_t _3614_dim,monty::rc_ptr< ::mosek::fusion::Parameter > _3615_p1,monty::rc_ptr< ::mosek::fusion::Parameter > _3616_p2)
{
  return ::mosek::fusion::p_Param::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 >{::monty::rc_ptr<::mosek::fusion::Parameter>(_3615_p1.get()),::monty::rc_ptr<::mosek::fusion::Parameter>(_3616_p2.get())}),_3614_dim);
}
// End mosek.fusion.Param.stack

// Begin mosek.fusion.Param.stack
// Method mosek.fusion.Param.stack @ bld/grindsted/final/default/src/fusion/Parameter.monty:3540:6-95
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Param::stack
  ( int32_t _3617_dim,
    std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > > _3618_p) { return mosek::fusion::p_Param::stack(_3617_dim,_3618_p); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Param::stack(int32_t _3617_dim,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > > _3618_p)
{
  return ::mosek::fusion::p_Param::dstack(_3618_p,_3617_dim);
}
// End mosek.fusion.Param.stack

// Begin mosek.fusion.Param.stack
// Method mosek.fusion.Param.stack @ bld/grindsted/final/default/src/fusion/Parameter.monty:3539:6-119
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Param::stack
  ( std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > >,1 > > _3619_p) { return mosek::fusion::p_Param::stack(_3619_p); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Param::stack(std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > >,1 > > _3619_p)
{
  std::vector<monty::rc_ptr< ::mosek::fusion::Parameter >> _11013_;
  for (int32_t _3620_i = (int)0, _11014_ = (int)((_3619_p)->size(0)); _3620_i < _11014_ ; ++_3620_i)
  {
    _11013_.push_back(::mosek::fusion::p_Param::hstack(((*_3619_p)(_3620_i))));
  }
  auto _11015_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 >(monty::shape(_11013_.size()),_11013_.begin(),_11013_.end()));
  return ::mosek::fusion::p_Param::vstack(_11015_);
}
// End mosek.fusion.Param.stack

// Begin mosek.fusion.Param.hstack
// Method mosek.fusion.Param.hstack @ bld/grindsted/final/default/src/fusion/Parameter.monty:3538:6-123
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Param::hstack
  ( monty::rc_ptr< ::mosek::fusion::Parameter > _3621_p1,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3622_p2,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3623_p3) { return mosek::fusion::p_Param::hstack(_3621_p1,_3622_p2,_3623_p3); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Param::hstack(monty::rc_ptr< ::mosek::fusion::Parameter > _3621_p1,monty::rc_ptr< ::mosek::fusion::Parameter > _3622_p2,monty::rc_ptr< ::mosek::fusion::Parameter > _3623_p3)
{
  return ::mosek::fusion::p_Param::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 >{::monty::rc_ptr<::mosek::fusion::Parameter>(_3621_p1.get()),::monty::rc_ptr<::mosek::fusion::Parameter>(_3622_p2.get()),::monty::rc_ptr<::mosek::fusion::Parameter>(_3623_p3.get())}),(int)1);
}
// End mosek.fusion.Param.hstack

// Begin mosek.fusion.Param.hstack
// Method mosek.fusion.Param.hstack @ bld/grindsted/final/default/src/fusion/Parameter.monty:3537:6-107
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Param::hstack
  ( monty::rc_ptr< ::mosek::fusion::Parameter > _3624_p1,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3625_p2) { return mosek::fusion::p_Param::hstack(_3624_p1,_3625_p2); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Param::hstack(monty::rc_ptr< ::mosek::fusion::Parameter > _3624_p1,monty::rc_ptr< ::mosek::fusion::Parameter > _3625_p2)
{
  return ::mosek::fusion::p_Param::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 >{::monty::rc_ptr<::mosek::fusion::Parameter>(_3624_p1.get()),::monty::rc_ptr<::mosek::fusion::Parameter>(_3625_p2.get())}),(int)1);
}
// End mosek.fusion.Param.hstack

// Begin mosek.fusion.Param.hstack
// Method mosek.fusion.Param.hstack @ bld/grindsted/final/default/src/fusion/Parameter.monty:3536:6-83
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Param::hstack
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > > _3626_p) { return mosek::fusion::p_Param::hstack(_3626_p); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Param::hstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > > _3626_p)
{
  return ::mosek::fusion::p_Param::dstack(_3626_p,(int)1);
}
// End mosek.fusion.Param.hstack

// Begin mosek.fusion.Param.vstack
// Method mosek.fusion.Param.vstack @ bld/grindsted/final/default/src/fusion/Parameter.monty:3535:6-123
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Param::vstack
  ( monty::rc_ptr< ::mosek::fusion::Parameter > _3627_p1,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3628_p2,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3629_p3) { return mosek::fusion::p_Param::vstack(_3627_p1,_3628_p2,_3629_p3); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Param::vstack(monty::rc_ptr< ::mosek::fusion::Parameter > _3627_p1,monty::rc_ptr< ::mosek::fusion::Parameter > _3628_p2,monty::rc_ptr< ::mosek::fusion::Parameter > _3629_p3)
{
  return ::mosek::fusion::p_Param::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 >{::monty::rc_ptr<::mosek::fusion::Parameter>(_3627_p1.get()),::monty::rc_ptr<::mosek::fusion::Parameter>(_3628_p2.get()),::monty::rc_ptr<::mosek::fusion::Parameter>(_3629_p3.get())}),(int)0);
}
// End mosek.fusion.Param.vstack

// Begin mosek.fusion.Param.vstack
// Method mosek.fusion.Param.vstack @ bld/grindsted/final/default/src/fusion/Parameter.monty:3534:6-107
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Param::vstack
  ( monty::rc_ptr< ::mosek::fusion::Parameter > _3630_p1,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3631_p2) { return mosek::fusion::p_Param::vstack(_3630_p1,_3631_p2); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Param::vstack(monty::rc_ptr< ::mosek::fusion::Parameter > _3630_p1,monty::rc_ptr< ::mosek::fusion::Parameter > _3631_p2)
{
  return ::mosek::fusion::p_Param::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 >{::monty::rc_ptr<::mosek::fusion::Parameter>(_3630_p1.get()),::monty::rc_ptr<::mosek::fusion::Parameter>(_3631_p2.get())}),(int)0);
}
// End mosek.fusion.Param.vstack

// Begin mosek.fusion.Param.vstack
// Method mosek.fusion.Param.vstack @ bld/grindsted/final/default/src/fusion/Parameter.monty:3533:6-83
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::Param::vstack
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > > _3632_p) { return mosek::fusion::p_Param::vstack(_3632_p); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Param::vstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > > _3632_p)
{
  return ::mosek::fusion::p_Param::dstack(_3632_p,(int)0);
}
// End mosek.fusion.Param.vstack

// Begin mosek.fusion.Param.dstack
// Method mosek.fusion.Param.dstack @ bld/grindsted/final/default/src/fusion/Parameter.monty:3422:6-3531:7
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_Param::dstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Parameter >,1 > > _3633_p,int32_t _3634_dim)
{
  if ((_3634_dim < (int)0))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid stacking dimension"));
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3635_dimsizes = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)((_3633_p)->size(0)))));
  _checked_ptr_1<int32_t> _ptr__3635_dimsizes(_3635_dimsizes ? _3635_dimsizes->raw() : nullptr,_3635_dimsizes ? _3635_dimsizes->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3636_itemsizes = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)((_3633_p)->size(0)))));
  _checked_ptr_1<int64_t> _ptr__3636_itemsizes(_3636_itemsizes ? _3636_itemsizes->raw() : nullptr,_3636_itemsizes ? _3636_itemsizes->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3637_rshape;
  _checked_ptr_1<int32_t> _ptr__3637_rshape(_3637_rshape ? _3637_rshape->raw() : nullptr,_3637_rshape ? _3637_rshape->size(0) : 0);
  int32_t _3638_rnd = ((*_3633_p)((int)0))->getND();
  int32_t _11016_ = (int)1;
  int32_t _11017_ = (int)((_3633_p)->size(0));
  for (int32_t _3639_i = _11016_; _3639_i < _11017_; ++_3639_i)
  {
    {
      if ((_3638_rnd < ((*_3633_p)(_3639_i))->getND()))
      {
        {
          _3638_rnd = ((*_3633_p)(_3639_i))->getND();
        }
      }
      {}
    }
  }
  if ((_3634_dim < _3638_rnd))
  {
    {
      int32_t _3640_i = (int)0;
      while ( ((_3640_i < (int)((_3633_p)->size(0))) && (_3638_rnd != ((*_3633_p)(_3640_i))->getND())) )
      {
        {
          ++ _3640_i;
        }
      }
      _3637_rshape = ((*_3633_p)(_3640_i))->getShape();
      _ptr__3637_rshape.update(_3637_rshape ? _3637_rshape->raw() : nullptr, _3637_rshape ? _3637_rshape->size(0) : 0);
      {
        int32_t _3641_i = (int)0;
        while ( ((_3641_i < (int)((_3633_p)->size(0))) && (_3638_rnd != ((*_3633_p)(_3641_i))->getND())) )
        {
          {
            ++ _3641_i;
          }
        }
        _3637_rshape = ((*_3633_p)(_3641_i))->getShape();
        _ptr__3637_rshape.update(_3637_rshape ? _3637_rshape->raw() : nullptr, _3637_rshape ? _3637_rshape->size(0) : 0);
      }
    }
  }
  else
  {
    {
      std::vector<int32_t> _11018_;
      for (int32_t _3642_i = (int)0, _11019_ = safe_add( _3634_dim,(int)1 ); _3642_i < _11019_ ; ++_3642_i)
      {
        _11018_.push_back((int)1);
      }
      auto _11020_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11018_.size()),_11018_.begin(),_11018_.end()));
      _3637_rshape = _11020_;
      _ptr__3637_rshape.update(_3637_rshape ? _3637_rshape->raw() : nullptr, _3637_rshape ? _3637_rshape->size(0) : 0);
      {
        int32_t _3643_i = (int)0;
        while ( ((_3643_i < (int)((_3633_p)->size(0))) && (_3638_rnd != ((*_3633_p)(_3643_i))->getND())) )
        {
          {
            ++ _3643_i;
          }
        }
        int32_t _3644_ndi = ((*_3633_p)(_3643_i))->getND();
        std::shared_ptr< monty::ndarray< int32_t,1 > > _3645_shapei = ((*_3633_p)(_3643_i))->getShape();
        _checked_ptr_1<int32_t> _ptr__3645_shapei(_3645_shapei ? _3645_shapei->raw() : nullptr,_3645_shapei ? _3645_shapei->size(0) : 0);
        int32_t _11021_ = (int)0;
        int32_t _11022_ = _3644_ndi;
        for (int32_t _3646_j = _11021_; _3646_j < _11022_; ++_3646_j)
        {
          {
            _ptr__3637_rshape[_3646_j] = _ptr__3645_shapei[_3646_j];
          }
        }
      }
    }
  }
  _3638_rnd = (int)((_3637_rshape)->size(0));
  int32_t _3647_dimsize = (int)0;
  {
    bool _3648_dimerr = false;
    int32_t _11023_ = (int)0;
    int32_t _11024_ = (int)((_3633_p)->size(0));
    for (int32_t _3649_i = _11023_; _3649_i < _11024_; ++_3649_i)
    {
      {
        std::shared_ptr< monty::ndarray< int32_t,1 > > _3650_shapei = ((*_3633_p)(_3649_i))->getShape();
        _checked_ptr_1<int32_t> _ptr__3650_shapei(_3650_shapei ? _3650_shapei->raw() : nullptr,_3650_shapei ? _3650_shapei->size(0) : 0);
        _ptr__3636_itemsizes[_3649_i] = ::mosek::fusion::p_Set::size(_3650_shapei);
        int32_t _11025_ = (int)0;
        int32_t _11026_ = (int)((_3650_shapei)->size(0));
        for (int32_t _3651_j = _11025_; _3651_j < _11026_; ++_3651_j)
        {
          {
            _3648_dimerr = (_3648_dimerr && ((_3651_j == _3634_dim) || (_ptr__3650_shapei[_3651_j] == _ptr__3637_rshape[_3651_j])));
          }
        }
        if ((_3634_dim < (int)((_3650_shapei)->size(0))))
        {
          {
            _ptr__3635_dimsizes[_3649_i] = _ptr__3650_shapei[_3634_dim];
            _3647_dimsize += _ptr__3650_shapei[_3634_dim];
            int32_t _11027_ = (int)((_3650_shapei)->size(0));
            int32_t _11028_ = _3638_rnd;
            for (int32_t _3652_j = _11027_; _3652_j < _11028_; ++_3652_j)
            {
              {
                _3648_dimerr = (_3648_dimerr && ((_3652_j == _3634_dim) || (_ptr__3637_rshape[_3652_j] == (int)1)));
              }
            }
          }
        }
        else
        {
          {
            _3647_dimsize += (int)1;
            _ptr__3635_dimsizes[_3649_i] = (int)1;
          }
        }
      }
    }
    if (_3648_dimerr)
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching dimensions for stacking"));
      }
    }
    {}
  }
  _ptr__3637_rshape[_3634_dim] = _3647_dimsize;
  std::vector<int32_t> _11029_;
  for (int32_t _3654_i = (int)0, _11030_ = (int)((_3633_p)->size(0)); _3654_i < _11030_ ; ++_3654_i)
  {
    _11029_.push_back(((*_3633_p)(_3654_i))->getNumNonzero());
  }
  auto _11031_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11029_.size()),_11029_.begin(),_11029_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3653_nnzs = _11031_;
  _checked_ptr_1<int32_t> _ptr__3653_nnzs(_3653_nnzs ? _3653_nnzs->raw() : nullptr,_3653_nnzs ? _3653_nnzs->size(0) : 0);
  int32_t _3655_rnnz = (int)0;
  int32_t _11032_ = (int)0;
  int32_t _11033_ = (int)((_3653_nnzs)->size(0));
  for (int32_t _3656_i = _11032_; _3656_i < _11033_; ++_3656_i)
  {
    {
      _3655_rnnz += _ptr__3653_nnzs[_3656_i];
    }
  }
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3657_sp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_3655_rnnz)));
  _checked_ptr_1<int64_t> _ptr__3657_sp(_3657_sp ? _3657_sp->raw() : nullptr,_3657_sp ? _3657_sp->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3658_idx = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3655_rnnz)));
  _checked_ptr_1<int32_t> _ptr__3658_idx(_3658_idx ? _3658_idx->raw() : nullptr,_3658_idx ? _3658_idx->size(0) : 0);
  int64_t _3659_dim0 = (int)1;
  int32_t _11034_ = (int)0;
  int32_t _11035_ = _3634_dim;
  for (int32_t _3660_i = _11034_; _3660_i < _11035_; ++_3660_i)
  {
    {
      _3659_dim0 *= _ptr__3637_rshape[_3660_i];
    }
  }
  int64_t _3661_dim1 = _3647_dimsize;
  int64_t _3662_dim2 = (int)1;
  int32_t _11036_ = safe_add( _3634_dim,(int)1 );
  int32_t _11037_ = _3638_rnd;
  for (int32_t _3663_i = _11036_; _3663_i < _11037_; ++_3663_i)
  {
    {
      _3662_dim2 *= _ptr__3637_rshape[_3663_i];
    }
  }
  {
    int32_t _3664_ofs = (int)0;
    int64_t _3665_ofsdim = (int)0;
    int32_t _11038_ = (int)0;
    int32_t _11039_ = (int)((_3633_p)->size(0));
    for (int32_t _3666_i = _11038_; _3666_i < _11039_; ++_3666_i)
    {
      {
        int32_t _3667_ni = ((*_3633_p)(_3666_i))->getNumNonzero();
        ((*_3633_p)(_3666_i))->getSp(_3657_sp,_3664_ofs);
        ((*_3633_p)(_3666_i))->getAllIndexes(_3658_idx,_3664_ofs);
        if ((_3634_dim == (int)0))
        {
          {
            int32_t _11040_ = _3664_ofs;
            int32_t _11041_ = safe_add( _3664_ofs,_3667_ni );
            for (int32_t _3668_j = _11040_; _3668_j < _11041_; ++_3668_j)
            {
              {
                _ptr__3657_sp[_3668_j] += _3665_ofsdim;
              }
            }
            _3665_ofsdim += _ptr__3636_itemsizes[_3666_i];
          }
        }
        else
        {
          {
            int32_t _11042_ = _3664_ofs;
            int32_t _11043_ = safe_add( _3664_ofs,_3667_ni );
            for (int32_t _3669_j = _11042_; _3669_j < _11043_; ++_3669_j)
            {
              {
                int64_t _3670_i0 = (_ptr__3657_sp[_3669_j] / safe_mul( _ptr__3635_dimsizes[_3666_i],_3662_dim2 ));
                int64_t _3671_i1 = ((_ptr__3657_sp[_3669_j] / _3662_dim2) % _ptr__3635_dimsizes[_3666_i]);
                int64_t _3672_i2 = (_ptr__3657_sp[_3669_j] % _3662_dim2);
                _ptr__3657_sp[_3669_j] = safe_add( safe_add( safe_mul( _3670_i0,safe_mul( _3647_dimsize,_3662_dim2 ) ),safe_mul( safe_add( _3671_i1,_3665_ofsdim ),_3662_dim2 ) ),_3672_i2 );
              }
            }
            _3665_ofsdim += _ptr__3635_dimsizes[_3666_i];
          }
        }
        _3664_ofs += _3667_ni;
      }
    }
  }
  int32_t _3673_maxdim = _ptr__3637_rshape[(int)0];
  int32_t _11044_ = (int)1;
  int32_t _11045_ = _3638_rnd;
  for (int32_t _3674_i = _11044_; _3674_i < _11045_; ++_3674_i)
  {
    {
      if ((_3673_maxdim < _ptr__3637_rshape[_3674_i]))
      {
        {
          _3673_maxdim = _ptr__3637_rshape[_3674_i];
        }
      }
      {}
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3675_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _3673_maxdim,(int)1 ))));
  _checked_ptr_1<int32_t> _ptr__3675_ptr(_3675_ptr ? _3675_ptr->raw() : nullptr,_3675_ptr ? _3675_ptr->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3676_perm = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3655_rnnz)));
  _checked_ptr_1<int32_t> _ptr__3676_perm(_3676_perm ? _3676_perm->raw() : nullptr,_3676_perm ? _3676_perm->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3677_perm2 = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_3655_rnnz)));
  _checked_ptr_1<int32_t> _ptr__3677_perm2(_3677_perm2 ? _3677_perm2->raw() : nullptr,_3677_perm2 ? _3677_perm2->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3678_rstrides = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_3638_rnd)));
  _checked_ptr_1<int64_t> _ptr__3678_rstrides(_3678_rstrides ? _3678_rstrides->raw() : nullptr,_3678_rstrides ? _3678_rstrides->size(0) : 0);
  _ptr__3678_rstrides[(_3638_rnd - (int)1)] = (int)1;
  int32_t _11046_ = (int)1;
  int32_t _11047_ = _3638_rnd;
  for (int32_t _3679_i = _11046_; _3679_i < _11047_; ++_3679_i)
  {
    {
      _ptr__3678_rstrides[((_3638_rnd - _3679_i) - (int)1)] = safe_mul( _ptr__3678_rstrides[(_3638_rnd - _3679_i)],_ptr__3637_rshape[(_3638_rnd - _3679_i)] );
    }
  }
  int32_t _11048_ = (int)0;
  int32_t _11049_ = _3655_rnnz;
  for (int32_t _3680_i = _11048_; _3680_i < _11049_; ++_3680_i)
  {
    {
      _ptr__3676_perm[_3680_i] = _3680_i;
    }
  }
  int32_t _11050_ = (int)0;
  int32_t _11051_ = _3638_rnd;
  for (int32_t _3681_d_ = _11050_; _3681_d_ < _11051_; ++_3681_d_)
  {
    {
      int32_t _3682_d = ((_3638_rnd - _3681_d_) - (int)1);
      int32_t _11052_ = (int)0;
      int32_t _11053_ = safe_add( _3673_maxdim,(int)1 );
      for (int32_t _3683_i = _11052_; _3683_i < _11053_; ++_3683_i)
      {
        {
          _ptr__3675_ptr[_3683_i] = (int)0;
        }
      }
      int32_t _11054_ = (int)0;
      int32_t _11055_ = _3655_rnnz;
      for (int32_t _3684_i = _11054_; _3684_i < _11055_; ++_3684_i)
      {
        {
          ++ _ptr__3675_ptr[safe_add( (int)1,((_ptr__3657_sp[_3684_i] / _ptr__3678_rstrides[_3682_d]) % _ptr__3637_rshape[_3682_d]) )];
        }
      }
      int32_t _11056_ = (int)0;
      int32_t _11057_ = _3673_maxdim;
      for (int32_t _3685_i = _11056_; _3685_i < _11057_; ++_3685_i)
      {
        {
          _ptr__3675_ptr[safe_add( _3685_i,(int)1 )] += _ptr__3675_ptr[_3685_i];
        }
      }
      int32_t _11058_ = (int)0;
      int32_t _11059_ = _3655_rnnz;
      for (int32_t _3686_i = _11058_; _3686_i < _11059_; ++_3686_i)
      {
        {
          int64_t _3687_idx = ((_ptr__3657_sp[_ptr__3676_perm[_3686_i]] / _ptr__3678_rstrides[_3682_d]) % _ptr__3637_rshape[_3682_d]);
          _ptr__3677_perm2[_ptr__3675_ptr[_3687_idx]] = _ptr__3676_perm[_3686_i];
          ++ _ptr__3675_ptr[_3687_idx];
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3688_tmp = _3677_perm2;
      _checked_ptr_1<int32_t> _ptr__3688_tmp(_3688_tmp ? _3688_tmp->raw() : nullptr,_3688_tmp ? _3688_tmp->size(0) : 0);
      _3677_perm2 = _3676_perm;
      _ptr__3677_perm2.update(_3677_perm2 ? _3677_perm2->raw() : nullptr, _3677_perm2 ? _3677_perm2->size(0) : 0);
      _3676_perm = _3688_tmp;
      _ptr__3676_perm.update(_3676_perm ? _3676_perm->raw() : nullptr, _3676_perm ? _3676_perm->size(0) : 0);
    }
  }
  std::vector<int64_t> _11060_;
  for (int32_t _3690_i = (int)0, _11061_ = _3655_rnnz; _3690_i < _11061_ ; ++_3690_i)
  {
    _11060_.push_back(_ptr__3657_sp[_ptr__3676_perm[_3690_i]]);
  }
  auto _11062_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_11060_.size()),_11060_.begin(),_11060_.end()));
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3689_rsp = _11062_;
  _checked_ptr_1<int64_t> _ptr__3689_rsp(_3689_rsp ? _3689_rsp->raw() : nullptr,_3689_rsp ? _3689_rsp->size(0) : 0);
  std::vector<int32_t> _11063_;
  for (int32_t _3692_i = (int)0, _11064_ = _3655_rnnz; _3692_i < _11064_ ; ++_3692_i)
  {
    _11063_.push_back(_ptr__3658_idx[_ptr__3676_perm[_3692_i]]);
  }
  auto _11065_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11063_.size()),_11063_.begin(),_11063_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3691_ridx = _11065_;
  _checked_ptr_1<int32_t> _ptr__3691_ridx(_3691_ridx ? _3691_ridx->raw() : nullptr,_3691_ridx ? _3691_ridx->size(0) : 0);
  return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(((*_3633_p)((int)0))->__mosek_2fusion_2Expression__getModel(),_3637_rshape,_3689_rsp,_3691_ridx)).as<::mosek::fusion::Parameter>();
}
// End mosek.fusion.Param.dstack

void mosek::fusion::p_Param::destroy()
{
}
void mosek::fusion::Param::destroy() { mosek::fusion::p_Param::_get_impl(this)->destroy(); }
// } class Param
// class ExprMulParamScalarExpr { // @ bld/grindsted/final/default/src/fusion/Parameter.monty:3189:4-3334:5
mosek::fusion::ExprMulParamScalarExpr::ExprMulParamScalarExpr(mosek::fusion::p_ExprMulParamScalarExpr *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulParamScalarExpr()" << this << std::endl; */ }
mosek::fusion::ExprMulParamScalarExpr::~ExprMulParamScalarExpr() {  /* std::cout << "~ExprMulParamScalarExpr()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulParamScalarExpr::p_ExprMulParamScalarExpr
  (::mosek::fusion::ExprMulParamScalarExpr * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulParamScalarExpr.ctor @ bld/grindsted/final/default/src/fusion/Parameter.monty:3193:6-3199:7
mosek::fusion::ExprMulParamScalarExpr::t mosek::fusion::p_ExprMulParamScalarExpr::_new_ExprMulParamScalarExpr
  (monty::rc_ptr< ::mosek::fusion::Parameter > _3693_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _3694_e)
{ return new mosek::fusion::ExprMulParamScalarExpr(_3693_p,_3694_e); }
mosek::fusion::ExprMulParamScalarExpr::ExprMulParamScalarExpr
  (monty::rc_ptr< ::mosek::fusion::Parameter > _3693_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _3694_e) : 
   ExprMulParamScalarExpr(new mosek::fusion::p_ExprMulParamScalarExpr(this))
{ mosek::fusion::p_ExprMulParamScalarExpr::_get_impl(this)->_initialize(_3693_p,_3694_e); }
void mosek::fusion::p_ExprMulParamScalarExpr::_initialize  (monty::rc_ptr< ::mosek::fusion::Parameter > _3693_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _3694_e)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(::mosek::fusion::p_BaseExpression::modelFrom(_3693_p->__mosek_2fusion_2Expression__getModel(),_3694_e),_3693_p->getShape());
    mosek::fusion::p_ExprMulParamScalarExpr::_get_impl(::mosek::fusion::ExprMulParamScalarExpr::t(_pubthis))->p = _3693_p;
    mosek::fusion::p_ExprMulParamScalarExpr::_get_impl(::mosek::fusion::ExprMulParamScalarExpr::t(_pubthis))->e = _3694_e;
    if ((_3694_e->getND() != (int)0))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions for multiplication"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprMulParamScalarExpr.ctor

// Begin mosek.fusion.ExprMulParamScalarExpr.eval
// Method mosek.fusion.ExprMulParamScalarExpr.eval @ bld/grindsted/final/default/src/fusion/Parameter.monty:3203:6-3333:7
void mosek::fusion::ExprMulParamScalarExpr :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _3695_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _3696_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _3697_xs,bool _3698_cache_eval) { mosek::fusion::p_ExprMulParamScalarExpr::_get_impl(this)->eval(_3695_rs,_3696_ws,_3697_xs,_3698_cache_eval); }
void mosek::fusion::p_ExprMulParamScalarExpr::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _3695_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _3696_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _3697_xs,bool _3698_cache_eval)
{
  e->recursive_eval(_3696_ws,_3695_rs,_3697_xs,_3698_cache_eval);
  _3696_ws->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3699_wi32 = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__3699_wi32(_3699_wi32 ? _3699_wi32->raw() : nullptr,_3699_wi32 ? _3699_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3700_wi64 = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__3700_wi64(_3700_wi64 ? _3700_wi64->raw() : nullptr,_3700_wi64 ? _3700_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _3701_wf64 = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->f64;
  _checked_ptr_1<double> _ptr__3701_wf64(_3701_wf64 ? _3701_wf64->raw() : nullptr,_3701_wf64 ? _3701_wf64->size(0) : 0);
  int32_t _3702_nd = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->nd;
  if ((_3702_nd != (int)0))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operator shape for multiplication"));
    }
  }
  {}
  int32_t _3703_nelem = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->nelem;
  int32_t _3704_nnz = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->nnz;
  bool _3705_hassp = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->hassp;
  int32_t _3706_ptr = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->ptr_base;
  int32_t _3707_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->ncodeatom;
  int32_t _3708_sp = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->sp_base;
  int32_t _3709_nidxs = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->nidxs_base;
  int32_t _3710_cof = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->cof_base;
  int32_t _3711_cconst = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->cconst_base;
  int32_t _3712_ptrcode = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->codeptr_base;
  int32_t _3713_code = mosek::fusion::p_WorkStack::_get_impl(_3696_ws)->code_base;
  int32_t _3714_rnd = p->getND();
  int32_t _3715_rnelem = p->getNumNonzero();
  int32_t _3716_rnnz = safe_mul( _3704_nnz,p->getNumNonzero() );
  bool _3717_rhassp = (p->getNumNonzero() < p->getSize());
  int32_t _11066_;
  bool _11067_ = (_3707_ncodeatom > (int)0);
  if (_11067_)
  {
    _11066_ = safe_add( safe_mul( _3707_ncodeatom,_3715_rnelem ),safe_mul( _3716_rnnz,(int)4 ) );
  }
  else
  {
    _11066_ = safe_mul( _3716_rnnz,(int)3 );
  }
  int32_t _3718_rncodeatom = _11066_;
  int32_t _3719_pidxs = _3697_xs->alloci32(p->getNumNonzero());
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3720_xi32 = mosek::fusion::p_WorkStack::_get_impl(_3697_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__3720_xi32(_3720_xi32 ? _3720_xi32->raw() : nullptr,_3720_xi32 ? _3720_xi32->size(0) : 0);
  p->getAllIndexes(_3720_xi32,_3719_pidxs);
  _3695_rs->alloc_expr(_3714_rnd,_3715_rnelem,_3716_rnnz,_3717_rhassp,_3718_rncodeatom);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3721_ri64 = mosek::fusion::p_WorkStack::_get_impl(_3695_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__3721_ri64(_3721_ri64 ? _3721_ri64->raw() : nullptr,_3721_ri64 ? _3721_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _3722_rf64 = mosek::fusion::p_WorkStack::_get_impl(_3695_rs)->f64;
  _checked_ptr_1<double> _ptr__3722_rf64(_3722_rf64 ? _3722_rf64->raw() : nullptr,_3722_rf64 ? _3722_rf64->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3723_ri32 = mosek::fusion::p_WorkStack::_get_impl(_3695_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__3723_ri32(_3723_ri32 ? _3723_ri32->raw() : nullptr,_3723_ri32 ? _3723_ri32->size(0) : 0);
  int32_t _3724_rptr = mosek::fusion::p_WorkStack::_get_impl(_3695_rs)->ptr_base;
  int32_t _3725_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_3695_rs)->nidxs_base;
  int32_t _3726_rsp = mosek::fusion::p_WorkStack::_get_impl(_3695_rs)->sp_base;
  int32_t _3727_rcof = mosek::fusion::p_WorkStack::_get_impl(_3695_rs)->cof_base;
  bool _3728_rhassp = mosek::fusion::p_WorkStack::_get_impl(_3695_rs)->hassp;
  int32_t _3729_rshape = mosek::fusion::p_WorkStack::_get_impl(_3695_rs)->shape_base;
  int32_t _3730_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_3695_rs)->codeptr_base;
  int32_t _3731_rcode = mosek::fusion::p_WorkStack::_get_impl(_3695_rs)->code_base;
  int32_t _3732_rcconst = mosek::fusion::p_WorkStack::_get_impl(_3695_rs)->cconst_base;
  {
    int32_t _11068_ = (int)0;
    int32_t _11069_ = _3716_rnnz;
    for (int32_t _3733_i = _11068_; _3733_i < _11069_; ++_3733_i)
    {
      {
        _ptr__3722_rf64[safe_add( _3727_rcof,_3733_i )] = 0.0;
      }
    }
    int32_t _11070_ = (int)0;
    int32_t _11071_ = safe_add( _3715_rnelem,(int)1 );
    for (int32_t _3734_i = _11070_; _3734_i < _11071_; ++_3734_i)
    {
      {
        _ptr__3723_ri32[safe_add( _3724_rptr,_3734_i )] = safe_mul( _3734_i,_3704_nnz );
      }
    }
    int32_t _11072_ = (int)0;
    int32_t _11073_ = _3714_rnd;
    for (int32_t _3735_i = _11072_; _3735_i < _11073_; ++_3735_i)
    {
      {
        _ptr__3723_ri32[safe_add( _3729_rshape,_3735_i )] = p->getDim(_3735_i);
      }
    }
    if (_3728_rhassp)
    {
      {
        p->getSp(_3721_ri64,_3726_rsp);
      }
    }
    {}
    int32_t _11074_ = (int)0;
    int32_t _11075_ = _3716_rnnz;
    for (int32_t _3736_i = _11074_; _3736_i < _11075_; ++_3736_i)
    {
      {
        _ptr__3721_ri64[safe_add( _3725_rnidxs,_3736_i )] = (-(int)999);
      }
    }
    {
      int32_t _3737_k = (int)0;
      int32_t _11076_ = (int)0;
      int32_t _11077_ = _3715_rnelem;
      for (int32_t _3738_i = _11076_; _3738_i < _11077_; ++_3738_i)
      {
        {
          int32_t _11078_ = (int)0;
          int32_t _11079_ = _3704_nnz;
          for (int32_t _3739_j = _11078_; _3739_j < _11079_; ++_3739_j)
          {
            {
              _ptr__3721_ri64[safe_add( _3725_rnidxs,_3737_k )] = _ptr__3700_wi64[safe_add( _3709_nidxs,_3739_j )];
              ++ _3737_k;
            }
          }
        }
      }
    }
    if ((_3718_rncodeatom > (int)0))
    {
      {
        _ptr__3723_ri32[_3730_rcodeptr] = (int)0;
      }
    }
    {}
    {
      if ((_3707_ncodeatom == (int)0))
      {
        {
          int32_t _3740_nzi = (int)0;
          int32_t _3741_codei = (int)0;
          int32_t _11080_ = (int)0;
          int32_t _11081_ = _3715_rnelem;
          for (int32_t _3742_i = _11080_; _3742_i < _11081_; ++_3742_i)
          {
            {
              int32_t _11082_ = (int)0;
              int32_t _11083_ = _3704_nnz;
              for (int32_t _3743_k = _11082_; _3743_k < _11083_; ++_3743_k)
              {
                {
                  _ptr__3723_ri32[safe_add( _3731_rcode,_3741_codei )] = 2;
                  _ptr__3722_rf64[safe_add( _3732_rcconst,_3741_codei )] = _ptr__3701_wf64[safe_add( _3710_cof,_3743_k )];
                  ++ _3741_codei;
                  _ptr__3723_ri32[safe_add( _3731_rcode,_3741_codei )] = 1;
                  _ptr__3722_rf64[safe_add( _3732_rcconst,_3741_codei )] = _ptr__3720_xi32[safe_add( _3719_pidxs,_3742_i )];
                  ++ _3741_codei;
                  _ptr__3723_ri32[safe_add( _3731_rcode,_3741_codei )] = 5;
                  ++ _3741_codei;
                  _ptr__3723_ri32[safe_add( safe_add( _3730_rcodeptr,_3740_nzi ),(int)1 )] = _3741_codei;
                  ++ _3740_nzi;
                }
              }
            }
          }
        }
      }
      else
      {
        {
          int32_t _3744_codei = (int)0;
          int32_t _3745_nzi = (int)0;
          int32_t _11084_ = (int)0;
          int32_t _11085_ = _3715_rnelem;
          for (int32_t _3746_i = _11084_; _3746_i < _11085_; ++_3746_i)
          {
            {
              int32_t _11086_ = (int)0;
              int32_t _11087_ = _3704_nnz;
              for (int32_t _3747_k = _11086_; _3747_k < _11087_; ++_3747_k)
              {
                {
                  _ptr__3723_ri32[safe_add( _3731_rcode,_3744_codei )] = 2;
                  _ptr__3722_rf64[safe_add( _3732_rcconst,_3744_codei )] = _ptr__3701_wf64[safe_add( _3710_cof,_3747_k )];
                  ++ _3744_codei;
                  int32_t _11088_ = _ptr__3699_wi32[safe_add( _3712_ptrcode,_3747_k )];
                  int32_t _11089_ = _ptr__3699_wi32[safe_add( safe_add( _3712_ptrcode,_3747_k ),(int)1 )];
                  for (int32_t _3748_l = _11088_; _3748_l < _11089_; ++_3748_l)
                  {
                    {
                      _ptr__3723_ri32[safe_add( _3731_rcode,_3744_codei )] = _ptr__3699_wi32[safe_add( _3713_code,_3748_l )];
                      _ptr__3722_rf64[safe_add( _3732_rcconst,_3744_codei )] = _ptr__3701_wf64[safe_add( _3711_cconst,_3748_l )];
                      ++ _3744_codei;
                    }
                  }
                  _ptr__3723_ri32[safe_add( _3731_rcode,_3744_codei )] = 3;
                  ++ _3744_codei;
                  _ptr__3723_ri32[safe_add( _3731_rcode,_3744_codei )] = 1;
                  _ptr__3722_rf64[safe_add( _3732_rcconst,_3744_codei )] = _ptr__3720_xi32[safe_add( _3719_pidxs,_3746_i )];
                  ++ _3744_codei;
                  _ptr__3723_ri32[safe_add( _3731_rcode,_3744_codei )] = 5;
                  ++ _3744_codei;
                  _ptr__3723_ri32[safe_add( safe_add( _3730_rcodeptr,_3745_nzi ),(int)1 )] = _3744_codei;
                  ++ _3745_nzi;
                }
              }
            }
          }
        }
      }
    }
  }
  _3697_xs->clear();
}
// End mosek.fusion.ExprMulParamScalarExpr.eval

// Begin mosek.fusion.ExprMulParamScalarExpr.toString
// Method mosek.fusion.ExprMulParamScalarExpr.toString @ bld/grindsted/final/default/src/fusion/Parameter.monty:3201:6-160
std::string mosek::fusion::ExprMulParamScalarExpr :: toString() { return mosek::fusion::p_ExprMulParamScalarExpr::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulParamScalarExpr::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulParamScalarExpr("))->__mosek_2fusion_2Utils_2StringBuffer__a(p->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(e->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprMulParamScalarExpr.toString

void mosek::fusion::p_ExprMulParamScalarExpr::destroy()
{
  e.reset();
  p.reset();
}
void mosek::fusion::ExprMulParamScalarExpr::destroy() { mosek::fusion::p_ExprMulParamScalarExpr::_get_impl(this)->destroy(); }
// } class ExprMulParamScalarExpr
// class ExprMulParamScalar { // @ bld/grindsted/final/default/src/fusion/Parameter.monty:3081:4-3186:5
mosek::fusion::ExprMulParamScalar::ExprMulParamScalar(mosek::fusion::p_ExprMulParamScalar *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulParamScalar()" << this << std::endl; */ }
mosek::fusion::ExprMulParamScalar::~ExprMulParamScalar() {  /* std::cout << "~ExprMulParamScalar()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulParamScalar::p_ExprMulParamScalar
  (::mosek::fusion::ExprMulParamScalar * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulParamScalar.ctor @ bld/grindsted/final/default/src/fusion/Parameter.monty:3085:6-3092:7
mosek::fusion::ExprMulParamScalar::t mosek::fusion::p_ExprMulParamScalar::_new_ExprMulParamScalar
  (monty::rc_ptr< ::mosek::fusion::Parameter > _3749_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _3750_e)
{ return new mosek::fusion::ExprMulParamScalar(_3749_p,_3750_e); }
mosek::fusion::ExprMulParamScalar::ExprMulParamScalar
  (monty::rc_ptr< ::mosek::fusion::Parameter > _3749_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _3750_e) : 
   ExprMulParamScalar(new mosek::fusion::p_ExprMulParamScalar(this))
{ mosek::fusion::p_ExprMulParamScalar::_get_impl(this)->_initialize(_3749_p,_3750_e); }
void mosek::fusion::p_ExprMulParamScalar::_initialize  (monty::rc_ptr< ::mosek::fusion::Parameter > _3749_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _3750_e)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(::mosek::fusion::p_BaseExpression::modelFrom(_3749_p->__mosek_2fusion_2Expression__getModel(),_3750_e),_3750_e->getShape());
    mosek::fusion::p_ExprMulParamScalar::_get_impl(::mosek::fusion::ExprMulParamScalar::t(_pubthis))->p = _3749_p;
    mosek::fusion::p_ExprMulParamScalar::_get_impl(::mosek::fusion::ExprMulParamScalar::t(_pubthis))->e = _3750_e;
    if ((_3749_p->getND() != (int)0))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions for multiplication"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprMulParamScalar.ctor

// Begin mosek.fusion.ExprMulParamScalar.eval
// Method mosek.fusion.ExprMulParamScalar.eval @ bld/grindsted/final/default/src/fusion/Parameter.monty:3096:6-3185:7
void mosek::fusion::ExprMulParamScalar :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _3751_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _3752_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _3753_xs,bool _3754_cache_eval) { mosek::fusion::p_ExprMulParamScalar::_get_impl(this)->eval(_3751_rs,_3752_ws,_3753_xs,_3754_cache_eval); }
void mosek::fusion::p_ExprMulParamScalar::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _3751_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _3752_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _3753_xs,bool _3754_cache_eval)
{
  e->recursive_eval(_3752_ws,_3751_rs,_3753_xs,_3754_cache_eval);
  _3752_ws->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3755_wi32 = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__3755_wi32(_3755_wi32 ? _3755_wi32->raw() : nullptr,_3755_wi32 ? _3755_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3756_wi64 = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__3756_wi64(_3756_wi64 ? _3756_wi64->raw() : nullptr,_3756_wi64 ? _3756_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _3757_wf64 = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->f64;
  _checked_ptr_1<double> _ptr__3757_wf64(_3757_wf64 ? _3757_wf64->raw() : nullptr,_3757_wf64 ? _3757_wf64->size(0) : 0);
  int32_t _3758_nd = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->nd;
  int32_t _3759_nelem = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->nelem;
  int32_t _3760_nnz = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->nnz;
  bool _3761_hassp = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->hassp;
  int32_t _3762_ptr = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->ptr_base;
  int32_t _3763_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->ncodeatom;
  int32_t _3764_shape = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->shape_base;
  int32_t _3765_sp = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->sp_base;
  int32_t _3766_nidxs = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->nidxs_base;
  int32_t _3767_cof = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->cof_base;
  int32_t _3768_cconst = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->cconst_base;
  int32_t _3769_ptrcode = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->codeptr_base;
  int32_t _3770_code = mosek::fusion::p_WorkStack::_get_impl(_3752_ws)->code_base;
  int32_t _3771_rnd = _3758_nd;
  int32_t _3772_rnelem = _3759_nelem;
  int32_t _3773_rnnz = _3760_nnz;
  bool _3774_rhassp = _3761_hassp;
  int32_t _11090_;
  bool _11091_ = (_3763_ncodeatom == (int)0);
  if (_11091_)
  {
    _11090_ = safe_mul( _3760_nnz,(int)3 );
  }
  else
  {
    _11090_ = safe_add( safe_mul( _3760_nnz,(int)4 ),_3763_ncodeatom );
  }
  int32_t _3775_rncodeatom = _11090_;
  _3751_rs->alloc_expr(_3771_rnd,_3772_rnelem,_3773_rnnz,_3774_rhassp,_3775_rncodeatom);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3776_ri64 = mosek::fusion::p_WorkStack::_get_impl(_3751_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__3776_ri64(_3776_ri64 ? _3776_ri64->raw() : nullptr,_3776_ri64 ? _3776_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _3777_rf64 = mosek::fusion::p_WorkStack::_get_impl(_3751_rs)->f64;
  _checked_ptr_1<double> _ptr__3777_rf64(_3777_rf64 ? _3777_rf64->raw() : nullptr,_3777_rf64 ? _3777_rf64->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3778_ri32 = mosek::fusion::p_WorkStack::_get_impl(_3751_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__3778_ri32(_3778_ri32 ? _3778_ri32->raw() : nullptr,_3778_ri32 ? _3778_ri32->size(0) : 0);
  int32_t _3779_rptr = mosek::fusion::p_WorkStack::_get_impl(_3751_rs)->ptr_base;
  int32_t _3780_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_3751_rs)->nidxs_base;
  int32_t _3781_rsp = mosek::fusion::p_WorkStack::_get_impl(_3751_rs)->sp_base;
  int32_t _3782_rcof = mosek::fusion::p_WorkStack::_get_impl(_3751_rs)->cof_base;
  bool _3783_rhassp = mosek::fusion::p_WorkStack::_get_impl(_3751_rs)->hassp;
  int32_t _3784_rshape = mosek::fusion::p_WorkStack::_get_impl(_3751_rs)->shape_base;
  int32_t _3785_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_3751_rs)->codeptr_base;
  int32_t _3786_rcode = mosek::fusion::p_WorkStack::_get_impl(_3751_rs)->code_base;
  int32_t _3787_rcconst = mosek::fusion::p_WorkStack::_get_impl(_3751_rs)->cconst_base;
  int32_t _3788_pidx0 = p->getIndex((int)0);
  {
    int32_t _11092_ = (int)0;
    int32_t _11093_ = _3773_rnnz;
    for (int32_t _3789_i = _11092_; _3789_i < _11093_; ++_3789_i)
    {
      {
        _ptr__3777_rf64[safe_add( _3782_rcof,_3789_i )] = 0.0;
      }
    }
    int32_t _11094_ = (int)0;
    int32_t _11095_ = safe_add( _3772_rnelem,(int)1 );
    for (int32_t _3790_i = _11094_; _3790_i < _11095_; ++_3790_i)
    {
      {
        _ptr__3778_ri32[safe_add( _3779_rptr,_3790_i )] = _ptr__3755_wi32[safe_add( _3762_ptr,_3790_i )];
      }
    }
    int32_t _11096_ = (int)0;
    int32_t _11097_ = _3771_rnd;
    for (int32_t _3791_i = _11096_; _3791_i < _11097_; ++_3791_i)
    {
      {
        _ptr__3778_ri32[safe_add( _3784_rshape,_3791_i )] = _ptr__3755_wi32[safe_add( _3764_shape,_3791_i )];
      }
    }
    int32_t _11098_ = (int)0;
    int32_t _11099_ = _3760_nnz;
    for (int32_t _3792_i = _11098_; _3792_i < _11099_; ++_3792_i)
    {
      {
        _ptr__3776_ri64[safe_add( _3780_rnidxs,_3792_i )] = _ptr__3756_wi64[safe_add( _3766_nidxs,_3792_i )];
      }
    }
    if (_3783_rhassp)
    {
      {
        int32_t _11100_ = (int)0;
        int32_t _11101_ = _3772_rnelem;
        for (int32_t _3793_i = _11100_; _3793_i < _11101_; ++_3793_i)
        {
          {
            _ptr__3776_ri64[safe_add( _3781_rsp,_3793_i )] = _ptr__3756_wi64[safe_add( _3765_sp,_3793_i )];
          }
        }
      }
    }
    {}
    int32_t _3794_codei = (int)0;
    if ((_3775_rncodeatom > (int)0))
    {
      {
        _ptr__3778_ri32[_3785_rcodeptr] = (int)0;
      }
    }
    {}
    int32_t _11102_ = (int)0;
    int32_t _11103_ = _3760_nnz;
    for (int32_t _3795_i = _11102_; _3795_i < _11103_; ++_3795_i)
    {
      {
        _ptr__3778_ri32[safe_add( _3786_rcode,_3794_codei )] = 2;
        _ptr__3777_rf64[safe_add( _3787_rcconst,_3794_codei )] = _ptr__3757_wf64[safe_add( _3767_cof,_3795_i )];
        ++ _3794_codei;
        if ((_3763_ncodeatom > (int)0))
        {
          {
            int32_t _11104_ = _ptr__3755_wi32[safe_add( _3769_ptrcode,_3795_i )];
            int32_t _11105_ = _ptr__3755_wi32[safe_add( safe_add( _3769_ptrcode,_3795_i ),(int)1 )];
            for (int32_t _3796_j = _11104_; _3796_j < _11105_; ++_3796_j)
            {
              {
                _ptr__3778_ri32[safe_add( _3786_rcode,_3794_codei )] = _ptr__3755_wi32[safe_add( _3770_code,_3796_j )];
                _ptr__3777_rf64[safe_add( _3787_rcconst,_3794_codei )] = _ptr__3757_wf64[safe_add( _3768_cconst,_3796_j )];
                ++ _3794_codei;
              }
            }
            _ptr__3778_ri32[safe_add( _3786_rcode,_3794_codei )] = 3;
            ++ _3794_codei;
          }
        }
        {}
        _ptr__3778_ri32[safe_add( _3786_rcode,_3794_codei )] = 1;
        _ptr__3777_rf64[safe_add( _3787_rcconst,_3794_codei )] = _3788_pidx0;
        ++ _3794_codei;
        _ptr__3778_ri32[safe_add( _3786_rcode,_3794_codei )] = 5;
        ++ _3794_codei;
        _ptr__3778_ri32[safe_add( safe_add( _3785_rcodeptr,_3795_i ),(int)1 )] = _3794_codei;
      }
    }
  }
  _3753_xs->clear();
}
// End mosek.fusion.ExprMulParamScalar.eval

// Begin mosek.fusion.ExprMulParamScalar.toString
// Method mosek.fusion.ExprMulParamScalar.toString @ bld/grindsted/final/default/src/fusion/Parameter.monty:3094:6-156
std::string mosek::fusion::ExprMulParamScalar :: toString() { return mosek::fusion::p_ExprMulParamScalar::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulParamScalar::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulParamScalar("))->__mosek_2fusion_2Utils_2StringBuffer__a(p->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(e->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprMulParamScalar.toString

void mosek::fusion::p_ExprMulParamScalar::destroy()
{
  e.reset();
  p.reset();
}
void mosek::fusion::ExprMulParamScalar::destroy() { mosek::fusion::p_ExprMulParamScalar::_get_impl(this)->destroy(); }
// } class ExprMulParamScalar
// class ExprMulParamDiagLeft { // @ bld/grindsted/final/default/src/fusion/Parameter.monty:2631:4-3075:5
mosek::fusion::ExprMulParamDiagLeft::ExprMulParamDiagLeft(mosek::fusion::p_ExprMulParamDiagLeft *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulParamDiagLeft()" << this << std::endl; */ }
mosek::fusion::ExprMulParamDiagLeft::~ExprMulParamDiagLeft() {  /* std::cout << "~ExprMulParamDiagLeft()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulParamDiagLeft::p_ExprMulParamDiagLeft
  (::mosek::fusion::ExprMulParamDiagLeft * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulParamDiagLeft.ctor @ bld/grindsted/final/default/src/fusion/Parameter.monty:2635:6-2645:7
mosek::fusion::ExprMulParamDiagLeft::t mosek::fusion::p_ExprMulParamDiagLeft::_new_ExprMulParamDiagLeft
  (monty::rc_ptr< ::mosek::fusion::Parameter > _3797_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _3798_e)
{ return new mosek::fusion::ExprMulParamDiagLeft(_3797_p,_3798_e); }
mosek::fusion::ExprMulParamDiagLeft::ExprMulParamDiagLeft
  (monty::rc_ptr< ::mosek::fusion::Parameter > _3797_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _3798_e) : 
   ExprMulParamDiagLeft(new mosek::fusion::p_ExprMulParamDiagLeft(this))
{ mosek::fusion::p_ExprMulParamDiagLeft::_get_impl(this)->_initialize(_3797_p,_3798_e); }
void mosek::fusion::p_ExprMulParamDiagLeft::_initialize  (monty::rc_ptr< ::mosek::fusion::Parameter > _3797_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _3798_e)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(::mosek::fusion::p_BaseExpression::modelFrom(_3797_p->__mosek_2fusion_2Expression__getModel(),_3798_e),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3798_e->getDim((int)1))}));
    mosek::fusion::p_ExprMulParamDiagLeft::_get_impl(::mosek::fusion::ExprMulParamDiagLeft::t(_pubthis))->p = _3797_p;
    mosek::fusion::p_ExprMulParamDiagLeft::_get_impl(::mosek::fusion::ExprMulParamDiagLeft::t(_pubthis))->e = _3798_e;
    if (((_3797_p->getND() != (int)2) || (_3798_e->getND() != (int)2)))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions for multiplication"));
      }
    }
    {}
    if (((_3797_p->getDim((int)1) != _3798_e->getDim((int)0)) || (_3797_p->getDim((int)0) != _3798_e->getDim((int)1))))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions for multiplication"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprMulParamDiagLeft.ctor

// Begin mosek.fusion.ExprMulParamDiagLeft.eval
// Method mosek.fusion.ExprMulParamDiagLeft.eval @ bld/grindsted/final/default/src/fusion/Parameter.monty:2648:6-2957:7
void mosek::fusion::ExprMulParamDiagLeft :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _3799_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _3800_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _3801_xs,bool _3802_cache_eval) { mosek::fusion::p_ExprMulParamDiagLeft::_get_impl(this)->eval(_3799_rs,_3800_ws,_3801_xs,_3802_cache_eval); }
void mosek::fusion::p_ExprMulParamDiagLeft::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _3799_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _3800_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _3801_xs,bool _3802_cache_eval)
{
  e->recursive_eval(_3800_ws,_3799_rs,_3801_xs,_3802_cache_eval);
  _3800_ws->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3803_wi32 = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__3803_wi32(_3803_wi32 ? _3803_wi32->raw() : nullptr,_3803_wi32 ? _3803_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3804_wi64 = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__3804_wi64(_3804_wi64 ? _3804_wi64->raw() : nullptr,_3804_wi64 ? _3804_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _3805_wf64 = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->f64;
  _checked_ptr_1<double> _ptr__3805_wf64(_3805_wf64 ? _3805_wf64->raw() : nullptr,_3805_wf64 ? _3805_wf64->size(0) : 0);
  int32_t _3806_nd = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->nd;
  int32_t _3807_nelem = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->nelem;
  int32_t _3808_nnz = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->nnz;
  bool _3809_hassp = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->hassp;
  int32_t _3810_ptr = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->ptr_base;
  int32_t _3811_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->ncodeatom;
  int32_t _3812_shape = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->shape_base;
  int32_t _3813_sp = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->sp_base;
  int32_t _3814_nidxs = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->nidxs_base;
  int32_t _3815_cof = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->cof_base;
  int32_t _3816_cconst = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->cconst_base;
  int32_t _3817_codeptr = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->codeptr_base;
  int32_t _3818_code = mosek::fusion::p_WorkStack::_get_impl(_3800_ws)->code_base;
  if (((_3806_nd != (int)2) || ((_ptr__3803_wi32[_3812_shape] != p->getDim((int)1)) || (_ptr__3803_wi32[safe_add( _3812_shape,(int)1 )] != p->getDim((int)0)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions for multiplication"));
    }
  }
  {}
  int32_t _3819_pnnz = p->getNumNonzero();
  int32_t _3820_psp = _3801_xs->alloci64(_3819_pnnz);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3821_xi64 = mosek::fusion::p_WorkStack::_get_impl(_3801_xs)->i64;
  _checked_ptr_1<int64_t> _ptr__3821_xi64(_3821_xi64 ? _3821_xi64->raw() : nullptr,_3821_xi64 ? _3821_xi64->size(0) : 0);
  p->getSp(_3821_xi64,_3820_psp);
  int32_t _3822_pdim0 = p->getDim((int)0);
  int32_t _3823_pdim1 = p->getDim((int)1);
  int32_t _3824_edim0 = _ptr__3803_wi32[_3812_shape];
  int32_t _3825_edim1 = _ptr__3803_wi32[safe_add( _3812_shape,(int)1 )];
  int32_t _3826_pidxs = _3801_xs->alloci32(p->getNumNonzero());
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3827_xi32 = mosek::fusion::p_WorkStack::_get_impl(_3801_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__3827_xi32(_3827_xi32 ? _3827_xi32->raw() : nullptr,_3827_xi32 ? _3827_xi32->size(0) : 0);
  p->getAllIndexes(_3827_xi32,_3826_pidxs);
  if (_3809_hassp)
  {
    {
      int32_t _3828_eperm = _3801_xs->alloci32(_3807_nelem);
      int32_t _3829_eptr = _3801_xs->alloci32(safe_add( _3825_edim1,(int)1 ));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3830_xi32 = mosek::fusion::p_WorkStack::_get_impl(_3801_xs)->i32;
      _checked_ptr_1<int32_t> _ptr__3830_xi32(_3830_xi32 ? _3830_xi32->raw() : nullptr,_3830_xi32 ? _3830_xi32->size(0) : 0);
      int32_t _11106_ = (int)0;
      int32_t _11107_ = safe_add( _3825_edim1,(int)1 );
      for (int32_t _3831_i = _11106_; _3831_i < _11107_; ++_3831_i)
      {
        {
          _ptr__3830_xi32[safe_add( _3829_eptr,_3831_i )] = (int)0;
        }
      }
      int32_t _11108_ = (int)0;
      int32_t _11109_ = _3807_nelem;
      for (int32_t _3832_i = _11108_; _3832_i < _11109_; ++_3832_i)
      {
        {
          ++ _ptr__3830_xi32[safe_add( safe_add( _3829_eptr,(_ptr__3804_wi64[safe_add( _3813_sp,_3832_i )] % _3825_edim1) ),(int)1 )];
        }
      }
      int32_t _11110_ = (int)0;
      int32_t _11111_ = _3825_edim1;
      for (int32_t _3833_i = _11110_; _3833_i < _11111_; ++_3833_i)
      {
        {
          _ptr__3830_xi32[safe_add( safe_add( _3829_eptr,_3833_i ),(int)1 )] += _ptr__3830_xi32[safe_add( _3829_eptr,_3833_i )];
        }
      }
      int32_t _11112_ = (int)0;
      int32_t _11113_ = _3807_nelem;
      for (int32_t _3834_i = _11112_; _3834_i < _11113_; ++_3834_i)
      {
        {
          int64_t _3835_colidx = (_ptr__3804_wi64[safe_add( _3813_sp,_3834_i )] % _3825_edim1);
          _ptr__3830_xi32[safe_add( _3828_eperm,_ptr__3830_xi32[safe_add( _3829_eptr,_3835_colidx )] )] = _3834_i;
          ++ _ptr__3830_xi32[safe_add( _3829_eptr,_3835_colidx )];
        }
      }
      int32_t _3836_rnelem = (int)0;
      int32_t _3837_rnnz = (int)0;
      int32_t _3838_rncodeatom = (int)0;
      {
        int32_t _3839_pe = (int)0;
        int32_t _3840_pp = (int)0;
        while ( ((_3840_pp < _3819_pnnz) && (_3839_pe < _3807_nelem)) )
        {
          {
            int32_t _3841_eidx = _ptr__3830_xi32[safe_add( _3828_eperm,_3839_pe )];
            int64_t _3842_psubi = (_ptr__3821_xi64[safe_add( _3820_psp,_3840_pp )] / _3823_pdim1);
            int64_t _3843_esubj = (_ptr__3804_wi64[safe_add( _3813_sp,_3841_eidx )] % _3825_edim1);
            if ((_3842_psubi < _3843_esubj))
            {
              {
                while ( ((_3840_pp < _3819_pnnz) && (_ptr__3821_xi64[safe_add( _3820_psp,_3840_pp )] < safe_mul( safe_add( _3842_psubi,(int)1 ),_3823_pdim1 ))) )
                {
                  {
                    ++ _3840_pp;
                  }
                }
              }
            }
            else if((_3843_esubj < _3842_psubi))
            {
              {
                while ( ((_3839_pe < _3819_pnnz) && ((_ptr__3804_wi64[safe_add( _3813_sp,_ptr__3830_xi32[safe_add( _3828_eperm,_3839_pe )] )] % _3825_edim1) == _3843_esubj)) )
                {
                  {
                    ++ _3839_pe;
                  }
                }
              }
            }
            else
            {
              {
                int32_t _3844_ie = _3839_pe;
                int32_t _3845_ip = _3840_pp;
                while ( ((_3840_pp < _3819_pnnz) && (_ptr__3821_xi64[safe_add( _3820_psp,_3840_pp )] < safe_mul( safe_add( _3842_psubi,(int)1 ),_3823_pdim1 ))) )
                {
                  {
                    ++ _3840_pp;
                  }
                }
                while ( ((_3839_pe < _3819_pnnz) && ((_ptr__3804_wi64[safe_add( _3813_sp,_ptr__3830_xi32[safe_add( _3828_eperm,_3839_pe )] )] % _3825_edim1) == _3843_esubj)) )
                {
                  {
                    ++ _3839_pe;
                  }
                }
                bool _3846_haselm = false;
                while ( ((_3845_ip < _3840_pp) && (_3844_ie < _3839_pe)) )
                {
                  {
                    int64_t _3847_psubj = (_ptr__3821_xi64[safe_add( _3820_psp,_3845_ip )] % _3823_pdim1);
                    int32_t _3848_eidx = _ptr__3830_xi32[safe_add( _3828_eperm,_3844_ie )];
                    int64_t _3849_esubi = (_ptr__3804_wi64[safe_add( _3813_sp,_3848_eidx )] / _3825_edim1);
                    if ((_3847_psubj < _3849_esubi))
                    {
                      {
                        ++ _3845_ip;
                      }
                    }
                    else if((_3847_psubj > _3849_esubi))
                    {
                      {
                        ++ _3844_ie;
                      }
                    }
                    else
                    {
                      {
                        _3837_rnnz += (_ptr__3803_wi32[safe_add( safe_add( _3810_ptr,_3848_eidx ),(int)1 )] - _ptr__3803_wi32[safe_add( _3810_ptr,_3848_eidx )]);
                        _3846_haselm = true;
                        int32_t _3850_n = (_ptr__3803_wi32[safe_add( safe_add( _3810_ptr,_3848_eidx ),(int)1 )] - _ptr__3803_wi32[safe_add( _3810_ptr,_3848_eidx )]);
                        int32_t _11114_;
                        bool _11115_ = (_3811_ncodeatom > (int)0);
                        if (_11115_)
                        {
                          _11114_ = safe_add( (_ptr__3803_wi32[safe_add( _3817_codeptr,_ptr__3803_wi32[safe_add( safe_add( _3810_ptr,_3848_eidx ),(int)1 )] )] - _ptr__3803_wi32[safe_add( _3817_codeptr,_ptr__3803_wi32[safe_add( _3810_ptr,_3848_eidx )] )]),safe_mul( (int)4,_3850_n ) );
                        }
                        else
                        {
                          _11114_ = safe_mul( (int)3,_3850_n );
                        }
                        _3838_rncodeatom += _11114_;
                        ++ _3845_ip;
                        ++ _3844_ie;
                      }
                    }
                  }
                }
                if (_3846_haselm)
                {
                  {
                    ++ _3836_rnelem;
                  }
                }
                {}
              }
            }
          }
        }
      }
      int32_t _3851_rnd = (int)1;
      bool _3852_rhassp = (_3836_rnelem < _3822_pdim0);
      _3799_rs->alloc_expr(_3851_rnd,_3836_rnelem,_3837_rnnz,_3852_rhassp,_3838_rncodeatom);
      int32_t _3853_rptr = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->ptr_base;
      int32_t _3854_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->nidxs_base;
      int32_t _11116_;
      bool _11117_ = _3852_rhassp;
      if (_11117_)
      {
        _11116_ = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->sp_base;
      }
      else
      {
        _11116_ = _3799_rs->alloci64(_3836_rnelem);
      }
      int32_t _3855_rsp = _11116_;
      int32_t _3856_rcof = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->cof_base;
      bool _3857_rhassp = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->hassp;
      int32_t _3858_rshape = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->shape_base;
      int32_t _3859_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->codeptr_base;
      int32_t _3860_rcode = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->code_base;
      int32_t _3861_rcconst = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int64_t,1 > > _3862_ri64 = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__3862_ri64(_3862_ri64 ? _3862_ri64->raw() : nullptr,_3862_ri64 ? _3862_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _3863_rf64 = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->f64;
      _checked_ptr_1<double> _ptr__3863_rf64(_3863_rf64 ? _3863_rf64->raw() : nullptr,_3863_rf64 ? _3863_rf64->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3864_ri32 = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__3864_ri32(_3864_ri32 ? _3864_ri32->raw() : nullptr,_3864_ri32 ? _3864_ri32->size(0) : 0);
      if ((_3836_rnelem > (int)0))
      {
        {
          _ptr__3864_ri32[_3853_rptr] = (int)0;
          if ((_3837_rnnz > (int)0))
          {
            {
              _ptr__3864_ri32[_3859_rcodeptr] = (int)0;
            }
          }
          {}
          _ptr__3864_ri32[_3858_rshape] = (int32_t)_3822_pdim0;
          int32_t _3865_codei = (int)0;
          int32_t _3866_elmi = (int)0;
          int32_t _3867_nzi = (int)0;
          int32_t _3868_pe = (int)0;
          int32_t _3869_pp = (int)0;
          while ( ((_3869_pp < _3819_pnnz) && (_3868_pe < _3807_nelem)) )
          {
            {
              int32_t _3870_eidx = _ptr__3830_xi32[safe_add( _3828_eperm,_3868_pe )];
              int64_t _3871_psubi = (_ptr__3821_xi64[safe_add( _3820_psp,_3869_pp )] / _3823_pdim1);
              int64_t _3872_esubj = (_ptr__3804_wi64[safe_add( _3813_sp,_3870_eidx )] % _3825_edim1);
              if ((_3871_psubi < _3872_esubj))
              {
                {
                  while ( ((_3869_pp < _3819_pnnz) && (_ptr__3821_xi64[safe_add( _3820_psp,_3869_pp )] < safe_mul( safe_add( _3871_psubi,(int)1 ),_3823_pdim1 ))) )
                  {
                    {
                      ++ _3869_pp;
                    }
                  }
                }
              }
              else if((_3872_esubj < _3871_psubi))
              {
                {
                  while ( ((_3868_pe < _3819_pnnz) && ((_ptr__3804_wi64[safe_add( _3813_sp,_ptr__3830_xi32[safe_add( _3828_eperm,_3868_pe )] )] % _3825_edim1) == _3872_esubj)) )
                  {
                    {
                      ++ _3868_pe;
                    }
                  }
                }
              }
              else
              {
                {
                  int32_t _3873_ie = _3868_pe;
                  int32_t _3874_ip = _3869_pp;
                  while ( ((_3869_pp < _3819_pnnz) && (_ptr__3821_xi64[safe_add( _3820_psp,_3869_pp )] < safe_mul( safe_add( _3871_psubi,(int)1 ),_3823_pdim1 ))) )
                  {
                    {
                      ++ _3869_pp;
                    }
                  }
                  while ( ((_3868_pe < _3819_pnnz) && ((_ptr__3804_wi64[safe_add( _3813_sp,_ptr__3830_xi32[safe_add( _3828_eperm,_3868_pe )] )] % _3825_edim1) == _3872_esubj)) )
                  {
                    {
                      ++ _3868_pe;
                    }
                  }
                  int32_t _3875_numelm = (int)0;
                  while ( ((_3874_ip < _3869_pp) && (_3873_ie < _3868_pe)) )
                  {
                    {
                      int64_t _3876_psubj = (_ptr__3821_xi64[safe_add( _3820_psp,_3874_ip )] % _3823_pdim1);
                      int32_t _3877_eidx = _ptr__3830_xi32[safe_add( _3828_eperm,_3873_ie )];
                      int64_t _3878_esubi = (_ptr__3804_wi64[safe_add( _3813_sp,_3877_eidx )] / _3825_edim1);
                      if ((_3876_psubj < _3878_esubi))
                      {
                        {
                          ++ _3874_ip;
                        }
                      }
                      else if((_3876_psubj > _3878_esubi))
                      {
                        {
                          ++ _3873_ie;
                        }
                      }
                      else
                      {
                        {
                          int32_t _11118_ = _ptr__3803_wi32[safe_add( _3810_ptr,_3877_eidx )];
                          int32_t _11119_ = _ptr__3803_wi32[safe_add( safe_add( _3810_ptr,_3877_eidx ),(int)1 )];
                          for (int32_t _3879_i = _11118_; _3879_i < _11119_; ++_3879_i)
                          {
                            {
                              _ptr__3863_rf64[safe_add( _3856_rcof,_3867_nzi )] = 0.0;
                              _ptr__3862_ri64[safe_add( _3854_rnidxs,_3867_nzi )] = _ptr__3804_wi64[safe_add( _3814_nidxs,_3879_i )];
                              _ptr__3864_ri32[safe_add( _3860_rcode,_3865_codei )] = 2;
                              _ptr__3863_rf64[safe_add( _3861_rcconst,_3865_codei )] = _ptr__3805_wf64[safe_add( _3815_cof,_3879_i )];
                              ++ _3865_codei;
                              if ((_3811_ncodeatom > (int)0))
                              {
                                {
                                  int32_t _11120_ = _ptr__3803_wi32[safe_add( _3817_codeptr,_3879_i )];
                                  int32_t _11121_ = _ptr__3803_wi32[safe_add( safe_add( _3817_codeptr,_3879_i ),(int)1 )];
                                  for (int32_t _3880_k = _11120_; _3880_k < _11121_; ++_3880_k)
                                  {
                                    {
                                      _ptr__3864_ri32[safe_add( _3860_rcode,_3865_codei )] = _ptr__3803_wi32[safe_add( _3818_code,_3880_k )];
                                      _ptr__3863_rf64[safe_add( _3861_rcconst,_3865_codei )] = _ptr__3805_wf64[safe_add( _3816_cconst,_3880_k )];
                                      ++ _3865_codei;
                                    }
                                  }
                                  _ptr__3864_ri32[safe_add( _3860_rcode,_3865_codei )] = 3;
                                  ++ _3865_codei;
                                }
                              }
                              {}
                              _ptr__3864_ri32[safe_add( _3860_rcode,_3865_codei )] = 1;
                              _ptr__3863_rf64[safe_add( _3861_rcconst,_3865_codei )] = _ptr__3830_xi32[safe_add( _3826_pidxs,_3874_ip )];
                              ++ _3865_codei;
                              _ptr__3864_ri32[safe_add( _3860_rcode,_3865_codei )] = 5;
                              ++ _3865_codei;
                              _ptr__3864_ri32[safe_add( safe_add( _3859_rcodeptr,_3867_nzi ),(int)1 )] = _3865_codei;
                              ++ _3867_nzi;
                            }
                          }
                          ++ _3874_ip;
                          ++ _3873_ie;
                          ++ _3875_numelm;
                        }
                      }
                    }
                  }
                  if ((_3875_numelm > (int)0))
                  {
                    {
                      _ptr__3862_ri64[safe_add( _3855_rsp,_3866_elmi )] = _3871_psubi;
                      _ptr__3864_ri32[safe_add( safe_add( _3853_rptr,_3866_elmi ),(int)1 )] = _3867_nzi;
                      ++ _3866_elmi;
                    }
                  }
                  {}
                }
              }
            }
          }
        }
      }
      {}
      if ((!_3857_rhassp))
      {
        {
          _3799_rs->popi64(_3836_rnelem);
        }
      }
      {}
      _3801_xs->clear();
    }
  }
  else
  {
    {
      int32_t _3881_rnelem = (int)0;
      int32_t _3882_rnnz = (int)0;
      int32_t _3883_rncodeatom = (int)0;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3884_xi32 = mosek::fusion::p_WorkStack::_get_impl(_3801_xs)->i32;
      _checked_ptr_1<int32_t> _ptr__3884_xi32(_3884_xi32 ? _3884_xi32->raw() : nullptr,_3884_xi32 ? _3884_xi32->size(0) : 0);
      {
        int32_t _3885_pi = (int)0;
        while ( (_3885_pi < _3819_pnnz) )
        {
          {
            int64_t _3886_prow = (_ptr__3821_xi64[safe_add( _3820_psp,_3885_pi )] / _3823_pdim1);
            int64_t _3887_prowend = safe_mul( safe_add( _3886_prow,(int)1 ),_3823_pdim1 );
            bool _3888_haselm = false;
            while ( ((_3885_pi < _3819_pnnz) && (_ptr__3821_xi64[safe_add( _3820_psp,_3885_pi )] < _3887_prowend)) )
            {
              {
                int64_t _3889_pcol = (_ptr__3821_xi64[safe_add( _3820_psp,_3885_pi )] % _3823_pdim1);
                int64_t _3890_eidx = safe_add( safe_mul( _3889_pcol,_3825_edim1 ),_3886_prow );
                int32_t _3891_n = (_ptr__3803_wi32[safe_add( safe_add( _3810_ptr,_3890_eidx ),(int)1 )] - _ptr__3803_wi32[safe_add( _3810_ptr,_3890_eidx )]);
                _3882_rnnz += _3891_n;
                _3888_haselm = true;
                int32_t _11122_;
                bool _11123_ = (_3811_ncodeatom > (int)0);
                if (_11123_)
                {
                  _11122_ = safe_add( (_ptr__3803_wi32[safe_add( _3817_codeptr,_ptr__3803_wi32[safe_add( safe_add( _3810_ptr,_3890_eidx ),(int)1 )] )] - _ptr__3803_wi32[safe_add( _3817_codeptr,_ptr__3803_wi32[safe_add( _3810_ptr,_3890_eidx )] )]),safe_mul( _3891_n,(int)4 ) );
                }
                else
                {
                  _11122_ = safe_mul( _3891_n,(int)3 );
                }
                _3883_rncodeatom += _11122_;
                ++ _3885_pi;
              }
            }
            if (_3888_haselm)
            {
              {
                ++ _3881_rnelem;
              }
            }
            {}
          }
        }
      }
      int32_t _3892_rnd = (int)1;
      bool _3893_rhassp = (_3881_rnelem < _3822_pdim0);
      _3799_rs->alloc_expr(_3892_rnd,_3881_rnelem,_3882_rnnz,_3893_rhassp,_3883_rncodeatom);
      int32_t _3894_rptr = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->ptr_base;
      int32_t _3895_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->nidxs_base;
      int32_t _11124_;
      bool _11125_ = _3893_rhassp;
      if (_11125_)
      {
        _11124_ = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->sp_base;
      }
      else
      {
        _11124_ = _3799_rs->alloci64(_3881_rnelem);
      }
      int32_t _3896_rsp = _11124_;
      int32_t _3897_rcof = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->cof_base;
      bool _3898_rhassp = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->hassp;
      int32_t _3899_rshape = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->shape_base;
      int32_t _3900_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->codeptr_base;
      int32_t _3901_rcode = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->code_base;
      int32_t _3902_rcconst = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int64_t,1 > > _3903_ri64 = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__3903_ri64(_3903_ri64 ? _3903_ri64->raw() : nullptr,_3903_ri64 ? _3903_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _3904_rf64 = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->f64;
      _checked_ptr_1<double> _ptr__3904_rf64(_3904_rf64 ? _3904_rf64->raw() : nullptr,_3904_rf64 ? _3904_rf64->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3905_ri32 = mosek::fusion::p_WorkStack::_get_impl(_3799_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__3905_ri32(_3905_ri32 ? _3905_ri32->raw() : nullptr,_3905_ri32 ? _3905_ri32->size(0) : 0);
      {
        _ptr__3905_ri32[_3894_rptr] = (int)0;
        if ((_3883_rncodeatom > (int)0))
        {
          {
            _ptr__3905_ri32[_3900_rcodeptr] = (int)0;
          }
        }
        {}
        _ptr__3905_ri32[_3899_rshape] = (int32_t)_3822_pdim0;
        int32_t _3906_codei = (int)0;
        int32_t _3907_elmi = (int)0;
        int32_t _3908_nzi = (int)0;
        int32_t _3909_pi = (int)0;
        while ( (_3909_pi < _3819_pnnz) )
        {
          {
            int64_t _3910_psubi = (_ptr__3821_xi64[safe_add( _3820_psp,_3909_pi )] / _3823_pdim1);
            int64_t _3911_prowend = safe_mul( safe_add( _3910_psubi,(int)1 ),_3823_pdim1 );
            int32_t _3912_numelm = (int)0;
            while ( ((_3909_pi < _3819_pnnz) && (_ptr__3821_xi64[safe_add( _3820_psp,_3909_pi )] < _3911_prowend)) )
            {
              {
                int64_t _3913_psubj = (_ptr__3821_xi64[safe_add( _3820_psp,_3909_pi )] % _3823_pdim1);
                int64_t _3914_eidx = safe_add( safe_mul( _3913_psubj,_3825_edim1 ),_3910_psubi );
                int32_t _11126_ = _ptr__3803_wi32[safe_add( _3810_ptr,_3914_eidx )];
                int32_t _11127_ = _ptr__3803_wi32[safe_add( safe_add( _3810_ptr,_3914_eidx ),(int)1 )];
                for (int32_t _3915_k = _11126_; _3915_k < _11127_; ++_3915_k)
                {
                  {
                    _ptr__3903_ri64[safe_add( _3895_rnidxs,_3908_nzi )] = _ptr__3804_wi64[safe_add( _3814_nidxs,_3915_k )];
                    _ptr__3904_rf64[safe_add( _3897_rcof,_3908_nzi )] = 0.0;
                    _ptr__3905_ri32[safe_add( _3901_rcode,_3906_codei )] = 2;
                    _ptr__3904_rf64[safe_add( _3902_rcconst,_3906_codei )] = _ptr__3805_wf64[safe_add( _3815_cof,_3915_k )];
                    ++ _3906_codei;
                    if ((_3811_ncodeatom > (int)0))
                    {
                      {
                        int32_t _11128_ = _ptr__3803_wi32[safe_add( _3817_codeptr,_3915_k )];
                        int32_t _11129_ = _ptr__3803_wi32[safe_add( safe_add( _3817_codeptr,_3915_k ),(int)1 )];
                        for (int32_t _3916_l = _11128_; _3916_l < _11129_; ++_3916_l)
                        {
                          {
                            _ptr__3905_ri32[safe_add( _3901_rcode,_3906_codei )] = _ptr__3803_wi32[safe_add( _3818_code,_3916_l )];
                            _ptr__3904_rf64[safe_add( _3902_rcconst,_3906_codei )] = _ptr__3805_wf64[safe_add( _3816_cconst,_3916_l )];
                            ++ _3906_codei;
                          }
                        }
                        _ptr__3905_ri32[safe_add( _3901_rcode,_3906_codei )] = 3;
                        ++ _3906_codei;
                      }
                    }
                    {}
                    _ptr__3905_ri32[safe_add( _3901_rcode,_3906_codei )] = 1;
                    _ptr__3904_rf64[safe_add( _3902_rcconst,_3906_codei )] = _ptr__3884_xi32[safe_add( _3826_pidxs,_3909_pi )];
                    ++ _3906_codei;
                    _ptr__3905_ri32[safe_add( _3901_rcode,_3906_codei )] = 5;
                    ++ _3906_codei;
                    _ptr__3905_ri32[safe_add( safe_add( _3900_rcodeptr,_3908_nzi ),(int)1 )] = _3906_codei;
                    ++ _3908_nzi;
                  }
                }
                ++ _3912_numelm;
                ++ _3909_pi;
              }
            }
            if ((_3912_numelm > (int)0))
            {
              {
                _ptr__3903_ri64[safe_add( _3896_rsp,_3907_elmi )] = _3910_psubi;
                _ptr__3905_ri32[safe_add( safe_add( _3894_rptr,_3907_elmi ),(int)1 )] = _3908_nzi;
                ++ _3907_elmi;
              }
            }
            {}
          }
        }
      }
      if ((!_3898_rhassp))
      {
        {
          _3799_rs->popi64(_3881_rnelem);
        }
      }
      {}
      _3801_xs->clear();
    }
  }
}
// End mosek.fusion.ExprMulParamDiagLeft.eval

// Begin mosek.fusion.ExprMulParamDiagLeft.toString
// Method mosek.fusion.ExprMulParamDiagLeft.toString @ bld/grindsted/final/default/src/fusion/Parameter.monty:2646:6-158
std::string mosek::fusion::ExprMulParamDiagLeft :: toString() { return mosek::fusion::p_ExprMulParamDiagLeft::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulParamDiagLeft::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulParamDiagLeft("))->__mosek_2fusion_2Utils_2StringBuffer__a(p->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(e->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprMulParamDiagLeft.toString

void mosek::fusion::p_ExprMulParamDiagLeft::destroy()
{
  e.reset();
  p.reset();
}
void mosek::fusion::ExprMulParamDiagLeft::destroy() { mosek::fusion::p_ExprMulParamDiagLeft::_get_impl(this)->destroy(); }
// } class ExprMulParamDiagLeft
// class ExprMulParamDiagRight { // @ bld/grindsted/final/default/src/fusion/Parameter.monty:2192:4-2628:5
mosek::fusion::ExprMulParamDiagRight::ExprMulParamDiagRight(mosek::fusion::p_ExprMulParamDiagRight *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulParamDiagRight()" << this << std::endl; */ }
mosek::fusion::ExprMulParamDiagRight::~ExprMulParamDiagRight() {  /* std::cout << "~ExprMulParamDiagRight()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulParamDiagRight::p_ExprMulParamDiagRight
  (::mosek::fusion::ExprMulParamDiagRight * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulParamDiagRight.ctor @ bld/grindsted/final/default/src/fusion/Parameter.monty:2196:6-2206:7
mosek::fusion::ExprMulParamDiagRight::t mosek::fusion::p_ExprMulParamDiagRight::_new_ExprMulParamDiagRight
  (monty::rc_ptr< ::mosek::fusion::Expression > _3917_e,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3918_p)
{ return new mosek::fusion::ExprMulParamDiagRight(_3917_e,_3918_p); }
mosek::fusion::ExprMulParamDiagRight::ExprMulParamDiagRight
  (monty::rc_ptr< ::mosek::fusion::Expression > _3917_e,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3918_p) : 
   ExprMulParamDiagRight(new mosek::fusion::p_ExprMulParamDiagRight(this))
{ mosek::fusion::p_ExprMulParamDiagRight::_get_impl(this)->_initialize(_3917_e,_3918_p); }
void mosek::fusion::p_ExprMulParamDiagRight::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _3917_e,
    monty::rc_ptr< ::mosek::fusion::Parameter > _3918_p)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(::mosek::fusion::p_BaseExpression::modelFrom(_3918_p->__mosek_2fusion_2Expression__getModel(),_3917_e),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_3917_e->getDim((int)0))}));
    mosek::fusion::p_ExprMulParamDiagRight::_get_impl(::mosek::fusion::ExprMulParamDiagRight::t(_pubthis))->p = _3918_p;
    mosek::fusion::p_ExprMulParamDiagRight::_get_impl(::mosek::fusion::ExprMulParamDiagRight::t(_pubthis))->e = _3917_e;
    if (((_3918_p->getND() != (int)2) || (_3917_e->getND() != (int)2)))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions for multiplication"));
      }
    }
    {}
    if (((_3918_p->getDim((int)1) != _3917_e->getDim((int)0)) || (_3918_p->getDim((int)0) != _3917_e->getDim((int)1))))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions for multiplication"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprMulParamDiagRight.ctor

// Begin mosek.fusion.ExprMulParamDiagRight.eval
// Method mosek.fusion.ExprMulParamDiagRight.eval @ bld/grindsted/final/default/src/fusion/Parameter.monty:2210:6-2510:7
void mosek::fusion::ExprMulParamDiagRight :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _3919_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _3920_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _3921_xs,bool _3922_cache_eval) { mosek::fusion::p_ExprMulParamDiagRight::_get_impl(this)->eval(_3919_rs,_3920_ws,_3921_xs,_3922_cache_eval); }
void mosek::fusion::p_ExprMulParamDiagRight::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _3919_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _3920_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _3921_xs,bool _3922_cache_eval)
{
  e->recursive_eval(_3920_ws,_3919_rs,_3921_xs,_3922_cache_eval);
  _3920_ws->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3923_wi32 = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__3923_wi32(_3923_wi32 ? _3923_wi32->raw() : nullptr,_3923_wi32 ? _3923_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3924_wi64 = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__3924_wi64(_3924_wi64 ? _3924_wi64->raw() : nullptr,_3924_wi64 ? _3924_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _3925_wf64 = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->f64;
  _checked_ptr_1<double> _ptr__3925_wf64(_3925_wf64 ? _3925_wf64->raw() : nullptr,_3925_wf64 ? _3925_wf64->size(0) : 0);
  int32_t _3926_nd = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->nd;
  int32_t _3927_nelem = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->nelem;
  int32_t _3928_nnz = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->nnz;
  bool _3929_hassp = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->hassp;
  int32_t _3930_ptr = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->ptr_base;
  int32_t _3931_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->ncodeatom;
  int32_t _3932_shape = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->shape_base;
  int32_t _3933_sp = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->sp_base;
  int32_t _3934_nidxs = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->nidxs_base;
  int32_t _3935_cof = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->cof_base;
  int32_t _3936_cconst = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->cconst_base;
  int32_t _3937_codeptr = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->codeptr_base;
  int32_t _3938_code = mosek::fusion::p_WorkStack::_get_impl(_3920_ws)->code_base;
  if (((_3926_nd != (int)2) || ((_ptr__3923_wi32[_3932_shape] != p->getDim((int)1)) || (_ptr__3923_wi32[safe_add( _3932_shape,(int)1 )] != p->getDim((int)0)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions for multiplication"));
    }
  }
  {}
  int32_t _3939_pnnz = p->getNumNonzero();
  int32_t _3940_psp = _3921_xs->alloci64(_3939_pnnz);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _3941_xi64 = mosek::fusion::p_WorkStack::_get_impl(_3921_xs)->i64;
  _checked_ptr_1<int64_t> _ptr__3941_xi64(_3941_xi64 ? _3941_xi64->raw() : nullptr,_3941_xi64 ? _3941_xi64->size(0) : 0);
  int32_t _3942_pidxs = _3921_xs->alloci32(p->getNumNonzero());
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3943_xi32 = mosek::fusion::p_WorkStack::_get_impl(_3921_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__3943_xi32(_3943_xi32 ? _3943_xi32->raw() : nullptr,_3943_xi32 ? _3943_xi32->size(0) : 0);
  p->getAllIndexes(_3943_xi32,_3942_pidxs);
  p->getSp(_3941_xi64,_3940_psp);
  int32_t _3944_pdim0 = p->getDim((int)0);
  int32_t _3945_pdim1 = p->getDim((int)1);
  int32_t _3946_edim0 = _ptr__3923_wi32[_3932_shape];
  int32_t _3947_edim1 = _ptr__3923_wi32[safe_add( _3932_shape,(int)1 )];
  int32_t _3948_pperm = _3921_xs->alloci32(_3939_pnnz);
  int32_t _3949_pptr = _3921_xs->alloci32(safe_add( _3945_pdim1,(int)1 ));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _3950_xi32 = mosek::fusion::p_WorkStack::_get_impl(_3921_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__3950_xi32(_3950_xi32 ? _3950_xi32->raw() : nullptr,_3950_xi32 ? _3950_xi32->size(0) : 0);
  int32_t _11130_ = (int)0;
  int32_t _11131_ = safe_add( _3945_pdim1,(int)1 );
  for (int32_t _3951_i = _11130_; _3951_i < _11131_; ++_3951_i)
  {
    {
      _ptr__3950_xi32[safe_add( _3949_pptr,_3951_i )] = (int)0;
    }
  }
  int32_t _11132_ = (int)0;
  int32_t _11133_ = _3939_pnnz;
  for (int32_t _3952_i = _11132_; _3952_i < _11133_; ++_3952_i)
  {
    {
      ++ _ptr__3950_xi32[safe_add( safe_add( _3949_pptr,(_ptr__3941_xi64[safe_add( _3940_psp,_3952_i )] % _3945_pdim1) ),(int)1 )];
    }
  }
  int32_t _11134_ = (int)1;
  int32_t _11135_ = _3945_pdim1;
  for (int32_t _3953_i = _11134_; _3953_i < _11135_; ++_3953_i)
  {
    {
      _ptr__3950_xi32[safe_add( _3949_pptr,_3953_i )] += _ptr__3950_xi32[(safe_add( _3949_pptr,_3953_i ) - (int)1)];
    }
  }
  int32_t _11136_ = (int)0;
  int32_t _11137_ = _3939_pnnz;
  for (int32_t _3954_i = _11136_; _3954_i < _11137_; ++_3954_i)
  {
    {
      int64_t _3955_colidx = (_ptr__3941_xi64[safe_add( _3940_psp,_3954_i )] % _3945_pdim1);
      _ptr__3950_xi32[safe_add( _3948_pperm,_ptr__3950_xi32[safe_add( _3949_pptr,_3955_colidx )] )] = _3954_i;
      ++ _ptr__3950_xi32[safe_add( _3949_pptr,_3955_colidx )];
    }
  }
  if (_3929_hassp)
  {
    {
      int32_t _3956_rncodeatom = (int)0;
      int32_t _3957_rnelem = (int)0;
      int32_t _3958_rnnz = (int)0;
      int32_t _3959_i1 = (int)0;
      int32_t _3960_i0 = (int)0;
      while ( ((_3960_i0 < _3927_nelem) && (_3959_i1 < _3939_pnnz)) )
      {
        {
          int64_t _3961_esubi = (_ptr__3924_wi64[safe_add( _3933_sp,_3960_i0 )] / _3947_edim1);
          int64_t _3962_psubj = (_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_3959_i1 )] )] % _3945_pdim1);
          if ((_3961_esubi < _3962_psubj))
          {
            {
              ++ _3960_i0;
            }
          }
          else if((_3961_esubi > _3962_psubj))
          {
            {
              ++ _3959_i1;
            }
          }
          else
          {
            {
              int32_t _3963_b0 = _3960_i0;
              ++ _3960_i0;
              int32_t _3964_b1 = _3959_i1;
              ++ _3959_i1;
              while ( ((_3960_i0 < _3927_nelem) && ((_ptr__3924_wi64[safe_add( _3933_sp,_3960_i0 )] / _3947_edim1) == _3961_esubi)) )
              {
                {
                  ++ _3960_i0;
                }
              }
              while ( ((_3959_i1 < _3939_pnnz) && ((_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_3959_i1 )] )] % _3945_pdim1) == _3962_psubj)) )
              {
                {
                  ++ _3959_i1;
                }
              }
              int32_t _3965_p1 = _3964_b1;
              int32_t _3966_p0 = _3963_b0;
              bool _3967_haselm = false;
              while ( ((_3966_p0 < _3960_i0) && (_3965_p1 < _3959_i1)) )
              {
                {
                  int64_t _3968_esubj = (_ptr__3924_wi64[safe_add( _3933_sp,_3966_p0 )] % _3947_edim1);
                  int64_t _3969_psubi = (_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_3965_p1 )] )] / _3945_pdim1);
                  if ((_3968_esubj < _3969_psubi))
                  {
                    {
                      ++ _3966_p0;
                    }
                  }
                  else if((_3968_esubj > _3969_psubi))
                  {
                    {
                      ++ _3965_p1;
                    }
                  }
                  else
                  {
                    {
                      _3967_haselm = true;
                      int32_t _3970_n = (_ptr__3923_wi32[safe_add( safe_add( _3930_ptr,_3966_p0 ),(int)1 )] - _ptr__3923_wi32[safe_add( _3930_ptr,_3966_p0 )]);
                      _3958_rnnz += _3970_n;
                      int32_t _11138_;
                      bool _11139_ = (_3931_ncodeatom > (int)0);
                      if (_11139_)
                      {
                        _11138_ = safe_add( (_ptr__3923_wi32[safe_add( _3937_codeptr,_ptr__3923_wi32[safe_add( safe_add( _3930_ptr,_3966_p0 ),(int)1 )] )] - _ptr__3923_wi32[safe_add( _3937_codeptr,_ptr__3923_wi32[safe_add( _3930_ptr,_3966_p0 )] )]),safe_mul( _3970_n,(int)4 ) );
                      }
                      else
                      {
                        _11138_ = safe_mul( _3970_n,(int)3 );
                      }
                      _3956_rncodeatom += _11138_;
                      ++ _3966_p0;
                      ++ _3965_p1;
                    }
                  }
                }
              }
              if (_3967_haselm)
              {
                {
                  ++ _3957_rnelem;
                }
              }
              {}
            }
          }
        }
      }
      int32_t _3971_rnd = (int)1;
      bool _3972_rhassp = (_3957_rnelem < _3946_edim0);
      _3919_rs->alloc_expr(_3971_rnd,_3957_rnelem,_3958_rnnz,_3972_rhassp,_3956_rncodeatom);
      int32_t _3973_rptr = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->ptr_base;
      int32_t _3974_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->nidxs_base;
      int32_t _11140_;
      bool _11141_ = _3972_rhassp;
      if (_11141_)
      {
        _11140_ = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->sp_base;
      }
      else
      {
        _11140_ = _3919_rs->alloci64(_3957_rnelem);
      }
      int32_t _3975_rsp = _11140_;
      int32_t _3976_rcof = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->cof_base;
      bool _3977_rhassp = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->hassp;
      int32_t _3978_rshape = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->shape_base;
      int32_t _3979_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->codeptr_base;
      int32_t _3980_rcode = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->code_base;
      int32_t _3981_rcconst = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int64_t,1 > > _3982_ri64 = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__3982_ri64(_3982_ri64 ? _3982_ri64->raw() : nullptr,_3982_ri64 ? _3982_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _3983_rf64 = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->f64;
      _checked_ptr_1<double> _ptr__3983_rf64(_3983_rf64 ? _3983_rf64->raw() : nullptr,_3983_rf64 ? _3983_rf64->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _3984_ri32 = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__3984_ri32(_3984_ri32 ? _3984_ri32->raw() : nullptr,_3984_ri32 ? _3984_ri32->size(0) : 0);
      if ((_3957_rnelem > (int)0))
      {
        {
          _ptr__3984_ri32[_3973_rptr] = (int)0;
          if ((_3956_rncodeatom > (int)0))
          {
            {
              _ptr__3984_ri32[_3979_rcodeptr] = (int)0;
            }
          }
          {}
          _ptr__3984_ri32[_3978_rshape] = (int32_t)_3946_edim0;
          int32_t _3985_codei = (int)0;
          int32_t _3986_elmi = (int)0;
          int32_t _3987_nzi = (int)0;
          int32_t _3988_i1 = (int)0;
          int32_t _3989_i0 = (int)0;
          while ( ((_3989_i0 < _3927_nelem) && (_3988_i1 < _3939_pnnz)) )
          {
            {
              int64_t _3990_esubi = (_ptr__3924_wi64[safe_add( _3933_sp,_3989_i0 )] / _3947_edim1);
              int64_t _3991_psubj = (_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_3988_i1 )] )] % _3945_pdim1);
              if ((_3990_esubi < _3991_psubj))
              {
                {
                  while ( ((_3989_i0 < _3927_nelem) && ((_ptr__3924_wi64[safe_add( _3933_sp,_3989_i0 )] / _3947_edim1) == _3990_esubi)) )
                  {
                    {
                      ++ _3989_i0;
                    }
                  }
                }
              }
              else if((_3990_esubi > _3991_psubj))
              {
                {
                  while ( ((_3988_i1 < _3939_pnnz) && ((_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_3988_i1 )] )] % _3945_pdim1) == _3991_psubj)) )
                  {
                    {
                      ++ _3988_i1;
                    }
                  }
                }
              }
              else
              {
                {
                  int32_t _3992_b0 = _3989_i0;
                  ++ _3989_i0;
                  int32_t _3993_b1 = _3988_i1;
                  ++ _3988_i1;
                  while ( ((_3989_i0 < _3927_nelem) && ((_ptr__3924_wi64[safe_add( _3933_sp,_3989_i0 )] / _3947_edim1) == _3990_esubi)) )
                  {
                    {
                      ++ _3989_i0;
                    }
                  }
                  while ( ((_3988_i1 < _3939_pnnz) && ((_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_3988_i1 )] )] % _3945_pdim1) == _3991_psubj)) )
                  {
                    {
                      ++ _3988_i1;
                    }
                  }
                  int32_t _3994_p1 = _3993_b1;
                  int32_t _3995_p0 = _3992_b0;
                  int32_t _3996_numelm = (int)0;
                  while ( ((_3995_p0 < _3989_i0) && (_3994_p1 < _3988_i1)) )
                  {
                    {
                      int64_t _3997_esubj = (_ptr__3924_wi64[safe_add( _3933_sp,_3995_p0 )] % _3947_edim1);
                      int64_t _3998_psubi = (_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_3994_p1 )] )] / _3945_pdim1);
                      if ((_3997_esubj < _3998_psubi))
                      {
                        {
                          ++ _3995_p0;
                        }
                      }
                      else if((_3997_esubj > _3998_psubi))
                      {
                        {
                          ++ _3994_p1;
                        }
                      }
                      else
                      {
                        {
                          int32_t _11142_ = _ptr__3923_wi32[safe_add( _3930_ptr,_3995_p0 )];
                          int32_t _11143_ = _ptr__3923_wi32[safe_add( safe_add( _3930_ptr,_3995_p0 ),(int)1 )];
                          for (int32_t _3999_j = _11142_; _3999_j < _11143_; ++_3999_j)
                          {
                            {
                              _ptr__3982_ri64[safe_add( _3974_rnidxs,_3987_nzi )] = _ptr__3924_wi64[safe_add( _3934_nidxs,_3999_j )];
                              _ptr__3983_rf64[safe_add( _3976_rcof,_3987_nzi )] = 0.0;
                              _ptr__3984_ri32[safe_add( _3980_rcode,_3985_codei )] = 2;
                              _ptr__3983_rf64[safe_add( _3981_rcconst,_3985_codei )] = _ptr__3925_wf64[safe_add( _3935_cof,_3999_j )];
                              ++ _3985_codei;
                              if ((_3931_ncodeatom > (int)0))
                              {
                                {
                                  int32_t _11144_ = _ptr__3923_wi32[safe_add( _3937_codeptr,_3999_j )];
                                  int32_t _11145_ = _ptr__3923_wi32[safe_add( safe_add( _3937_codeptr,_3999_j ),(int)1 )];
                                  for (int32_t _4000_k = _11144_; _4000_k < _11145_; ++_4000_k)
                                  {
                                    {
                                      _ptr__3984_ri32[safe_add( _3980_rcode,_3985_codei )] = _ptr__3923_wi32[safe_add( _3938_code,_4000_k )];
                                      _ptr__3983_rf64[safe_add( _3981_rcconst,_3985_codei )] = _ptr__3925_wf64[safe_add( _3936_cconst,_4000_k )];
                                      ++ _3985_codei;
                                    }
                                  }
                                  _ptr__3984_ri32[safe_add( _3980_rcode,_3985_codei )] = 3;
                                  ++ _3985_codei;
                                }
                              }
                              {}
                              _ptr__3984_ri32[safe_add( _3980_rcode,_3985_codei )] = 1;
                              _ptr__3983_rf64[safe_add( _3981_rcconst,_3985_codei )] = _ptr__3950_xi32[safe_add( _3942_pidxs,_ptr__3950_xi32[safe_add( _3948_pperm,_3994_p1 )] )];
                              ++ _3985_codei;
                              _ptr__3984_ri32[safe_add( _3980_rcode,_3985_codei )] = 5;
                              ++ _3985_codei;
                              _ptr__3984_ri32[safe_add( safe_add( _3979_rcodeptr,_3987_nzi ),(int)1 )] = _3985_codei;
                              ++ _3987_nzi;
                            }
                          }
                          ++ _3996_numelm;
                          ++ _3995_p0;
                          ++ _3994_p1;
                        }
                      }
                    }
                  }
                  if ((_3996_numelm > (int)0))
                  {
                    {
                      _ptr__3982_ri64[safe_add( _3975_rsp,_3986_elmi )] = _3990_esubi;
                      _ptr__3984_ri32[safe_add( safe_add( _3973_rptr,_3986_elmi ),(int)1 )] = _3987_nzi;
                      ++ _3986_elmi;
                    }
                  }
                  {}
                }
              }
            }
          }
          if ((_3957_rnelem > _ptr__3984_ri32[_3978_rshape]))
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid shape"));
            }
          }
          {}
          if ((_3986_elmi != _3957_rnelem))
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid num elements"));
            }
          }
          {}
          if ((_3987_nzi != _3958_rnnz))
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid num nonzeros"));
            }
          }
          {}
        }
      }
      {}
      if ((!_3977_rhassp))
      {
        {
          _3919_rs->popi64(_3957_rnelem);
        }
      }
      {}
      _3921_xs->clear();
    }
  }
  else
  {
    {
      int32_t _4001_rncodeatom = (int)0;
      int32_t _4002_rnelem = (int)0;
      int32_t _4003_rnnz = (int)0;
      int32_t _4004_i1 = (int)0;
      while ( (_4004_i1 < _3939_pnnz) )
      {
        {
          int64_t _4005_psubj = (_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_4004_i1 )] )] % _3945_pdim1);
          int32_t _4006_b1 = _4004_i1;
          ++ _4004_i1;
          while ( ((_4004_i1 < _3939_pnnz) && ((_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_4004_i1 )] )] % _3945_pdim1) == _4005_psubj)) )
          {
            {
              ++ _4004_i1;
            }
          }
          int32_t _11146_ = _4006_b1;
          int32_t _11147_ = _4004_i1;
          for (int32_t _4007_k1 = _11146_; _4007_k1 < _11147_; ++_4007_k1)
          {
            {
              int64_t _4008_psubi = (_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_4004_i1 )] )] / _3945_pdim1);
              int64_t _4009_eidx = safe_add( safe_mul( _4005_psubj,_3947_edim1 ),_4008_psubi );
              int32_t _4010_n = (_ptr__3923_wi32[safe_add( safe_add( _3930_ptr,_4009_eidx ),(int)1 )] - _ptr__3923_wi32[safe_add( _3930_ptr,_4009_eidx )]);
              _4003_rnnz += _4010_n;
              int32_t _11148_;
              bool _11149_ = (_3931_ncodeatom > (int)0);
              if (_11149_)
              {
                _11148_ = safe_add( (_ptr__3923_wi32[safe_add( _3937_codeptr,_ptr__3923_wi32[safe_add( safe_add( _3930_ptr,_4009_eidx ),(int)1 )] )] - _ptr__3923_wi32[safe_add( _3937_codeptr,_ptr__3923_wi32[safe_add( _3930_ptr,_4009_eidx )] )]),safe_mul( _4010_n,(int)4 ) );
              }
              else
              {
                _11148_ = safe_mul( _4010_n,(int)3 );
              }
              _4001_rncodeatom += _11148_;
            }
          }
          ++ _4002_rnelem;
        }
      }
      int32_t _4011_rnd = (int)1;
      bool _4012_rhassp = (_4002_rnelem < _3946_edim0);
      _3919_rs->alloc_expr(_4011_rnd,_4002_rnelem,_4003_rnnz,_4012_rhassp,_4001_rncodeatom);
      int32_t _4013_rptr = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->ptr_base;
      int32_t _4014_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->nidxs_base;
      int32_t _11150_;
      bool _11151_ = _4012_rhassp;
      if (_11151_)
      {
        _11150_ = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->sp_base;
      }
      else
      {
        _11150_ = _3919_rs->alloci64(_4002_rnelem);
      }
      int32_t _4015_rsp = _11150_;
      int32_t _4016_rcof = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->cof_base;
      bool _4017_rhassp = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->hassp;
      int32_t _4018_rshape = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->shape_base;
      int32_t _4019_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->codeptr_base;
      int32_t _4020_rcode = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->code_base;
      int32_t _4021_rcconst = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4022_ri64 = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__4022_ri64(_4022_ri64 ? _4022_ri64->raw() : nullptr,_4022_ri64 ? _4022_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _4023_rf64 = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->f64;
      _checked_ptr_1<double> _ptr__4023_rf64(_4023_rf64 ? _4023_rf64->raw() : nullptr,_4023_rf64 ? _4023_rf64->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4024_ri32 = mosek::fusion::p_WorkStack::_get_impl(_3919_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__4024_ri32(_4024_ri32 ? _4024_ri32->raw() : nullptr,_4024_ri32 ? _4024_ri32->size(0) : 0);
      {
        _ptr__4024_ri32[_4013_rptr] = (int)0;
        if ((_4001_rncodeatom > (int)0))
        {
          {
            _ptr__4024_ri32[_4019_rcodeptr] = (int)0;
          }
        }
        {}
        _ptr__4024_ri32[_4018_rshape] = (int32_t)_3946_edim0;
        int32_t _4025_codei = (int)0;
        int32_t _4026_elmi = (int)0;
        int32_t _4027_nzi = (int)0;
        int32_t _4028_i1 = (int)0;
        while ( (_4028_i1 < _3939_pnnz) )
        {
          {
            int64_t _4029_psubj = (_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_4028_i1 )] )] % _3945_pdim1);
            int32_t _4030_b1 = _4028_i1;
            ++ _4028_i1;
            while ( ((_4028_i1 < _3939_pnnz) && ((_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_4028_i1 )] )] % _3945_pdim1) == _4029_psubj)) )
            {
              {
                ++ _4028_i1;
              }
            }
            int32_t _11152_ = _4030_b1;
            int32_t _11153_ = _4028_i1;
            for (int32_t _4031_k1 = _11152_; _4031_k1 < _11153_; ++_4031_k1)
            {
              {
                int64_t _4032_psubi = (_ptr__3941_xi64[safe_add( _3940_psp,_ptr__3950_xi32[safe_add( _3948_pperm,_4031_k1 )] )] / _3945_pdim1);
                int64_t _4033_eidx = safe_add( safe_mul( _4029_psubj,_3947_edim1 ),_4032_psubi );
                int32_t _11154_ = _ptr__3923_wi32[safe_add( _3930_ptr,_4033_eidx )];
                int32_t _11155_ = _ptr__3923_wi32[safe_add( safe_add( _3930_ptr,_4033_eidx ),(int)1 )];
                for (int32_t _4034_i = _11154_; _4034_i < _11155_; ++_4034_i)
                {
                  {
                    _ptr__4022_ri64[safe_add( _4014_rnidxs,_4027_nzi )] = _ptr__3924_wi64[safe_add( _3934_nidxs,_4034_i )];
                    _ptr__4023_rf64[safe_add( _4016_rcof,_4027_nzi )] = 0.0;
                    _ptr__4024_ri32[safe_add( _4020_rcode,_4025_codei )] = 2;
                    _ptr__4023_rf64[safe_add( _4021_rcconst,_4025_codei )] = _ptr__3925_wf64[safe_add( _3935_cof,_4034_i )];
                    ++ _4025_codei;
                    if ((_3931_ncodeatom > (int)0))
                    {
                      {
                        int32_t _11156_ = _ptr__3923_wi32[safe_add( _3937_codeptr,_4034_i )];
                        int32_t _11157_ = _ptr__3923_wi32[safe_add( safe_add( _3937_codeptr,_4034_i ),(int)1 )];
                        for (int32_t _4035_k = _11156_; _4035_k < _11157_; ++_4035_k)
                        {
                          {
                            _ptr__4024_ri32[safe_add( _4020_rcode,_4025_codei )] = _ptr__3923_wi32[safe_add( _3938_code,_4035_k )];
                            _ptr__4023_rf64[safe_add( _4021_rcconst,_4025_codei )] = _ptr__3925_wf64[safe_add( _3936_cconst,_4035_k )];
                            ++ _4025_codei;
                          }
                        }
                        _ptr__4024_ri32[safe_add( _4020_rcode,_4025_codei )] = 3;
                        ++ _4025_codei;
                      }
                    }
                    {}
                    _ptr__4024_ri32[safe_add( _4020_rcode,_4025_codei )] = 1;
                    _ptr__4023_rf64[safe_add( _4021_rcconst,_4025_codei )] = _ptr__3950_xi32[safe_add( _3942_pidxs,_ptr__3950_xi32[safe_add( _3948_pperm,_4031_k1 )] )];
                    ++ _4025_codei;
                    _ptr__4024_ri32[safe_add( _4020_rcode,_4025_codei )] = 5;
                    ++ _4025_codei;
                    _ptr__4024_ri32[safe_add( safe_add( _4019_rcodeptr,_4027_nzi ),(int)1 )] = _4025_codei;
                    ++ _4027_nzi;
                  }
                }
              }
            }
            _ptr__4022_ri64[safe_add( _4015_rsp,_4026_elmi )] = _4029_psubj;
            _ptr__4024_ri32[safe_add( safe_add( _4013_rptr,_4026_elmi ),(int)1 )] = _4027_nzi;
            ++ _4026_elmi;
          }
        }
        if ((_4002_rnelem > _ptr__4024_ri32[_4018_rshape]))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid shape"));
          }
        }
        {}
        if ((_4026_elmi != _4002_rnelem))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid num elements"));
          }
        }
        {}
        if ((_4027_nzi != _4003_rnnz))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid num nonzeros"));
          }
        }
        {}
      }
      if ((!_4017_rhassp))
      {
        {
          _3919_rs->popi64(_4002_rnelem);
        }
      }
      {}
      _3921_xs->clear();
    }
  }
}
// End mosek.fusion.ExprMulParamDiagRight.eval

// Begin mosek.fusion.ExprMulParamDiagRight.toString
// Method mosek.fusion.ExprMulParamDiagRight.toString @ bld/grindsted/final/default/src/fusion/Parameter.monty:2208:6-159
std::string mosek::fusion::ExprMulParamDiagRight :: toString() { return mosek::fusion::p_ExprMulParamDiagRight::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulParamDiagRight::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulParamDiagRight("))->__mosek_2fusion_2Utils_2StringBuffer__a(e->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(p->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprMulParamDiagRight.toString

void mosek::fusion::p_ExprMulParamDiagRight::destroy()
{
  e.reset();
  p.reset();
}
void mosek::fusion::ExprMulParamDiagRight::destroy() { mosek::fusion::p_ExprMulParamDiagRight::_get_impl(this)->destroy(); }
// } class ExprMulParamDiagRight
// class ExprDotParam { // @ bld/grindsted/final/default/src/fusion/Parameter.monty:1997:4-2187:5
mosek::fusion::ExprDotParam::ExprDotParam(mosek::fusion::p_ExprDotParam *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprDotParam()" << this << std::endl; */ }
mosek::fusion::ExprDotParam::~ExprDotParam() {  /* std::cout << "~ExprDotParam()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprDotParam::p_ExprDotParam
  (::mosek::fusion::ExprDotParam * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprDotParam.ctor @ bld/grindsted/final/default/src/fusion/Parameter.monty:2001:6-2011:7
mosek::fusion::ExprDotParam::t mosek::fusion::p_ExprDotParam::_new_ExprDotParam
  (monty::rc_ptr< ::mosek::fusion::Parameter > _4036_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _4037_e)
{ return new mosek::fusion::ExprDotParam(_4036_p,_4037_e); }
mosek::fusion::ExprDotParam::ExprDotParam
  (monty::rc_ptr< ::mosek::fusion::Parameter > _4036_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _4037_e) : 
   ExprDotParam(new mosek::fusion::p_ExprDotParam(this))
{ mosek::fusion::p_ExprDotParam::_get_impl(this)->_initialize(_4036_p,_4037_e); }
void mosek::fusion::p_ExprDotParam::_initialize  (monty::rc_ptr< ::mosek::fusion::Parameter > _4036_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _4037_e)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(::mosek::fusion::p_BaseExpression::modelFrom(_4036_p->__mosek_2fusion_2Expression__getModel(),_4037_e),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))));
    mosek::fusion::p_ExprDotParam::_get_impl(::mosek::fusion::ExprDotParam::t(_pubthis))->p = _4036_p;
    mosek::fusion::p_ExprDotParam::_get_impl(::mosek::fusion::ExprDotParam::t(_pubthis))->e = _4037_e;
    if ((_4036_p->getND() != _4037_e->getND()))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
      }
    }
    {}
    int32_t _11158_ = (int)0;
    int32_t _11159_ = _4036_p->getND();
    for (int32_t _4038_i = _11158_; _4038_i < _11159_; ++_4038_i)
    {
      {
        if ((_4036_p->getDim(_4038_i) != _4037_e->getDim(_4038_i)))
        {
          {
            throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
          }
        }
        {}
      }
    }
  }
}
// mosek.fusion.ExprDotParam.ctor

// Begin mosek.fusion.ExprDotParam.eval
// Method mosek.fusion.ExprDotParam.eval @ bld/grindsted/final/default/src/fusion/Parameter.monty:2015:6-2186:7
void mosek::fusion::ExprDotParam :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4039_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4040_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4041_xs,bool _4042_cache_eval) { mosek::fusion::p_ExprDotParam::_get_impl(this)->eval(_4039_rs,_4040_ws,_4041_xs,_4042_cache_eval); }
void mosek::fusion::p_ExprDotParam::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4039_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4040_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4041_xs,bool _4042_cache_eval)
{
  e->recursive_eval(_4040_ws,_4039_rs,_4041_xs,_4042_cache_eval);
  _4040_ws->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4043_wi32 = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__4043_wi32(_4043_wi32 ? _4043_wi32->raw() : nullptr,_4043_wi32 ? _4043_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4044_wi64 = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__4044_wi64(_4044_wi64 ? _4044_wi64->raw() : nullptr,_4044_wi64 ? _4044_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4045_wf64 = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->f64;
  _checked_ptr_1<double> _ptr__4045_wf64(_4045_wf64 ? _4045_wf64->raw() : nullptr,_4045_wf64 ? _4045_wf64->size(0) : 0);
  int32_t _4046_nd = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->nd;
  int32_t _4047_nelem = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->nelem;
  int32_t _4048_nnz = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->nnz;
  bool _4049_hassp = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->hassp;
  int32_t _4050_ptr = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->ptr_base;
  int32_t _4051_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->ncodeatom;
  int32_t _4052_shape = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->shape_base;
  int32_t _4053_sp = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->sp_base;
  int32_t _4054_nidxs = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->nidxs_base;
  int32_t _4055_cof = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->cof_base;
  int32_t _4056_cconst = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->cconst_base;
  int32_t _4057_codeptr = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->codeptr_base;
  int32_t _4058_code = mosek::fusion::p_WorkStack::_get_impl(_4040_ws)->code_base;
  int32_t _4059_pnnz = p->getNumNonzero();
  int32_t _4060_psp = _4041_xs->alloci64(_4059_pnnz);
  p->getSp(mosek::fusion::p_WorkStack::_get_impl(_4041_xs)->i64,_4060_psp);
  int32_t _4061_pidxs = _4041_xs->alloci32(p->getNumNonzero());
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4062_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4041_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__4062_xi32(_4062_xi32 ? _4062_xi32->raw() : nullptr,_4062_xi32 ? _4062_xi32->size(0) : 0);
  p->getAllIndexes(_4062_xi32,_4061_pidxs);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4063_xi64 = mosek::fusion::p_WorkStack::_get_impl(_4041_xs)->i64;
  _checked_ptr_1<int64_t> _ptr__4063_xi64(_4063_xi64 ? _4063_xi64->raw() : nullptr,_4063_xi64 ? _4063_xi64->size(0) : 0);
  int32_t _4064_rnnz = (int)0;
  int32_t _4065_rnelem = (int)1;
  int32_t _4066_rncodeatom = (int)0;
  if (_4049_hassp)
  {
    {
      int32_t _4067_ei = (int)0;
      int32_t _4068_pi = (int)0;
      while ( ((_4067_ei < _4047_nelem) && (_4068_pi < _4059_pnnz)) )
      {
        {
          if ((_ptr__4044_wi64[safe_add( _4053_sp,_4067_ei )] < _ptr__4063_xi64[safe_add( _4060_psp,_4068_pi )]))
          {
            {
              ++ _4067_ei;
            }
          }
          else if((_ptr__4044_wi64[safe_add( _4053_sp,_4067_ei )] > _ptr__4063_xi64[safe_add( _4060_psp,_4068_pi )]))
          {
            {
              ++ _4068_pi;
            }
          }
          else
          {
            {
              int32_t _4069_n = (_ptr__4043_wi32[safe_add( safe_add( _4050_ptr,_4067_ei ),(int)1 )] - _ptr__4043_wi32[safe_add( _4050_ptr,_4067_ei )]);
              _4064_rnnz += _4069_n;
              int32_t _11160_;
              bool _11161_ = (_4051_ncodeatom > (int)0);
              if (_11161_)
              {
                _11160_ = safe_add( (_ptr__4043_wi32[safe_add( _4057_codeptr,_ptr__4043_wi32[safe_add( safe_add( _4050_ptr,_4067_ei ),(int)1 )] )] - _ptr__4043_wi32[safe_add( _4057_codeptr,_ptr__4043_wi32[safe_add( _4050_ptr,_4067_ei )] )]),safe_mul( (int)4,_4069_n ) );
              }
              else
              {
                _11160_ = safe_mul( (int)3,_4069_n );
              }
              _4066_rncodeatom += _11160_;
              ++ _4067_ei;
              ++ _4068_pi;
            }
          }
        }
      }
    }
  }
  else
  {
    {
      int32_t _11162_ = (int)0;
      int32_t _11163_ = _4059_pnnz;
      for (int32_t _4070_i = _11162_; _4070_i < _11163_; ++_4070_i)
      {
        {
          _4064_rnnz += (_ptr__4043_wi32[safe_add( safe_add( _4050_ptr,_ptr__4063_xi64[safe_add( _4060_psp,_4070_i )] ),(int)1 )] - _ptr__4043_wi32[safe_add( _4050_ptr,_ptr__4063_xi64[safe_add( _4060_psp,_4070_i )] )]);
        }
      }
      if ((_4051_ncodeatom > (int)0))
      {
        {
          int32_t _11164_ = (int)0;
          int32_t _11165_ = _4059_pnnz;
          for (int32_t _4071_i = _11164_; _4071_i < _11165_; ++_4071_i)
          {
            {
              _4066_rncodeatom += safe_add( (_ptr__4043_wi32[safe_add( _4057_codeptr,_ptr__4043_wi32[safe_add( safe_add( _4050_ptr,_ptr__4063_xi64[safe_add( _4060_psp,_4071_i )] ),(int)1 )] )] - _ptr__4043_wi32[safe_add( _4057_codeptr,_ptr__4043_wi32[safe_add( _4050_ptr,_ptr__4063_xi64[safe_add( _4060_psp,_4071_i )] )] )]),safe_mul( (int)4,(_ptr__4043_wi32[safe_add( safe_add( _4050_ptr,_ptr__4063_xi64[safe_add( _4060_psp,_4071_i )] ),(int)1 )] - _ptr__4043_wi32[safe_add( _4050_ptr,_ptr__4063_xi64[safe_add( _4060_psp,_4071_i )] )]) ) );
            }
          }
        }
      }
      else
      {
        {
          int32_t _11166_ = (int)0;
          int32_t _11167_ = _4059_pnnz;
          for (int32_t _4072_i = _11166_; _4072_i < _11167_; ++_4072_i)
          {
            {
              _4066_rncodeatom += safe_mul( (int)3,(_ptr__4043_wi32[safe_add( safe_add( _4050_ptr,_ptr__4063_xi64[safe_add( _4060_psp,_4072_i )] ),(int)1 )] - _ptr__4043_wi32[safe_add( _4050_ptr,_ptr__4063_xi64[safe_add( _4060_psp,_4072_i )] )]) );
            }
          }
        }
      }
    }
  }
  int64_t _4073_rsz = (int)1;
  int32_t _11168_ = (int)0;
  int32_t _11169_ = _4046_nd;
  for (int32_t _4074_i = _11168_; _4074_i < _11169_; ++_4074_i)
  {
    {
      _4073_rsz *= _ptr__4043_wi32[safe_add( _4052_shape,_4074_i )];
    }
  }
  _4039_rs->alloc_expr((int)0,_4065_rnelem,_4064_rnnz,false,_4066_rncodeatom);
  int32_t _4075_rptr = mosek::fusion::p_WorkStack::_get_impl(_4039_rs)->ptr_base;
  int32_t _4076_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_4039_rs)->nidxs_base;
  int32_t _4077_rcof = mosek::fusion::p_WorkStack::_get_impl(_4039_rs)->cof_base;
  bool _4078_rhassp = mosek::fusion::p_WorkStack::_get_impl(_4039_rs)->hassp;
  int32_t _4079_rshape = mosek::fusion::p_WorkStack::_get_impl(_4039_rs)->shape_base;
  int32_t _4080_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_4039_rs)->codeptr_base;
  int32_t _4081_rcode = mosek::fusion::p_WorkStack::_get_impl(_4039_rs)->code_base;
  int32_t _4082_rcconst = mosek::fusion::p_WorkStack::_get_impl(_4039_rs)->cconst_base;
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4083_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4039_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__4083_ri64(_4083_ri64 ? _4083_ri64->raw() : nullptr,_4083_ri64 ? _4083_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4084_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4039_rs)->f64;
  _checked_ptr_1<double> _ptr__4084_rf64(_4084_rf64 ? _4084_rf64->raw() : nullptr,_4084_rf64 ? _4084_rf64->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4085_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4039_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__4085_ri32(_4085_ri32 ? _4085_ri32->raw() : nullptr,_4085_ri32 ? _4085_ri32->size(0) : 0);
  _ptr__4085_ri32[_4075_rptr] = (int)0;
  _ptr__4085_ri32[safe_add( _4075_rptr,(int)1 )] = _4064_rnnz;
  if ((_4066_rncodeatom > (int)0))
  {
    {
      _ptr__4085_ri32[_4080_rcodeptr] = (int)0;
    }
  }
  {}
  if (_4049_hassp)
  {
    {
      int32_t _4086_codei = (int)0;
      int32_t _4087_nzi = (int)0;
      int32_t _4088_elmi = (int)0;
      int32_t _4089_ei = (int)0;
      int32_t _4090_pi = (int)0;
      while ( ((_4089_ei < _4047_nelem) && (_4090_pi < _4059_pnnz)) )
      {
        {
          if ((_ptr__4044_wi64[safe_add( _4053_sp,_4089_ei )] < _ptr__4063_xi64[safe_add( _4060_psp,_4090_pi )]))
          {
            {
              ++ _4089_ei;
            }
          }
          else if((_ptr__4044_wi64[safe_add( _4053_sp,_4089_ei )] > _ptr__4063_xi64[safe_add( _4060_psp,_4090_pi )]))
          {
            {
              ++ _4090_pi;
            }
          }
          else
          {
            {
              int32_t _11170_ = _ptr__4043_wi32[safe_add( _4050_ptr,_4089_ei )];
              int32_t _11171_ = _ptr__4043_wi32[safe_add( safe_add( _4050_ptr,_4089_ei ),(int)1 )];
              for (int32_t _4091_i = _11170_; _4091_i < _11171_; ++_4091_i)
              {
                {
                  _ptr__4083_ri64[safe_add( _4076_rnidxs,_4087_nzi )] = _ptr__4044_wi64[safe_add( _4054_nidxs,_4091_i )];
                  _ptr__4084_rf64[safe_add( _4077_rcof,_4087_nzi )] = 0.0;
                  _ptr__4085_ri32[safe_add( _4081_rcode,_4086_codei )] = 2;
                  _ptr__4084_rf64[safe_add( _4082_rcconst,_4086_codei )] = _ptr__4045_wf64[safe_add( _4055_cof,_4091_i )];
                  ++ _4086_codei;
                  if ((_4051_ncodeatom > (int)0))
                  {
                    {
                      int32_t _11172_ = _ptr__4043_wi32[safe_add( _4057_codeptr,_4091_i )];
                      int32_t _11173_ = _ptr__4043_wi32[safe_add( safe_add( _4057_codeptr,_4091_i ),(int)1 )];
                      for (int32_t _4092_k = _11172_; _4092_k < _11173_; ++_4092_k)
                      {
                        {
                          _ptr__4085_ri32[safe_add( _4081_rcode,_4086_codei )] = _ptr__4043_wi32[safe_add( _4058_code,_4092_k )];
                          _ptr__4084_rf64[safe_add( _4082_rcconst,_4086_codei )] = _ptr__4045_wf64[safe_add( _4056_cconst,_4092_k )];
                          ++ _4086_codei;
                        }
                      }
                      _ptr__4085_ri32[safe_add( _4081_rcode,_4086_codei )] = 3;
                      ++ _4086_codei;
                    }
                  }
                  {}
                  _ptr__4085_ri32[safe_add( _4081_rcode,_4086_codei )] = 1;
                  _ptr__4084_rf64[safe_add( _4082_rcconst,_4086_codei )] = _ptr__4062_xi32[safe_add( _4061_pidxs,_4090_pi )];
                  ++ _4086_codei;
                  _ptr__4085_ri32[safe_add( _4081_rcode,_4086_codei )] = 5;
                  ++ _4086_codei;
                  _ptr__4085_ri32[safe_add( safe_add( _4080_rcodeptr,_4087_nzi ),(int)1 )] = _4086_codei;
                  ++ _4087_nzi;
                }
              }
              ++ _4089_ei;
              ++ _4090_pi;
            }
          }
        }
      }
      if ((_4088_elmi != _4065_rnelem))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: broken elmi"));
        }
      }
      {}
      if ((_4087_nzi != _4064_rnnz))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: broken nzi"));
        }
      }
      {}
      if ((_4086_codei != _4066_rncodeatom))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: broken codei"));
        }
      }
      {}
    }
  }
  else
  {
    {
      int32_t _4093_codei = (int)0;
      int32_t _4094_nzi = (int)0;
      int32_t _11174_ = (int)0;
      int32_t _11175_ = _4059_pnnz;
      for (int32_t _4095_pi = _11174_; _4095_pi < _11175_; ++_4095_pi)
      {
        {
          int32_t _4096_elmi = _4095_pi;
          int64_t _4097_ei = _ptr__4063_xi64[safe_add( _4060_psp,_4095_pi )];
          int32_t _11176_ = _ptr__4043_wi32[safe_add( _4050_ptr,_4097_ei )];
          int32_t _11177_ = _ptr__4043_wi32[safe_add( safe_add( _4050_ptr,_4097_ei ),(int)1 )];
          for (int32_t _4098_i = _11176_; _4098_i < _11177_; ++_4098_i)
          {
            {
              _ptr__4083_ri64[safe_add( _4076_rnidxs,_4094_nzi )] = _ptr__4044_wi64[safe_add( _4054_nidxs,_4098_i )];
              _ptr__4084_rf64[safe_add( _4077_rcof,_4094_nzi )] = 0.0;
              _ptr__4085_ri32[safe_add( _4081_rcode,_4093_codei )] = 2;
              _ptr__4084_rf64[safe_add( _4082_rcconst,_4093_codei )] = _ptr__4045_wf64[safe_add( _4055_cof,_4098_i )];
              ++ _4093_codei;
              if ((_4051_ncodeatom > (int)0))
              {
                {
                  int32_t _11178_ = _ptr__4043_wi32[safe_add( _4057_codeptr,_4098_i )];
                  int32_t _11179_ = _ptr__4043_wi32[safe_add( safe_add( _4057_codeptr,_4098_i ),(int)1 )];
                  for (int32_t _4099_k = _11178_; _4099_k < _11179_; ++_4099_k)
                  {
                    {
                      _ptr__4085_ri32[safe_add( _4081_rcode,_4093_codei )] = _ptr__4043_wi32[safe_add( _4058_code,_4099_k )];
                      _ptr__4084_rf64[safe_add( _4082_rcconst,_4093_codei )] = _ptr__4045_wf64[safe_add( _4056_cconst,_4099_k )];
                      ++ _4093_codei;
                    }
                  }
                  _ptr__4085_ri32[safe_add( _4081_rcode,_4093_codei )] = 3;
                  ++ _4093_codei;
                }
              }
              {}
              _ptr__4085_ri32[safe_add( _4081_rcode,_4093_codei )] = 1;
              _ptr__4084_rf64[safe_add( _4082_rcconst,_4093_codei )] = _ptr__4062_xi32[safe_add( _4061_pidxs,_4095_pi )];
              ++ _4093_codei;
              _ptr__4085_ri32[safe_add( _4081_rcode,_4093_codei )] = 5;
              ++ _4093_codei;
              _ptr__4085_ri32[safe_add( safe_add( _4080_rcodeptr,_4094_nzi ),(int)1 )] = _4093_codei;
              ++ _4094_nzi;
            }
          }
        }
      }
      if ((_4094_nzi != _4064_rnnz))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: invalid nzi"));
        }
      }
      {}
      if ((_4093_codei != _4066_rncodeatom))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: invalid codei"));
        }
      }
      {}
    }
  }
  _4041_xs->clear();
}
// End mosek.fusion.ExprDotParam.eval

// Begin mosek.fusion.ExprDotParam.toString
// Method mosek.fusion.ExprDotParam.toString @ bld/grindsted/final/default/src/fusion/Parameter.monty:2013:6-150
std::string mosek::fusion::ExprDotParam :: toString() { return mosek::fusion::p_ExprDotParam::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprDotParam::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprDotParam("))->__mosek_2fusion_2Utils_2StringBuffer__a(p->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(e->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprDotParam.toString

void mosek::fusion::p_ExprDotParam::destroy()
{
  e.reset();
  p.reset();
}
void mosek::fusion::ExprDotParam::destroy() { mosek::fusion::p_ExprDotParam::_get_impl(this)->destroy(); }
// } class ExprDotParam
// class ExprMulParamElem { // @ bld/grindsted/final/default/src/fusion/Parameter.monty:1665:4-1994:5
mosek::fusion::ExprMulParamElem::ExprMulParamElem(mosek::fusion::p_ExprMulParamElem *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulParamElem()" << this << std::endl; */ }
mosek::fusion::ExprMulParamElem::~ExprMulParamElem() {  /* std::cout << "~ExprMulParamElem()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulParamElem::p_ExprMulParamElem
  (::mosek::fusion::ExprMulParamElem * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulParamElem.ctor @ bld/grindsted/final/default/src/fusion/Parameter.monty:1669:6-1679:7
mosek::fusion::ExprMulParamElem::t mosek::fusion::p_ExprMulParamElem::_new_ExprMulParamElem
  (monty::rc_ptr< ::mosek::fusion::Parameter > _4100_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _4101_e)
{ return new mosek::fusion::ExprMulParamElem(_4100_p,_4101_e); }
mosek::fusion::ExprMulParamElem::ExprMulParamElem
  (monty::rc_ptr< ::mosek::fusion::Parameter > _4100_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _4101_e) : 
   ExprMulParamElem(new mosek::fusion::p_ExprMulParamElem(this))
{ mosek::fusion::p_ExprMulParamElem::_get_impl(this)->_initialize(_4100_p,_4101_e); }
void mosek::fusion::p_ExprMulParamElem::_initialize  (monty::rc_ptr< ::mosek::fusion::Parameter > _4100_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _4101_e)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(::mosek::fusion::p_BaseExpression::modelFrom(_4100_p->__mosek_2fusion_2Expression__getModel(),_4101_e),_4101_e->getShape());
    mosek::fusion::p_ExprMulParamElem::_get_impl(::mosek::fusion::ExprMulParamElem::t(_pubthis))->p = _4100_p;
    mosek::fusion::p_ExprMulParamElem::_get_impl(::mosek::fusion::ExprMulParamElem::t(_pubthis))->e = _4101_e;
    if ((_4100_p->getND() != _4101_e->getND()))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
      }
    }
    {}
    int32_t _11180_ = (int)0;
    int32_t _11181_ = _4100_p->getND();
    for (int32_t _4102_i = _11180_; _4102_i < _11181_; ++_4102_i)
    {
      {
        if ((_4100_p->getDim(_4102_i) != _4101_e->getDim(_4102_i)))
        {
          {
            throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
          }
        }
        {}
      }
    }
  }
}
// mosek.fusion.ExprMulParamElem.ctor

// Begin mosek.fusion.ExprMulParamElem.eval
// Method mosek.fusion.ExprMulParamElem.eval @ bld/grindsted/final/default/src/fusion/Parameter.monty:1683:6-1877:7
void mosek::fusion::ExprMulParamElem :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4103_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4104_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4105_xs,bool _4106_cache_eval) { mosek::fusion::p_ExprMulParamElem::_get_impl(this)->eval(_4103_rs,_4104_ws,_4105_xs,_4106_cache_eval); }
void mosek::fusion::p_ExprMulParamElem::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4103_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4104_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4105_xs,bool _4106_cache_eval)
{
  e->recursive_eval(_4104_ws,_4103_rs,_4105_xs,_4106_cache_eval);
  _4104_ws->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4107_wi32 = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__4107_wi32(_4107_wi32 ? _4107_wi32->raw() : nullptr,_4107_wi32 ? _4107_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4108_wi64 = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__4108_wi64(_4108_wi64 ? _4108_wi64->raw() : nullptr,_4108_wi64 ? _4108_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4109_wf64 = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->f64;
  _checked_ptr_1<double> _ptr__4109_wf64(_4109_wf64 ? _4109_wf64->raw() : nullptr,_4109_wf64 ? _4109_wf64->size(0) : 0);
  int32_t _4110_nd = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->nd;
  int32_t _4111_nelem = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->nelem;
  int32_t _4112_nnz = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->nnz;
  bool _4113_hassp = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->hassp;
  int32_t _4114_ptr = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->ptr_base;
  int32_t _4115_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->ncodeatom;
  int32_t _4116_shape = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->shape_base;
  int32_t _4117_sp = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->sp_base;
  int32_t _4118_nidxs = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->nidxs_base;
  int32_t _4119_cof = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->cof_base;
  int32_t _4120_cconst = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->cconst_base;
  int32_t _4121_codeptr = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->codeptr_base;
  int32_t _4122_code = mosek::fusion::p_WorkStack::_get_impl(_4104_ws)->code_base;
  int32_t _4123_pnnz = p->getNumNonzero();
  int32_t _4124_psp = _4105_xs->alloci64(_4123_pnnz);
  p->getSp(mosek::fusion::p_WorkStack::_get_impl(_4105_xs)->i64,_4124_psp);
  int32_t _4125_pidxs = _4105_xs->alloci32(p->getNumNonzero());
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4126_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4105_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__4126_xi32(_4126_xi32 ? _4126_xi32->raw() : nullptr,_4126_xi32 ? _4126_xi32->size(0) : 0);
  p->getAllIndexes(_4126_xi32,_4125_pidxs);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4127_xi64 = mosek::fusion::p_WorkStack::_get_impl(_4105_xs)->i64;
  _checked_ptr_1<int64_t> _ptr__4127_xi64(_4127_xi64 ? _4127_xi64->raw() : nullptr,_4127_xi64 ? _4127_xi64->size(0) : 0);
  int32_t _4128_rnd = _4110_nd;
  int32_t _4129_rnnz = (int)0;
  int32_t _4130_rnelem = (int)0;
  int32_t _4131_rncodeatom = (int)0;
  if (_4113_hassp)
  {
    {
      int32_t _4132_ei = (int)0;
      int32_t _4133_pi = (int)0;
      while ( ((_4132_ei < _4111_nelem) && (_4133_pi < _4123_pnnz)) )
      {
        {
          if ((_ptr__4108_wi64[safe_add( _4117_sp,_4132_ei )] < _ptr__4127_xi64[safe_add( _4124_psp,_4133_pi )]))
          {
            {
              ++ _4132_ei;
            }
          }
          else if((_ptr__4108_wi64[safe_add( _4117_sp,_4132_ei )] > _ptr__4127_xi64[safe_add( _4124_psp,_4133_pi )]))
          {
            {
              ++ _4133_pi;
            }
          }
          else
          {
            {
              int32_t _4134_n = (_ptr__4107_wi32[safe_add( safe_add( _4114_ptr,_4132_ei ),(int)1 )] - _ptr__4107_wi32[safe_add( _4114_ptr,_4132_ei )]);
              _4129_rnnz += _4134_n;
              int32_t _11182_;
              bool _11183_ = (_4115_ncodeatom > (int)0);
              if (_11183_)
              {
                _11182_ = safe_add( (_ptr__4107_wi32[safe_add( _4121_codeptr,_ptr__4107_wi32[safe_add( safe_add( _4114_ptr,_4132_ei ),(int)1 )] )] - _ptr__4107_wi32[safe_add( _4121_codeptr,_ptr__4107_wi32[safe_add( _4114_ptr,_4132_ei )] )]),safe_mul( (int)4,_4134_n ) );
              }
              else
              {
                _11182_ = safe_mul( (int)3,_4134_n );
              }
              _4131_rncodeatom += _11182_;
              _4130_rnelem += (int)1;
              ++ _4132_ei;
              ++ _4133_pi;
            }
          }
        }
      }
    }
  }
  else
  {
    {
      _4130_rnelem = _4123_pnnz;
      int32_t _11184_ = (int)0;
      int32_t _11185_ = _4123_pnnz;
      for (int32_t _4135_i = _11184_; _4135_i < _11185_; ++_4135_i)
      {
        {
          _4129_rnnz += (_ptr__4107_wi32[safe_add( safe_add( _4114_ptr,_ptr__4127_xi64[safe_add( _4124_psp,_4135_i )] ),(int)1 )] - _ptr__4107_wi32[safe_add( _4114_ptr,_ptr__4127_xi64[safe_add( _4124_psp,_4135_i )] )]);
        }
      }
      if ((_4115_ncodeatom > (int)0))
      {
        {
          int32_t _11186_ = (int)0;
          int32_t _11187_ = _4123_pnnz;
          for (int32_t _4136_i = _11186_; _4136_i < _11187_; ++_4136_i)
          {
            {
              _4131_rncodeatom += safe_add( (_ptr__4107_wi32[safe_add( _4121_codeptr,_ptr__4107_wi32[safe_add( safe_add( _4114_ptr,_ptr__4127_xi64[safe_add( _4124_psp,_4136_i )] ),(int)1 )] )] - _ptr__4107_wi32[safe_add( _4121_codeptr,_ptr__4107_wi32[safe_add( _4114_ptr,_ptr__4127_xi64[safe_add( _4124_psp,_4136_i )] )] )]),safe_mul( (int)4,(_ptr__4107_wi32[safe_add( safe_add( _4114_ptr,_ptr__4127_xi64[safe_add( _4124_psp,_4136_i )] ),(int)1 )] - _ptr__4107_wi32[safe_add( _4114_ptr,_ptr__4127_xi64[safe_add( _4124_psp,_4136_i )] )]) ) );
            }
          }
        }
      }
      else
      {
        {
          int32_t _11188_ = (int)0;
          int32_t _11189_ = _4123_pnnz;
          for (int32_t _4137_i = _11188_; _4137_i < _11189_; ++_4137_i)
          {
            {
              _4131_rncodeatom += safe_mul( (int)3,(_ptr__4107_wi32[safe_add( safe_add( _4114_ptr,_ptr__4127_xi64[safe_add( _4124_psp,_4137_i )] ),(int)1 )] - _ptr__4107_wi32[safe_add( _4114_ptr,_ptr__4127_xi64[safe_add( _4124_psp,_4137_i )] )]) );
            }
          }
        }
      }
    }
  }
  int64_t _4138_rsz = (int)1;
  int32_t _11190_ = (int)0;
  int32_t _11191_ = _4110_nd;
  for (int32_t _4139_i = _11190_; _4139_i < _11191_; ++_4139_i)
  {
    {
      _4138_rsz *= _ptr__4107_wi32[safe_add( _4116_shape,_4139_i )];
    }
  }
  bool _4140_rhassp = (_4130_rnelem < _4138_rsz);
  _4103_rs->alloc_expr(_4128_rnd,_4130_rnelem,_4129_rnnz,_4140_rhassp,_4131_rncodeatom);
  int32_t _4141_rptr = mosek::fusion::p_WorkStack::_get_impl(_4103_rs)->ptr_base;
  int32_t _4142_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_4103_rs)->nidxs_base;
  int32_t _11192_;
  bool _11193_ = _4140_rhassp;
  if (_11193_)
  {
    _11192_ = mosek::fusion::p_WorkStack::_get_impl(_4103_rs)->sp_base;
  }
  else
  {
    _11192_ = _4103_rs->alloci64(_4130_rnelem);
  }
  int32_t _4143_rsp = _11192_;
  int32_t _4144_rcof = mosek::fusion::p_WorkStack::_get_impl(_4103_rs)->cof_base;
  bool _4145_rhassp = mosek::fusion::p_WorkStack::_get_impl(_4103_rs)->hassp;
  int32_t _4146_rshape = mosek::fusion::p_WorkStack::_get_impl(_4103_rs)->shape_base;
  int32_t _4147_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_4103_rs)->codeptr_base;
  int32_t _4148_rcode = mosek::fusion::p_WorkStack::_get_impl(_4103_rs)->code_base;
  int32_t _4149_rcconst = mosek::fusion::p_WorkStack::_get_impl(_4103_rs)->cconst_base;
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4150_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4103_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__4150_ri64(_4150_ri64 ? _4150_ri64->raw() : nullptr,_4150_ri64 ? _4150_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4151_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4103_rs)->f64;
  _checked_ptr_1<double> _ptr__4151_rf64(_4151_rf64 ? _4151_rf64->raw() : nullptr,_4151_rf64 ? _4151_rf64->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4152_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4103_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__4152_ri32(_4152_ri32 ? _4152_ri32->raw() : nullptr,_4152_ri32 ? _4152_ri32->size(0) : 0);
  int32_t _11194_ = (int)0;
  int32_t _11195_ = _4110_nd;
  for (int32_t _4153_i = _11194_; _4153_i < _11195_; ++_4153_i)
  {
    {
      _ptr__4152_ri32[safe_add( _4146_rshape,_4153_i )] = _ptr__4107_wi32[safe_add( _4116_shape,_4153_i )];
    }
  }
  _ptr__4152_ri32[_4141_rptr] = (int)0;
  if ((_4131_rncodeatom > (int)0))
  {
    {
      _ptr__4152_ri32[_4147_rcodeptr] = (int)0;
    }
  }
  {}
  if (_4113_hassp)
  {
    {
      int32_t _4154_codei = (int)0;
      int32_t _4155_nzi = (int)0;
      int32_t _4156_elmi = (int)0;
      int32_t _4157_ei = (int)0;
      int32_t _4158_pi = (int)0;
      while ( ((_4157_ei < _4111_nelem) && (_4158_pi < _4123_pnnz)) )
      {
        {
          if ((_ptr__4108_wi64[safe_add( _4117_sp,_4157_ei )] < _ptr__4127_xi64[safe_add( _4124_psp,_4158_pi )]))
          {
            {
              ++ _4157_ei;
            }
          }
          else if((_ptr__4108_wi64[safe_add( _4117_sp,_4157_ei )] > _ptr__4127_xi64[safe_add( _4124_psp,_4158_pi )]))
          {
            {
              ++ _4158_pi;
            }
          }
          else
          {
            {
              int32_t _11196_ = _ptr__4107_wi32[safe_add( _4114_ptr,_4157_ei )];
              int32_t _11197_ = _ptr__4107_wi32[safe_add( safe_add( _4114_ptr,_4157_ei ),(int)1 )];
              for (int32_t _4159_i = _11196_; _4159_i < _11197_; ++_4159_i)
              {
                {
                  _ptr__4150_ri64[safe_add( _4142_rnidxs,_4155_nzi )] = _ptr__4108_wi64[safe_add( _4118_nidxs,_4159_i )];
                  _ptr__4151_rf64[safe_add( _4144_rcof,_4155_nzi )] = 0.0;
                  _ptr__4152_ri32[safe_add( _4148_rcode,_4154_codei )] = 2;
                  _ptr__4151_rf64[safe_add( _4149_rcconst,_4154_codei )] = _ptr__4109_wf64[safe_add( _4119_cof,_4159_i )];
                  ++ _4154_codei;
                  if ((_4115_ncodeatom > (int)0))
                  {
                    {
                      int32_t _11198_ = _ptr__4107_wi32[safe_add( _4121_codeptr,_4159_i )];
                      int32_t _11199_ = _ptr__4107_wi32[safe_add( safe_add( _4121_codeptr,_4159_i ),(int)1 )];
                      for (int32_t _4160_k = _11198_; _4160_k < _11199_; ++_4160_k)
                      {
                        {
                          _ptr__4152_ri32[safe_add( _4148_rcode,_4154_codei )] = _ptr__4107_wi32[safe_add( _4122_code,_4160_k )];
                          _ptr__4151_rf64[safe_add( _4149_rcconst,_4154_codei )] = _ptr__4109_wf64[safe_add( _4120_cconst,_4160_k )];
                          ++ _4154_codei;
                        }
                      }
                      _ptr__4152_ri32[safe_add( _4148_rcode,_4154_codei )] = 3;
                      ++ _4154_codei;
                    }
                  }
                  {}
                  _ptr__4152_ri32[safe_add( _4148_rcode,_4154_codei )] = 1;
                  _ptr__4151_rf64[safe_add( _4149_rcconst,_4154_codei )] = _ptr__4126_xi32[safe_add( _4125_pidxs,_4158_pi )];
                  ++ _4154_codei;
                  _ptr__4152_ri32[safe_add( _4148_rcode,_4154_codei )] = 5;
                  ++ _4154_codei;
                  _ptr__4152_ri32[safe_add( safe_add( _4147_rcodeptr,_4155_nzi ),(int)1 )] = _4154_codei;
                  ++ _4155_nzi;
                }
              }
              _ptr__4150_ri64[safe_add( _4143_rsp,_4156_elmi )] = _ptr__4108_wi64[safe_add( _4117_sp,_4157_ei )];
              _ptr__4152_ri32[safe_add( safe_add( _4141_rptr,_4156_elmi ),(int)1 )] = _4155_nzi;
              ++ _4156_elmi;
              ++ _4157_ei;
              ++ _4158_pi;
            }
          }
        }
      }
      if ((_4156_elmi != _4130_rnelem))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: broken elmi"));
        }
      }
      {}
      if ((_4155_nzi != _4129_rnnz))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: broken nzi"));
        }
      }
      {}
      if ((_4154_codei != _4131_rncodeatom))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: broken codei"));
        }
      }
      {}
    }
  }
  else
  {
    {
      int32_t _4161_codei = (int)0;
      int32_t _4162_nzi = (int)0;
      int32_t _11200_ = (int)0;
      int32_t _11201_ = _4123_pnnz;
      for (int32_t _4163_pi = _11200_; _4163_pi < _11201_; ++_4163_pi)
      {
        {
          int32_t _4164_elmi = _4163_pi;
          int64_t _4165_ei = _ptr__4127_xi64[safe_add( _4124_psp,_4163_pi )];
          int32_t _11202_ = _ptr__4107_wi32[safe_add( _4114_ptr,_4165_ei )];
          int32_t _11203_ = _ptr__4107_wi32[safe_add( safe_add( _4114_ptr,_4165_ei ),(int)1 )];
          for (int32_t _4166_i = _11202_; _4166_i < _11203_; ++_4166_i)
          {
            {
              _ptr__4150_ri64[safe_add( _4142_rnidxs,_4162_nzi )] = _ptr__4108_wi64[safe_add( _4118_nidxs,_4166_i )];
              _ptr__4151_rf64[safe_add( _4144_rcof,_4162_nzi )] = 0.0;
              _ptr__4152_ri32[safe_add( _4148_rcode,_4161_codei )] = 2;
              _ptr__4151_rf64[safe_add( _4149_rcconst,_4161_codei )] = _ptr__4109_wf64[safe_add( _4119_cof,_4166_i )];
              ++ _4161_codei;
              if ((_4115_ncodeatom > (int)0))
              {
                {
                  int32_t _11204_ = _ptr__4107_wi32[safe_add( _4121_codeptr,_4166_i )];
                  int32_t _11205_ = _ptr__4107_wi32[safe_add( safe_add( _4121_codeptr,_4166_i ),(int)1 )];
                  for (int32_t _4167_k = _11204_; _4167_k < _11205_; ++_4167_k)
                  {
                    {
                      _ptr__4152_ri32[safe_add( _4148_rcode,_4161_codei )] = _ptr__4107_wi32[safe_add( _4122_code,_4167_k )];
                      _ptr__4151_rf64[safe_add( _4149_rcconst,_4161_codei )] = _ptr__4109_wf64[safe_add( _4120_cconst,_4167_k )];
                      ++ _4161_codei;
                    }
                  }
                  _ptr__4152_ri32[safe_add( _4148_rcode,_4161_codei )] = 3;
                  ++ _4161_codei;
                }
              }
              {}
              _ptr__4152_ri32[safe_add( _4148_rcode,_4161_codei )] = 1;
              _ptr__4151_rf64[safe_add( _4149_rcconst,_4161_codei )] = _ptr__4126_xi32[safe_add( _4125_pidxs,_4163_pi )];
              ++ _4161_codei;
              _ptr__4152_ri32[safe_add( _4148_rcode,_4161_codei )] = 5;
              ++ _4161_codei;
              _ptr__4152_ri32[safe_add( safe_add( _4147_rcodeptr,_4162_nzi ),(int)1 )] = _4161_codei;
              ++ _4162_nzi;
            }
          }
          _ptr__4150_ri64[safe_add( _4143_rsp,_4164_elmi )] = _4165_ei;
          _ptr__4152_ri32[safe_add( safe_add( _4141_rptr,_4164_elmi ),(int)1 )] = _4162_nzi;
        }
      }
      if ((_4131_rncodeatom != _4161_codei))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Invalid code list result"));
        }
      }
      {}
    }
  }
  if ((!_4145_rhassp))
  {
    {
      _4103_rs->popi64(_4130_rnelem);
    }
  }
  {}
  _4105_xs->clear();
}
// End mosek.fusion.ExprMulParamElem.eval

// Begin mosek.fusion.ExprMulParamElem.toString
// Method mosek.fusion.ExprMulParamElem.toString @ bld/grindsted/final/default/src/fusion/Parameter.monty:1681:6-154
std::string mosek::fusion::ExprMulParamElem :: toString() { return mosek::fusion::p_ExprMulParamElem::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulParamElem::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulParamElem("))->__mosek_2fusion_2Utils_2StringBuffer__a(p->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(e->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprMulParamElem.toString

void mosek::fusion::p_ExprMulParamElem::destroy()
{
  e.reset();
  p.reset();
}
void mosek::fusion::ExprMulParamElem::destroy() { mosek::fusion::p_ExprMulParamElem::_get_impl(this)->destroy(); }
// } class ExprMulParamElem
// class ExprMulParamRight { // @ bld/grindsted/final/default/src/fusion/Parameter.monty:1216:4-1661:5
mosek::fusion::ExprMulParamRight::ExprMulParamRight(mosek::fusion::p_ExprMulParamRight *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulParamRight()" << this << std::endl; */ }
mosek::fusion::ExprMulParamRight::~ExprMulParamRight() {  /* std::cout << "~ExprMulParamRight()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulParamRight::p_ExprMulParamRight
  (::mosek::fusion::ExprMulParamRight * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulParamRight.ctor @ bld/grindsted/final/default/src/fusion/Parameter.monty:1220:6-1229:7
mosek::fusion::ExprMulParamRight::t mosek::fusion::p_ExprMulParamRight::_new_ExprMulParamRight
  (monty::rc_ptr< ::mosek::fusion::Expression > _4168_e,
    monty::rc_ptr< ::mosek::fusion::Parameter > _4169_p)
{ return new mosek::fusion::ExprMulParamRight(_4168_e,_4169_p); }
mosek::fusion::ExprMulParamRight::ExprMulParamRight
  (monty::rc_ptr< ::mosek::fusion::Expression > _4168_e,
    monty::rc_ptr< ::mosek::fusion::Parameter > _4169_p) : 
   ExprMulParamRight(new mosek::fusion::p_ExprMulParamRight(this))
{ mosek::fusion::p_ExprMulParamRight::_get_impl(this)->_initialize(_4168_e,_4169_p); }
void mosek::fusion::p_ExprMulParamRight::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _4168_e,
    monty::rc_ptr< ::mosek::fusion::Parameter > _4169_p)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_4169_p->__mosek_2fusion_2Expression__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_4168_e->getDim((int)0)),(int32_t)(_4169_p->getDim((int)1))}));
    mosek::fusion::p_ExprMulParamRight::_get_impl(::mosek::fusion::ExprMulParamRight::t(_pubthis))->p = _4169_p;
    mosek::fusion::p_ExprMulParamRight::_get_impl(::mosek::fusion::ExprMulParamRight::t(_pubthis))->e = _4168_e;
    if (((_4169_p->getND() != (int)2) || (_4168_e->getND() != (int)2)))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions for multiplication"));
      }
    }
    {}
    if ((_4169_p->getDim((int)0) != _4168_e->getDim((int)1)))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprMulParamRight.ctor

// Begin mosek.fusion.ExprMulParamRight.eval
// Method mosek.fusion.ExprMulParamRight.eval @ bld/grindsted/final/default/src/fusion/Parameter.monty:1233:6-1529:7
void mosek::fusion::ExprMulParamRight :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4170_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4171_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4172_xs,bool _4173_cache_eval) { mosek::fusion::p_ExprMulParamRight::_get_impl(this)->eval(_4170_rs,_4171_ws,_4172_xs,_4173_cache_eval); }
void mosek::fusion::p_ExprMulParamRight::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4170_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4171_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4172_xs,bool _4173_cache_eval)
{
  e->recursive_eval(_4171_ws,_4170_rs,_4172_xs,_4173_cache_eval);
  _4171_ws->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4174_wi32 = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__4174_wi32(_4174_wi32 ? _4174_wi32->raw() : nullptr,_4174_wi32 ? _4174_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4175_wi64 = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__4175_wi64(_4175_wi64 ? _4175_wi64->raw() : nullptr,_4175_wi64 ? _4175_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4176_wf64 = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->f64;
  _checked_ptr_1<double> _ptr__4176_wf64(_4176_wf64 ? _4176_wf64->raw() : nullptr,_4176_wf64 ? _4176_wf64->size(0) : 0);
  int32_t _4177_nd = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->nd;
  int32_t _4178_nelem = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->nelem;
  int32_t _4179_nnz = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->nnz;
  bool _4180_hassp = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->hassp;
  int32_t _4181_ptr = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->ptr_base;
  int32_t _4182_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->ncodeatom;
  int32_t _4183_shape = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->shape_base;
  int32_t _4184_sp = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->sp_base;
  int32_t _4185_nidxs = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->nidxs_base;
  int32_t _4186_cof = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->cof_base;
  int32_t _4187_cconst = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->cconst_base;
  int32_t _4188_codeptr = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->codeptr_base;
  int32_t _4189_code = mosek::fusion::p_WorkStack::_get_impl(_4171_ws)->code_base;
  if (((_4177_nd != (int)2) || (p->getDim((int)0) != _ptr__4174_wi32[safe_add( _4183_shape,(int)1 )])))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
    }
  }
  {}
  int32_t _4190_edim0 = _ptr__4174_wi32[_4183_shape];
  int32_t _4191_edim1 = _ptr__4174_wi32[safe_add( _4183_shape,(int)1 )];
  int32_t _4192_pdim0 = p->getDim((int)0);
  int32_t _4193_pdim1 = p->getDim((int)1);
  int32_t _4194_pnnz = p->getNumNonzero();
  int32_t _4195_pidxs = _4172_xs->alloci32(p->getNumNonzero());
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4196_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4172_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__4196_xi32(_4196_xi32 ? _4196_xi32->raw() : nullptr,_4196_xi32 ? _4196_xi32->size(0) : 0);
  p->getAllIndexes(_4196_xi32,_4195_pidxs);
  int32_t _4197_pperm = _4172_xs->alloci32(_4194_pnnz);
  int32_t _4198_psp = _4172_xs->alloci64(_4194_pnnz);
  p->getSp(mosek::fusion::p_WorkStack::_get_impl(_4172_xs)->i64,_4198_psp);
  {
    int32_t _4199_pptr = _4172_xs->alloci32(safe_add( _4193_pdim1,(int)1 ));
    std::shared_ptr< monty::ndarray< int32_t,1 > > _4200_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4172_xs)->i32;
    _checked_ptr_1<int32_t> _ptr__4200_xi32(_4200_xi32 ? _4200_xi32->raw() : nullptr,_4200_xi32 ? _4200_xi32->size(0) : 0);
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4201_xi64 = mosek::fusion::p_WorkStack::_get_impl(_4172_xs)->i64;
    _checked_ptr_1<int64_t> _ptr__4201_xi64(_4201_xi64 ? _4201_xi64->raw() : nullptr,_4201_xi64 ? _4201_xi64->size(0) : 0);
    int32_t _11206_ = (int)0;
    int32_t _11207_ = safe_add( _4193_pdim1,(int)1 );
    for (int32_t _4202_i = _11206_; _4202_i < _11207_; ++_4202_i)
    {
      {
        _ptr__4200_xi32[safe_add( _4199_pptr,_4202_i )] = (int)0;
      }
    }
    int32_t _11208_ = (int)0;
    int32_t _11209_ = _4194_pnnz;
    for (int32_t _4203_i = _11208_; _4203_i < _11209_; ++_4203_i)
    {
      {
        ++ _ptr__4200_xi32[safe_add( safe_add( _4199_pptr,(_ptr__4201_xi64[safe_add( _4198_psp,_4203_i )] % _4193_pdim1) ),(int)1 )];
      }
    }
    int32_t _11210_ = (int)0;
    int32_t _11211_ = _4193_pdim1;
    for (int32_t _4204_i = _11210_; _4204_i < _11211_; ++_4204_i)
    {
      {
        _ptr__4200_xi32[safe_add( safe_add( _4199_pptr,_4204_i ),(int)1 )] += _ptr__4200_xi32[safe_add( _4199_pptr,_4204_i )];
      }
    }
    int32_t _11212_ = (int)0;
    int32_t _11213_ = _4194_pnnz;
    for (int32_t _4205_i = _11212_; _4205_i < _11213_; ++_4205_i)
    {
      {
        _ptr__4200_xi32[safe_add( _4197_pperm,_ptr__4200_xi32[safe_add( _4199_pptr,(_ptr__4201_xi64[safe_add( _4198_psp,_4205_i )] % _4193_pdim1) )] )] = _4205_i;
        ++ _ptr__4200_xi32[safe_add( _4199_pptr,(_ptr__4201_xi64[safe_add( _4198_psp,_4205_i )] % _4193_pdim1) )];
      }
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4206_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4172_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__4206_xi32(_4206_xi32 ? _4206_xi32->raw() : nullptr,_4206_xi32 ? _4206_xi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4207_xi64 = mosek::fusion::p_WorkStack::_get_impl(_4172_xs)->i64;
  _checked_ptr_1<int64_t> _ptr__4207_xi64(_4207_xi64 ? _4207_xi64->raw() : nullptr,_4207_xi64 ? _4207_xi64->size(0) : 0);
  int32_t _4208_rncodeatom = (int)0;
  int32_t _4209_rnelem = (int)0;
  int32_t _4210_rnnz = (int)0;
  if (((!p->isSparse()) && (!_4180_hassp)))
  {
    {
      _4210_rnnz = safe_mul( _4179_nnz,_4193_pdim1 );
      _4209_rnelem = safe_mul( _4190_edim0,_4193_pdim1 );
      int32_t _11214_;
      bool _11215_ = (_4182_ncodeatom > (int)0);
      if (_11215_)
      {
        _11214_ = safe_mul( safe_add( _4182_ncodeatom,safe_mul( _4179_nnz,(int)4 ) ),_4193_pdim1 );
      }
      else
      {
        _11214_ = safe_mul( safe_mul( _4179_nnz,_4193_pdim1 ),(int)3 );
      }
      _4208_rncodeatom = _11214_;
    }
  }
  else if((!_4180_hassp))
  {
    {
      int32_t _4211_i1 = (int)0;
      while ( (_4211_i1 < _4194_pnnz) )
      {
        {
          int64_t _4212_psubj = (_ptr__4207_xi64[safe_add( _4198_psp,_ptr__4206_xi32[safe_add( _4197_pperm,_4211_i1 )] )] % _4193_pdim1);
          int32_t _4213_b1 = _4211_i1;
          while ( ((_4211_i1 < _4194_pnnz) && ((_ptr__4207_xi64[safe_add( _4198_psp,_ptr__4206_xi32[safe_add( _4197_pperm,_4211_i1 )] )] % _4193_pdim1) == _4212_psubj)) )
          {
            {
              int64_t _4214_psubi = (_ptr__4207_xi64[safe_add( _4198_psp,_ptr__4206_xi32[safe_add( _4197_pperm,_4211_i1 )] )] / _4193_pdim1);
              int32_t _11216_ = (int)0;
              int32_t _11217_ = _4190_edim0;
              for (int32_t _4215_i0 = _11216_; _4215_i0 < _11217_; ++_4215_i0)
              {
                {
                  int64_t _4216_eidx = safe_add( safe_mul( _4215_i0,_4191_edim1 ),_4214_psubi );
                  int32_t _4217_n = (_ptr__4174_wi32[safe_add( safe_add( _4181_ptr,_4216_eidx ),(int)1 )] - _ptr__4174_wi32[safe_add( _4181_ptr,_4216_eidx )]);
                  _4210_rnnz += _4217_n;
                  int32_t _11218_;
                  bool _11219_ = (_4182_ncodeatom > (int)0);
                  if (_11219_)
                  {
                    _11218_ = safe_add( (_ptr__4174_wi32[safe_add( _4188_codeptr,_ptr__4174_wi32[safe_add( safe_add( _4181_ptr,_4216_eidx ),(int)1 )] )] - _ptr__4174_wi32[safe_add( _4188_codeptr,_ptr__4174_wi32[safe_add( _4181_ptr,_4216_eidx )] )]),safe_mul( _4217_n,(int)4 ) );
                  }
                  else
                  {
                    _11218_ = safe_mul( _4217_n,(int)3 );
                  }
                  _4208_rncodeatom += _11218_;
                }
              }
              ++ _4211_i1;
            }
          }
          _4209_rnelem += _4190_edim0;
        }
      }
    }
  }
  else
  {
    {
      int32_t _4218_i0 = (int)0;
      while ( (_4218_i0 < _4178_nelem) )
      {
        {
          int64_t _4219_erow = (_ptr__4175_wi64[safe_add( _4184_sp,_4218_i0 )] / _4191_edim1);
          int32_t _4220_b0 = _4218_i0;
          int64_t _4221_rowend = safe_mul( safe_add( _4219_erow,(int)1 ),_4191_edim1 );
          while ( ((_4218_i0 < _4178_nelem) && (_ptr__4175_wi64[safe_add( _4184_sp,_4218_i0 )] < _4221_rowend)) )
          {
            {
              ++ _4218_i0;
            }
          }
          int32_t _4222_i1 = (int)0;
          while ( (_4222_i1 < _4194_pnnz) )
          {
            {
              int64_t _4223_pcol = (_ptr__4207_xi64[safe_add( _4198_psp,_ptr__4206_xi32[safe_add( _4197_pperm,_4222_i1 )] )] % _4193_pdim1);
              int32_t _4224_b1 = _4222_i1;
              while ( ((_4222_i1 < _4194_pnnz) && (_4223_pcol == (_ptr__4207_xi64[safe_add( _4198_psp,_ptr__4206_xi32[safe_add( _4197_pperm,_4222_i1 )] )] % _4193_pdim1))) )
              {
                {
                  ++ _4222_i1;
                }
              }
              int32_t _4225_nentryelm = (int)0;
              int32_t _4226_ii1 = _4224_b1;
              int32_t _4227_ii0 = _4220_b0;
              while ( ((_4227_ii0 < _4218_i0) && (_4226_ii1 < _4222_i1)) )
              {
                {
                  int64_t _4228_ecol = (_ptr__4175_wi64[safe_add( _4184_sp,_4227_ii0 )] % _4191_edim1);
                  int64_t _4229_prow = (_ptr__4207_xi64[safe_add( _4198_psp,_ptr__4206_xi32[safe_add( _4197_pperm,_4226_ii1 )] )] / _4193_pdim1);
                  if ((_4228_ecol < _4229_prow))
                  {
                    {
                      ++ _4227_ii0;
                    }
                  }
                  else if((_4228_ecol > _4229_prow))
                  {
                    {
                      ++ _4226_ii1;
                    }
                  }
                  else
                  {
                    {
                      int32_t _4230_n = (_ptr__4174_wi32[safe_add( safe_add( _4181_ptr,_4227_ii0 ),(int)1 )] - _ptr__4174_wi32[safe_add( _4181_ptr,_4227_ii0 )]);
                      _4210_rnnz += _4230_n;
                      int32_t _11220_;
                      bool _11221_ = (_4182_ncodeatom > (int)0);
                      if (_11221_)
                      {
                        _11220_ = safe_add( (_ptr__4174_wi32[safe_add( _4188_codeptr,_ptr__4174_wi32[safe_add( safe_add( _4181_ptr,_4227_ii0 ),(int)1 )] )] - _ptr__4174_wi32[safe_add( _4188_codeptr,_ptr__4174_wi32[safe_add( _4181_ptr,_4227_ii0 )] )]),safe_mul( _4230_n,(int)4 ) );
                      }
                      else
                      {
                        _11220_ = safe_mul( _4230_n,(int)3 );
                      }
                      _4208_rncodeatom += _11220_;
                      ++ _4227_ii0;
                      ++ _4226_ii1;
                      ++ _4225_nentryelm;
                    }
                  }
                }
              }
              if ((_4225_nentryelm > (int)0))
              {
                {
                  ++ _4209_rnelem;
                }
              }
              {}
            }
          }
        }
      }
    }
  }
  int32_t _4231_rnd = (int)2;
  bool _4232_rhassp = (_4209_rnelem < safe_mul( _4193_pdim1,_4190_edim0 ));
  _4170_rs->alloc_expr(_4231_rnd,_4209_rnelem,_4210_rnnz,_4232_rhassp,_4208_rncodeatom);
  int32_t _4233_rptr = mosek::fusion::p_WorkStack::_get_impl(_4170_rs)->ptr_base;
  int32_t _4234_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_4170_rs)->nidxs_base;
  int32_t _11222_;
  bool _11223_ = _4232_rhassp;
  if (_11223_)
  {
    _11222_ = mosek::fusion::p_WorkStack::_get_impl(_4170_rs)->sp_base;
  }
  else
  {
    _11222_ = _4170_rs->alloci64(_4209_rnelem);
  }
  int32_t _4235_rsp = _11222_;
  int32_t _4236_rcof = mosek::fusion::p_WorkStack::_get_impl(_4170_rs)->cof_base;
  bool _4237_rhassp = mosek::fusion::p_WorkStack::_get_impl(_4170_rs)->hassp;
  int32_t _4238_rshape = mosek::fusion::p_WorkStack::_get_impl(_4170_rs)->shape_base;
  int32_t _4239_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_4170_rs)->codeptr_base;
  int32_t _4240_rcode = mosek::fusion::p_WorkStack::_get_impl(_4170_rs)->code_base;
  int32_t _4241_rcconst = mosek::fusion::p_WorkStack::_get_impl(_4170_rs)->cconst_base;
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4242_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4170_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__4242_ri64(_4242_ri64 ? _4242_ri64->raw() : nullptr,_4242_ri64 ? _4242_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4243_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4170_rs)->f64;
  _checked_ptr_1<double> _ptr__4243_rf64(_4243_rf64 ? _4243_rf64->raw() : nullptr,_4243_rf64 ? _4243_rf64->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4244_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4170_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__4244_ri32(_4244_ri32 ? _4244_ri32->raw() : nullptr,_4244_ri32 ? _4244_ri32->size(0) : 0);
  _ptr__4244_ri32[_4233_rptr] = (int)0;
  if ((_4208_rncodeatom > (int)0))
  {
    {
      _ptr__4244_ri32[_4239_rcodeptr] = (int)0;
    }
  }
  {}
  _ptr__4244_ri32[_4238_rshape] = _4190_edim0;
  _ptr__4244_ri32[safe_add( _4238_rshape,(int)1 )] = _4193_pdim1;
  int32_t _4245_codei = (int)0;
  int32_t _4246_elmi = (int)0;
  int32_t _4247_nzi = (int)0;
  if ((!_4180_hassp))
  {
    {
      int32_t _11224_ = (int)0;
      int32_t _11225_ = _4190_edim0;
      for (int32_t _4248_i = _11224_; _4248_i < _11225_; ++_4248_i)
      {
        {
          int32_t _4249_i1 = (int)0;
          while ( (_4249_i1 < _4194_pnnz) )
          {
            {
              int32_t _4250_b1 = _4249_i1;
              int64_t _4251_psubj = (_ptr__4207_xi64[safe_add( _4198_psp,_ptr__4206_xi32[safe_add( _4197_pperm,_4249_i1 )] )] % _4193_pdim1);
              while ( ((_4249_i1 < _4194_pnnz) && (_4251_psubj == (_ptr__4207_xi64[safe_add( _4198_psp,_ptr__4206_xi32[safe_add( _4197_pperm,_4249_i1 )] )] % _4193_pdim1))) )
              {
                {
                  ++ _4249_i1;
                }
              }
              int32_t _4252_ii1 = _4250_b1;
              while ( (_4252_ii1 < _4249_i1) )
              {
                {
                  int64_t _4253_psubi = (_ptr__4207_xi64[safe_add( _4198_psp,_ptr__4206_xi32[safe_add( _4197_pperm,_4252_ii1 )] )] / _4193_pdim1);
                  int64_t _4254_eidx = safe_add( safe_mul( _4248_i,_4191_edim1 ),_4253_psubi );
                  int32_t _4255_pidx = _ptr__4206_xi32[safe_add( _4195_pidxs,_ptr__4206_xi32[safe_add( _4197_pperm,_4252_ii1 )] )];
                  int32_t _11226_ = _ptr__4174_wi32[safe_add( _4181_ptr,_4254_eidx )];
                  int32_t _11227_ = _ptr__4174_wi32[safe_add( safe_add( _4181_ptr,_4254_eidx ),(int)1 )];
                  for (int32_t _4256_k = _11226_; _4256_k < _11227_; ++_4256_k)
                  {
                    {
                      _ptr__4242_ri64[safe_add( _4234_rnidxs,_4247_nzi )] = _ptr__4175_wi64[safe_add( _4185_nidxs,_4256_k )];
                      _ptr__4243_rf64[safe_add( _4236_rcof,_4247_nzi )] = (int)0;
                      _ptr__4244_ri32[safe_add( _4240_rcode,_4245_codei )] = 2;
                      _ptr__4243_rf64[safe_add( _4241_rcconst,_4245_codei )] = _ptr__4176_wf64[safe_add( _4186_cof,_4256_k )];
                      ++ _4245_codei;
                      if ((_4182_ncodeatom > (int)0))
                      {
                        {
                          int32_t _11228_ = _ptr__4174_wi32[safe_add( _4188_codeptr,_4256_k )];
                          int32_t _11229_ = _ptr__4174_wi32[safe_add( safe_add( _4188_codeptr,_4256_k ),(int)1 )];
                          for (int32_t _4257_l = _11228_; _4257_l < _11229_; ++_4257_l)
                          {
                            {
                              _ptr__4244_ri32[safe_add( _4240_rcode,_4245_codei )] = _ptr__4174_wi32[safe_add( _4189_code,_4257_l )];
                              _ptr__4243_rf64[safe_add( _4241_rcconst,_4245_codei )] = _ptr__4176_wf64[safe_add( _4187_cconst,_4257_l )];
                              ++ _4245_codei;
                            }
                          }
                          _ptr__4244_ri32[safe_add( _4240_rcode,_4245_codei )] = 3;
                          ++ _4245_codei;
                        }
                      }
                      {}
                      _ptr__4244_ri32[safe_add( _4240_rcode,_4245_codei )] = 1;
                      _ptr__4243_rf64[safe_add( _4241_rcconst,_4245_codei )] = _4255_pidx;
                      ++ _4245_codei;
                      _ptr__4244_ri32[safe_add( _4240_rcode,_4245_codei )] = 5;
                      ++ _4245_codei;
                      _ptr__4244_ri32[safe_add( safe_add( _4239_rcodeptr,_4247_nzi ),(int)1 )] = _4245_codei;
                      ++ _4247_nzi;
                    }
                  }
                  ++ _4252_ii1;
                }
              }
              _ptr__4244_ri32[safe_add( safe_add( _4233_rptr,_4246_elmi ),(int)1 )] = _4247_nzi;
              _ptr__4242_ri64[safe_add( _4235_rsp,_4246_elmi )] = safe_add( safe_mul( _4248_i,_4193_pdim1 ),_4251_psubj );
              ++ _4246_elmi;
            }
          }
        }
      }
    }
  }
  else
  {
    {
      int32_t _4258_i0 = (int)0;
      while ( (_4258_i0 < _4178_nelem) )
      {
        {
          int64_t _4259_erow = (_ptr__4175_wi64[safe_add( _4184_sp,_4258_i0 )] / _4191_edim1);
          int32_t _4260_b0 = _4258_i0;
          int64_t _4261_rowend = safe_mul( safe_add( _4259_erow,(int)1 ),_4191_edim1 );
          while ( ((_4258_i0 < _4178_nelem) && (_ptr__4175_wi64[safe_add( _4184_sp,_4258_i0 )] < _4261_rowend)) )
          {
            {
              ++ _4258_i0;
            }
          }
          int32_t _4262_i1 = (int)0;
          while ( (_4262_i1 < _4194_pnnz) )
          {
            {
              int64_t _4263_pcol = (_ptr__4207_xi64[safe_add( _4198_psp,_ptr__4206_xi32[safe_add( _4197_pperm,_4262_i1 )] )] % _4193_pdim1);
              int32_t _4264_b1 = _4262_i1;
              while ( ((_4262_i1 < _4194_pnnz) && (_4263_pcol == (_ptr__4207_xi64[safe_add( _4198_psp,_ptr__4206_xi32[safe_add( _4197_pperm,_4262_i1 )] )] % _4193_pdim1))) )
              {
                {
                  ++ _4262_i1;
                }
              }
              int32_t _4265_nentryelm = (int)0;
              int32_t _4266_ii1 = _4264_b1;
              int32_t _4267_ii0 = _4260_b0;
              while ( ((_4267_ii0 < _4258_i0) && (_4266_ii1 < _4262_i1)) )
              {
                {
                  int64_t _4268_ecol = (_ptr__4175_wi64[safe_add( _4184_sp,_4267_ii0 )] % _4191_edim1);
                  int64_t _4269_prow = (_ptr__4207_xi64[safe_add( _4198_psp,_ptr__4206_xi32[safe_add( _4197_pperm,_4266_ii1 )] )] / _4193_pdim1);
                  if ((_4268_ecol < _4269_prow))
                  {
                    {
                      ++ _4267_ii0;
                    }
                  }
                  else if((_4268_ecol > _4269_prow))
                  {
                    {
                      ++ _4266_ii1;
                    }
                  }
                  else
                  {
                    {
                      int32_t _4270_pidx = _ptr__4206_xi32[safe_add( _4195_pidxs,_ptr__4206_xi32[safe_add( _4197_pperm,_4266_ii1 )] )];
                      int32_t _11230_ = _ptr__4174_wi32[safe_add( _4181_ptr,_4267_ii0 )];
                      int32_t _11231_ = _ptr__4174_wi32[safe_add( safe_add( _4181_ptr,_4267_ii0 ),(int)1 )];
                      for (int32_t _4271_k = _11230_; _4271_k < _11231_; ++_4271_k)
                      {
                        {
                          _ptr__4242_ri64[safe_add( _4234_rnidxs,_4247_nzi )] = _ptr__4175_wi64[safe_add( _4185_nidxs,_4271_k )];
                          _ptr__4243_rf64[safe_add( _4236_rcof,_4247_nzi )] = (int)0;
                          _ptr__4244_ri32[safe_add( _4240_rcode,_4245_codei )] = 2;
                          _ptr__4243_rf64[safe_add( _4241_rcconst,_4245_codei )] = _ptr__4176_wf64[safe_add( _4186_cof,_4271_k )];
                          ++ _4245_codei;
                          if ((_4182_ncodeatom > (int)0))
                          {
                            {
                              int32_t _11232_ = _ptr__4174_wi32[safe_add( _4188_codeptr,_4271_k )];
                              int32_t _11233_ = _ptr__4174_wi32[safe_add( safe_add( _4188_codeptr,_4271_k ),(int)1 )];
                              for (int32_t _4272_l = _11232_; _4272_l < _11233_; ++_4272_l)
                              {
                                {
                                  _ptr__4244_ri32[safe_add( _4240_rcode,_4245_codei )] = _ptr__4174_wi32[safe_add( _4189_code,_4272_l )];
                                  _ptr__4243_rf64[safe_add( _4241_rcconst,_4245_codei )] = _ptr__4176_wf64[safe_add( _4187_cconst,_4272_l )];
                                  ++ _4245_codei;
                                }
                              }
                              _ptr__4244_ri32[safe_add( _4240_rcode,_4245_codei )] = 3;
                              ++ _4245_codei;
                            }
                          }
                          {}
                          _ptr__4244_ri32[safe_add( _4240_rcode,_4245_codei )] = 1;
                          _ptr__4243_rf64[safe_add( _4241_rcconst,_4245_codei )] = _4270_pidx;
                          ++ _4245_codei;
                          _ptr__4244_ri32[safe_add( _4240_rcode,_4245_codei )] = 5;
                          ++ _4245_codei;
                          _ptr__4244_ri32[safe_add( safe_add( _4239_rcodeptr,_4247_nzi ),(int)1 )] = _4245_codei;
                          ++ _4247_nzi;
                        }
                      }
                      ++ _4267_ii0;
                      ++ _4266_ii1;
                      ++ _4265_nentryelm;
                    }
                  }
                }
              }
              if ((_4265_nentryelm > (int)0))
              {
                {
                  _ptr__4244_ri32[safe_add( safe_add( _4233_rptr,_4246_elmi ),(int)1 )] = _4247_nzi;
                  _ptr__4242_ri64[safe_add( _4235_rsp,_4246_elmi )] = safe_add( safe_mul( _4259_erow,_4193_pdim1 ),_4263_pcol );
                  ++ _4246_elmi;
                }
              }
              {}
            }
          }
        }
      }
    }
  }
  if ((!_4237_rhassp))
  {
    {
      _4170_rs->popi64(_4209_rnelem);
    }
  }
  {}
  if ((_4246_elmi != _4209_rnelem))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("broken elmi"));
    }
  }
  {}
  if ((_4247_nzi != _4210_rnnz))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("broken nzi"));
    }
  }
  {}
  if ((_4245_codei != _4208_rncodeatom))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("broken codei"));
    }
  }
  {}
  _4172_xs->clear();
}
// End mosek.fusion.ExprMulParamRight.eval

// Begin mosek.fusion.ExprMulParamRight.toString
// Method mosek.fusion.ExprMulParamRight.toString @ bld/grindsted/final/default/src/fusion/Parameter.monty:1231:6-155
std::string mosek::fusion::ExprMulParamRight :: toString() { return mosek::fusion::p_ExprMulParamRight::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulParamRight::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulParamRight("))->__mosek_2fusion_2Utils_2StringBuffer__a(e->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(p->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprMulParamRight.toString

void mosek::fusion::p_ExprMulParamRight::destroy()
{
  e.reset();
  p.reset();
}
void mosek::fusion::ExprMulParamRight::destroy() { mosek::fusion::p_ExprMulParamRight::_get_impl(this)->destroy(); }
// } class ExprMulParamRight
// class ExprMulParamLeft { // @ bld/grindsted/final/default/src/fusion/Parameter.monty:635:4-1211:5
mosek::fusion::ExprMulParamLeft::ExprMulParamLeft(mosek::fusion::p_ExprMulParamLeft *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulParamLeft()" << this << std::endl; */ }
mosek::fusion::ExprMulParamLeft::~ExprMulParamLeft() {  /* std::cout << "~ExprMulParamLeft()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulParamLeft::p_ExprMulParamLeft
  (::mosek::fusion::ExprMulParamLeft * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulParamLeft.ctor @ bld/grindsted/final/default/src/fusion/Parameter.monty:639:6-648:7
mosek::fusion::ExprMulParamLeft::t mosek::fusion::p_ExprMulParamLeft::_new_ExprMulParamLeft
  (monty::rc_ptr< ::mosek::fusion::Parameter > _4273_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _4274_e)
{ return new mosek::fusion::ExprMulParamLeft(_4273_p,_4274_e); }
mosek::fusion::ExprMulParamLeft::ExprMulParamLeft
  (monty::rc_ptr< ::mosek::fusion::Parameter > _4273_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _4274_e) : 
   ExprMulParamLeft(new mosek::fusion::p_ExprMulParamLeft(this))
{ mosek::fusion::p_ExprMulParamLeft::_get_impl(this)->_initialize(_4273_p,_4274_e); }
void mosek::fusion::p_ExprMulParamLeft::_initialize  (monty::rc_ptr< ::mosek::fusion::Parameter > _4273_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _4274_e)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_4273_p->__mosek_2fusion_2Expression__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_4273_p->getDim((int)0)),(int32_t)(_4274_e->getDim((int)1))}));
    mosek::fusion::p_ExprMulParamLeft::_get_impl(::mosek::fusion::ExprMulParamLeft::t(_pubthis))->p = _4273_p;
    mosek::fusion::p_ExprMulParamLeft::_get_impl(::mosek::fusion::ExprMulParamLeft::t(_pubthis))->e = _4274_e;
    if (((_4273_p->getND() != (int)2) || (_4274_e->getND() != (int)2)))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions for multiplication"));
      }
    }
    {}
    if ((_4273_p->getDim((int)1) != _4274_e->getDim((int)0)))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprMulParamLeft.ctor

// Begin mosek.fusion.ExprMulParamLeft.eval
// Method mosek.fusion.ExprMulParamLeft.eval @ bld/grindsted/final/default/src/fusion/Parameter.monty:652:6-1087:7
void mosek::fusion::ExprMulParamLeft :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4275_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4276_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4277_xs,bool _4278_cache_eval) { mosek::fusion::p_ExprMulParamLeft::_get_impl(this)->eval(_4275_rs,_4276_ws,_4277_xs,_4278_cache_eval); }
void mosek::fusion::p_ExprMulParamLeft::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4275_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4276_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4277_xs,bool _4278_cache_eval)
{
  e->recursive_eval(_4276_ws,_4275_rs,_4277_xs,_4278_cache_eval);
  _4276_ws->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4279_wi32 = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__4279_wi32(_4279_wi32 ? _4279_wi32->raw() : nullptr,_4279_wi32 ? _4279_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4280_wi64 = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__4280_wi64(_4280_wi64 ? _4280_wi64->raw() : nullptr,_4280_wi64 ? _4280_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4281_wf64 = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->f64;
  _checked_ptr_1<double> _ptr__4281_wf64(_4281_wf64 ? _4281_wf64->raw() : nullptr,_4281_wf64 ? _4281_wf64->size(0) : 0);
  int32_t _4282_nd = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->nd;
  int32_t _4283_nelem = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->nelem;
  int32_t _4284_nnz = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->nnz;
  bool _4285_hassp = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->hassp;
  int32_t _4286_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->ncodeatom;
  int32_t _4287_ptr = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->ptr_base;
  int32_t _4288_code = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->code_base;
  int32_t _4289_cconst = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->cconst_base;
  int32_t _4290_codeptr = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->codeptr_base;
  int32_t _4291_shape = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->shape_base;
  int32_t _4292_sp = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->sp_base;
  int32_t _4293_nidxs = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->nidxs_base;
  int32_t _4294_cof = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->cof_base;
  int32_t _4295_consts = mosek::fusion::p_WorkStack::_get_impl(_4276_ws)->cconst_base;
  if (((_4282_nd != (int)2) || (_ptr__4279_wi32[_4291_shape] != p->getDim((int)1))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
    }
  }
  {}
  int32_t _4296_pdim0 = p->getDim((int)0);
  int32_t _4297_pdim1 = p->getDim((int)1);
  int32_t _4298_edim0 = _ptr__4279_wi32[_4291_shape];
  int32_t _4299_edim1 = _ptr__4279_wi32[safe_add( _4291_shape,(int)1 )];
  int32_t _4300_pnnz = p->getNumNonzero();
  int32_t _4301_pidxs = _4277_xs->alloci32(p->getNumNonzero());
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4302_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4277_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__4302_xi32(_4302_xi32 ? _4302_xi32->raw() : nullptr,_4302_xi32 ? _4302_xi32->size(0) : 0);
  p->getAllIndexes(_4302_xi32,_4301_pidxs);
  if (((!_4285_hassp) && (!p->isSparse())))
  {
    {
      int32_t _4303_rnd = (int)2;
      int32_t _4304_rnelem = safe_mul( _4299_edim1,p->getDim((int)0) );
      int32_t _4305_rnnz = safe_mul( _4284_nnz,p->getDim((int)0) );
      int32_t _11234_;
      bool _11235_ = (_4286_ncodeatom > (int)0);
      if (_11235_)
      {
        _11234_ = safe_add( safe_mul( p->getDim((int)0),_4286_ncodeatom ),safe_mul( (int)4,_4305_rnnz ) );
      }
      else
      {
        _11234_ = safe_mul( (int)3,_4305_rnnz );
      }
      int32_t _4306_rncodeatom = _11234_;
      bool _4307_rhassp = false;
      _4275_rs->alloc_expr(_4303_rnd,_4304_rnelem,_4305_rnnz,_4307_rhassp,_4306_rncodeatom);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4308_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__4308_ri64(_4308_ri64 ? _4308_ri64->raw() : nullptr,_4308_ri64 ? _4308_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _4309_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->f64;
      _checked_ptr_1<double> _ptr__4309_rf64(_4309_rf64 ? _4309_rf64->raw() : nullptr,_4309_rf64 ? _4309_rf64->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4310_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__4310_ri32(_4310_ri32 ? _4310_ri32->raw() : nullptr,_4310_ri32 ? _4310_ri32->size(0) : 0);
      int32_t _4311_rptr = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->ptr_base;
      int32_t _4312_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->nidxs_base;
      int32_t _4313_rcof = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->cof_base;
      int32_t _4314_rcode = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->code_base;
      int32_t _4315_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->codeptr_base;
      int32_t _4316_rcconst = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->cconst_base;
      bool _4317_rhassp = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->hassp;
      int32_t _4318_rshape = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->shape_base;
      _ptr__4310_ri32[_4318_rshape] = _4296_pdim0;
      _ptr__4310_ri32[safe_add( _4318_rshape,(int)1 )] = _4299_edim1;
      {
        _ptr__4310_ri32[_4311_rptr] = (int)0;
        _ptr__4310_ri32[_4315_rcodeptr] = (int)0;
        int32_t _4319_nzi = (int)0;
        int32_t _4320_elmi = (int)0;
        int32_t _4321_codei = (int)0;
        int32_t _11236_ = (int)0;
        int32_t _11237_ = p->getDim((int)0);
        for (int32_t _4322_i = _11236_; _4322_i < _11237_; ++_4322_i)
        {
          {
            int32_t _11238_ = (int)0;
            int32_t _11239_ = e->getDim((int)1);
            for (int32_t _4323_j = _11238_; _4323_j < _11239_; ++_4323_j)
            {
              {
                int32_t _11240_ = (int)0;
                int32_t _11241_ = p->getDim((int)1);
                for (int32_t _4324_k = _11240_; _4324_k < _11241_; ++_4324_k)
                {
                  {
                    int32_t _11242_ = _ptr__4279_wi32[safe_add( safe_add( _4287_ptr,safe_mul( _4324_k,_4299_edim1 ) ),_4323_j )];
                    int32_t _11243_ = _ptr__4279_wi32[safe_add( safe_add( safe_add( _4287_ptr,safe_mul( _4324_k,_4299_edim1 ) ),_4323_j ),(int)1 )];
                    for (int32_t _4325_l = _11242_; _4325_l < _11243_; ++_4325_l)
                    {
                      {
                        _ptr__4308_ri64[safe_add( _4312_rnidxs,_4319_nzi )] = _ptr__4280_wi64[safe_add( _4293_nidxs,_4325_l )];
                        _ptr__4309_rf64[safe_add( _4313_rcof,_4319_nzi )] = 0.0;
                        _ptr__4310_ri32[safe_add( _4314_rcode,_4321_codei )] = 2;
                        _ptr__4309_rf64[safe_add( _4316_rcconst,_4321_codei )] = _ptr__4281_wf64[safe_add( _4294_cof,_4325_l )];
                        ++ _4321_codei;
                        if ((_4286_ncodeatom > (int)0))
                        {
                          {
                            int32_t _11244_ = _ptr__4279_wi32[safe_add( _4290_codeptr,_4325_l )];
                            int32_t _11245_ = _ptr__4279_wi32[safe_add( safe_add( _4290_codeptr,_4325_l ),(int)1 )];
                            for (int32_t _4326_m = _11244_; _4326_m < _11245_; ++_4326_m)
                            {
                              {
                                _ptr__4310_ri32[safe_add( _4314_rcode,_4321_codei )] = _ptr__4279_wi32[safe_add( _4288_code,_4326_m )];
                                _ptr__4309_rf64[safe_add( _4316_rcconst,_4321_codei )] = _ptr__4281_wf64[safe_add( _4289_cconst,_4326_m )];
                                ++ _4321_codei;
                              }
                            }
                            _ptr__4310_ri32[safe_add( _4314_rcode,_4321_codei )] = 3;
                            ++ _4321_codei;
                          }
                        }
                        {}
                        _ptr__4310_ri32[safe_add( _4314_rcode,_4321_codei )] = 1;
                        _ptr__4309_rf64[safe_add( _4316_rcconst,_4321_codei )] = _ptr__4302_xi32[safe_add( safe_add( _4301_pidxs,safe_mul( _4322_i,_4297_pdim1 ) ),_4324_k )];
                        ++ _4321_codei;
                        _ptr__4310_ri32[safe_add( _4314_rcode,_4321_codei )] = 5;
                        ++ _4321_codei;
                        _ptr__4310_ri32[safe_add( safe_add( _4315_rcodeptr,_4319_nzi ),(int)1 )] = _4321_codei;
                        ++ _4319_nzi;
                      }
                    }
                  }
                }
                _ptr__4310_ri32[safe_add( safe_add( _4311_rptr,_4320_elmi ),(int)1 )] = _4319_nzi;
                ++ _4320_elmi;
              }
            }
          }
        }
        if ((_4321_codei != _4306_rncodeatom))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Incorrect a-code length"));
          }
        }
        {}
        if ((_4319_nzi != _4305_rnnz))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Incorrect nnz length"));
          }
        }
        {}
        if ((_4320_elmi != _4304_rnelem))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Incorrect nelem length"));
          }
        }
        {}
        int32_t _11246_ = (int)0;
        int32_t _11247_ = _4304_rnelem;
        for (int32_t _4327_i = _11246_; _4327_i < _11247_; ++_4327_i)
        {
          {
            if ((_ptr__4310_ri32[safe_add( _4311_rptr,_4327_i )] > _ptr__4310_ri32[safe_add( safe_add( _4311_rptr,_4327_i ),(int)1 )]))
            {
              {
                throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Incorrect ptr indexes"));
              }
            }
            {}
          }
        }
      }
    }
  }
  else if((!_4285_hassp))
  {
    {
      int32_t _4328_numpnz = _4283_nelem;
      int32_t _4329_pnelem = _4300_pnnz;
      int32_t _4330_xpsp = _4277_xs->alloci64(_4329_pnelem);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4331_xi64 = mosek::fusion::p_WorkStack::_get_impl(_4277_xs)->i64;
      _checked_ptr_1<int64_t> _ptr__4331_xi64(_4331_xi64 ? _4331_xi64->raw() : nullptr,_4331_xi64 ? _4331_xi64->size(0) : 0);
      p->getSp(_4331_xi64,_4330_xpsp);
      int32_t _4332_rnelem = (int)0;
      int32_t _4333_rnnz = (int)0;
      int32_t _4334_rncodeatom = (int)0;
      {
        int32_t _4335_i0 = (int)0;
        while ( (_4335_i0 < _4300_pnnz) )
        {
          {
            int32_t _4336_ii = (int32_t)(_ptr__4331_xi64[safe_add( _4330_xpsp,_4335_i0 )] / _4297_pdim1);
            int32_t _4337_prowb = _4335_i0;
            ++ _4335_i0;
            while ( ((_4335_i0 < _4300_pnnz) && (_ptr__4331_xi64[safe_add( _4330_xpsp,_4335_i0 )] < safe_mul( safe_add( _4336_ii,(int)1 ),_4297_pdim1 ))) )
            {
              {
                ++ _4335_i0;
              }
            }
            int32_t _4338_prowe = _4335_i0;
            int32_t _11248_ = (int)0;
            int32_t _11249_ = _4299_edim1;
            for (int32_t _4339_jj = _11248_; _4339_jj < _11249_; ++_4339_jj)
            {
              {
                int32_t _11250_ = _4337_prowb;
                int32_t _11251_ = _4338_prowe;
                for (int32_t _4340_i = _11250_; _4340_i < _11251_; ++_4340_i)
                {
                  {
                    int64_t _4341_eidx = safe_add( safe_mul( (_ptr__4331_xi64[safe_add( _4330_xpsp,_4340_i )] % _4297_pdim1),_4299_edim1 ),_4339_jj );
                    int32_t _4342_n = (_ptr__4279_wi32[safe_add( safe_add( _4287_ptr,_4341_eidx ),(int)1 )] - _ptr__4279_wi32[safe_add( _4287_ptr,_4341_eidx )]);
                    _4333_rnnz += _4342_n;
                    if ((_4286_ncodeatom > (int)0))
                    {
                      {
                        _4334_rncodeatom += safe_add( (_ptr__4279_wi32[safe_add( _4290_codeptr,_ptr__4279_wi32[safe_add( safe_add( _4287_ptr,_4341_eidx ),(int)1 )] )] - _ptr__4279_wi32[safe_add( _4290_codeptr,_ptr__4279_wi32[safe_add( _4287_ptr,_4341_eidx )] )]),safe_mul( (int)4,_4342_n ) );
                      }
                    }
                    else
                    {
                      {
                        _4334_rncodeatom += safe_mul( (int)3,_4342_n );
                      }
                    }
                  }
                }
                ++ _4332_rnelem;
              }
            }
          }
        }
      }
      bool _4343_rhassp = (_4332_rnelem < safe_mul( _4296_pdim0,_4299_edim1 ));
      int32_t _4344_rnd = (int)2;
      _4275_rs->alloc_expr(_4344_rnd,_4332_rnelem,_4333_rnnz,_4343_rhassp,_4334_rncodeatom);
      int32_t _4345_rptr = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->ptr_base;
      int32_t _4346_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->nidxs_base;
      int32_t _11252_;
      bool _11253_ = _4343_rhassp;
      if (_11253_)
      {
        _11252_ = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->sp_base;
      }
      else
      {
        _11252_ = _4275_rs->alloci64(_4332_rnelem);
      }
      int32_t _4347_rsp = _11252_;
      int32_t _4348_rcof = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->cof_base;
      bool _4349_rhassp = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->hassp;
      int32_t _4350_rshape = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->shape_base;
      int32_t _4351_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->codeptr_base;
      int32_t _4352_rcode = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->code_base;
      int32_t _4353_rcconst = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4354_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__4354_ri64(_4354_ri64 ? _4354_ri64->raw() : nullptr,_4354_ri64 ? _4354_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _4355_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->f64;
      _checked_ptr_1<double> _ptr__4355_rf64(_4355_rf64 ? _4355_rf64->raw() : nullptr,_4355_rf64 ? _4355_rf64->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4356_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__4356_ri32(_4356_ri32 ? _4356_ri32->raw() : nullptr,_4356_ri32 ? _4356_ri32->size(0) : 0);
      _ptr__4356_ri32[_4350_rshape] = _4296_pdim0;
      _ptr__4356_ri32[safe_add( _4350_rshape,(int)1 )] = _4299_edim1;
      {
        int32_t _4357_nzi = (int)0;
        int32_t _4358_elmi = (int)0;
        int32_t _4359_codei = (int)0;
        if ((_4334_rncodeatom > (int)0))
        {
          {
            _ptr__4356_ri32[_4351_rcodeptr] = (int)0;
          }
        }
        {}
        _ptr__4356_ri32[_4345_rptr] = (int)0;
        int32_t _11254_ = (int)0;
        int32_t _11255_ = _4333_rnnz;
        for (int32_t _4360_i = _11254_; _4360_i < _11255_; ++_4360_i)
        {
          {
            _ptr__4355_rf64[safe_add( _4348_rcof,_4360_i )] = 0.0;
          }
        }
        int32_t _4361_i0 = (int)0;
        while ( (_4361_i0 < _4300_pnnz) )
        {
          {
            int32_t _4362_ii = (int32_t)(_ptr__4331_xi64[safe_add( _4330_xpsp,_4361_i0 )] / _4297_pdim1);
            int32_t _4363_prowb = _4361_i0;
            ++ _4361_i0;
            while ( ((_4361_i0 < _4300_pnnz) && (_ptr__4331_xi64[safe_add( _4330_xpsp,_4361_i0 )] < safe_mul( safe_add( _4362_ii,(int)1 ),_4297_pdim1 ))) )
            {
              {
                ++ _4361_i0;
              }
            }
            int32_t _4364_prowe = _4361_i0;
            int32_t _11256_ = (int)0;
            int32_t _11257_ = _4299_edim1;
            for (int32_t _4365_jj = _11256_; _4365_jj < _11257_; ++_4365_jj)
            {
              {
                int32_t _11258_ = _4363_prowb;
                int32_t _11259_ = _4364_prowe;
                for (int32_t _4366_i = _11258_; _4366_i < _11259_; ++_4366_i)
                {
                  {
                    int64_t _4367_eidx = safe_add( safe_mul( (_ptr__4331_xi64[safe_add( _4330_xpsp,_4366_i )] % _4297_pdim1),_4299_edim1 ),_4365_jj );
                    int32_t _11260_ = _ptr__4279_wi32[safe_add( _4287_ptr,_4367_eidx )];
                    int32_t _11261_ = _ptr__4279_wi32[safe_add( safe_add( _4287_ptr,_4367_eidx ),(int)1 )];
                    for (int32_t _4368_k = _11260_; _4368_k < _11261_; ++_4368_k)
                    {
                      {
                        _ptr__4354_ri64[safe_add( _4346_rnidxs,_4357_nzi )] = _ptr__4280_wi64[safe_add( _4293_nidxs,_4368_k )];
                        _ptr__4356_ri32[safe_add( _4352_rcode,_4359_codei )] = 2;
                        _ptr__4355_rf64[safe_add( _4353_rcconst,_4359_codei )] = _ptr__4281_wf64[safe_add( _4294_cof,_4368_k )];
                        ++ _4359_codei;
                        if ((_4286_ncodeatom > (int)0))
                        {
                          {
                            int32_t _11262_ = _ptr__4279_wi32[safe_add( _4290_codeptr,_4368_k )];
                            int32_t _11263_ = _ptr__4279_wi32[safe_add( safe_add( _4290_codeptr,_4368_k ),(int)1 )];
                            for (int32_t _4369_l = _11262_; _4369_l < _11263_; ++_4369_l)
                            {
                              {
                                _ptr__4356_ri32[safe_add( _4352_rcode,_4359_codei )] = _ptr__4279_wi32[safe_add( _4288_code,_4369_l )];
                                _ptr__4355_rf64[safe_add( _4353_rcconst,_4359_codei )] = _ptr__4281_wf64[safe_add( _4289_cconst,_4369_l )];
                                ++ _4359_codei;
                              }
                            }
                            _ptr__4356_ri32[safe_add( _4352_rcode,_4359_codei )] = 3;
                            ++ _4359_codei;
                          }
                        }
                        {}
                        _ptr__4356_ri32[safe_add( _4352_rcode,_4359_codei )] = 1;
                        _ptr__4355_rf64[safe_add( _4353_rcconst,_4359_codei )] = _ptr__4302_xi32[safe_add( _4301_pidxs,_4366_i )];
                        ++ _4359_codei;
                        _ptr__4356_ri32[safe_add( _4352_rcode,_4359_codei )] = 5;
                        ++ _4359_codei;
                        _ptr__4356_ri32[safe_add( safe_add( _4351_rcodeptr,_4357_nzi ),(int)1 )] = _4359_codei;
                        ++ _4357_nzi;
                      }
                    }
                  }
                }
                _ptr__4356_ri32[safe_add( safe_add( _4345_rptr,_4358_elmi ),(int)1 )] = _4357_nzi;
                _ptr__4354_ri64[safe_add( _4347_rsp,_4358_elmi )] = safe_add( safe_mul( (int64_t)_4362_ii,_4299_edim1 ),_4365_jj );
                ++ _4358_elmi;
              }
            }
          }
        }
        if ((_4359_codei != _4334_rncodeatom))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Incorrect code list"));
          }
        }
        {}
        if ((_4357_nzi != _4333_rnnz))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Incorrect nnz length"));
          }
        }
        {}
        if ((_4358_elmi != _4332_rnelem))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Incorrect nelem length"));
          }
        }
        {}
        if ((_ptr__4356_ri32[safe_add( _4345_rptr,_4332_rnelem )] != _4333_rnnz))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Incorrect ptr"));
          }
        }
        {}
      }
      if ((!_4349_rhassp))
      {
        {
          _4275_rs->popi64(_4332_rnelem);
        }
      }
      {}
      _4277_xs->clear();
    }
  }
  else
  {
    {
      int32_t _4370_numpnz = _4283_nelem;
      int32_t _4371_xperm = _4277_xs->alloci32(_4370_numpnz);
      int32_t _4372_pnelem = p->getNumNonzero();
      int32_t _4373_xpsp = _4277_xs->alloci64(_4372_pnelem);
      int32_t _4374_xptr = _4277_xs->alloci32(safe_add( _ptr__4279_wi32[safe_add( _4291_shape,(int)1 )],(int)1 ));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4375_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4277_xs)->i32;
      _checked_ptr_1<int32_t> _ptr__4375_xi32(_4375_xi32 ? _4375_xi32->raw() : nullptr,_4375_xi32 ? _4375_xi32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4376_xi64 = mosek::fusion::p_WorkStack::_get_impl(_4277_xs)->i64;
      _checked_ptr_1<int64_t> _ptr__4376_xi64(_4376_xi64 ? _4376_xi64->raw() : nullptr,_4376_xi64 ? _4376_xi64->size(0) : 0);
      p->getSp(_4376_xi64,_4373_xpsp);
      {
        int32_t _4377_d1 = _ptr__4279_wi32[safe_add( _4291_shape,(int)1 )];
        int32_t _11264_ = (int)0;
        int32_t _11265_ = safe_add( _ptr__4279_wi32[safe_add( _4291_shape,(int)1 )],(int)1 );
        for (int32_t _4378_i = _11264_; _4378_i < _11265_; ++_4378_i)
        {
          {
            _ptr__4375_xi32[safe_add( _4374_xptr,_4378_i )] = (int)0;
          }
        }
        int32_t _11266_ = (int)0;
        int32_t _11267_ = _4283_nelem;
        for (int32_t _4379_i = _11266_; _4379_i < _11267_; ++_4379_i)
        {
          {
            ++ _ptr__4375_xi32[safe_add( safe_add( _4374_xptr,(_ptr__4280_wi64[safe_add( _4292_sp,_4379_i )] % _4377_d1) ),(int)1 )];
          }
        }
        int32_t _11268_ = (int)0;
        int32_t _11269_ = _4377_d1;
        for (int32_t _4380_i = _11268_; _4380_i < _11269_; ++_4380_i)
        {
          {
            _ptr__4375_xi32[safe_add( safe_add( _4374_xptr,_4380_i ),(int)1 )] += _ptr__4375_xi32[safe_add( _4374_xptr,_4380_i )];
          }
        }
        int32_t _11270_ = (int)0;
        int32_t _11271_ = _4283_nelem;
        for (int32_t _4381_i = _11270_; _4381_i < _11271_; ++_4381_i)
        {
          {
            _ptr__4375_xi32[safe_add( _4371_xperm,_ptr__4375_xi32[safe_add( _4374_xptr,(_ptr__4280_wi64[safe_add( _4292_sp,_4381_i )] % _4377_d1) )] )] = _4381_i;
            ++ _ptr__4375_xi32[safe_add( _4374_xptr,(_ptr__4280_wi64[safe_add( _4292_sp,_4381_i )] % _4377_d1) )];
          }
        }
      }
      int32_t _4382_rnelem = (int)0;
      int32_t _4383_rnnz = (int)0;
      int32_t _4384_rncodeatom = (int)0;
      int32_t _4385_edim1 = _ptr__4279_wi32[safe_add( _4291_shape,(int)1 )];
      int32_t _4386_edim0 = _ptr__4279_wi32[_4291_shape];
      int32_t _4387_pdim1 = p->getDim((int)1);
      int32_t _4388_pdim0 = p->getDim((int)0);
      {
        int32_t _4389_prowp = (int)0;
        while ( (_4389_prowp < _4372_pnelem) )
        {
          {
            int32_t _4390_prowb = _4389_prowp;
            int64_t _4391_ri = (_ptr__4376_xi64[safe_add( _4373_xpsp,_4389_prowp )] / _4387_pdim1);
            while ( ((_4389_prowp < _4372_pnelem) && (_ptr__4376_xi64[safe_add( _4373_xpsp,_4389_prowp )] < safe_mul( safe_add( _4391_ri,(int)1 ),_4387_pdim1 ))) )
            {
              {
                ++ _4389_prowp;
              }
            }
            int32_t _4392_ecolp = (int)0;
            while ( (_4392_ecolp < _4283_nelem) )
            {
              {
                int32_t _4393_ecolb = _4392_ecolp;
                int64_t _4394_rj = (_ptr__4280_wi64[safe_add( _4292_sp,_ptr__4375_xi32[safe_add( _4371_xperm,_4392_ecolp )] )] % _4385_edim1);
                ++ _4392_ecolp;
                while ( ((_4392_ecolp < _4283_nelem) && ((_ptr__4280_wi64[safe_add( _4292_sp,_ptr__4375_xi32[safe_add( _4371_xperm,_4392_ecolp )] )] % _4385_edim1) == _4394_rj)) )
                {
                  {
                    ++ _4392_ecolp;
                  }
                }
                int32_t _4395_ep = _4393_ecolb;
                int32_t _4396_pp = _4390_prowb;
                bool _4397_exist = false;
                int32_t _4398_rownnz = (int)0;
                while ( ((_4396_pp < _4389_prowp) && (_4395_ep < _4392_ecolp)) )
                {
                  {
                    int32_t _4399_eidx = _ptr__4375_xi32[safe_add( _4371_xperm,_4395_ep )];
                    if (((_ptr__4376_xi64[safe_add( _4373_xpsp,_4396_pp )] % _4387_pdim1) < (_ptr__4280_wi64[safe_add( _4292_sp,_4399_eidx )] / _4385_edim1)))
                    {
                      {
                        ++ _4396_pp;
                      }
                    }
                    else if(((_ptr__4376_xi64[safe_add( _4373_xpsp,_4396_pp )] % _4387_pdim1) > (_ptr__4280_wi64[safe_add( _4292_sp,_4399_eidx )] / _4385_edim1)))
                    {
                      {
                        ++ _4395_ep;
                      }
                    }
                    else
                    {
                      {
                        int32_t _4400_n = (_ptr__4279_wi32[safe_add( safe_add( _4287_ptr,_4399_eidx ),(int)1 )] - _ptr__4279_wi32[safe_add( _4287_ptr,_4399_eidx )]);
                        _4383_rnnz += _4400_n;
                        int32_t _11272_;
                        bool _11273_ = (_4286_ncodeatom > (int)0);
                        if (_11273_)
                        {
                          _11272_ = safe_add( (_ptr__4279_wi32[safe_add( _4290_codeptr,_ptr__4279_wi32[safe_add( safe_add( _4287_ptr,_4399_eidx ),(int)1 )] )] - _ptr__4279_wi32[safe_add( _4290_codeptr,_ptr__4279_wi32[safe_add( _4287_ptr,_4399_eidx )] )]),safe_mul( (int)4,_4400_n ) );
                        }
                        else
                        {
                          _11272_ = safe_mul( (int)3,_4400_n );
                        }
                        _4384_rncodeatom += _11272_;
                        ++ _4395_ep;
                        ++ _4396_pp;
                        ++ _4398_rownnz;
                      }
                    }
                  }
                }
                if ((_4398_rownnz > (int)0))
                {
                  {
                    ++ _4382_rnelem;
                  }
                }
                {}
              }
            }
          }
        }
      }
      int32_t _4401_rnd = (int)2;
      bool _4402_rhassp = (_4382_rnelem < safe_mul( _4388_pdim0,_4385_edim1 ));
      _4275_rs->alloc_expr(_4401_rnd,_4382_rnelem,_4383_rnnz,_4402_rhassp,_4384_rncodeatom);
      int32_t _4403_rptr = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->ptr_base;
      int32_t _4404_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->nidxs_base;
      int32_t _11274_;
      bool _11275_ = _4402_rhassp;
      if (_11275_)
      {
        _11274_ = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->sp_base;
      }
      else
      {
        _11274_ = _4275_rs->alloci64(_4382_rnelem);
      }
      int32_t _4405_rsp = _11274_;
      int32_t _4406_rcof = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->cof_base;
      int32_t _4407_rshape = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->shape_base;
      int32_t _4408_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->codeptr_base;
      int32_t _4409_rcode = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->code_base;
      int32_t _4410_rcconst = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4411_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__4411_ri64(_4411_ri64 ? _4411_ri64->raw() : nullptr,_4411_ri64 ? _4411_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _4412_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->f64;
      _checked_ptr_1<double> _ptr__4412_rf64(_4412_rf64 ? _4412_rf64->raw() : nullptr,_4412_rf64 ? _4412_rf64->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4413_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4275_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__4413_ri32(_4413_ri32 ? _4413_ri32->raw() : nullptr,_4413_ri32 ? _4413_ri32->size(0) : 0);
      int32_t _11276_ = (int)0;
      int32_t _11277_ = safe_add( _4382_rnelem,(int)1 );
      for (int32_t _4414_i = _11276_; _4414_i < _11277_; ++_4414_i)
      {
        {
          _ptr__4413_ri32[safe_add( _4403_rptr,_4414_i )] = (-(int)9999);
        }
      }
      {
        _ptr__4413_ri32[_4403_rptr] = (int)0;
        if ((_4384_rncodeatom > (int)0))
        {
          {
            _ptr__4413_ri32[_4408_rcodeptr] = (int)0;
          }
        }
        {}
        _ptr__4413_ri32[_4407_rshape] = _4388_pdim0;
        _ptr__4413_ri32[safe_add( _4407_rshape,(int)1 )] = _4385_edim1;
        int32_t _4415_nzi = (int)0;
        int32_t _4416_elmi = (int)0;
        int32_t _4417_codei = (int)0;
        int32_t _11278_ = (int)0;
        int32_t _11279_ = _4383_rnnz;
        for (int32_t _4418_i = _11278_; _4418_i < _11279_; ++_4418_i)
        {
          {
            _ptr__4412_rf64[safe_add( _4406_rcof,_4418_i )] = 0.0;
          }
        }
        int32_t _4419_prowp = (int)0;
        while ( (_4419_prowp < _4372_pnelem) )
        {
          {
            int32_t _4420_prowb = _4419_prowp;
            int64_t _4421_ri = (_ptr__4376_xi64[safe_add( _4373_xpsp,_4419_prowp )] / _4387_pdim1);
            while ( ((_4419_prowp < _4372_pnelem) && (_ptr__4376_xi64[safe_add( _4373_xpsp,_4419_prowp )] < safe_mul( safe_add( _4421_ri,(int)1 ),_4387_pdim1 ))) )
            {
              {
                ++ _4419_prowp;
              }
            }
            int32_t _4422_ecolp = (int)0;
            while ( (_4422_ecolp < _4283_nelem) )
            {
              {
                int32_t _4423_ecolb = _4422_ecolp;
                int64_t _4424_rj = (_ptr__4280_wi64[safe_add( _4292_sp,_ptr__4375_xi32[safe_add( _4371_xperm,_4422_ecolp )] )] % _4385_edim1);
                ++ _4422_ecolp;
                while ( ((_4422_ecolp < _4283_nelem) && ((_ptr__4280_wi64[safe_add( _4292_sp,_ptr__4375_xi32[safe_add( _4371_xperm,_4422_ecolp )] )] % _4385_edim1) == _4424_rj)) )
                {
                  {
                    ++ _4422_ecolp;
                  }
                }
                int32_t _4425_ep = _4423_ecolb;
                int32_t _4426_pp = _4420_prowb;
                int32_t _4427_nsumelm = (int)0;
                while ( ((_4426_pp < _4419_prowp) && (_4425_ep < _4422_ecolp)) )
                {
                  {
                    int32_t _4428_eidx = _ptr__4375_xi32[safe_add( _4371_xperm,_4425_ep )];
                    if (((_ptr__4376_xi64[safe_add( _4373_xpsp,_4426_pp )] % _4387_pdim1) < (_ptr__4280_wi64[safe_add( _4292_sp,_4428_eidx )] / _4385_edim1)))
                    {
                      {
                        ++ _4426_pp;
                      }
                    }
                    else if(((_ptr__4376_xi64[safe_add( _4373_xpsp,_4426_pp )] % _4387_pdim1) > (_ptr__4280_wi64[safe_add( _4292_sp,_4428_eidx )] / _4385_edim1)))
                    {
                      {
                        ++ _4425_ep;
                      }
                    }
                    else
                    {
                      {
                        int32_t _11280_ = _ptr__4279_wi32[safe_add( _4287_ptr,_4428_eidx )];
                        int32_t _11281_ = _ptr__4279_wi32[safe_add( safe_add( _4287_ptr,_4428_eidx ),(int)1 )];
                        for (int32_t _4429_i = _11280_; _4429_i < _11281_; ++_4429_i)
                        {
                          {
                            _ptr__4411_ri64[safe_add( _4404_rnidxs,_4415_nzi )] = _ptr__4280_wi64[safe_add( _4293_nidxs,_4429_i )];
                            _ptr__4413_ri32[safe_add( _4409_rcode,_4417_codei )] = 2;
                            _ptr__4412_rf64[safe_add( _4410_rcconst,_4417_codei )] = _ptr__4281_wf64[safe_add( _4294_cof,_4429_i )];
                            ++ _4417_codei;
                            if ((_4286_ncodeatom > (int)0))
                            {
                              {
                                int32_t _11282_ = _ptr__4279_wi32[safe_add( _4290_codeptr,_4429_i )];
                                int32_t _11283_ = _ptr__4279_wi32[safe_add( safe_add( _4290_codeptr,_4429_i ),(int)1 )];
                                for (int32_t _4430_k = _11282_; _4430_k < _11283_; ++_4430_k)
                                {
                                  {
                                    _ptr__4413_ri32[safe_add( _4409_rcode,_4417_codei )] = _ptr__4279_wi32[safe_add( _4288_code,_4430_k )];
                                    _ptr__4412_rf64[safe_add( _4410_rcconst,_4417_codei )] = _ptr__4281_wf64[safe_add( _4289_cconst,_4430_k )];
                                    ++ _4417_codei;
                                  }
                                }
                                _ptr__4413_ri32[safe_add( _4409_rcode,_4417_codei )] = 3;
                                ++ _4417_codei;
                              }
                            }
                            {}
                            _ptr__4413_ri32[safe_add( _4409_rcode,_4417_codei )] = 1;
                            _ptr__4412_rf64[safe_add( _4410_rcconst,_4417_codei )] = _ptr__4375_xi32[safe_add( _4301_pidxs,_4426_pp )];
                            ++ _4417_codei;
                            _ptr__4413_ri32[safe_add( _4409_rcode,_4417_codei )] = 5;
                            ++ _4417_codei;
                            _ptr__4413_ri32[safe_add( safe_add( _4408_rcodeptr,_4415_nzi ),(int)1 )] = _4417_codei;
                            ++ _4415_nzi;
                          }
                        }
                        ++ _4427_nsumelm;
                        ++ _4426_pp;
                        ++ _4425_ep;
                      }
                    }
                  }
                }
                if ((_4427_nsumelm > (int)0))
                {
                  {
                    _ptr__4411_ri64[safe_add( _4405_rsp,_4416_elmi )] = safe_add( safe_mul( _4421_ri,_4385_edim1 ),_4424_rj );
                    _ptr__4413_ri32[safe_add( safe_add( _4403_rptr,_4416_elmi ),(int)1 )] = _4415_nzi;
                    ++ _4416_elmi;
                  }
                }
                {}
              }
            }
          }
        }
        if ((_4417_codei != _4384_rncodeatom))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Incorrect a-code length"));
          }
        }
        {}
        if ((_4415_nzi != _4383_rnnz))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Incorrect nnz length"));
          }
        }
        {}
        if ((_4416_elmi != _4382_rnelem))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Incorrect nelem length"));
          }
        }
        {}
        if ((_ptr__4413_ri32[safe_add( _4403_rptr,_4416_elmi )] != _4383_rnnz))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal! Incorrect ptr"));
          }
        }
        {}
      }
      if ((!_4402_rhassp))
      {
        {
          _4275_rs->popi64(_4382_rnelem);
        }
      }
      {}
    }
  }
  _4277_xs->clear();
}
// End mosek.fusion.ExprMulParamLeft.eval

// Begin mosek.fusion.ExprMulParamLeft.toString
// Method mosek.fusion.ExprMulParamLeft.toString @ bld/grindsted/final/default/src/fusion/Parameter.monty:650:6-154
std::string mosek::fusion::ExprMulParamLeft :: toString() { return mosek::fusion::p_ExprMulParamLeft::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulParamLeft::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulParamLeft("))->__mosek_2fusion_2Utils_2StringBuffer__a(p->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(e->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprMulParamLeft.toString

void mosek::fusion::p_ExprMulParamLeft::destroy()
{
  e.reset();
  p.reset();
}
void mosek::fusion::ExprMulParamLeft::destroy() { mosek::fusion::p_ExprMulParamLeft::_get_impl(this)->destroy(); }
// } class ExprMulParamLeft
// class ParameterImpl { // @ bld/grindsted/final/default/src/fusion/Parameter.monty:113:4-616:5
mosek::fusion::ParameterImpl::ParameterImpl(mosek::fusion::p_ParameterImpl *_impl) : _impl(_impl) { /*std::cout << "ParameterImpl() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::ParameterImpl::~ParameterImpl() { delete _impl; _impl = nullptr; }
mosek::fusion::p_ParameterImpl::p_ParameterImpl
  (::mosek::fusion::ParameterImpl * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.ParameterImpl.ctor @ bld/grindsted/final/default/src/fusion/Parameter.monty:131:6-137:7
mosek::fusion::ParameterImpl::t mosek::fusion::p_ParameterImpl::_new_ParameterImpl
  (monty::rc_ptr< ::mosek::fusion::ParameterImpl > _4431_other,
    monty::rc_ptr< ::mosek::fusion::Model > _4432_model)
{ return new mosek::fusion::ParameterImpl(_4431_other,_4432_model); }
mosek::fusion::ParameterImpl::ParameterImpl
  (monty::rc_ptr< ::mosek::fusion::ParameterImpl > _4431_other,
    monty::rc_ptr< ::mosek::fusion::Model > _4432_model) : 
   ParameterImpl(new mosek::fusion::p_ParameterImpl(this))
{ mosek::fusion::p_ParameterImpl::_get_impl(this)->_initialize(_4431_other,_4432_model); }
void mosek::fusion::p_ParameterImpl::_initialize  (monty::rc_ptr< ::mosek::fusion::ParameterImpl > _4431_other,
    monty::rc_ptr< ::mosek::fusion::Model > _4432_model)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ParameterImpl::_get_impl(::mosek::fusion::ParameterImpl::t(_pubthis))->model = _4432_model;
    mosek::fusion::p_ParameterImpl::_get_impl(::mosek::fusion::ParameterImpl::t(_pubthis))->shape = mosek::fusion::p_ParameterImpl::_get_impl(_4431_other)->shape;
    mosek::fusion::p_ParameterImpl::_get_impl(::mosek::fusion::ParameterImpl::t(_pubthis))->sp = mosek::fusion::p_ParameterImpl::_get_impl(_4431_other)->sp;
    mosek::fusion::p_ParameterImpl::_get_impl(::mosek::fusion::ParameterImpl::t(_pubthis))->size = mosek::fusion::p_ParameterImpl::_get_impl(_4431_other)->size;
    mosek::fusion::p_ParameterImpl::_get_impl(::mosek::fusion::ParameterImpl::t(_pubthis))->nidxs = mosek::fusion::p_ParameterImpl::_get_impl(_4431_other)->nidxs;
  }
}
// mosek.fusion.ParameterImpl.ctor

// mosek.fusion.ParameterImpl.ctor @ bld/grindsted/final/default/src/fusion/Parameter.monty:120:6-129:7
mosek::fusion::ParameterImpl::t mosek::fusion::p_ParameterImpl::_new_ParameterImpl
  (monty::rc_ptr< ::mosek::fusion::Model > _4433_model,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _4434_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4435_sp,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _4436_nidxs)
{ return new mosek::fusion::ParameterImpl(_4433_model,_4434_shape,_4435_sp,_4436_nidxs); }
mosek::fusion::ParameterImpl::ParameterImpl
  (monty::rc_ptr< ::mosek::fusion::Model > _4433_model,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _4434_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4435_sp,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _4436_nidxs) : 
   ParameterImpl(new mosek::fusion::p_ParameterImpl(this))
{ mosek::fusion::p_ParameterImpl::_get_impl(this)->_initialize(_4433_model,_4434_shape,_4435_sp,_4436_nidxs); }
void mosek::fusion::p_ParameterImpl::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _4433_model,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _4434_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4435_sp,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _4436_nidxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__4434_shape(_4434_shape ? _4434_shape->raw() : nullptr, _4434_shape ? _4434_shape->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__4435_sp(_4435_sp ? _4435_sp->raw() : nullptr, _4435_sp ? _4435_sp->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__4436_nidxs(_4436_nidxs ? _4436_nidxs->raw() : nullptr, _4436_nidxs ? _4436_nidxs->size(0) : 0);
    mosek::fusion::p_ParameterImpl::_get_impl(::mosek::fusion::ParameterImpl::t(_pubthis))->model = _4433_model;
    mosek::fusion::p_ParameterImpl::_get_impl(::mosek::fusion::ParameterImpl::t(_pubthis))->shape = ::mosek::fusion::Utils::Tools::arraycopy(_4434_shape);
    mosek::fusion::p_ParameterImpl::_get_impl(::mosek::fusion::ParameterImpl::t(_pubthis))->sp = _4435_sp;
    mosek::fusion::p_ParameterImpl::_get_impl(::mosek::fusion::ParameterImpl::t(_pubthis))->size = ::mosek::fusion::p_Set::size(_4434_shape);
    mosek::fusion::p_ParameterImpl::_get_impl(::mosek::fusion::ParameterImpl::t(_pubthis))->nidxs = ::mosek::fusion::Utils::Tools::arraycopy(_4436_nidxs);
  }
}
// mosek.fusion.ParameterImpl.ctor

// Begin mosek.fusion.ParameterImpl.clone
// Method mosek.fusion.ParameterImpl.clone @ bld/grindsted/final/default/src/fusion/Parameter.monty:563:6-565:7
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl :: __mosek_2fusion_2ParameterImpl__clone(monty::rc_ptr< ::mosek::fusion::Model > _4437_m) { return mosek::fusion::p_ParameterImpl::_get_impl(this)->__mosek_2fusion_2ParameterImpl__clone(_4437_m); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::clone(monty::rc_ptr< ::mosek::fusion::Model > _4437_m) { return __mosek_2fusion_2ParameterImpl__clone(_4437_m); }
/* override: mosek.fusion.Parameter.clone*/
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::__mosek_2fusion_2Parameter__clone(monty::rc_ptr< ::mosek::fusion::Model > _4437_m) { return __mosek_2fusion_2ParameterImpl__clone(_4437_m); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_ParameterImpl::__mosek_2fusion_2ParameterImpl__clone(monty::rc_ptr< ::mosek::fusion::Model > _4437_m)
{
  return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(::mosek::fusion::ParameterImpl::t(_pubthis),_4437_m)).as<::mosek::fusion::Parameter>();
}
// End mosek.fusion.ParameterImpl.clone

// Begin mosek.fusion.ParameterImpl.toString
// Method mosek.fusion.ParameterImpl.toString @ bld/grindsted/final/default/src/fusion/Parameter.monty:548:6-560:7
std::string mosek::fusion::ParameterImpl :: toString() { return mosek::fusion::p_ParameterImpl::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ParameterImpl::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _4438_r = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Parameter(("));
  if (((int)((shape)->size(0)) > (int)0))
  {
    {
      _4438_r->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)((int)0)));
      int32_t _11284_ = (int)1;
      int32_t _11285_ = (int)((shape)->size(0));
      for (int32_t _4439_i = _11284_; _4439_i < _11285_; ++_4439_i)
      {
        {
          _4438_r->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*shape)(_4439_i)));
        }
      }
    }
  }
  {}
  _4438_r->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"));
  if ((NULL != sp.get()))
  {
    {
      _4438_r->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",sparse"));
    }
  }
  {}
  _4438_r->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"));
  return _4438_r->toString();
}
// End mosek.fusion.ParameterImpl.toString

// Begin mosek.fusion.ParameterImpl.pick
// Method mosek.fusion.ParameterImpl.pick @ bld/grindsted/final/default/src/fusion/Parameter.monty:487:6-545:7
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl :: __mosek_2fusion_2ParameterImpl__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _4440_midxs) { return mosek::fusion::p_ParameterImpl::_get_impl(this)->__mosek_2fusion_2ParameterImpl__pick(_4440_midxs); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _4440_midxs) { return __mosek_2fusion_2ParameterImpl__pick(_4440_midxs); }
/* override: mosek.fusion.Parameter.pick*/
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::__mosek_2fusion_2Parameter__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _4440_midxs) { return __mosek_2fusion_2ParameterImpl__pick(_4440_midxs); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_ParameterImpl::__mosek_2fusion_2ParameterImpl__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _4440_midxs)
{
  if (((int)((shape)->size(0)) != (int)((_4440_midxs)->size(1))))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid index"));
    }
  }
  {}
  bool _4441_invalidindex = false;
  int32_t _11286_ = (int)0;
  int32_t _11287_ = (int)((_4440_midxs)->size(0));
  for (int32_t _4442_i = _11286_; _4442_i < _11287_; ++_4442_i)
  {
    {
      int32_t _11288_ = (int)0;
      int32_t _11289_ = (int)((_4440_midxs)->size(1));
      for (int32_t _4443_j = _11288_; _4443_j < _11289_; ++_4443_j)
      {
        {
          if (((((*_4440_midxs)(_4442_i,_4443_j)) < (int)0) || (((*_4440_midxs)(_4442_i,_4443_j)) >= ((*shape)(_4443_j)))))
          {
            {
              _4441_invalidindex = true;
            }
          }
          {}
        }
      }
    }
  }
  if (_4441_invalidindex)
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid index"));
    }
  }
  {}
  int32_t _4444_nd = (int)((shape)->size(0));
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4445_strides = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_4444_nd)));
  _checked_ptr_1<int64_t> _ptr__4445_strides(_4445_strides ? _4445_strides->raw() : nullptr,_4445_strides ? _4445_strides->size(0) : 0);
  _ptr__4445_strides[(_4444_nd - (int)1)] = (int)1;
  int32_t _11290_ = (int)1;
  int32_t _11291_ = _4444_nd;
  for (int32_t _4446_i = _11290_; _4446_i < _11291_; ++_4446_i)
  {
    {
      _ptr__4445_strides[((_4444_nd - _4446_i) - (int)1)] = safe_mul( _ptr__4445_strides[(_4444_nd - _4446_i)],((*shape)((_4444_nd - _4446_i))) );
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4447_rshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_4440_midxs)->size(0)))});
  _checked_ptr_1<int32_t> _ptr__4447_rshape(_4447_rshape ? _4447_rshape->raw() : nullptr,_4447_rshape ? _4447_rshape->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4448_idxs;
  _checked_ptr_1<int32_t> _ptr__4448_idxs(_4448_idxs ? _4448_idxs->raw() : nullptr,_4448_idxs ? _4448_idxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4449_rsp = nullptr;
  _checked_ptr_1<int64_t> _ptr__4449_rsp(_4449_rsp ? _4449_rsp->raw() : nullptr,_4449_rsp ? _4449_rsp->size(0) : 0);
  if ((NULL == sp.get()))
  {
    {
      _4448_idxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)((_4440_midxs)->size(0)))));
      _ptr__4448_idxs.update(_4448_idxs ? _4448_idxs->raw() : nullptr, _4448_idxs ? _4448_idxs->size(0) : 0);
      {
        int32_t _11292_ = (int)0;
        int32_t _11293_ = (int)((_4440_midxs)->size(0));
        for (int32_t _4450_i = _11292_; _4450_i < _11293_; ++_4450_i)
        {
          {
            int64_t _4451_ii = (int64_t)0;
            int32_t _11294_ = (int)0;
            int32_t _11295_ = _4444_nd;
            for (int32_t _4452_j = _11294_; _4452_j < _11295_; ++_4452_j)
            {
              {
                _4451_ii += safe_mul( _ptr__4445_strides[_4452_j],((*_4440_midxs)(_4450_i,_4452_j)) );
              }
            }
            _ptr__4448_idxs[_4450_i] = ((*nidxs)(_4451_ii));
          }
        }
      }
    }
  }
  else
  {
    {
      int32_t _4453_nnz = (int)0;
      int32_t _11296_ = (int)0;
      int32_t _11297_ = (int)((_4440_midxs)->size(0));
      for (int32_t _4454_i = _11296_; _4454_i < _11297_; ++_4454_i)
      {
        {
          int64_t _4455_ii = (int64_t)0;
          int32_t _11298_ = (int)0;
          int32_t _11299_ = _4444_nd;
          for (int32_t _4456_j = _11298_; _4456_j < _11299_; ++_4456_j)
          {
            {
              _4455_ii += safe_mul( _ptr__4445_strides[_4456_j],((*_4440_midxs)(_4454_i,_4456_j)) );
            }
          }
          if ((::mosek::fusion::p_CommonTools::binarySearch(sp,_4455_ii) >= (int)0))
          {
            {
              ++ _4453_nnz;
            }
          }
          {}
        }
      }
      _4448_idxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_4453_nnz)));
      _ptr__4448_idxs.update(_4448_idxs ? _4448_idxs->raw() : nullptr, _4448_idxs ? _4448_idxs->size(0) : 0);
      _4449_rsp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_4453_nnz)));
      _ptr__4449_rsp.update(_4449_rsp ? _4449_rsp->raw() : nullptr, _4449_rsp ? _4449_rsp->size(0) : 0);
      {
        int32_t _4457_k = (int)0;
        int32_t _11300_ = (int)0;
        int32_t _11301_ = (int)((_4440_midxs)->size(0));
        for (int32_t _4458_i = _11300_; _4458_i < _11301_; ++_4458_i)
        {
          {
            int64_t _4459_ii = (int64_t)0;
            int32_t _11302_ = (int)0;
            int32_t _11303_ = _4444_nd;
            for (int32_t _4460_j = _11302_; _4460_j < _11303_; ++_4460_j)
            {
              {
                _4459_ii += safe_mul( _ptr__4445_strides[_4460_j],((*_4440_midxs)(_4458_i,_4460_j)) );
              }
            }
            int32_t _4461_iidx = ::mosek::fusion::p_CommonTools::binarySearch(sp,_4459_ii);
            if ((_4461_iidx >= (int)0))
            {
              {
                _ptr__4448_idxs[_4457_k] = ((*nidxs)(_4461_iidx));
                _ptr__4449_rsp[_4457_k] = _4458_i;
                ++ _4457_k;
              }
            }
            {}
          }
        }
      }
      if ((_4453_nnz == (int)((_4440_midxs)->size(0))))
      {
        {
          _4449_rsp = nullptr;
          _ptr__4449_rsp.update(_4449_rsp ? _4449_rsp->raw() : nullptr, _4449_rsp ? _4449_rsp->size(0) : 0);
        }
      }
      {}
    }
  }
  return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,_4447_rshape,_4449_rsp,_4448_idxs)).as<::mosek::fusion::Parameter>();
}
// End mosek.fusion.ParameterImpl.pick

// Begin mosek.fusion.ParameterImpl.pick
// Method mosek.fusion.ParameterImpl.pick @ bld/grindsted/final/default/src/fusion/Parameter.monty:446:6-485:7
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl :: __mosek_2fusion_2ParameterImpl__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _4462_idxs) { return mosek::fusion::p_ParameterImpl::_get_impl(this)->__mosek_2fusion_2ParameterImpl__pick(_4462_idxs); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _4462_idxs) { return __mosek_2fusion_2ParameterImpl__pick(_4462_idxs); }
/* override: mosek.fusion.Parameter.pick*/
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::__mosek_2fusion_2Parameter__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _4462_idxs) { return __mosek_2fusion_2ParameterImpl__pick(_4462_idxs); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_ParameterImpl::__mosek_2fusion_2ParameterImpl__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _4462_idxs)
{
  _checked_ptr_1<int32_t> _ptr__4462_idxs(_4462_idxs ? _4462_idxs->raw() : nullptr, _4462_idxs ? _4462_idxs->size(0) : 0);
  if (((int)((shape)->size(0)) != (int)1))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid index"));
    }
  }
  {}
  bool _4463_invalidindex = false;
  int32_t _11304_ = (int)0;
  int32_t _11305_ = (int)((_4462_idxs)->size(0));
  for (int32_t _4464_i = _11304_; _4464_i < _11305_; ++_4464_i)
  {
    {
      if (((_ptr__4462_idxs[_4464_i] < (int)0) || (_ptr__4462_idxs[_4464_i] >= ((*shape)((int)0)))))
      {
        {
          _4463_invalidindex = true;
        }
      }
      {}
    }
  }
  if (_4463_invalidindex)
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid index"));
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4465_rnidxs;
  _checked_ptr_1<int32_t> _ptr__4465_rnidxs(_4465_rnidxs ? _4465_rnidxs->raw() : nullptr,_4465_rnidxs ? _4465_rnidxs->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4466_rsp = nullptr;
  _checked_ptr_1<int64_t> _ptr__4466_rsp(_4466_rsp ? _4466_rsp->raw() : nullptr,_4466_rsp ? _4466_rsp->size(0) : 0);
  if ((NULL == sp.get()))
  {
    {
      std::vector<int32_t> _11306_;
      for (int32_t _4467_i = (int)0, _11307_ = (int)((_4462_idxs)->size(0)); _4467_i < _11307_ ; ++_4467_i)
      {
        _11306_.push_back(((*nidxs)(_ptr__4462_idxs[_4467_i])));
      }
      auto _11308_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11306_.size()),_11306_.begin(),_11306_.end()));
      _4465_rnidxs = _11308_;
      _ptr__4465_rnidxs.update(_4465_rnidxs ? _4465_rnidxs->raw() : nullptr, _4465_rnidxs ? _4465_rnidxs->size(0) : 0);
    }
  }
  else
  {
    {
      int32_t _4468_nnz = (int)0;
      int32_t _11309_ = (int)0;
      int32_t _11310_ = (int)((_4462_idxs)->size(0));
      for (int32_t _4469_i = _11309_; _4469_i < _11310_; ++_4469_i)
      {
        {
          if ((::mosek::fusion::p_CommonTools::binarySearch(sp,(int64_t)(_ptr__4462_idxs[_4469_i])) >= (int)0))
          {
            {
              ++ _4468_nnz;
            }
          }
          {}
        }
      }
      _4465_rnidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_4468_nnz)));
      _ptr__4465_rnidxs.update(_4465_rnidxs ? _4465_rnidxs->raw() : nullptr, _4465_rnidxs ? _4465_rnidxs->size(0) : 0);
      _4466_rsp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_4468_nnz)));
      _ptr__4466_rsp.update(_4466_rsp ? _4466_rsp->raw() : nullptr, _4466_rsp ? _4466_rsp->size(0) : 0);
      int32_t _4470_k = (int)0;
      int32_t _11311_ = (int)0;
      int32_t _11312_ = (int)((_4462_idxs)->size(0));
      for (int32_t _4471_i = _11311_; _4471_i < _11312_; ++_4471_i)
      {
        {
          int32_t _4472_j = ::mosek::fusion::p_CommonTools::binarySearch(sp,(int64_t)(_ptr__4462_idxs[_4471_i]));
          if ((_4472_j >= (int)0))
          {
            {
              _ptr__4466_rsp[_4470_k] = _4471_i;
              _ptr__4465_rnidxs[_4470_k] = ((*nidxs)(_4472_j));
              ++ _4470_k;
            }
          }
          {}
        }
      }
      if ((_4468_nnz == (int)((_4462_idxs)->size(0))))
      {
        {
          _4466_rsp = nullptr;
          _ptr__4466_rsp.update(_4466_rsp ? _4466_rsp->raw() : nullptr, _4466_rsp ? _4466_rsp->size(0) : 0);
        }
      }
      {}
    }
  }
  return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_4462_idxs)->size(0)))}),_4466_rsp,_4465_rnidxs)).as<::mosek::fusion::Parameter>();
}
// End mosek.fusion.ParameterImpl.pick

// Begin mosek.fusion.ParameterImpl.index
// Method mosek.fusion.ParameterImpl.index @ bld/grindsted/final/default/src/fusion/Parameter.monty:418:6-444:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ParameterImpl :: __mosek_2fusion_2ParameterImpl__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _4473_indexes) { return mosek::fusion::p_ParameterImpl::_get_impl(this)->__mosek_2fusion_2ParameterImpl__index(_4473_indexes); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ParameterImpl::index(std::shared_ptr< monty::ndarray< int32_t,1 > > _4473_indexes) { return __mosek_2fusion_2ParameterImpl__index(_4473_indexes); }
/* override: mosek.fusion.Expression.index*/
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ParameterImpl::__mosek_2fusion_2Expression__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _4473_indexes) { return __mosek_2fusion_2ParameterImpl__index(_4473_indexes); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_ParameterImpl::__mosek_2fusion_2ParameterImpl__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _4473_indexes)
{
  _checked_ptr_1<int32_t> _ptr__4473_indexes(_4473_indexes ? _4473_indexes->raw() : nullptr, _4473_indexes ? _4473_indexes->size(0) : 0);
  if (((int)((shape)->size(0)) != (int)((_4473_indexes)->size(0))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Index has incorrect dimension"));
    }
  }
  else
  {
    {
      int32_t _11313_ = (int)0;
      int32_t _11314_ = (int)((_4473_indexes)->size(0));
      for (int32_t _4474_i = _11313_; _4474_i < _11314_; ++_4474_i)
      {
        {
          if (((_ptr__4473_indexes[_4474_i] < (int)0) || (_ptr__4473_indexes[_4474_i] >= ((*shape)(_4474_i)))))
          {
            {
              throw ::mosek::fusion::IndexError(std::string ("Index out of bounds"));
            }
          }
          {}
        }
      }
    }
  }
  if ((NULL == sp.get()))
  {
    {
      int32_t _4475_nd = (int)((_4473_indexes)->size(0));
      int64_t _4476_ix = _ptr__4473_indexes[(_4475_nd - (int)1)];
      int32_t _11315_ = (int)1;
      int32_t _11316_ = _4475_nd;
      for (int32_t _4477_i = _11315_; _4477_i < _11316_; ++_4477_i)
      {
        {
          _4476_ix = safe_add( safe_mul( _4476_ix,((*shape)((_4475_nd - _4477_i))) ),_ptr__4473_indexes[((_4475_nd - _4477_i) - (int)1)] );
        }
      }
      return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),nullptr,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(((*nidxs)(_4476_ix)))}))).as<::mosek::fusion::Expression>();
    }
  }
  else
  {
    {
      int32_t _4478_nd = (int)((_4473_indexes)->size(0));
      int64_t _4479_ix = _ptr__4473_indexes[(_4478_nd - (int)1)];
      int32_t _11317_ = (int)1;
      int32_t _11318_ = _4478_nd;
      for (int32_t _4480_i = _11317_; _4480_i < _11318_; ++_4480_i)
      {
        {
          _4479_ix = safe_add( safe_mul( _4479_ix,((*shape)((_4478_nd - _4480_i))) ),_ptr__4473_indexes[((_4478_nd - _4480_i) - (int)1)] );
        }
      }
      int32_t _4481_j = (int)0;
      while ( ((_4481_j < (int)((sp)->size(0))) && (((*sp)(_4481_j)) < _4479_ix)) )
      {
        {
          ++ _4481_j;
        }
      }
      if (((_4481_j < (int)((sp)->size(0))) && (((*sp)(_4481_j)) == _4479_ix)))
      {
        {
          return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),nullptr,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(((*nidxs)(_4481_j)))}))).as<::mosek::fusion::Expression>();
        }
      }
      else
      {
        {
          return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)0))),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))))).as<::mosek::fusion::Expression>();
        }
      }
    }
  }
}
// End mosek.fusion.ParameterImpl.index

// Begin mosek.fusion.ParameterImpl.index
// Method mosek.fusion.ParameterImpl.index @ bld/grindsted/final/default/src/fusion/Parameter.monty:400:6-416:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ParameterImpl :: __mosek_2fusion_2ParameterImpl__index(int32_t _4482_i) { return mosek::fusion::p_ParameterImpl::_get_impl(this)->__mosek_2fusion_2ParameterImpl__index(_4482_i); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ParameterImpl::index(int32_t _4482_i) { return __mosek_2fusion_2ParameterImpl__index(_4482_i); }
/* override: mosek.fusion.Expression.index*/
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ParameterImpl::__mosek_2fusion_2Expression__index(int32_t _4482_i) { return __mosek_2fusion_2ParameterImpl__index(_4482_i); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_ParameterImpl::__mosek_2fusion_2ParameterImpl__index(int32_t _4482_i)
{
  if (((int)((shape)->size(0)) != (int)1))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Index has incorrect dimension"));
    }
  }
  else if(((_4482_i < (int)0) || (_4482_i >= ((*shape)((int)0)))))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Index out of bounds"));
    }
  }
  {}
  if ((NULL == sp.get()))
  {
    {
      return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),nullptr,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(((*nidxs)(_4482_i)))}))).as<::mosek::fusion::Expression>();
    }
  }
  else
  {
    {
      int32_t _4483_j = (int)0;
      while ( ((_4483_j < (int)((sp)->size(0))) && (((*sp)(_4483_j)) < _4482_i)) )
      {
        {
          ++ _4483_j;
        }
      }
      if (((_4483_j < (int)((sp)->size(0))) && (((*sp)(_4483_j)) == _4482_i)))
      {
        {
          return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),nullptr,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(((*nidxs)(_4483_j)))}))).as<::mosek::fusion::Expression>();
        }
      }
      else
      {
        {
          return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)0))),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))))).as<::mosek::fusion::Expression>();
        }
      }
    }
  }
}
// End mosek.fusion.ParameterImpl.index

// Begin mosek.fusion.ParameterImpl.eval
// Method mosek.fusion.ParameterImpl.eval @ bld/grindsted/final/default/src/fusion/Parameter.monty:359:6-397:7
void mosek::fusion::ParameterImpl :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4484_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4485_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4486_xs,bool _4487_cache_eval) { mosek::fusion::p_ParameterImpl::_get_impl(this)->eval(_4484_rs,_4485_ws,_4486_xs,_4487_cache_eval); }
void mosek::fusion::p_ParameterImpl::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4484_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4485_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4486_xs,bool _4487_cache_eval)
{
  int32_t _4488_nd = (int)((shape)->size(0));
  int32_t _4489_nelem = (int)((nidxs)->size(0));
  bool _4490_hassp = (NULL != sp.get());
  _4484_rs->alloc_expr(_4488_nd,_4489_nelem,(int)((nidxs)->size(0)),_4490_hassp,(int)((nidxs)->size(0)));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4491_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4484_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__4491_ri32(_4491_ri32 ? _4491_ri32->raw() : nullptr,_4491_ri32 ? _4491_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4492_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4484_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__4492_ri64(_4492_ri64 ? _4492_ri64->raw() : nullptr,_4492_ri64 ? _4492_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4493_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4484_rs)->f64;
  _checked_ptr_1<double> _ptr__4493_rf64(_4493_rf64 ? _4493_rf64->raw() : nullptr,_4493_rf64 ? _4493_rf64->size(0) : 0);
  int32_t _4494_rptr = mosek::fusion::p_WorkStack::_get_impl(_4484_rs)->ptr_base;
  int32_t _4495_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_4484_rs)->nidxs_base;
  int32_t _4496_rcof = mosek::fusion::p_WorkStack::_get_impl(_4484_rs)->cof_base;
  int32_t _4497_rshape = mosek::fusion::p_WorkStack::_get_impl(_4484_rs)->shape_base;
  int32_t _4498_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_4484_rs)->codeptr_base;
  int32_t _4499_rcode = mosek::fusion::p_WorkStack::_get_impl(_4484_rs)->code_base;
  int32_t _4500_rcconst = mosek::fusion::p_WorkStack::_get_impl(_4484_rs)->cconst_base;
  int32_t _4501_rsp = mosek::fusion::p_WorkStack::_get_impl(_4484_rs)->sp_base;
  {
    _ptr__4491_ri32[_4494_rptr] = (int)0;
    int32_t _11319_ = (int)0;
    int32_t _11320_ = _4488_nd;
    for (int32_t _4502_i = _11319_; _4502_i < _11320_; ++_4502_i)
    {
      {
        _ptr__4491_ri32[safe_add( _4497_rshape,_4502_i )] = ((*shape)(_4502_i));
      }
    }
    int32_t _11321_ = (int)0;
    int32_t _11322_ = _4489_nelem;
    for (int32_t _4503_i = _11321_; _4503_i < _11322_; ++_4503_i)
    {
      {
        _ptr__4492_ri64[safe_add( _4495_rnidxs,_4503_i )] = (int)0;
      }
    }
    int32_t _11323_ = (int)0;
    int32_t _11324_ = _4489_nelem;
    for (int32_t _4504_i = _11323_; _4504_i < _11324_; ++_4504_i)
    {
      {
        _ptr__4493_rf64[safe_add( _4496_rcof,_4504_i )] = 0.0;
      }
    }
    int32_t _11325_ = (int)0;
    int32_t _11326_ = safe_add( _4489_nelem,(int)1 );
    for (int32_t _4505_i = _11325_; _4505_i < _11326_; ++_4505_i)
    {
      {
        _ptr__4491_ri32[safe_add( _4494_rptr,_4505_i )] = _4505_i;
      }
    }
    if ((_4489_nelem > (int)0))
    {
      {
        int32_t _11327_ = (int)0;
        int32_t _11328_ = safe_add( _4489_nelem,(int)1 );
        for (int32_t _4506_i = _11327_; _4506_i < _11328_; ++_4506_i)
        {
          {
            _ptr__4491_ri32[safe_add( _4498_rcodeptr,_4506_i )] = _4506_i;
          }
        }
      }
    }
    {}
    if (_4490_hassp)
    {
      {
        int32_t _11329_ = (int)0;
        int32_t _11330_ = _4489_nelem;
        for (int32_t _4507_i = _11329_; _4507_i < _11330_; ++_4507_i)
        {
          {
            _ptr__4492_ri64[safe_add( _4501_rsp,_4507_i )] = ((*sp)(_4507_i));
          }
        }
      }
    }
    {}
    int32_t _11331_ = (int)0;
    int32_t _11332_ = _4489_nelem;
    for (int32_t _4508_i = _11331_; _4508_i < _11332_; ++_4508_i)
    {
      {
        _ptr__4491_ri32[safe_add( _4499_rcode,_4508_i )] = (int)1;
        _ptr__4493_rf64[safe_add( _4500_rcconst,_4508_i )] = ((*nidxs)(_4508_i));
      }
    }
  }
}
// End mosek.fusion.ParameterImpl.eval

// Begin mosek.fusion.ParameterImpl.compress_when_caching
// Method mosek.fusion.ParameterImpl.compress_when_caching @ bld/grindsted/final/default/src/fusion/Parameter.monty:356:6-66
bool mosek::fusion::ParameterImpl :: compress_when_caching() { return mosek::fusion::p_ParameterImpl::_get_impl(this)->compress_when_caching(); }
bool mosek::fusion::p_ParameterImpl::compress_when_caching()
{
  return false;
}
// End mosek.fusion.ParameterImpl.compress_when_caching

// Begin mosek.fusion.ParameterImpl.eval
// Method mosek.fusion.ParameterImpl.eval @ bld/grindsted/final/default/src/fusion/Parameter.monty:353:6-103
void mosek::fusion::ParameterImpl :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4509_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4510_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4511_xs) { mosek::fusion::p_ParameterImpl::_get_impl(this)->eval(_4509_rs,_4510_ws,_4511_xs); }
void mosek::fusion::p_ParameterImpl::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4509_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4510_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4511_xs)
{
  _pubthis->recursive_eval(_4509_rs,_4510_ws,_4511_xs,false);
}
// End mosek.fusion.ParameterImpl.eval

// Begin mosek.fusion.ParameterImpl.recursive_eval
// Method mosek.fusion.ParameterImpl.recursive_eval @ bld/grindsted/final/default/src/fusion/Parameter.monty:350:6-125
void mosek::fusion::ParameterImpl :: recursive_eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4512_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4513_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4514_xs,bool _4515_cache_eval) { mosek::fusion::p_ParameterImpl::_get_impl(this)->recursive_eval(_4512_rs,_4513_ws,_4514_xs,_4515_cache_eval); }
void mosek::fusion::p_ParameterImpl::recursive_eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4512_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4513_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4514_xs,bool _4515_cache_eval)
{
  _pubthis->eval(_4512_rs,_4513_ws,_4514_xs,_4515_cache_eval);
}
// End mosek.fusion.ParameterImpl.recursive_eval

// Begin mosek.fusion.ParameterImpl.getSp
// Method mosek.fusion.ParameterImpl.getSp @ bld/grindsted/final/default/src/fusion/Parameter.monty:339:6-346:7
void mosek::fusion::ParameterImpl :: getSp(std::shared_ptr< monty::ndarray< int64_t,1 > > _4516_dest,int32_t _4517_offset) { mosek::fusion::p_ParameterImpl::_get_impl(this)->getSp(_4516_dest,_4517_offset); }
void mosek::fusion::p_ParameterImpl::getSp(std::shared_ptr< monty::ndarray< int64_t,1 > > _4516_dest,int32_t _4517_offset)
{
  _checked_ptr_1<int64_t> _ptr__4516_dest(_4516_dest ? _4516_dest->raw() : nullptr, _4516_dest ? _4516_dest->size(0) : 0);
  if ((NULL != sp.get()))
  {
    {
      int32_t _11333_ = (int)0;
      int32_t _11334_ = (int)((sp)->size(0));
      for (int32_t _4518_i = _11333_; _4518_i < _11334_; ++_4518_i)
      {
        {
          _ptr__4516_dest[safe_add( _4518_i,_4517_offset )] = ((*sp)(_4518_i));
        }
      }
    }
  }
  else
  {
    {
      int32_t _11335_ = (int)0;
      int32_t _11336_ = (int)((nidxs)->size(0));
      for (int32_t _4519_i = _11335_; _4519_i < _11336_; ++_4519_i)
      {
        {
          _ptr__4516_dest[safe_add( _4519_i,_4517_offset )] = _4519_i;
        }
      }
    }
  }
}
// End mosek.fusion.ParameterImpl.getSp

// Begin mosek.fusion.ParameterImpl.isSparse
// Method mosek.fusion.ParameterImpl.isSparse @ bld/grindsted/final/default/src/fusion/Parameter.monty:337:6-58
bool mosek::fusion::ParameterImpl :: isSparse() { return mosek::fusion::p_ParameterImpl::_get_impl(this)->isSparse(); }
bool mosek::fusion::p_ParameterImpl::isSparse()
{
  return (NULL != sp.get());
}
// End mosek.fusion.ParameterImpl.isSparse

// Begin mosek.fusion.ParameterImpl.slice
// Method mosek.fusion.ParameterImpl.slice @ bld/grindsted/final/default/src/fusion/Parameter.monty:279:6-335:7
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl :: __mosek_2fusion_2ParameterImpl__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _4520_astart,std::shared_ptr< monty::ndarray< int32_t,1 > > _4521_astop) { return mosek::fusion::p_ParameterImpl::_get_impl(this)->__mosek_2fusion_2ParameterImpl__slice(_4520_astart,_4521_astop); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _4520_astart,std::shared_ptr< monty::ndarray< int32_t,1 > > _4521_astop) { return __mosek_2fusion_2ParameterImpl__slice(_4520_astart,_4521_astop); }
/* override: mosek.fusion.Parameter.slice*/
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::__mosek_2fusion_2Parameter__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _4520_astart,std::shared_ptr< monty::ndarray< int32_t,1 > > _4521_astop) { return __mosek_2fusion_2ParameterImpl__slice(_4520_astart,_4521_astop); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_ParameterImpl::__mosek_2fusion_2ParameterImpl__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _4520_astart,std::shared_ptr< monty::ndarray< int32_t,1 > > _4521_astop)
{
  _checked_ptr_1<int32_t> _ptr__4520_astart(_4520_astart ? _4520_astart->raw() : nullptr, _4520_astart ? _4520_astart->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__4521_astop(_4521_astop ? _4521_astop->raw() : nullptr, _4521_astop ? _4521_astop->size(0) : 0);
  if ((((int)((_4520_astart)->size(0)) != (int)((_4521_astop)->size(0))) || ((int)((_4520_astart)->size(0)) != (int)((shape)->size(0)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid index dimension"));
    }
  }
  {}
  int32_t _4522_nd = (int)((_4520_astart)->size(0));
  int32_t _11337_ = (int)0;
  int32_t _11338_ = _4522_nd;
  for (int32_t _4523_i = _11337_; _4523_i < _11338_; ++_4523_i)
  {
    {
      if (((_ptr__4520_astart[_4523_i] < (int)0) || ((_ptr__4520_astart[_4523_i] >= _ptr__4521_astop[_4523_i]) || (_ptr__4521_astop[_4523_i] > ((*shape)(_4523_i))))))
      {
        {
          throw ::mosek::fusion::IndexError(std::string ("Invalid index"));
        }
      }
      {}
    }
  }
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4524_stride = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_4522_nd)));
  _checked_ptr_1<int64_t> _ptr__4524_stride(_4524_stride ? _4524_stride->raw() : nullptr,_4524_stride ? _4524_stride->size(0) : 0);
  _ptr__4524_stride[(_4522_nd - (int)1)] = (int)1;
  int32_t _11339_ = (int)1;
  int32_t _11340_ = _4522_nd;
  for (int32_t _4525_i = _11339_; _4525_i < _11340_; ++_4525_i)
  {
    {
      _ptr__4524_stride[((_4522_nd - _4525_i) - (int)1)] = safe_mul( _ptr__4524_stride[(_4522_nd - _4525_i)],((*shape)(_4525_i)) );
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4526_index = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_4522_nd)));
  _checked_ptr_1<int32_t> _ptr__4526_index(_4526_index ? _4526_index->raw() : nullptr,_4526_index ? _4526_index->size(0) : 0);
  std::vector<int32_t> _11341_;
  for (int32_t _4528_i = (int)0, _11342_ = _4522_nd; _4528_i < _11342_ ; ++_4528_i)
  {
    _11341_.push_back((_ptr__4521_astop[_4528_i] - _ptr__4520_astart[_4528_i]));
  }
  auto _11343_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11341_.size()),_11341_.begin(),_11341_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4527_rshape = _11343_;
  _checked_ptr_1<int32_t> _ptr__4527_rshape(_4527_rshape ? _4527_rshape->raw() : nullptr,_4527_rshape ? _4527_rshape->size(0) : 0);
  if ((NULL == sp.get()))
  {
    {
      int32_t _4529_count = (int)1;
      int32_t _11344_ = (int)0;
      int32_t _11345_ = _4522_nd;
      for (int32_t _4530_i = _11344_; _4530_i < _11345_; ++_4530_i)
      {
        {
          _4529_count *= _ptr__4527_rshape[_4530_i];
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4531_rnidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_4529_count)));
      _checked_ptr_1<int32_t> _ptr__4531_rnidxs(_4531_rnidxs ? _4531_rnidxs->raw() : nullptr,_4531_rnidxs ? _4531_rnidxs->size(0) : 0);
      int32_t _4532_k = (int)0;
      int32_t _11346_ = (int)0;
      int32_t _11347_ = (int)((nidxs)->size(0));
      for (int32_t _4533_i = _11346_; _4533_i < _11347_; ++_4533_i)
      {
        {
          int32_t _11348_ = (int)0;
          int32_t _11349_ = _4522_nd;
          for (int32_t _4534_j = _11348_; _4534_j < _11349_; ++_4534_j)
          {
            {
              _ptr__4526_index[_4534_j] = (int32_t)((_4533_i / _ptr__4524_stride[_4534_j]) % ((*shape)(_4534_j)));
            }
          }
          bool _4535_inslice = true;
          int32_t _11350_ = (int)0;
          int32_t _11351_ = _4522_nd;
          for (int32_t _4536_j = _11350_; _4536_j < _11351_; ++_4536_j)
          {
            {
              _4535_inslice = (_4535_inslice && ((_ptr__4520_astart[_4536_j] <= _ptr__4526_index[_4536_j]) && (_ptr__4526_index[_4536_j] < _ptr__4521_astop[_4536_j])));
            }
          }
          if (_4535_inslice)
          {
            {
              _ptr__4531_rnidxs[_4532_k] = ((*nidxs)(_4533_i));
              ++ _4532_k;
            }
          }
          {}
        }
      }
      return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,_4527_rshape,nullptr,_4531_rnidxs)).as<::mosek::fusion::Parameter>();
    }
  }
  else
  {
    {
      int32_t _4537_count = (int)0;
      int32_t _11352_ = (int)0;
      int32_t _11353_ = (int)((nidxs)->size(0));
      for (int32_t _4538_i = _11352_; _4538_i < _11353_; ++_4538_i)
      {
        {
          int32_t _11354_ = (int)0;
          int32_t _11355_ = _4522_nd;
          for (int32_t _4539_j = _11354_; _4539_j < _11355_; ++_4539_j)
          {
            {
              _ptr__4526_index[_4539_j] = (int32_t)((((*sp)(_4538_i)) / _ptr__4524_stride[_4539_j]) % ((*shape)(_4539_j)));
            }
          }
          bool _4540_inslice = true;
          int32_t _11356_ = (int)0;
          int32_t _11357_ = _4522_nd;
          for (int32_t _4541_j = _11356_; _4541_j < _11357_; ++_4541_j)
          {
            {
              _4540_inslice = (_4540_inslice && ((_ptr__4520_astart[_4541_j] <= _ptr__4526_index[_4541_j]) && (_ptr__4526_index[_4541_j] < _ptr__4521_astop[_4541_j])));
            }
          }
          if (_4540_inslice)
          {
            {
              ++ _4537_count;
            }
          }
          {}
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4542_rnidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_4537_count)));
      _checked_ptr_1<int32_t> _ptr__4542_rnidxs(_4542_rnidxs ? _4542_rnidxs->raw() : nullptr,_4542_rnidxs ? _4542_rnidxs->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4543_rsp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_4537_count)));
      _checked_ptr_1<int64_t> _ptr__4543_rsp(_4543_rsp ? _4543_rsp->raw() : nullptr,_4543_rsp ? _4543_rsp->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4544_rstride = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_4522_nd)));
      _checked_ptr_1<int64_t> _ptr__4544_rstride(_4544_rstride ? _4544_rstride->raw() : nullptr,_4544_rstride ? _4544_rstride->size(0) : 0);
      _ptr__4544_rstride[(_4522_nd - (int)1)] = (int)1;
      int32_t _11358_ = (int)1;
      int32_t _11359_ = _4522_nd;
      for (int32_t _4545_i = _11358_; _4545_i < _11359_; ++_4545_i)
      {
        {
          _ptr__4544_rstride[((_4522_nd - _4545_i) - (int)1)] = safe_mul( _ptr__4544_rstride[(_4522_nd - _4545_i)],_ptr__4527_rshape[_4545_i] );
        }
      }
      int32_t _4546_k = (int)0;
      int32_t _11360_ = (int)0;
      int32_t _11361_ = (int)((nidxs)->size(0));
      for (int32_t _4547_i = _11360_; _4547_i < _11361_; ++_4547_i)
      {
        {
          int32_t _11362_ = (int)0;
          int32_t _11363_ = _4522_nd;
          for (int32_t _4548_j = _11362_; _4548_j < _11363_; ++_4548_j)
          {
            {
              _ptr__4526_index[_4547_i] = (int32_t)((((*sp)(_4547_i)) / _ptr__4524_stride[_4548_j]) % ((*shape)(_4548_j)));
            }
          }
          bool _4549_inslice = true;
          int32_t _11364_ = (int)0;
          int32_t _11365_ = _4522_nd;
          for (int32_t _4550_j = _11364_; _4550_j < _11365_; ++_4550_j)
          {
            {
              _4549_inslice = (_4549_inslice && ((_ptr__4520_astart[_4550_j] <= _ptr__4526_index[_4550_j]) && (_ptr__4526_index[_4550_j] < _ptr__4521_astop[_4550_j])));
            }
          }
          if (_4549_inslice)
          {
            {
              int64_t _4551_ri = (int64_t)0;
              int32_t _11366_ = (int)0;
              int32_t _11367_ = _4522_nd;
              for (int32_t _4552_j = _11366_; _4552_j < _11367_; ++_4552_j)
              {
                {
                  _4551_ri += safe_mul( (_ptr__4526_index[_4552_j] - _ptr__4520_astart[_4552_j]),_ptr__4544_rstride[_4552_j] );
                }
              }
              _ptr__4543_rsp[_4546_k] = _4551_ri;
              _ptr__4542_rnidxs[_4546_k] = ((*nidxs)(_4547_i));
              ++ _4546_k;
            }
          }
          {}
        }
      }
      return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,_4527_rshape,_4543_rsp,_4542_rnidxs)).as<::mosek::fusion::Parameter>();
    }
  }
}
// End mosek.fusion.ParameterImpl.slice

// Begin mosek.fusion.ParameterImpl.transpose
// Method mosek.fusion.ParameterImpl.transpose @ bld/grindsted/final/default/src/fusion/Parameter.monty:244:6-277:7
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl :: __mosek_2fusion_2ParameterImpl__transpose() { return mosek::fusion::p_ParameterImpl::_get_impl(this)->__mosek_2fusion_2ParameterImpl__transpose(); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::transpose() { return __mosek_2fusion_2ParameterImpl__transpose(); }
/* override: mosek.fusion.Parameter.transpose*/
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::__mosek_2fusion_2Parameter__transpose() { return __mosek_2fusion_2ParameterImpl__transpose(); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_ParameterImpl::__mosek_2fusion_2ParameterImpl__transpose()
{
  if (((int)((shape)->size(0)) == (int)0))
  {
    {
      return (::mosek::fusion::ParameterImpl::t(_pubthis)).as<::mosek::fusion::Parameter>();
    }
  }
  else
  {
    {
      if (((int)((shape)->size(0)) == (int)1))
      {
        {
          return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)(((*shape)((int)0)))}),sp,nidxs)).as<::mosek::fusion::Parameter>();
        }
      }
      else
      {
        {
          if (((int)((shape)->size(0)) == (int)2))
          {
            {
              int32_t _4553_d0 = ((*shape)((int)0));
              int32_t _4554_d1 = ((*shape)((int)1));
              std::shared_ptr< monty::ndarray< int32_t,1 > > _4555_tshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_4554_d1),(int32_t)(_4553_d0)});
              _checked_ptr_1<int32_t> _ptr__4555_tshape(_4555_tshape ? _4555_tshape->raw() : nullptr,_4555_tshape ? _4555_tshape->size(0) : 0);
              if ((NULL != sp.get()))
              {
                {
                  std::shared_ptr< monty::ndarray< int32_t,1 > > _4556_tnidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)((nidxs)->size(0)))));
                  _checked_ptr_1<int32_t> _ptr__4556_tnidxs(_4556_tnidxs ? _4556_tnidxs->raw() : nullptr,_4556_tnidxs ? _4556_tnidxs->size(0) : 0);
                  std::shared_ptr< monty::ndarray< int64_t,1 > > _4557_tsp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)((sp)->size(0)))));
                  _checked_ptr_1<int64_t> _ptr__4557_tsp(_4557_tsp ? _4557_tsp->raw() : nullptr,_4557_tsp ? _4557_tsp->size(0) : 0);
                  std::shared_ptr< monty::ndarray< int32_t,1 > > _4558_ptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _4554_d1,(int)1 ))));
                  _checked_ptr_1<int32_t> _ptr__4558_ptr(_4558_ptr ? _4558_ptr->raw() : nullptr,_4558_ptr ? _4558_ptr->size(0) : 0);
                  int32_t _11368_ = (int)0;
                  int32_t _11369_ = (int)((sp)->size(0));
                  for (int32_t _4559_k = _11368_; _4559_k < _11369_; ++_4559_k)
                  {
                    {
                      _ptr__4558_ptr[safe_add( (int)1,(((*sp)(_4559_k)) % _4554_d1) )] += (int)1;
                    }
                  }
                  int32_t _11370_ = (int)0;
                  int32_t _11371_ = _4554_d1;
                  for (int32_t _4560_k = _11370_; _4560_k < _11371_; ++_4560_k)
                  {
                    {
                      _ptr__4558_ptr[safe_add( _4560_k,(int)1 )] += _ptr__4558_ptr[_4560_k];
                    }
                  }
                  int32_t _11372_ = (int)0;
                  int32_t _11373_ = (int)((sp)->size(0));
                  for (int32_t _4561_k = _11372_; _4561_k < _11373_; ++_4561_k)
                  {
                    {
                      int64_t _4562_i0 = (((*sp)(_4561_k)) / _4554_d1);
                      int64_t _4563_i1 = (((*sp)(_4561_k)) % _4554_d1);
                      _ptr__4556_tnidxs[_ptr__4558_ptr[_4563_i1]] = ((*nidxs)(_4561_k));
                      _ptr__4557_tsp[_ptr__4558_ptr[_4563_i1]] = safe_add( safe_mul( _4563_i1,_4553_d0 ),_4562_i0 );
                      _ptr__4558_ptr[_4563_i1] += (int)1;
                    }
                  }
                  return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,_4555_tshape,_4557_tsp,_4556_tnidxs)).as<::mosek::fusion::Parameter>();
                }
              }
              else
              {
                {
                  std::vector<int32_t> _11374_;
                  for (int32_t _4565_j = (int)0, _11375_ = _4554_d1; _4565_j < _11375_ ; ++_4565_j)
                  {
                    for (int32_t _4566_i = (int)0, _11376_ = _4554_d1; _4566_i < _11376_ ; ++_4566_i)
                    {
                      _11374_.push_back(((*nidxs)(safe_add( safe_mul( _4566_i,_4554_d1 ),_4565_j ))));
                    }
                  }
                  auto _11377_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11374_.size()),_11374_.begin(),_11374_.end()));
                  std::shared_ptr< monty::ndarray< int32_t,1 > > _4564_tnidxs = _11377_;
                  _checked_ptr_1<int32_t> _ptr__4564_tnidxs(_4564_tnidxs ? _4564_tnidxs->raw() : nullptr,_4564_tnidxs ? _4564_tnidxs->size(0) : 0);
                  return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,_4555_tshape,nullptr,_4564_tnidxs)).as<::mosek::fusion::Parameter>();
                }
              }
            }
          }
          else
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Invalid shape for transpose"));
            }
          }
        }
      }
    }
  }
}
// End mosek.fusion.ParameterImpl.transpose

// Begin mosek.fusion.ParameterImpl.slice
// Method mosek.fusion.ParameterImpl.slice @ bld/grindsted/final/default/src/fusion/Parameter.monty:217:6-242:7
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl :: __mosek_2fusion_2ParameterImpl__slice(int32_t _4567_start,int32_t _4568_stop) { return mosek::fusion::p_ParameterImpl::_get_impl(this)->__mosek_2fusion_2ParameterImpl__slice(_4567_start,_4568_stop); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::slice(int32_t _4567_start,int32_t _4568_stop) { return __mosek_2fusion_2ParameterImpl__slice(_4567_start,_4568_stop); }
/* override: mosek.fusion.Parameter.slice*/
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::__mosek_2fusion_2Parameter__slice(int32_t _4567_start,int32_t _4568_stop) { return __mosek_2fusion_2ParameterImpl__slice(_4567_start,_4568_stop); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_ParameterImpl::__mosek_2fusion_2ParameterImpl__slice(int32_t _4567_start,int32_t _4568_stop)
{
  if (((int)((shape)->size(0)) != (int)1))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid index dimension"));
    }
  }
  {}
  if (((_4567_start < (int)0) || ((_4567_start >= _4568_stop) || (_4568_stop > size))))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid index"));
    }
  }
  {}
  if ((NULL == sp.get()))
  {
    {
      std::vector<int32_t> _11378_;
      for (int32_t _4569_i = _4567_start, _11379_ = _4568_stop; _4569_i < _11379_ ; ++_4569_i)
      {
        _11378_.push_back(((*nidxs)(_4569_i)));
      }
      auto _11380_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11378_.size()),_11378_.begin(),_11378_.end()));
      return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((_4568_stop - _4567_start))}),nullptr,_11380_)).as<::mosek::fusion::Parameter>();
    }
  }
  else
  {
    {
      int32_t _4570_count = (int)0;
      int32_t _11381_ = (int)0;
      int32_t _11382_ = (int)((sp)->size(0));
      for (int32_t _4571_i = _11381_; _4571_i < _11382_; ++_4571_i)
      {
        {
          if (((_4567_start <= ((*sp)(_4571_i))) && (((*sp)(_4571_i)) < _4568_stop)))
          {
            {
              ++ _4570_count;
            }
          }
          {}
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4572_rnidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_4570_count)));
      _checked_ptr_1<int32_t> _ptr__4572_rnidxs(_4572_rnidxs ? _4572_rnidxs->raw() : nullptr,_4572_rnidxs ? _4572_rnidxs->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4573_rsp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_4570_count)));
      _checked_ptr_1<int64_t> _ptr__4573_rsp(_4573_rsp ? _4573_rsp->raw() : nullptr,_4573_rsp ? _4573_rsp->size(0) : 0);
      int32_t _4574_k = (int)0;
      int32_t _11383_ = (int)0;
      int32_t _11384_ = (int)((sp)->size(0));
      for (int32_t _4575_i = _11383_; _4575_i < _11384_; ++_4575_i)
      {
        {
          if (((_4567_start <= ((*sp)(_4575_i))) && (((*sp)(_4575_i)) < _4568_stop)))
          {
            {
              _ptr__4572_rnidxs[_4574_k] = ((*nidxs)(_4575_i));
              _ptr__4573_rsp[_4574_k] = (((*sp)(_4574_k)) - _4567_start);
              ++ _4574_k;
            }
          }
          {}
        }
      }
      return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((_4568_stop - _4567_start))}),_4573_rsp,_4572_rnidxs)).as<::mosek::fusion::Parameter>();
    }
  }
}
// End mosek.fusion.ParameterImpl.slice

// Begin mosek.fusion.ParameterImpl.reshape
// Method mosek.fusion.ParameterImpl.reshape @ bld/grindsted/final/default/src/fusion/Parameter.monty:211:6-215:7
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl :: __mosek_2fusion_2ParameterImpl__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > > _4576_dims) { return mosek::fusion::p_ParameterImpl::_get_impl(this)->__mosek_2fusion_2ParameterImpl__reshape(_4576_dims); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::reshape(std::shared_ptr< monty::ndarray< int32_t,1 > > _4576_dims) { return __mosek_2fusion_2ParameterImpl__reshape(_4576_dims); }
/* override: mosek.fusion.Parameter.reshape*/
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::ParameterImpl::__mosek_2fusion_2Parameter__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > > _4576_dims) { return __mosek_2fusion_2ParameterImpl__reshape(_4576_dims); }
monty::rc_ptr< ::mosek::fusion::Parameter > mosek::fusion::p_ParameterImpl::__mosek_2fusion_2ParameterImpl__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > > _4576_dims)
{
  _checked_ptr_1<int32_t> _ptr__4576_dims(_4576_dims ? _4576_dims->raw() : nullptr, _4576_dims ? _4576_dims->size(0) : 0);
  if ((::mosek::fusion::p_Set::size(_4576_dims) != ::mosek::fusion::p_Set::size(shape)))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Incompatible shape for resize"));
    }
  }
  {}
  return (::mosek::fusion::p_ParameterImpl::_new_ParameterImpl(model,_4576_dims,sp,nidxs)).as<::mosek::fusion::Parameter>();
}
// End mosek.fusion.ParameterImpl.reshape

// Begin mosek.fusion.ParameterImpl.asExpr
// Method mosek.fusion.ParameterImpl.asExpr @ bld/grindsted/final/default/src/fusion/Parameter.monty:209:6-75
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ParameterImpl :: __mosek_2fusion_2ParameterImpl__asExpr() { return mosek::fusion::p_ParameterImpl::_get_impl(this)->__mosek_2fusion_2ParameterImpl__asExpr(); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ParameterImpl::asExpr() { return __mosek_2fusion_2ParameterImpl__asExpr(); }
/* override: mosek.fusion.Parameter.asExpr*/
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ParameterImpl::__mosek_2fusion_2Parameter__asExpr() { return __mosek_2fusion_2ParameterImpl__asExpr(); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_ParameterImpl::__mosek_2fusion_2ParameterImpl__asExpr()
{
  return (::mosek::fusion::p_ExprParameter::_new_ExprParameter((::mosek::fusion::ParameterImpl::t(_pubthis)).as<::mosek::fusion::Parameter>())).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.ParameterImpl.asExpr

// Begin mosek.fusion.ParameterImpl.getSize
// Method mosek.fusion.ParameterImpl.getSize @ bld/grindsted/final/default/src/fusion/Parameter.monty:207:6-69
int64_t mosek::fusion::ParameterImpl :: getSize() { return mosek::fusion::p_ParameterImpl::_get_impl(this)->getSize(); }
int64_t mosek::fusion::p_ParameterImpl::getSize()
{
  return ::mosek::fusion::p_Set::size(shape);
}
// End mosek.fusion.ParameterImpl.getSize

// Begin mosek.fusion.ParameterImpl.getNumNonzero
// Method mosek.fusion.ParameterImpl.getNumNonzero @ bld/grindsted/final/default/src/fusion/Parameter.monty:206:6-64
int32_t mosek::fusion::ParameterImpl :: getNumNonzero() { return mosek::fusion::p_ParameterImpl::_get_impl(this)->getNumNonzero(); }
int32_t mosek::fusion::p_ParameterImpl::getNumNonzero()
{
  return (int)((nidxs)->size(0));
}
// End mosek.fusion.ParameterImpl.getNumNonzero

// Begin mosek.fusion.ParameterImpl.getND
// Method mosek.fusion.ParameterImpl.getND @ bld/grindsted/final/default/src/fusion/Parameter.monty:205:6-64
int32_t mosek::fusion::ParameterImpl :: getND() { return mosek::fusion::p_ParameterImpl::_get_impl(this)->getND(); }
int32_t mosek::fusion::p_ParameterImpl::getND()
{
  return (int)((shape)->size(0));
}
// End mosek.fusion.ParameterImpl.getND

// Begin mosek.fusion.ParameterImpl.getShape
// Method mosek.fusion.ParameterImpl.getShape @ bld/grindsted/final/default/src/fusion/Parameter.monty:204:6-82
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::ParameterImpl :: getShape() { return mosek::fusion::p_ParameterImpl::_get_impl(this)->getShape(); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_ParameterImpl::getShape()
{
  return ::mosek::fusion::Utils::Tools::arraycopy(shape);
}
// End mosek.fusion.ParameterImpl.getShape

// Begin mosek.fusion.ParameterImpl.getDim
// Method mosek.fusion.ParameterImpl.getDim @ bld/grindsted/final/default/src/fusion/Parameter.monty:203:6-69
int32_t mosek::fusion::ParameterImpl :: getDim(int32_t _4577_i) { return mosek::fusion::p_ParameterImpl::_get_impl(this)->getDim(_4577_i); }
int32_t mosek::fusion::p_ParameterImpl::getDim(int32_t _4577_i)
{
  return ((*shape)(_4577_i));
}
// End mosek.fusion.ParameterImpl.getDim

// Begin mosek.fusion.ParameterImpl.getAllIndexes
// Method mosek.fusion.ParameterImpl.getAllIndexes @ bld/grindsted/final/default/src/fusion/Parameter.monty:198:6-201:7
void mosek::fusion::ParameterImpl :: getAllIndexes(std::shared_ptr< monty::ndarray< int32_t,1 > > _4578_dst,int32_t _4579_ofs) { mosek::fusion::p_ParameterImpl::_get_impl(this)->getAllIndexes(_4578_dst,_4579_ofs); }
void mosek::fusion::p_ParameterImpl::getAllIndexes(std::shared_ptr< monty::ndarray< int32_t,1 > > _4578_dst,int32_t _4579_ofs)
{
  _checked_ptr_1<int32_t> _ptr__4578_dst(_4578_dst ? _4578_dst->raw() : nullptr, _4578_dst ? _4578_dst->size(0) : 0);
  int32_t _11385_ = (int)0;
  int32_t _11386_ = (int)((nidxs)->size(0));
  for (int32_t _4580_i = _11385_; _4580_i < _11386_; ++_4580_i)
  {
    {
      _ptr__4578_dst[safe_add( _4579_ofs,_4580_i )] = ((*nidxs)(_4580_i));
    }
  }
}
// End mosek.fusion.ParameterImpl.getAllIndexes

// Begin mosek.fusion.ParameterImpl.getIndex
// Method mosek.fusion.ParameterImpl.getIndex @ bld/grindsted/final/default/src/fusion/Parameter.monty:195:6-197:7
int32_t mosek::fusion::ParameterImpl :: getIndex(int32_t _4581_i) { return mosek::fusion::p_ParameterImpl::_get_impl(this)->getIndex(_4581_i); }
int32_t mosek::fusion::p_ParameterImpl::getIndex(int32_t _4581_i)
{
  return ((*nidxs)(_4581_i));
}
// End mosek.fusion.ParameterImpl.getIndex

// Begin mosek.fusion.ParameterImpl.getValue
// Method mosek.fusion.ParameterImpl.getValue @ bld/grindsted/final/default/src/fusion/Parameter.monty:190:6-192:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::ParameterImpl :: getValue() { return mosek::fusion::p_ParameterImpl::_get_impl(this)->getValue(); }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_ParameterImpl::getValue()
{
  return mosek::fusion::p_Model::_get_impl(model.get())->getParameterValue(nidxs);
}
// End mosek.fusion.ParameterImpl.getValue

// Begin mosek.fusion.ParameterImpl.setValue
// Method mosek.fusion.ParameterImpl.setValue @ bld/grindsted/final/default/src/fusion/Parameter.monty:168:6-186:7
void mosek::fusion::ParameterImpl :: setValue(std::shared_ptr< monty::ndarray< double,2 > > _4582_values2) { mosek::fusion::p_ParameterImpl::_get_impl(this)->setValue(_4582_values2); }
void mosek::fusion::p_ParameterImpl::setValue(std::shared_ptr< monty::ndarray< double,2 > > _4582_values2)
{
  if (((_pubthis->getND() != (int)2) || (((int)((_4582_values2)->size(0)) != ((*shape)((int)0))) || ((int)((_4582_values2)->size(1)) != ((*shape)((int)1))))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Mismatching value shape"));
    }
  }
  {}
  if ((NULL == sp.get()))
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _4583_vals = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(safe_mul( ((*shape)((int)0)),((*shape)((int)1)) ))));
      _checked_ptr_1<double> _ptr__4583_vals(_4583_vals ? _4583_vals->raw() : nullptr,_4583_vals ? _4583_vals->size(0) : 0);
      int32_t _11387_ = (int)0;
      int32_t _11388_ = ((*shape)((int)0));
      for (int32_t _4584_i = _11387_; _4584_i < _11388_; ++_4584_i)
      {
        {
          int32_t _11389_ = (int)0;
          int32_t _11390_ = ((*shape)((int)1));
          for (int32_t _4585_j = _11389_; _4585_j < _11390_; ++_4585_j)
          {
            {
              _ptr__4583_vals[safe_add( safe_mul( _4584_i,((*shape)((int)1)) ),_4585_j )] = ((*_4582_values2)(_4584_i,_4585_j));
            }
          }
        }
      }
      mosek::fusion::p_Model::_get_impl(model.get())->setParameterValue(nidxs,_4583_vals);
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _4586_vals = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)((sp)->size(0)))));
      _checked_ptr_1<double> _ptr__4586_vals(_4586_vals ? _4586_vals->raw() : nullptr,_4586_vals ? _4586_vals->size(0) : 0);
      int32_t _11391_ = (int)0;
      int32_t _11392_ = (int)((sp)->size(0));
      for (int32_t _4587_i = _11391_; _4587_i < _11392_; ++_4587_i)
      {
        {
          _ptr__4586_vals[_4587_i] = ((*_4582_values2)((((*sp)(_4587_i)) / ((*shape)((int)1))),(((*sp)(_4587_i)) % ((*shape)((int)1)))));
        }
      }
      mosek::fusion::p_Model::_get_impl(model.get())->setParameterValue(nidxs,_4586_vals);
    }
  }
}
// End mosek.fusion.ParameterImpl.setValue

// Begin mosek.fusion.ParameterImpl.setValue
// Method mosek.fusion.ParameterImpl.setValue @ bld/grindsted/final/default/src/fusion/Parameter.monty:147:6-166:7
void mosek::fusion::ParameterImpl :: setValue(std::shared_ptr< monty::ndarray< double,1 > > _4588_values) { mosek::fusion::p_ParameterImpl::_get_impl(this)->setValue(_4588_values); }
void mosek::fusion::p_ParameterImpl::setValue(std::shared_ptr< monty::ndarray< double,1 > > _4588_values)
{
  _checked_ptr_1<double> _ptr__4588_values(_4588_values ? _4588_values->raw() : nullptr, _4588_values ? _4588_values->size(0) : 0);
  if ((NULL != sp.get()))
  {
    {
      if (((int)((_4588_values)->size(0)) != _pubthis->getSize()))
      {
        {
          throw ::mosek::fusion::LengthError(std::string ("Length of value array is incorrect"));
        }
      }
      else
      {
        {
          std::shared_ptr< monty::ndarray< double,1 > > _4589_cvals = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)((nidxs)->size(0)))));
          _checked_ptr_1<double> _ptr__4589_cvals(_4589_cvals ? _4589_cvals->raw() : nullptr,_4589_cvals ? _4589_cvals->size(0) : 0);
          int32_t _11393_ = (int)0;
          int32_t _11394_ = (int)((nidxs)->size(0));
          for (int32_t _4590_i = _11393_; _4590_i < _11394_; ++_4590_i)
          {
            {
              _ptr__4589_cvals[_4590_i] = _ptr__4588_values[((*sp)(_4590_i))];
            }
          }
          mosek::fusion::p_Model::_get_impl(model.get())->setParameterValue(nidxs,_4589_cvals);
        }
      }
    }
  }
  else
  {
    {
      if (((int)((_4588_values)->size(0)) != (int)((nidxs)->size(0))))
      {
        {
          throw ::mosek::fusion::LengthError(std::string ("Length of value array is incorrect for sparse parameter"));
        }
      }
      else
      {
        {
          mosek::fusion::p_Model::_get_impl(model.get())->setParameterValue(nidxs,_4588_values);
        }
      }
    }
  }
}
// End mosek.fusion.ParameterImpl.setValue

// Begin mosek.fusion.ParameterImpl.setValue
// Method mosek.fusion.ParameterImpl.setValue @ bld/grindsted/final/default/src/fusion/Parameter.monty:140:6-145:7
void mosek::fusion::ParameterImpl :: setValue(double _4591_value) { mosek::fusion::p_ParameterImpl::_get_impl(this)->setValue(_4591_value); }
void mosek::fusion::p_ParameterImpl::setValue(double _4591_value)
{
  std::shared_ptr< monty::ndarray< double,1 > > _4592_vals = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(size)));
  _checked_ptr_1<double> _ptr__4592_vals(_4592_vals ? _4592_vals->raw() : nullptr,_4592_vals ? _4592_vals->size(0) : 0);
  int32_t _11395_ = (int)0;
  int64_t _11396_ = size;
  for (int64_t _4593_i = _11395_; _4593_i < _11396_; ++_4593_i)
  {
    {
      _ptr__4592_vals[_4593_i] = _4591_value;
    }
  }
  mosek::fusion::p_Model::_get_impl(model.get())->setParameterValue(nidxs,_4592_vals);
}
// End mosek.fusion.ParameterImpl.setValue

// Begin mosek.fusion.ParameterImpl.getModel
// Method mosek.fusion.ParameterImpl.getModel @ bld/grindsted/final/default/src/fusion/Parameter.monty:139:6-54
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::ParameterImpl :: __mosek_2fusion_2ParameterImpl__getModel() { return mosek::fusion::p_ParameterImpl::_get_impl(this)->__mosek_2fusion_2ParameterImpl__getModel(); }
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::ParameterImpl::getModel() { return __mosek_2fusion_2ParameterImpl__getModel(); }
/* override: mosek.fusion.Expression.getModel*/
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::ParameterImpl::__mosek_2fusion_2Expression__getModel() { return __mosek_2fusion_2ParameterImpl__getModel(); }
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::p_ParameterImpl::__mosek_2fusion_2ParameterImpl__getModel()
{
  return model;
}
// End mosek.fusion.ParameterImpl.getModel

void mosek::fusion::p_ParameterImpl::destroy()
{
  nidxs.reset();
  sp.reset();
  shape.reset();
  model.reset();
}
void mosek::fusion::ParameterImpl::destroy() { mosek::fusion::p_ParameterImpl::_get_impl(this)->destroy(); }
// } class ParameterImpl
// class Parameter { // @ bld/grindsted/final/default/src/fusion/Parameter.monty:74:4-110:5
// Begin mosek.fusion.Parameter.clone
monty::rc_ptr< mosek::fusion::Parameter > mosek::fusion::Parameter::clone(monty::rc_ptr< ::mosek::fusion::Model > _4594_m) { return __mosek_2fusion_2Parameter__clone(_4594_m); }
// End mosek.fusion.Parameter.clone

// Begin mosek.fusion.Parameter.getSize
// End mosek.fusion.Parameter.getSize

// Begin mosek.fusion.Parameter.getAllIndexes
// End mosek.fusion.Parameter.getAllIndexes

// Begin mosek.fusion.Parameter.getIndex
// End mosek.fusion.Parameter.getIndex

// Begin mosek.fusion.Parameter.getSp
// End mosek.fusion.Parameter.getSp

// Begin mosek.fusion.Parameter.getShape
// End mosek.fusion.Parameter.getShape

// Begin mosek.fusion.Parameter.getND
// End mosek.fusion.Parameter.getND

// Begin mosek.fusion.Parameter.getDim
// End mosek.fusion.Parameter.getDim

// Begin mosek.fusion.Parameter.transpose
monty::rc_ptr< mosek::fusion::Parameter > mosek::fusion::Parameter::transpose() { return __mosek_2fusion_2Parameter__transpose(); }
// End mosek.fusion.Parameter.transpose

// Begin mosek.fusion.Parameter.pick
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Parameter::__mosek_2fusion_2Expression__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _4601_midxs) { return __mosek_2fusion_2Parameter__pick(_4601_midxs); }
monty::rc_ptr< mosek::fusion::Parameter > mosek::fusion::Parameter::pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _4601_midxs) { return __mosek_2fusion_2Parameter__pick(_4601_midxs); }
// End mosek.fusion.Parameter.pick

// Begin mosek.fusion.Parameter.pick
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Parameter::__mosek_2fusion_2Expression__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _4602_idxs) { return __mosek_2fusion_2Parameter__pick(_4602_idxs); }
monty::rc_ptr< mosek::fusion::Parameter > mosek::fusion::Parameter::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _4602_idxs) { return __mosek_2fusion_2Parameter__pick(_4602_idxs); }
// End mosek.fusion.Parameter.pick

// Begin mosek.fusion.Parameter.slice
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Parameter::__mosek_2fusion_2Expression__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _4603_astart,std::shared_ptr< monty::ndarray< int32_t,1 > > _4604_astop) { return __mosek_2fusion_2Parameter__slice(_4603_astart,_4604_astop); }
monty::rc_ptr< mosek::fusion::Parameter > mosek::fusion::Parameter::slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _4603_astart,std::shared_ptr< monty::ndarray< int32_t,1 > > _4604_astop) { return __mosek_2fusion_2Parameter__slice(_4603_astart,_4604_astop); }
// End mosek.fusion.Parameter.slice

// Begin mosek.fusion.Parameter.slice
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Parameter::__mosek_2fusion_2Expression__slice(int32_t _4605_start,int32_t _4606_stop) { return __mosek_2fusion_2Parameter__slice(_4605_start,_4606_stop); }
monty::rc_ptr< mosek::fusion::Parameter > mosek::fusion::Parameter::slice(int32_t _4605_start,int32_t _4606_stop) { return __mosek_2fusion_2Parameter__slice(_4605_start,_4606_stop); }
// End mosek.fusion.Parameter.slice

// Begin mosek.fusion.Parameter.isSparse
// End mosek.fusion.Parameter.isSparse

// Begin mosek.fusion.Parameter.reshape
monty::rc_ptr< mosek::fusion::Parameter > mosek::fusion::Parameter::reshape(std::shared_ptr< monty::ndarray< int32_t,1 > > _4607_dims) { return __mosek_2fusion_2Parameter__reshape(_4607_dims); }
// End mosek.fusion.Parameter.reshape

// Begin mosek.fusion.Parameter.getNumNonzero
// End mosek.fusion.Parameter.getNumNonzero

// Begin mosek.fusion.Parameter.asExpr
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Parameter::asExpr() { return __mosek_2fusion_2Parameter__asExpr(); }
// End mosek.fusion.Parameter.asExpr

// Begin mosek.fusion.Parameter.getValue
// End mosek.fusion.Parameter.getValue

// Begin mosek.fusion.Parameter.setValue
// End mosek.fusion.Parameter.setValue

// Begin mosek.fusion.Parameter.setValue
// End mosek.fusion.Parameter.setValue

// Begin mosek.fusion.Parameter.setValue
// End mosek.fusion.Parameter.setValue

// } class Parameter
// class ExprOptimizeCode { // @ bld/grindsted/final/default/src/fusion/ExprCompress.monty:460:4-1165:5
mosek::fusion::ExprOptimizeCode::ExprOptimizeCode(mosek::fusion::p_ExprOptimizeCode *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprOptimizeCode()" << this << std::endl; */ }
mosek::fusion::ExprOptimizeCode::~ExprOptimizeCode() {  /* std::cout << "~ExprOptimizeCode()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprOptimizeCode::p_ExprOptimizeCode
  (::mosek::fusion::ExprOptimizeCode * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprOptimizeCode.ctor @ bld/grindsted/final/default/src/fusion/ExprCompress.monty:462:6-465:7
mosek::fusion::ExprOptimizeCode::t mosek::fusion::p_ExprOptimizeCode::_new_ExprOptimizeCode
  (monty::rc_ptr< ::mosek::fusion::Expression > _4611_expr)
{ return new mosek::fusion::ExprOptimizeCode(_4611_expr); }
mosek::fusion::ExprOptimizeCode::ExprOptimizeCode
  (monty::rc_ptr< ::mosek::fusion::Expression > _4611_expr) : 
   ExprOptimizeCode(new mosek::fusion::p_ExprOptimizeCode(this))
{ mosek::fusion::p_ExprOptimizeCode::_get_impl(this)->_initialize(_4611_expr); }
void mosek::fusion::p_ExprOptimizeCode::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _4611_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_4611_expr->__mosek_2fusion_2Expression__getModel(),_4611_expr->getShape());
    mosek::fusion::p_ExprOptimizeCode::_get_impl(::mosek::fusion::ExprOptimizeCode::t(_pubthis))->expr = _4611_expr;
  }
}
// mosek.fusion.ExprOptimizeCode.ctor

// Begin mosek.fusion.ExprOptimizeCode.compress_code
// Method mosek.fusion.ExprOptimizeCode.compress_code @ bld/grindsted/final/default/src/fusion/ExprCompress.monty:722:6-1164:7
void mosek::fusion::p_ExprOptimizeCode::compress_code(monty::rc_ptr< ::mosek::fusion::WorkStack > _4612_xs,int32_t _4613_n,std::shared_ptr< monty::ndarray< int32_t,1 > > _4614_code,int32_t _4615_code_base,std::shared_ptr< monty::ndarray< int32_t,1 > > _4616_ptr,int32_t _4617_ptr_base,std::shared_ptr< monty::ndarray< double,1 > > _4618_fixterm,int32_t _4619_fixterm_base,std::shared_ptr< monty::ndarray< double,1 > > _4620_code_consts,int32_t _4621_code_consts_base,int32_t _4622_target_code_base,int32_t _4623_target_const_base,int32_t _4624_target_ptr_base)
{
  _checked_ptr_1<int32_t> _ptr__4614_code(_4614_code ? _4614_code->raw() : nullptr, _4614_code ? _4614_code->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__4616_ptr(_4616_ptr ? _4616_ptr->raw() : nullptr, _4616_ptr ? _4616_ptr->size(0) : 0);
  _checked_ptr_1<double> _ptr__4618_fixterm(_4618_fixterm ? _4618_fixterm->raw() : nullptr, _4618_fixterm ? _4618_fixterm->size(0) : 0);
  _checked_ptr_1<double> _ptr__4620_code_consts(_4620_code_consts ? _4620_code_consts->raw() : nullptr, _4620_code_consts ? _4620_code_consts->size(0) : 0);
  int32_t _4625_ncodeatoms = _ptr__4616_ptr[safe_add( _4617_ptr_base,_4613_n )];
  int32_t _4626_stack = _4612_xs->alloci32(safe_add( _4625_ncodeatoms,(int)2 ));
  int32_t _4627_stackp = (int)0;
  int32_t _4628_chld = _4612_xs->alloci32(safe_add( _4625_ncodeatoms,(int)2 ));
  int32_t _4629_chld_ptr = _4612_xs->alloci32(safe_add( _4625_ncodeatoms,(int)3 ));
  int32_t _4630_tcconst = _4612_xs->allocf64(safe_add( _4625_ncodeatoms,(int)2 ));
  int32_t _4631_tcode = _4612_xs->alloci32(safe_add( _4625_ncodeatoms,(int)2 ));
  int32_t _4632_tcodep = (int)0;
  int32_t _4633_error_at = (-(int)1);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4634_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4612_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__4634_xi32(_4634_xi32 ? _4634_xi32->raw() : nullptr,_4634_xi32 ? _4634_xi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4635_xf64 = mosek::fusion::p_WorkStack::_get_impl(_4612_xs)->f64;
  _checked_ptr_1<double> _ptr__4635_xf64(_4635_xf64 ? _4635_xf64->raw() : nullptr,_4635_xf64 ? _4635_xf64->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4636_target_code = _4634_xi32;
  _checked_ptr_1<int32_t> _ptr__4636_target_code(_4636_target_code ? _4636_target_code->raw() : nullptr,_4636_target_code ? _4636_target_code->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4637_target_const = _4635_xf64;
  _checked_ptr_1<double> _ptr__4637_target_const(_4637_target_const ? _4637_target_const->raw() : nullptr,_4637_target_const ? _4637_target_const->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4638_target_ptr = _4634_xi32;
  _checked_ptr_1<int32_t> _ptr__4638_target_ptr(_4638_target_ptr ? _4638_target_ptr->raw() : nullptr,_4638_target_ptr ? _4638_target_ptr->size(0) : 0);
  int32_t _4639_xpi32 = mosek::fusion::p_WorkStack::_get_impl(_4612_xs)->pi32;
  int32_t _4640_xpi64 = mosek::fusion::p_WorkStack::_get_impl(_4612_xs)->pi64;
  int32_t _4641_xpf64 = mosek::fusion::p_WorkStack::_get_impl(_4612_xs)->pf64;
  _ptr__4638_target_ptr[_4624_target_ptr_base] = (int)0;
  int32_t _4642_codei = (int)0;
  int32_t _11397_ = (int)0;
  int32_t _11398_ = _4613_n;
  for (int32_t _4643_i = _11397_; _4643_i < _11398_; ++_4643_i)
  {
    {
      int32_t _4644_e = _ptr__4616_ptr[safe_add( safe_add( _4617_ptr_base,_4643_i ),(int)1 )];
      int32_t _4645_b = _ptr__4616_ptr[safe_add( _4617_ptr_base,_4643_i )];
      if ((_4633_error_at < (int)0))
      {
        {
          _4627_stackp = (int)0;
          _4632_tcodep = (int)0;
          _ptr__4634_xi32[_4629_chld_ptr] = (int)0;
          int32_t _11399_ = (int)0;
          int32_t _11400_ = (_4644_e - _4645_b);
          for (int32_t _4646_j = _11399_; _4646_j < _11400_; ++_4646_j)
          {
            {
              _ptr__4636_target_code[safe_add( _4631_tcode,_4646_j )] = (-(int)9999);
            }
          }
          int32_t _11401_ = _4645_b;
          int32_t _11402_ = _4644_e;
          for (int32_t _4647_j = _11401_; _4647_j < _11402_; ++_4647_j)
          {
            {
              int32_t _4648_opcode = _ptr__4614_code[safe_add( _4615_code_base,_4647_j )];
              double _4649_oparg = _ptr__4620_code_consts[safe_add( _4621_code_consts_base,_4647_j )];
              if ((_4648_opcode == 0))
              {
                {
                }
              }
              else if((_4648_opcode == 2))
              {
                {
                  _ptr__4636_target_code[safe_add( _4631_tcode,_4632_tcodep )] = 2;
                  _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = _4649_oparg;
                  _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                  _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                  ++ _4627_stackp;
                  ++ _4632_tcodep;
                }
              }
              else if((_4648_opcode == 1))
              {
                {
                  _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = _4648_opcode;
                  _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = _4649_oparg;
                  _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                  _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                  ++ _4627_stackp;
                  ++ _4632_tcodep;
                }
              }
              else if((_4648_opcode == 3))
              {
                {
                  if ((_4627_stackp >= (int)2))
                  {
                    {
                      int32_t _4650_i1 = _ptr__4634_xi32[(safe_add( _4626_stack,_4627_stackp ) - (int)1)];
                      -- _4627_stackp;
                      int32_t _4651_i0 = _ptr__4634_xi32[(safe_add( _4626_stack,_4627_stackp ) - (int)1)];
                      -- _4627_stackp;
                      if (((_ptr__4634_xi32[safe_add( _4631_tcode,_4651_i0 )] == 2) && (_ptr__4634_xi32[safe_add( _4631_tcode,_4650_i1 )] == 2)))
                      {
                        {
                          _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = 2;
                          _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = (_ptr__4635_xf64[safe_add( _4630_tcconst,_4651_i0 )] + _ptr__4635_xf64[safe_add( _4630_tcconst,_4650_i1 )]);
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                      else if(((_ptr__4634_xi32[safe_add( _4631_tcode,_4651_i0 )] == 2) && ((_ptr__4635_xf64[safe_add( _4630_tcconst,_4651_i0 )] <= 0.0) && (_ptr__4635_xf64[safe_add( _4630_tcconst,_4651_i0 )] >= 0.0))))
                      {
                        {
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                          _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = 0.0;
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4650_i1;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                      else if(((_ptr__4634_xi32[safe_add( _4631_tcode,_4650_i1 )] == 2) && ((_ptr__4635_xf64[safe_add( _4630_tcconst,_4650_i1 )] <= 0.0) && (_ptr__4635_xf64[safe_add( _4630_tcconst,_4650_i1 )] >= 0.0))))
                      {
                        {
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4651_i0;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                      else
                      {
                        {
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = safe_add( _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )],(int)2 );
                          _ptr__4634_xi32[safe_add( _4628_chld,_ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )] )] = _4651_i0;
                          _ptr__4634_xi32[safe_add( safe_add( _4628_chld,_ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )] ),(int)1 )] = _4650_i1;
                          _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = _4648_opcode;
                          _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = _4649_oparg;
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                    }
                  }
                  else
                  {
                    {
                      _4633_error_at = _4647_j;
                    }
                  }
                }
              }
              else if((_4648_opcode == 5))
              {
                {
                  if ((_4627_stackp >= (int)2))
                  {
                    {
                      int32_t _4652_i1 = _ptr__4634_xi32[(safe_add( _4626_stack,_4627_stackp ) - (int)1)];
                      -- _4627_stackp;
                      int32_t _4653_i0 = _ptr__4634_xi32[(safe_add( _4626_stack,_4627_stackp ) - (int)1)];
                      -- _4627_stackp;
                      if (((_ptr__4634_xi32[safe_add( _4631_tcode,_4653_i0 )] == 2) && (_ptr__4634_xi32[safe_add( _4631_tcode,_4652_i1 )] == 2)))
                      {
                        {
                          _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = 2;
                          _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = (_ptr__4635_xf64[safe_add( _4630_tcconst,_4653_i0 )] * _ptr__4635_xf64[safe_add( _4630_tcconst,_4652_i1 )]);
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                      else if(((_ptr__4634_xi32[safe_add( _4631_tcode,_4653_i0 )] == 2) && ((_ptr__4635_xf64[safe_add( _4630_tcconst,_4653_i0 )] <= 0.0) && (_ptr__4635_xf64[safe_add( _4630_tcconst,_4653_i0 )] >= 0.0))))
                      {
                        {
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                          _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = 2;
                          _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = 0.0;
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                      else if(((_ptr__4634_xi32[safe_add( _4631_tcode,_4652_i1 )] == 2) && ((_ptr__4635_xf64[safe_add( _4630_tcconst,_4652_i1 )] <= 0.0) && (_ptr__4635_xf64[safe_add( _4630_tcconst,_4652_i1 )] >= 0.0))))
                      {
                        {
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                          _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = 2;
                          _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = 0.0;
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                      else if(((_ptr__4634_xi32[safe_add( _4631_tcode,_4652_i1 )] == 2) && ((_ptr__4635_xf64[safe_add( _4630_tcconst,_4652_i1 )] <= 1.0) && (_ptr__4635_xf64[safe_add( _4630_tcconst,_4652_i1 )] >= 1.0))))
                      {
                        {
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = safe_add( _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )],(int)1 );
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4653_i0;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                      else if(((_ptr__4634_xi32[safe_add( _4631_tcode,_4653_i0 )] == 2) && ((_ptr__4635_xf64[safe_add( _4630_tcconst,_4653_i0 )] <= 1.0) && (_ptr__4635_xf64[safe_add( _4630_tcconst,_4653_i0 )] >= 1.0))))
                      {
                        {
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = safe_add( _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )],(int)1 );
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4652_i1;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                      else
                      {
                        {
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = safe_add( _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )],(int)2 );
                          _ptr__4634_xi32[safe_add( _4628_chld,_ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )] )] = _4653_i0;
                          _ptr__4634_xi32[safe_add( safe_add( _4628_chld,_ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )] ),(int)1 )] = _4652_i1;
                          _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = 5;
                          _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = _4649_oparg;
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                    }
                  }
                  else
                  {
                    {
                      _4633_error_at = _4647_j;
                    }
                  }
                }
              }
              else if((_4648_opcode == 4))
              {
                {
                  if ((_4627_stackp >= (int)1))
                  {
                    {
                      int32_t _4654_i0 = _ptr__4634_xi32[(safe_add( _4626_stack,_4627_stackp ) - (int)1)];
                      -- _4627_stackp;
                      if ((_ptr__4634_xi32[safe_add( _4631_tcode,_4654_i0 )] == 2))
                      {
                        {
                          _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = 2;
                          _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = (-_ptr__4635_xf64[safe_add( _4630_tcconst,_4654_i0 )]);
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                      else
                      {
                        {
                          _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = _ptr__4614_code[safe_add( _4615_code_base,_4647_j )];
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = safe_add( _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )],(int)1 );
                          _ptr__4634_xi32[safe_add( _4628_chld,_ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )] )] = _4654_i0;
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                    }
                  }
                  else
                  {
                    {
                      _4633_error_at = _4647_j;
                    }
                  }
                }
              }
              else if((_4648_opcode == 6))
              {
                {
                  if ((_4627_stackp >= (int)1))
                  {
                    {
                      int32_t _4655_i0 = _ptr__4634_xi32[(safe_add( _4626_stack,_4627_stackp ) - (int)1)];
                      -- _4627_stackp;
                      if ((_ptr__4634_xi32[safe_add( _4631_tcode,_4655_i0 )] == 2))
                      {
                        {
                          _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = 2;
                          _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = (1.0 / _ptr__4635_xf64[safe_add( _4630_tcconst,_4655_i0 )]);
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                      else
                      {
                        {
                          _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = _ptr__4614_code[safe_add( _4615_code_base,_4647_j )];
                          _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = safe_add( _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )],(int)1 );
                          _ptr__4634_xi32[safe_add( _4628_chld,_ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )] )] = _4655_i0;
                          _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                          ++ _4627_stackp;
                          ++ _4632_tcodep;
                        }
                      }
                    }
                  }
                  else
                  {
                    {
                      _4633_error_at = _4647_j;
                    }
                  }
                }
              }
              else if((_4648_opcode == 8))
              {
                {
                  int32_t _4656_num = (int32_t)_4649_oparg;
                  if ((_4656_num < (int)0))
                  {
                    {
                      _4633_error_at = _4647_j;
                    }
                  }
                  else if((_4656_num > _4627_stackp))
                  {
                    {
                      _4633_error_at = _4647_j;
                    }
                  }
                  else if((_4656_num == (int)0))
                  {
                    {
                      _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = 2;
                      _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = 0.0;
                      _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                      _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                      ++ _4627_stackp;
                      ++ _4632_tcodep;
                    }
                  }
                  else if((_4656_num == (int)1))
                  {
                    {
                      _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = (int)0;
                      _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                      _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                      ++ _4627_stackp;
                      ++ _4632_tcodep;
                    }
                  }
                  else
                  {
                    {
                      std::vector<int32_t> _11403_;
                      for (int32_t _4658_j = (int)0, _11404_ = _4656_num; _4658_j < _11404_ ; ++_4658_j)
                      {
                        _11403_.push_back(_ptr__4634_xi32[((safe_add( _4626_stack,_4627_stackp ) - (int)1) - _4658_j)]);
                      }
                      auto _11405_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11403_.size()),_11403_.begin(),_11403_.end()));
                      std::shared_ptr< monty::ndarray< int32_t,1 > > _4657_ii = _11405_;
                      _checked_ptr_1<int32_t> _ptr__4657_ii(_4657_ii ? _4657_ii->raw() : nullptr,_4657_ii ? _4657_ii->size(0) : 0);
                      _4627_stackp -= _4656_num;
                      {
                        int32_t _4659_i1 = (_4656_num - (int)1);
                        int32_t _4660_i0 = (int)0;
                        while ( (_4660_i0 < _4659_i1) )
                        {
                          {
                            while ( ((_4660_i0 < _4659_i1) && (_ptr__4634_xi32[safe_add( _4631_tcode,_ptr__4657_ii[_4660_i0] )] == 2)) )
                            {
                              {
                                ++ _4660_i0;
                              }
                            }
                            while ( ((_4660_i0 < _4659_i1) && (_ptr__4634_xi32[safe_add( _4631_tcode,_ptr__4657_ii[_4659_i1] )] != 2)) )
                            {
                              {
                                -- _4659_i1;
                              }
                            }
                            if ((_4660_i0 < _4659_i1))
                            {
                              {
                                int32_t _4661_t = _ptr__4657_ii[_4660_i0];
                                _ptr__4657_ii[_4660_i0] = _ptr__4657_ii[_4659_i1];
                                _ptr__4657_ii[_4659_i1] = _4661_t;
                                ++ _4660_i0;
                                -- _4659_i1;
                              }
                            }
                            {}
                          }
                        }
                        double _4662_val = 0.0;
                        int32_t _4663_numconstelm = (int)0;
                        while ( ((_4663_numconstelm < _4656_num) && (_ptr__4634_xi32[safe_add( _4631_tcode,_ptr__4657_ii[_4663_numconstelm] )] == 2)) )
                        {
                          {
                            _4662_val += _ptr__4635_xf64[safe_add( _4630_tcconst,_ptr__4657_ii[_4663_numconstelm] )];
                            ++ _4663_numconstelm;
                          }
                        }
                        int32_t _11406_;
                        bool _11407_ = (_4663_numconstelm > (int)0);
                        if (_11407_)
                        {
                          _11406_ = safe_add( (_4656_num - _4663_numconstelm),(int)1 );
                        }
                        else
                        {
                          _11406_ = _4656_num;
                        }
                        int32_t _4664_numsumelm = _11406_;
                        int32_t _4665_p = (int)0;
                        if ((_4663_numconstelm < (int)2))
                        {
                          {
                            int32_t _11408_ = (int)0;
                            int32_t _11409_ = _4656_num;
                            for (int32_t _4666_j = _11408_; _4666_j < _11409_; ++_4666_j)
                            {
                              {
                                _ptr__4634_xi32[safe_add( safe_add( _4628_chld,_ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )] ),_4666_j )] = _ptr__4657_ii[_4666_j];
                              }
                            }
                            _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = safe_add( _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )],_4656_num );
                            _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = 8;
                            _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = _4656_num;
                            _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                            ++ _4627_stackp;
                            ++ _4632_tcodep;
                          }
                        }
                        else
                        {
                          {
                            _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = 2;
                            _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = _4662_val;
                            _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )];
                            ++ _4632_tcodep;
                            if ((_4663_numconstelm == _4656_num))
                            {
                              {
                                _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = (_4632_tcodep - (int)1);
                                ++ _4627_stackp;
                              }
                            }
                            else
                            {
                              {
                                _ptr__4634_xi32[safe_add( _4628_chld,_ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )] )] = (_4632_tcodep - (int)1);
                                int32_t _11410_ = _4663_numconstelm;
                                int32_t _11411_ = _4656_num;
                                for (int32_t _4667_j = _11410_; _4667_j < _11411_; ++_4667_j)
                                {
                                  {
                                    _ptr__4634_xi32[safe_add( (safe_add( safe_add( _4628_chld,_ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )] ),_4667_j ) - _4663_numconstelm),(int)1 )] = _ptr__4657_ii[_4667_j];
                                  }
                                }
                                _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4632_tcodep ),(int)1 )] = safe_add( _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4632_tcodep )],_4664_numsumelm );
                                _ptr__4634_xi32[safe_add( _4631_tcode,_4632_tcodep )] = 8;
                                _ptr__4635_xf64[safe_add( _4630_tcconst,_4632_tcodep )] = _4664_numsumelm;
                                _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _4632_tcodep;
                                ++ _4627_stackp;
                                ++ _4632_tcodep;
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
              else
              {
                {
                  _4633_error_at = _4647_j;
                }
              }
            }
          }
        }
      }
      {}
      if (((_4633_error_at < (int)0) && (_4627_stackp != (int)1)))
      {
        {
          _4633_error_at = _4632_tcodep;
        }
      }
      {}
      if ((_4633_error_at < (int)0))
      {
        {
          int32_t _4668_p0 = _4642_codei;
          int32_t _4669_p = _4668_p0;
          if ((_ptr__4634_xi32[safe_add( _4631_tcode,_ptr__4634_xi32[(safe_add( _4626_stack,_4627_stackp ) - (int)1)] )] == 2))
          {
            {
              _ptr__4618_fixterm[safe_add( _4619_fixterm_base,_4643_i )] += _ptr__4635_xf64[safe_add( _4630_tcconst,_ptr__4634_xi32[(safe_add( _4626_stack,_4627_stackp ) - (int)1)] )];
              _ptr__4636_target_code[safe_add( _4622_target_code_base,_4669_p )] = 10;
              _ptr__4637_target_const[safe_add( _4623_target_const_base,_4669_p )] = 0.0;
              ++ _4669_p;
            }
          }
          else
          {
            {
              if (((_ptr__4618_fixterm[safe_add( _4619_fixterm_base,_4643_i )] < (int)0) || ((int)0 < _ptr__4618_fixterm[safe_add( _4619_fixterm_base,_4643_i )])))
              {
                {
                  _ptr__4636_target_code[safe_add( _4622_target_code_base,_4669_p )] = 3;
                  ++ _4669_p;
                  _ptr__4636_target_code[safe_add( _4622_target_code_base,_4669_p )] = 2;
                  _ptr__4637_target_const[safe_add( _4623_target_const_base,_4669_p )] = _ptr__4618_fixterm[safe_add( _4619_fixterm_base,_4643_i )];
                  ++ _4669_p;
                  _ptr__4618_fixterm[safe_add( _4619_fixterm_base,_4643_i )] = (int)0;
                }
              }
              {}
              while ( (_4627_stackp > (int)0) )
              {
                {
                  int32_t _4670_k = _ptr__4634_xi32[(safe_add( _4626_stack,_4627_stackp ) - (int)1)];
                  -- _4627_stackp;
                  int32_t _4671_op = _ptr__4634_xi32[safe_add( _4631_tcode,_4670_k )];
                  double _4672_arg = _ptr__4635_xf64[safe_add( _4630_tcconst,_4670_k )];
                  _ptr__4636_target_code[safe_add( _4622_target_code_base,_4669_p )] = _4671_op;
                  _ptr__4637_target_const[safe_add( _4623_target_const_base,_4669_p )] = _4672_arg;
                  ++ _4669_p;
                  int32_t _11412_ = _ptr__4634_xi32[safe_add( _4629_chld_ptr,_4670_k )];
                  int32_t _11413_ = _ptr__4634_xi32[safe_add( safe_add( _4629_chld_ptr,_4670_k ),(int)1 )];
                  for (int32_t _4673_l = _11412_; _4673_l < _11413_; ++_4673_l)
                  {
                    {
                      _ptr__4634_xi32[safe_add( _4626_stack,_4627_stackp )] = _ptr__4634_xi32[safe_add( _4628_chld,_4673_l )];
                      ++ _4627_stackp;
                    }
                  }
                }
              }
              int32_t _4674_p1 = _4669_p;
              -- _4674_p1;
              while ( (_4668_p0 < _4674_p1) )
              {
                {
                  int32_t _4675_ta = _ptr__4636_target_code[safe_add( _4622_target_code_base,_4668_p0 )];
                  double _4676_v = _ptr__4637_target_const[safe_add( _4623_target_const_base,_4668_p0 )];
                  _ptr__4636_target_code[safe_add( _4622_target_code_base,_4668_p0 )] = _ptr__4636_target_code[safe_add( _4622_target_code_base,_4674_p1 )];
                  _ptr__4637_target_const[safe_add( _4623_target_const_base,_4668_p0 )] = _ptr__4637_target_const[safe_add( _4623_target_const_base,_4674_p1 )];
                  _ptr__4636_target_code[safe_add( _4622_target_code_base,_4674_p1 )] = _4675_ta;
                  _ptr__4637_target_const[safe_add( _4623_target_const_base,_4674_p1 )] = _4676_v;
                  ++ _4668_p0;
                  -- _4674_p1;
                }
              }
            }
          }
          _ptr__4638_target_ptr[safe_add( safe_add( _4624_target_ptr_base,_4643_i ),(int)1 )] = _4669_p;
          _4642_codei = _4669_p;
        }
      }
      {}
    }
  }
  mosek::fusion::p_WorkStack::_get_impl(_4612_xs)->pi32 = _4639_xpi32;
  mosek::fusion::p_WorkStack::_get_impl(_4612_xs)->pi64 = _4640_xpi64;
  mosek::fusion::p_WorkStack::_get_impl(_4612_xs)->pf64 = _4641_xpf64;
  if ((_4633_error_at >= (int)0))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal error: Invalid parameterization code list"));
    }
  }
  {}
}
// End mosek.fusion.ExprOptimizeCode.compress_code

// Begin mosek.fusion.ExprOptimizeCode.eval
// Method mosek.fusion.ExprOptimizeCode.eval @ bld/grindsted/final/default/src/fusion/ExprCompress.monty:471:6-705:7
void mosek::fusion::ExprOptimizeCode :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4677_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4678_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4679_xs,bool _4680_cache_eval) { mosek::fusion::p_ExprOptimizeCode::_get_impl(this)->eval(_4677_rs,_4678_ws,_4679_xs,_4680_cache_eval); }
void mosek::fusion::p_ExprOptimizeCode::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4677_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4678_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4679_xs,bool _4680_cache_eval)
{
  expr->recursive_eval(_4678_ws,_4677_rs,_4679_xs,_4680_cache_eval);
  _4678_ws->peek_expr();
  _4678_ws->pop_expr();
  int32_t _4681_nd = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->nd;
  int32_t _4682_shape = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->shape_base;
  int32_t _4683_nelem = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->nelem;
  int32_t _4684_nnz = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->nnz;
  bool _4685_hassp = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->hassp;
  int32_t _4686_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->ncodeatom;
  int32_t _4687_ptr = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->ptr_base;
  int32_t _4688_sp = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->sp_base;
  int32_t _4689_nidxs = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->nidxs_base;
  int32_t _4690_cof = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->cof_base;
  int32_t _4691_code = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->code_base;
  int32_t _4692_codeptr = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->codeptr_base;
  int32_t _4693_cconst = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4694_wi32 = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__4694_wi32(_4694_wi32 ? _4694_wi32->raw() : nullptr,_4694_wi32 ? _4694_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4695_wi64 = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__4695_wi64(_4695_wi64 ? _4695_wi64->raw() : nullptr,_4695_wi64 ? _4695_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4696_wf64 = mosek::fusion::p_WorkStack::_get_impl(_4678_ws)->f64;
  _checked_ptr_1<double> _ptr__4696_wf64(_4696_wf64 ? _4696_wf64->raw() : nullptr,_4696_wf64 ? _4696_wf64->size(0) : 0);
  if ((_4686_ncodeatom == (int)0))
  {
    {
      _4677_rs->alloc_expr(_4681_nd,_4683_nelem,_4684_nnz,_4685_hassp,(int)0);
      int32_t _4697_rptr = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->ptr_base;
      int32_t _4698_rsp = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->sp_base;
      int32_t _4699_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->nidxs_base;
      int32_t _4700_rcof = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->cof_base;
      int32_t _4701_rshape = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->shape_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4702_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__4702_ri32(_4702_ri32 ? _4702_ri32->raw() : nullptr,_4702_ri32 ? _4702_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4703_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__4703_ri64(_4703_ri64 ? _4703_ri64->raw() : nullptr,_4703_ri64 ? _4703_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _4704_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->f64;
      _checked_ptr_1<double> _ptr__4704_rf64(_4704_rf64 ? _4704_rf64->raw() : nullptr,_4704_rf64 ? _4704_rf64->size(0) : 0);
      int32_t _11414_ = (int)0;
      int32_t _11415_ = safe_add( _4683_nelem,(int)1 );
      for (int32_t _4705_i = _11414_; _4705_i < _11415_; ++_4705_i)
      {
        {
          _ptr__4702_ri32[safe_add( _4697_rptr,_4705_i )] = _ptr__4694_wi32[safe_add( _4687_ptr,_4705_i )];
        }
      }
      int32_t _11416_ = (int)0;
      int32_t _11417_ = _4681_nd;
      for (int32_t _4706_i = _11416_; _4706_i < _11417_; ++_4706_i)
      {
        {
          _ptr__4702_ri32[safe_add( _4701_rshape,_4706_i )] = _ptr__4694_wi32[safe_add( _4682_shape,_4706_i )];
        }
      }
      int32_t _11418_ = (int)0;
      int32_t _11419_ = _4684_nnz;
      for (int32_t _4707_i = _11418_; _4707_i < _11419_; ++_4707_i)
      {
        {
          _ptr__4703_ri64[safe_add( _4699_rnidxs,_4707_i )] = _ptr__4695_wi64[safe_add( _4689_nidxs,_4707_i )];
        }
      }
      int32_t _11420_ = (int)0;
      int32_t _11421_ = _4684_nnz;
      for (int32_t _4708_i = _11420_; _4708_i < _11421_; ++_4708_i)
      {
        {
          _ptr__4704_rf64[safe_add( _4700_rcof,_4708_i )] = _ptr__4696_wf64[safe_add( _4690_cof,_4708_i )];
        }
      }
      if (_4685_hassp)
      {
        {
          int32_t _11422_ = (int)0;
          int32_t _11423_ = _4683_nelem;
          for (int32_t _4709_i = _11422_; _4709_i < _11423_; ++_4709_i)
          {
            {
              _ptr__4703_ri64[safe_add( _4698_rsp,_4709_i )] = _ptr__4695_wi64[safe_add( _4688_sp,_4709_i )];
            }
          }
        }
      }
      {}
    }
  }
  else
  {
    {
      int32_t _4710_xcode = _4679_xs->alloci32(safe_add( _4686_ncodeatom,safe_mul( _4684_nnz,(int)2 ) ));
      int32_t _4711_xcodeptr = _4679_xs->alloci32(safe_add( _4684_nnz,(int)1 ));
      int32_t _4712_xcconst = _4679_xs->allocf64(safe_add( _4686_ncodeatom,safe_mul( _4684_nnz,(int)2 ) ));
      ::mosek::fusion::p_ExprOptimizeCode::compress_code(_4679_xs,_4684_nnz,_4694_wi32,_4691_code,_4694_wi32,_4692_codeptr,_4696_wf64,_4690_cof,_4696_wf64,_4693_cconst,_4710_xcode,_4712_xcconst,_4711_xcodeptr);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4713_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4679_xs)->i32;
      _checked_ptr_1<int32_t> _ptr__4713_xi32(_4713_xi32 ? _4713_xi32->raw() : nullptr,_4713_xi32 ? _4713_xi32->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _4714_xf64 = mosek::fusion::p_WorkStack::_get_impl(_4679_xs)->f64;
      _checked_ptr_1<double> _ptr__4714_xf64(_4714_xf64 ? _4714_xf64->raw() : nullptr,_4714_xf64 ? _4714_xf64->size(0) : 0);
      int32_t _4715_rncodeatom = (int)0;
      int32_t _4716_rnnz = (int)0;
      int32_t _4717_rnelem = (int)0;
      int32_t _11424_ = (int)0;
      int32_t _11425_ = _4683_nelem;
      for (int32_t _4718_i = _11424_; _4718_i < _11425_; ++_4718_i)
      {
        {
          int32_t _4719_elmnz = (int)0;
          int32_t _11426_ = _ptr__4694_wi32[safe_add( _4687_ptr,_4718_i )];
          int32_t _11427_ = _ptr__4694_wi32[safe_add( safe_add( _4687_ptr,_4718_i ),(int)1 )];
          for (int32_t _4720_j = _11426_; _4720_j < _11427_; ++_4720_j)
          {
            {
              if (((_ptr__4696_wf64[safe_add( _4690_cof,_4720_j )] < (int)0) || ((int)0 < _ptr__4696_wf64[safe_add( _4690_cof,_4720_j )])))
              {
                {
                  ++ _4716_rnnz;
                  ++ _4719_elmnz;
                  ++ _4715_rncodeatom;
                }
              }
              else
              {
                {
                  if (((_ptr__4713_xi32[safe_add( safe_add( _4711_xcodeptr,_4720_j ),(int)1 )] - _ptr__4713_xi32[safe_add( _4711_xcodeptr,_4720_j )]) > (int)1))
                  {
                    {
                      ++ _4716_rnnz;
                      ++ _4719_elmnz;
                      _4715_rncodeatom += (_ptr__4713_xi32[safe_add( safe_add( _4711_xcodeptr,_4720_j ),(int)1 )] - _ptr__4713_xi32[safe_add( _4711_xcodeptr,_4720_j )]);
                    }
                  }
                  else
                  {
                    {
                      if ((_ptr__4713_xi32[safe_add( _4710_xcode,_ptr__4713_xi32[safe_add( _4711_xcodeptr,_4720_j )] )] != 10))
                      {
                        {
                          ++ _4716_rnnz;
                          ++ _4719_elmnz;
                          ++ _4715_rncodeatom;
                        }
                      }
                      {}
                    }
                  }
                }
              }
            }
          }
          if ((_4719_elmnz > (int)0))
          {
            {
              ++ _4717_rnelem;
            }
          }
          {}
        }
      }
      bool _4721_rhassp = false;
      {
        int64_t _4722_sz = (int64_t)1;
        int32_t _11428_ = (int)0;
        int32_t _11429_ = _4681_nd;
        for (int32_t _4723_i = _11428_; _4723_i < _11429_; ++_4723_i)
        {
          {
            _4722_sz *= _ptr__4694_wi32[safe_add( _4682_shape,_4723_i )];
          }
        }
        _4721_rhassp = (_4722_sz > _4717_rnelem);
      }
      _4677_rs->alloc_expr(_4681_nd,_4717_rnelem,_4716_rnnz,_4721_rhassp,_4715_rncodeatom);
      int32_t _4724_rptr = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->ptr_base;
      int32_t _4725_rsp = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->sp_base;
      int32_t _4726_rshape = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->shape_base;
      int32_t _4727_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->nidxs_base;
      int32_t _4728_rcof = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->cof_base;
      int32_t _4729_rcode = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->code_base;
      int32_t _4730_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->codeptr_base;
      int32_t _4731_rcconst = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4732_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__4732_ri32(_4732_ri32 ? _4732_ri32->raw() : nullptr,_4732_ri32 ? _4732_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4733_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__4733_ri64(_4733_ri64 ? _4733_ri64->raw() : nullptr,_4733_ri64 ? _4733_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _4734_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4677_rs)->f64;
      _checked_ptr_1<double> _ptr__4734_rf64(_4734_rf64 ? _4734_rf64->raw() : nullptr,_4734_rf64 ? _4734_rf64->size(0) : 0);
      int32_t _11430_ = (int)0;
      int32_t _11431_ = _4681_nd;
      for (int32_t _4735_i = _11430_; _4735_i < _11431_; ++_4735_i)
      {
        {
          _ptr__4732_ri32[safe_add( _4726_rshape,_4735_i )] = _ptr__4694_wi32[safe_add( _4682_shape,_4735_i )];
        }
      }
      if ((_4686_ncodeatom == (int)0))
      {
        {
          int32_t _11432_ = (int)0;
          int32_t _11433_ = _4684_nnz;
          for (int32_t _4736_i = _11432_; _4736_i < _11433_; ++_4736_i)
          {
            {
              _ptr__4733_ri64[safe_add( _4727_rnidxs,_4736_i )] = _ptr__4695_wi64[safe_add( _4689_nidxs,_4736_i )];
            }
          }
          int32_t _11434_ = (int)0;
          int32_t _11435_ = _4684_nnz;
          for (int32_t _4737_i = _11434_; _4737_i < _11435_; ++_4737_i)
          {
            {
              _ptr__4734_rf64[safe_add( _4728_rcof,_4737_i )] = _ptr__4696_wf64[safe_add( _4690_cof,_4737_i )];
            }
          }
          int32_t _11436_ = (int)0;
          int32_t _11437_ = safe_add( _4683_nelem,(int)1 );
          for (int32_t _4738_i = _11436_; _4738_i < _11437_; ++_4738_i)
          {
            {
              _ptr__4732_ri32[safe_add( _4724_rptr,_4738_i )] = _ptr__4732_ri32[safe_add( _4687_ptr,_4738_i )];
            }
          }
          if (_4685_hassp)
          {
            {
              int32_t _11438_ = (int)0;
              int32_t _11439_ = _4683_nelem;
              for (int32_t _4739_i = _11438_; _4739_i < _11439_; ++_4739_i)
              {
                {
                  _ptr__4733_ri64[safe_add( _4725_rsp,_4739_i )] = _ptr__4733_ri64[safe_add( _4688_sp,_4739_i )];
                }
              }
            }
          }
          {}
        }
      }
      else
      {
        {
          int32_t _4740_codei = (int)0;
          int32_t _4741_elmi = (int)0;
          int32_t _4742_nzi = (int)0;
          _ptr__4732_ri32[_4724_rptr] = (int)0;
          if ((_4715_rncodeatom > (int)0))
          {
            {
              _ptr__4732_ri32[_4730_rcodeptr] = (int)0;
            }
          }
          {}
          int32_t _11440_ = (int)0;
          int32_t _11441_ = _4683_nelem;
          for (int32_t _4743_i = _11440_; _4743_i < _11441_; ++_4743_i)
          {
            {
              int32_t _4744_elmnz = (int)0;
              int32_t _11442_ = _ptr__4694_wi32[safe_add( _4687_ptr,_4743_i )];
              int32_t _11443_ = _ptr__4694_wi32[safe_add( safe_add( _4687_ptr,_4743_i ),(int)1 )];
              for (int32_t _4745_j = _11442_; _4745_j < _11443_; ++_4745_j)
              {
                {
                  if (((_ptr__4696_wf64[safe_add( _4690_cof,_4745_j )] < (int)0) || ((int)0 < _ptr__4696_wf64[safe_add( _4690_cof,_4745_j )])))
                  {
                    {
                      _ptr__4733_ri64[safe_add( _4727_rnidxs,_4742_nzi )] = _ptr__4695_wi64[safe_add( _4689_nidxs,_4745_j )];
                      _ptr__4734_rf64[safe_add( _4728_rcof,_4742_nzi )] = _ptr__4696_wf64[safe_add( _4690_cof,_4745_j )];
                      _ptr__4732_ri32[safe_add( _4729_rcode,_4740_codei )] = _ptr__4713_xi32[safe_add( _4710_xcode,_ptr__4713_xi32[safe_add( _4711_xcodeptr,_4745_j )] )];
                      _ptr__4734_rf64[safe_add( _4731_rcconst,_4740_codei )] = _ptr__4714_xf64[safe_add( _4712_xcconst,_ptr__4713_xi32[safe_add( _4711_xcodeptr,_4745_j )] )];
                      ++ _4740_codei;
                      _ptr__4732_ri32[safe_add( safe_add( _4730_rcodeptr,_4742_nzi ),(int)1 )] = _4740_codei;
                      ++ _4742_nzi;
                      ++ _4744_elmnz;
                    }
                  }
                  else
                  {
                    {
                      if ((((_ptr__4713_xi32[safe_add( safe_add( _4711_xcodeptr,_4745_j ),(int)1 )] - _ptr__4713_xi32[safe_add( _4711_xcodeptr,_4745_j )]) > (int)1) || (_ptr__4713_xi32[safe_add( _4710_xcode,_ptr__4713_xi32[safe_add( _4711_xcodeptr,_4745_j )] )] != 10)))
                      {
                        {
                          _ptr__4733_ri64[safe_add( _4727_rnidxs,_4742_nzi )] = _ptr__4695_wi64[safe_add( _4689_nidxs,_4745_j )];
                          _ptr__4734_rf64[safe_add( _4728_rcof,_4742_nzi )] = 0.0;
                          int32_t _11444_ = _ptr__4713_xi32[safe_add( _4711_xcodeptr,_4745_j )];
                          int32_t _11445_ = _ptr__4713_xi32[safe_add( safe_add( _4711_xcodeptr,_4745_j ),(int)1 )];
                          for (int32_t _4746_k = _11444_; _4746_k < _11445_; ++_4746_k)
                          {
                            {
                              _ptr__4732_ri32[safe_add( _4729_rcode,_4740_codei )] = _ptr__4713_xi32[safe_add( _4710_xcode,_4746_k )];
                              _ptr__4734_rf64[safe_add( _4731_rcconst,_4740_codei )] = _ptr__4714_xf64[safe_add( _4712_xcconst,_4746_k )];
                              ++ _4740_codei;
                            }
                          }
                          _ptr__4732_ri32[safe_add( safe_add( _4730_rcodeptr,_4742_nzi ),(int)1 )] = _4740_codei;
                          ++ _4742_nzi;
                          ++ _4744_elmnz;
                        }
                      }
                      {}
                    }
                  }
                }
              }
              if ((_4744_elmnz > (int)0))
              {
                {
                  _ptr__4732_ri32[safe_add( safe_add( _4724_rptr,_4741_elmi ),(int)1 )] = _4742_nzi;
                  if (_4721_rhassp)
                  {
                    {
                      if (_4685_hassp)
                      {
                        {
                          _ptr__4733_ri64[safe_add( _4725_rsp,_4741_elmi )] = _ptr__4695_wi64[safe_add( _4688_sp,_4743_i )];
                        }
                      }
                      else
                      {
                        {
                          _ptr__4733_ri64[safe_add( _4725_rsp,_4741_elmi )] = _4743_i;
                        }
                      }
                    }
                  }
                  {}
                  ++ _4741_elmi;
                }
              }
              {}
            }
          }
          if ((_4741_elmi != _4717_rnelem))
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Incorrect result nelem"));
            }
          }
          {}
          if ((_4742_nzi != _4716_rnnz))
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Incorrect result nnz"));
            }
          }
          {}
          if ((_4740_codei != _4715_rncodeatom))
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Incorrect result num code atoms"));
            }
          }
          {}
          if ((_4715_rncodeatom > (int)0))
          {
            {
              if ((_ptr__4732_ri32[safe_add( _4730_rcodeptr,_4716_rnnz )] != _4715_rncodeatom))
              {
                {
                  throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Incorrect codeptr"));
                }
              }
              {}
            }
          }
          {}
        }
      }
    }
  }
}
// End mosek.fusion.ExprOptimizeCode.eval

// Begin mosek.fusion.ExprOptimizeCode.toString
// Method mosek.fusion.ExprOptimizeCode.toString @ bld/grindsted/final/default/src/fusion/ExprCompress.monty:467:6-469:7
std::string mosek::fusion::ExprOptimizeCode :: toString() { return mosek::fusion::p_ExprOptimizeCode::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprOptimizeCode::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprOptimizeCode("))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprOptimizeCode.toString

void mosek::fusion::p_ExprOptimizeCode::destroy()
{
  expr.reset();
}
void mosek::fusion::ExprOptimizeCode::destroy() { mosek::fusion::p_ExprOptimizeCode::_get_impl(this)->destroy(); }
// } class ExprOptimizeCode
// class ExprCompress { // @ bld/grindsted/final/default/src/fusion/ExprCompress.monty:11:4-449:5
mosek::fusion::ExprCompress::ExprCompress(mosek::fusion::p_ExprCompress *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprCompress()" << this << std::endl; */ }
mosek::fusion::ExprCompress::~ExprCompress() {  /* std::cout << "~ExprCompress()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprCompress::p_ExprCompress
  (::mosek::fusion::ExprCompress * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprCompress.ctor @ bld/grindsted/final/default/src/fusion/ExprCompress.monty:16:6-19:7
mosek::fusion::ExprCompress::t mosek::fusion::p_ExprCompress::_new_ExprCompress
  (monty::rc_ptr< ::mosek::fusion::Expression > _4747_expr)
{ return new mosek::fusion::ExprCompress(_4747_expr); }
mosek::fusion::ExprCompress::ExprCompress
  (monty::rc_ptr< ::mosek::fusion::Expression > _4747_expr) : 
   ExprCompress(new mosek::fusion::p_ExprCompress(this))
{ mosek::fusion::p_ExprCompress::_get_impl(this)->_initialize(_4747_expr); }
void mosek::fusion::p_ExprCompress::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _4747_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_4747_expr->__mosek_2fusion_2Expression__getModel(),_4747_expr->getShape());
    mosek::fusion::p_ExprCompress::_get_impl(::mosek::fusion::ExprCompress::t(_pubthis))->expr = _4747_expr;
  }
}
// mosek.fusion.ExprCompress.ctor

// Begin mosek.fusion.ExprCompress.arg_sort
// Method mosek.fusion.ExprCompress.arg_sort @ bld/grindsted/final/default/src/fusion/ExprCompress.monty:316:6-448:7
void mosek::fusion::ExprCompress::arg_sort
  ( monty::rc_ptr< ::mosek::fusion::WorkStack > _4748_ws,
    monty::rc_ptr< ::mosek::fusion::WorkStack > _4749_xs,
    int32_t _4750_perm,
    int32_t _4751_nelem,
    int32_t _4752_nnz,
    int32_t _4753_ptr,
    int32_t _4754_nidxs) { mosek::fusion::p_ExprCompress::arg_sort(_4748_ws,_4749_xs,_4750_perm,_4751_nelem,_4752_nnz,_4753_ptr,_4754_nidxs); }
void mosek::fusion::p_ExprCompress::arg_sort(monty::rc_ptr< ::mosek::fusion::WorkStack > _4748_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4749_xs,int32_t _4750_perm,int32_t _4751_nelem,int32_t _4752_nnz,int32_t _4753_ptr,int32_t _4754_nidxs)
{
  int32_t _4755_maxrow = (int)0;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4756_wi32 = mosek::fusion::p_WorkStack::_get_impl(_4748_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__4756_wi32(_4756_wi32 ? _4756_wi32->raw() : nullptr,_4756_wi32 ? _4756_wi32->size(0) : 0);
  int32_t _11446_ = (int)0;
  int32_t _11447_ = _4751_nelem;
  for (int32_t _4757_i = _11446_; _4757_i < _11447_; ++_4757_i)
  {
    {
      if (((_ptr__4756_wi32[safe_add( safe_add( _4753_ptr,_4757_i ),(int)1 )] - _ptr__4756_wi32[safe_add( _4753_ptr,_4757_i )]) > _4755_maxrow))
      {
        {
          _4755_maxrow = (_ptr__4756_wi32[safe_add( safe_add( _4753_ptr,_4757_i ),(int)1 )] - _ptr__4756_wi32[safe_add( _4753_ptr,_4757_i )]);
        }
      }
      {}
    }
  }
  int32_t _11448_;
  bool _11449_ = (_4755_maxrow > (int)2);
  if (_11449_)
  {
    _11448_ = _4749_xs->alloci32(safe_mul( _4755_maxrow,(int)2 ));
  }
  else
  {
    _11448_ = (int)99999;
  }
  int32_t _4758_workspace = _11448_;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4759_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4749_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__4759_xi32(_4759_xi32 ? _4759_xi32->raw() : nullptr,_4759_xi32 ? _4759_xi32->size(0) : 0);
  _4756_wi32 = mosek::fusion::p_WorkStack::_get_impl(_4748_ws)->i32;
  _ptr__4756_wi32.update(_4756_wi32 ? _4756_wi32->raw() : nullptr, _4756_wi32 ? _4756_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4760_wi64 = mosek::fusion::p_WorkStack::_get_impl(_4748_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__4760_wi64(_4760_wi64 ? _4760_wi64->raw() : nullptr,_4760_wi64 ? _4760_wi64->size(0) : 0);
  int32_t _11450_ = (int)0;
  int32_t _11451_ = _4751_nelem;
  for (int32_t _4761_i = _11450_; _4761_i < _11451_; ++_4761_i)
  {
    {
      int32_t _4762_p0 = _ptr__4756_wi32[safe_add( _4753_ptr,_4761_i )];
      int32_t _4763_p1 = _ptr__4756_wi32[safe_add( safe_add( _4753_ptr,_4761_i ),(int)1 )];
      int32_t _4764_n = (_4763_p1 - _4762_p0);
      if ((_4764_n == (int)0))
      {
        {
        }
      }
      else if((_4764_n == (int)1))
      {
        {
          _ptr__4759_xi32[safe_add( _4750_perm,_4762_p0 )] = _4762_p0;
        }
      }
      else if((_4764_n == (int)2))
      {
        {
          if ((_ptr__4760_wi64[safe_add( _4754_nidxs,_4762_p0 )] <= _ptr__4760_wi64[safe_add( safe_add( _4754_nidxs,_4762_p0 ),(int)1 )]))
          {
            {
              _ptr__4759_xi32[safe_add( _4750_perm,_4762_p0 )] = _4762_p0;
              _ptr__4759_xi32[safe_add( safe_add( _4750_perm,_4762_p0 ),(int)1 )] = safe_add( _4762_p0,(int)1 );
            }
          }
          else
          {
            {
              _ptr__4759_xi32[safe_add( _4750_perm,_4762_p0 )] = safe_add( _4762_p0,(int)1 );
              _ptr__4759_xi32[safe_add( safe_add( _4750_perm,_4762_p0 ),(int)1 )] = _4762_p0;
            }
          }
        }
      }
      else
      {
        {
          int64_t _4765_vmin = _ptr__4760_wi64[safe_add( _4754_nidxs,_4762_p0 )];
          int64_t _4766_vmax = _ptr__4760_wi64[safe_add( _4754_nidxs,_4762_p0 )];
          bool _4767_sorted = false;
          int32_t _11452_ = safe_add( _4762_p0,(int)1 );
          int32_t _11453_ = _4763_p1;
          for (int32_t _4768_i = _11452_; _4768_i < _11453_; ++_4768_i)
          {
            {
              _4767_sorted = (_4767_sorted && (_ptr__4760_wi64[(safe_add( _4754_nidxs,_4768_i ) - (int)1)] <= _ptr__4760_wi64[safe_add( _4754_nidxs,_4768_i )]));
              if ((_4765_vmin > _ptr__4760_wi64[safe_add( _4754_nidxs,_4768_i )]))
              {
                {
                  _4765_vmin = _ptr__4760_wi64[safe_add( _4754_nidxs,_4768_i )];
                }
              }
              {}
              if ((_4766_vmax < _ptr__4760_wi64[safe_add( _4754_nidxs,_4768_i )]))
              {
                {
                  _4766_vmax = _ptr__4760_wi64[safe_add( _4754_nidxs,_4768_i )];
                }
              }
              {}
            }
          }
          if (_4767_sorted)
          {
            {
              int32_t _11454_ = _4762_p0;
              int32_t _11455_ = _4763_p1;
              for (int32_t _4769_i = _11454_; _4769_i < _11455_; ++_4769_i)
              {
                {
                  _ptr__4759_xi32[safe_add( _4750_perm,_4769_i )] = _4769_i;
                }
              }
            }
          }
          else if((safe_add( (_4766_vmax - _4765_vmin),(int)1 ) <= _4764_n))
          {
            {
              int64_t _4770_m = safe_add( (_4766_vmax - _4765_vmin),(int)1 );
              int32_t _11456_ = (int)0;
              int64_t _11457_ = safe_add( _4770_m,(int)1 );
              for (int64_t _4771_j = _11456_; _4771_j < _11457_; ++_4771_j)
              {
                {
                  _ptr__4759_xi32[safe_add( _4758_workspace,_4771_j )] = (int)0;
                }
              }
              int32_t _11458_ = _4762_p0;
              int32_t _11459_ = _4763_p1;
              for (int32_t _4772_j = _11458_; _4772_j < _11459_; ++_4772_j)
              {
                {
                  ++ _ptr__4759_xi32[safe_add( (safe_add( _4758_workspace,_ptr__4760_wi64[safe_add( _4754_nidxs,_4772_j )] ) - _4765_vmin),(int)1 )];
                }
              }
              int32_t _11460_ = (int)0;
              int64_t _11461_ = _4770_m;
              for (int64_t _4773_j = _11460_; _4773_j < _11461_; ++_4773_j)
              {
                {
                  _ptr__4759_xi32[safe_add( safe_add( _4758_workspace,_4773_j ),(int)1 )] += _ptr__4759_xi32[safe_add( _4758_workspace,_4773_j )];
                }
              }
              int32_t _11462_ = _4762_p0;
              int32_t _11463_ = _4763_p1;
              for (int32_t _4774_j = _11462_; _4774_j < _11463_; ++_4774_j)
              {
                {
                  _ptr__4759_xi32[safe_add( safe_add( _4750_perm,_4762_p0 ),_ptr__4759_xi32[(safe_add( _4758_workspace,_ptr__4760_wi64[safe_add( _4754_nidxs,_4774_j )] ) - _4765_vmin)] )] = _4774_j;
                  ++ _ptr__4759_xi32[(safe_add( _4758_workspace,_ptr__4760_wi64[safe_add( _4754_nidxs,_4774_j )] ) - _4765_vmin)];
                }
              }
            }
          }
          else
          {
            {
              int32_t _4775_blocksize = (int)1;
              int32_t _4776_perm1 = _4758_workspace;
              int32_t _4777_perm2 = safe_add( _4758_workspace,_4764_n );
              int32_t _11464_ = (int)0;
              int32_t _11465_ = _4764_n;
              for (int32_t _4778_j = _11464_; _4778_j < _11465_; ++_4778_j)
              {
                {
                  _ptr__4759_xi32[safe_add( _4776_perm1,_4778_j )] = _4778_j;
                }
              }
              while ( (_4775_blocksize < _4764_n) )
              {
                {
                  int32_t _4779_mergesize = safe_mul( _4775_blocksize,(int)2 );
                  int32_t _4780_nummerges = (_4764_n / _4779_mergesize);
                  if ((safe_add( safe_mul( _4780_nummerges,_4779_mergesize ),_4775_blocksize ) < _4764_n))
                  {
                    {
                      ++ _4780_nummerges;
                    }
                  }
                  {}
                  int32_t _4781_k = (int)0;
                  int32_t _11466_ = (int)0;
                  int32_t _11467_ = _4780_nummerges;
                  for (int32_t _4782_j = _11466_; _4782_j < _11467_; ++_4782_j)
                  {
                    {
                      int32_t _4783_a0 = safe_mul( _4782_j,_4779_mergesize );
                      int32_t _4784_a1 = safe_add( _4783_a0,_4775_blocksize );
                      int32_t _4785_b0 = _4784_a1;
                      int32_t _4786_b1 = safe_add( _4785_b0,_4775_blocksize );
                      if ((_4786_b1 > _4764_n))
                      {
                        {
                          _4786_b1 = _4764_n;
                        }
                      }
                      {}
                      while ( ((_4783_a0 < _4784_a1) && (_4785_b0 < _4786_b1)) )
                      {
                        {
                          if ((_ptr__4760_wi64[safe_add( safe_add( _4754_nidxs,_ptr__4759_xi32[safe_add( _4776_perm1,_4783_a0 )] ),_4762_p0 )] <= _ptr__4760_wi64[safe_add( safe_add( _4754_nidxs,_ptr__4759_xi32[safe_add( _4776_perm1,_4785_b0 )] ),_4762_p0 )]))
                          {
                            {
                              _ptr__4759_xi32[safe_add( _4777_perm2,_4781_k )] = _ptr__4759_xi32[safe_add( _4776_perm1,_4783_a0 )];
                              ++ _4781_k;
                              ++ _4783_a0;
                            }
                          }
                          else
                          {
                            {
                              _ptr__4759_xi32[safe_add( _4777_perm2,_4781_k )] = _ptr__4759_xi32[safe_add( _4776_perm1,_4785_b0 )];
                              ++ _4781_k;
                              ++ _4785_b0;
                            }
                          }
                        }
                      }
                      while ( (_4783_a0 < _4784_a1) )
                      {
                        {
                          _ptr__4759_xi32[safe_add( _4777_perm2,_4781_k )] = _ptr__4759_xi32[safe_add( _4776_perm1,_4783_a0 )];
                          ++ _4781_k;
                          ++ _4783_a0;
                        }
                      }
                      while ( (_4785_b0 < _4786_b1) )
                      {
                        {
                          _ptr__4759_xi32[safe_add( _4777_perm2,_4781_k )] = _ptr__4759_xi32[safe_add( _4776_perm1,_4785_b0 )];
                          ++ _4781_k;
                          ++ _4785_b0;
                        }
                      }
                    }
                  }
                  if ((safe_mul( _4780_nummerges,_4779_mergesize ) < _4764_n))
                  {
                    {
                      int32_t _4787_b = safe_mul( _4780_nummerges,_4779_mergesize );
                      while ( (_4787_b < _4764_n) )
                      {
                        {
                          _ptr__4759_xi32[safe_add( _4777_perm2,_4781_k )] = _ptr__4759_xi32[safe_add( _4776_perm1,_4787_b )];
                          ++ _4787_b;
                          ++ _4781_k;
                        }
                      }
                    }
                  }
                  {}
                  int32_t _4788_tmp = _4776_perm1;
                  _4776_perm1 = _4777_perm2;
                  _4777_perm2 = _4788_tmp;
                  _4775_blocksize *= (int)2;
                }
              }
              int32_t _11468_ = (int)0;
              int32_t _11469_ = _4764_n;
              for (int32_t _4789_i = _11468_; _4789_i < _11469_; ++_4789_i)
              {
                {
                  _ptr__4759_xi32[safe_add( safe_add( _4750_perm,_4762_p0 ),_4789_i )] = safe_add( _ptr__4759_xi32[safe_add( _4776_perm1,_4789_i )],_4762_p0 );
                }
              }
            }
          }
        }
      }
    }
  }
}
// End mosek.fusion.ExprCompress.arg_sort

// Begin mosek.fusion.ExprCompress.merge_sort
// Method mosek.fusion.ExprCompress.merge_sort @ bld/grindsted/final/default/src/fusion/ExprCompress.monty:255:6-314:7
void mosek::fusion::ExprCompress::merge_sort
  ( int32_t _4790_origperm1,
    int32_t _4791_origperm2,
    int32_t _4792_nelem,
    int32_t _4793_nnz,
    int32_t _4794_ptr_base,
    int32_t _4795_nidxs_base,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _4796_wi32,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4797_wi64) { mosek::fusion::p_ExprCompress::merge_sort(_4790_origperm1,_4791_origperm2,_4792_nelem,_4793_nnz,_4794_ptr_base,_4795_nidxs_base,_4796_wi32,_4797_wi64); }
void mosek::fusion::p_ExprCompress::merge_sort(int32_t _4790_origperm1,int32_t _4791_origperm2,int32_t _4792_nelem,int32_t _4793_nnz,int32_t _4794_ptr_base,int32_t _4795_nidxs_base,std::shared_ptr< monty::ndarray< int32_t,1 > > _4796_wi32,std::shared_ptr< monty::ndarray< int64_t,1 > > _4797_wi64)
{
  _checked_ptr_1<int32_t> _ptr__4796_wi32(_4796_wi32 ? _4796_wi32->raw() : nullptr, _4796_wi32 ? _4796_wi32->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__4797_wi64(_4797_wi64 ? _4797_wi64->raw() : nullptr, _4797_wi64 ? _4797_wi64->size(0) : 0);
  int32_t _4798_perm1 = _4790_origperm1;
  int32_t _4799_perm2 = _4791_origperm2;
  int32_t _11470_ = (int)0;
  int32_t _11471_ = _4793_nnz;
  for (int32_t _4800_j = _11470_; _4800_j < _11471_; ++_4800_j)
  {
    {
      _ptr__4796_wi32[safe_add( _4798_perm1,_4800_j )] = _4800_j;
    }
  }
  int32_t _11472_ = (int)0;
  int32_t _11473_ = _4792_nelem;
  for (int32_t _4801_i = _11472_; _4801_i < _11473_; ++_4801_i)
  {
    {
      _4798_perm1 = _4790_origperm1;
      _4799_perm2 = _4791_origperm2;
      int32_t _4802_p1 = _ptr__4796_wi32[safe_add( safe_add( _4794_ptr_base,_4801_i ),(int)1 )];
      int32_t _4803_p0 = _ptr__4796_wi32[safe_add( _4794_ptr_base,_4801_i )];
      if ((safe_add( _4803_p0,(int)1 ) < _4802_p1))
      {
        {
          int32_t _4804_n = (_4802_p1 - _4803_p0);
          int32_t _4805_lg2n = (int)0;
          while ( (_4804_n > (int)1) )
          {
            {
              ++ _4805_lg2n;
              _4804_n /= (int)2;
            }
          }
          _4804_n = (_4802_p1 - _4803_p0);
          int32_t _4806_blocksz = (int)1;
          int32_t _11474_ = (int)0;
          int32_t _11475_ = safe_add( _4805_lg2n,(int)1 );
          for (int32_t _4807_k = _11474_; _4807_k < _11475_; ++_4807_k)
          {
            {
              int32_t _4808_numblocks = ((safe_add( _4804_n,_4806_blocksz ) - (int)1) / _4806_blocksz);
              int32_t _4809_nmerge = (_4808_numblocks / (int)2);
              int32_t _4810_kk = _4803_p0;
              int32_t _11476_ = (int)0;
              int32_t _11477_ = _4809_nmerge;
              for (int32_t _4811_ii_ = _11476_; _4811_ii_ < _11477_; ++_4811_ii_)
              {
                {
                  int32_t _4812_ii = safe_mul( safe_mul( _4811_ii_,_4806_blocksz ),(int)2 );
                  int32_t _11478_;
                  bool _11479_ = (safe_add( safe_add( _4803_p0,_4812_ii ),safe_mul( (int)2,_4806_blocksz ) ) < _4802_p1);
                  if (_11479_)
                  {
                    _11478_ = safe_add( safe_add( _4803_p0,_4812_ii ),safe_mul( (int)2,_4806_blocksz ) );
                  }
                  else
                  {
                    _11478_ = _4802_p1;
                  }
                  int32_t _4813_jj1e = _11478_;
                  int32_t _4814_jj1 = safe_add( safe_add( _4803_p0,_4812_ii ),_4806_blocksz );
                  int32_t _4815_jj0e = safe_add( safe_add( _4803_p0,_4812_ii ),_4806_blocksz );
                  int32_t _4816_jj0 = safe_add( _4803_p0,_4812_ii );
                  while ( ((_4816_jj0 < _4815_jj0e) && (_4814_jj1 < _4813_jj1e)) )
                  {
                    {
                      if ((_ptr__4797_wi64[safe_add( _4795_nidxs_base,_ptr__4796_wi32[safe_add( _4798_perm1,_4816_jj0 )] )] <= _ptr__4797_wi64[safe_add( _4795_nidxs_base,_ptr__4796_wi32[safe_add( _4798_perm1,_4814_jj1 )] )]))
                      {
                        {
                          _ptr__4796_wi32[safe_add( _4799_perm2,_4810_kk )] = _ptr__4796_wi32[safe_add( _4798_perm1,_4816_jj0 )];
                          ++ _4810_kk;
                          ++ _4816_jj0;
                        }
                      }
                      else
                      {
                        {
                          _ptr__4796_wi32[safe_add( _4799_perm2,_4810_kk )] = _ptr__4796_wi32[safe_add( _4798_perm1,_4814_jj1 )];
                          ++ _4810_kk;
                          ++ _4814_jj1;
                        }
                      }
                    }
                  }
                  while ( (_4816_jj0 < _4815_jj0e) )
                  {
                    {
                      _ptr__4796_wi32[safe_add( _4799_perm2,_4810_kk )] = _ptr__4796_wi32[safe_add( _4798_perm1,_4816_jj0 )];
                      ++ _4810_kk;
                      ++ _4816_jj0;
                    }
                  }
                  while ( (_4814_jj1 < _4813_jj1e) )
                  {
                    {
                      _ptr__4796_wi32[safe_add( _4799_perm2,_4810_kk )] = _ptr__4796_wi32[safe_add( _4798_perm1,_4814_jj1 )];
                      ++ _4810_kk;
                      ++ _4814_jj1;
                    }
                  }
                }
              }
              int32_t _11480_ = _4810_kk;
              int32_t _11481_ = _4802_p1;
              for (int32_t _4817_ii = _11480_; _4817_ii < _11481_; ++_4817_ii)
              {
                {
                  _ptr__4796_wi32[safe_add( _4799_perm2,_4817_ii )] = _ptr__4796_wi32[safe_add( _4798_perm1,_4817_ii )];
                }
              }
              int32_t _4818_tmp = _4798_perm1;
              _4798_perm1 = _4799_perm2;
              _4799_perm2 = _4818_tmp;
              _4806_blocksz *= (int)2;
            }
          }
        }
      }
      {}
      int32_t _11482_ = _4803_p0;
      int32_t _11483_ = _4802_p1;
      for (int32_t _4819_i = _11482_; _4819_i < _11483_; ++_4819_i)
      {
        {
          _ptr__4796_wi32[safe_add( _4790_origperm1,_4819_i )] = _ptr__4796_wi32[safe_add( _4798_perm1,_4819_i )];
        }
      }
    }
  }
}
// End mosek.fusion.ExprCompress.merge_sort

// Begin mosek.fusion.ExprCompress.eval_continue
// Method mosek.fusion.ExprCompress.eval_continue @ bld/grindsted/final/default/src/fusion/ExprCompress.monty:26:6-251:7
void mosek::fusion::ExprCompress :: eval_continue(monty::rc_ptr< ::mosek::fusion::WorkStack > _4820_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4821_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4822_xs) { mosek::fusion::p_ExprCompress::_get_impl(this)->eval_continue(_4820_rs,_4821_ws,_4822_xs); }
void mosek::fusion::p_ExprCompress::eval_continue(monty::rc_ptr< ::mosek::fusion::WorkStack > _4820_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4821_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4822_xs)
{
  _4821_ws->pop_expr();
  int32_t _4823_nd = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->nd;
  int32_t _4824_shape = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->shape_base;
  int32_t _4825_nelem = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->nelem;
  int32_t _4826_nnz = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->nnz;
  bool _4827_hassp = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->hassp;
  int32_t _4828_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->ncodeatom;
  int32_t _4829_ptr = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->ptr_base;
  int32_t _4830_sp = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->sp_base;
  int32_t _4831_nidxs = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->nidxs_base;
  int32_t _4832_cof = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->cof_base;
  int32_t _4833_code = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->code_base;
  int32_t _4834_codeptr = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->codeptr_base;
  int32_t _4835_cconst = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4836_wi32 = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__4836_wi32(_4836_wi32 ? _4836_wi32->raw() : nullptr,_4836_wi32 ? _4836_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4837_wi64 = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__4837_wi64(_4837_wi64 ? _4837_wi64->raw() : nullptr,_4837_wi64 ? _4837_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4838_wf64 = mosek::fusion::p_WorkStack::_get_impl(_4821_ws)->f64;
  _checked_ptr_1<double> _ptr__4838_wf64(_4838_wf64 ? _4838_wf64->raw() : nullptr,_4838_wf64 ? _4838_wf64->size(0) : 0);
  bool _4839_iscompact = true;
  {
    std::shared_ptr< monty::ndarray< int32_t,1 > > _4840_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4822_xs)->i32;
    _checked_ptr_1<int32_t> _ptr__4840_xi32(_4840_xi32 ? _4840_xi32->raw() : nullptr,_4840_xi32 ? _4840_xi32->size(0) : 0);
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4841_xi64 = mosek::fusion::p_WorkStack::_get_impl(_4822_xs)->i64;
    _checked_ptr_1<int64_t> _ptr__4841_xi64(_4841_xi64 ? _4841_xi64->raw() : nullptr,_4841_xi64 ? _4841_xi64->size(0) : 0);
    std::shared_ptr< monty::ndarray< double,1 > > _4842_xf64 = mosek::fusion::p_WorkStack::_get_impl(_4822_xs)->f64;
    _checked_ptr_1<double> _ptr__4842_xf64(_4842_xf64 ? _4842_xf64->raw() : nullptr,_4842_xf64 ? _4842_xf64->size(0) : 0);
    int32_t _11484_ = (int)0;
    int32_t _11485_ = _4825_nelem;
    for (int32_t _4843_i = _11484_; _4843_i < _11485_; ++_4843_i)
    {
      {
        int32_t _11486_ = _ptr__4836_wi32[safe_add( _4829_ptr,_4843_i )];
        int32_t _11487_ = (_ptr__4836_wi32[safe_add( safe_add( _4829_ptr,_4843_i ),(int)1 )] - (int)1);
        for (int32_t _4844_j = _11486_; _4844_j < _11487_; ++_4844_j)
        {
          {
            _4839_iscompact = (_4839_iscompact && (_ptr__4837_wi64[safe_add( _4831_nidxs,_4844_j )] < _ptr__4837_wi64[safe_add( safe_add( _4831_nidxs,_4844_j ),(int)1 )]));
          }
        }
      }
    }
    if (_4839_iscompact)
    {
      {
        if ((_4828_ncodeatom > (int)0))
        {
          {
            int32_t _11488_ = (int)0;
            int32_t _11489_ = _4826_nnz;
            for (int32_t _4845_j = _11488_; _4845_j < _11489_; ++_4845_j)
            {
              {
                _4839_iscompact = (_4839_iscompact && ((!((_ptr__4838_wf64[safe_add( _4832_cof,_4845_j )] >= 0.0) && (0.0 >= _ptr__4838_wf64[safe_add( _4832_cof,_4845_j )]))) || (((_ptr__4836_wi32[safe_add( safe_add( _4834_codeptr,_4845_j ),(int)1 )] - _ptr__4836_wi32[safe_add( _4834_codeptr,_4845_j )]) == (int)0) || (!(((_ptr__4836_wi32[safe_add( safe_add( _4834_codeptr,_4845_j ),(int)1 )] - _ptr__4836_wi32[safe_add( _4834_codeptr,_4845_j )]) == (int)1) && ((_ptr__4836_wi32[safe_add( _4833_code,_ptr__4836_wi32[safe_add( _4834_codeptr,_4845_j )] )] == 2) && (!((_ptr__4838_wf64[safe_add( _4835_cconst,_ptr__4836_wi32[safe_add( _4834_codeptr,_4845_j )] )] <= 0.0) && (_ptr__4838_wf64[safe_add( _4835_cconst,_ptr__4836_wi32[safe_add( _4834_codeptr,_4845_j )] )] >= 0.0)))))))));
              }
            }
          }
        }
        else
        {
          {
            int32_t _11490_ = (int)0;
            int32_t _11491_ = _4826_nnz;
            for (int32_t _4846_j = _11490_; _4846_j < _11491_; ++_4846_j)
            {
              {
                _4839_iscompact = (_4839_iscompact && (!((_ptr__4838_wf64[safe_add( _4832_cof,_4846_j )] <= 0.0) && (0.0 <= _ptr__4838_wf64[safe_add( _4832_cof,_4846_j )]))));
              }
            }
          }
        }
      }
    }
    {}
  }
  if (_4839_iscompact)
  {
    {
      _4820_rs->alloc_expr(_4823_nd,_4825_nelem,_4826_nnz,_4827_hassp,_4828_ncodeatom);
      int32_t _4847_rptr = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->ptr_base;
      int32_t _4848_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->nidxs_base;
      int32_t _4849_rsp = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->sp_base;
      int32_t _4850_rcof = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->cof_base;
      int32_t _4851_rshape = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->shape_base;
      int32_t _4852_rcode = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->code_base;
      int32_t _4853_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->codeptr_base;
      int32_t _4854_rcconst = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4855_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__4855_ri32(_4855_ri32 ? _4855_ri32->raw() : nullptr,_4855_ri32 ? _4855_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4856_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__4856_ri64(_4856_ri64 ? _4856_ri64->raw() : nullptr,_4856_ri64 ? _4856_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _4857_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->f64;
      _checked_ptr_1<double> _ptr__4857_rf64(_4857_rf64 ? _4857_rf64->raw() : nullptr,_4857_rf64 ? _4857_rf64->size(0) : 0);
      {
        int32_t _11492_ = (int)0;
        int32_t _11493_ = _4823_nd;
        for (int32_t _4858_i = _11492_; _4858_i < _11493_; ++_4858_i)
        {
          {
            _ptr__4855_ri32[safe_add( _4851_rshape,_4858_i )] = _ptr__4836_wi32[safe_add( _4824_shape,_4858_i )];
          }
        }
        int32_t _11494_ = (int)0;
        int32_t _11495_ = safe_add( _4825_nelem,(int)1 );
        for (int32_t _4859_i = _11494_; _4859_i < _11495_; ++_4859_i)
        {
          {
            _ptr__4855_ri32[safe_add( _4847_rptr,_4859_i )] = _ptr__4836_wi32[safe_add( _4829_ptr,_4859_i )];
          }
        }
        int32_t _11496_ = (int)0;
        int32_t _11497_ = _4826_nnz;
        for (int32_t _4860_i = _11496_; _4860_i < _11497_; ++_4860_i)
        {
          {
            _ptr__4856_ri64[safe_add( _4848_rnidxs,_4860_i )] = _ptr__4837_wi64[safe_add( _4831_nidxs,_4860_i )];
          }
        }
        int32_t _11498_ = (int)0;
        int32_t _11499_ = _4826_nnz;
        for (int32_t _4861_i = _11498_; _4861_i < _11499_; ++_4861_i)
        {
          {
            _ptr__4857_rf64[safe_add( _4850_rcof,_4861_i )] = _ptr__4838_wf64[safe_add( _4832_cof,_4861_i )];
          }
        }
        if (_4827_hassp)
        {
          {
            int32_t _11500_ = (int)0;
            int32_t _11501_ = _4825_nelem;
            for (int32_t _4862_i = _11500_; _4862_i < _11501_; ++_4862_i)
            {
              {
                _ptr__4856_ri64[safe_add( _4849_rsp,_4862_i )] = _ptr__4837_wi64[safe_add( _4830_sp,_4862_i )];
              }
            }
          }
        }
        {}
        if ((_4828_ncodeatom > (int)0))
        {
          {
            int32_t _11502_ = (int)0;
            int32_t _11503_ = _4828_ncodeatom;
            for (int32_t _4863_i = _11502_; _4863_i < _11503_; ++_4863_i)
            {
              {
                _ptr__4855_ri32[safe_add( _4852_rcode,_4863_i )] = _ptr__4836_wi32[safe_add( _4833_code,_4863_i )];
              }
            }
            int32_t _11504_ = (int)0;
            int32_t _11505_ = _4828_ncodeatom;
            for (int32_t _4864_i = _11504_; _4864_i < _11505_; ++_4864_i)
            {
              {
                _ptr__4857_rf64[safe_add( _4854_rcconst,_4864_i )] = _ptr__4838_wf64[safe_add( _4835_cconst,_4864_i )];
              }
            }
            int32_t _11506_ = (int)0;
            int32_t _11507_ = safe_add( _4826_nnz,(int)1 );
            for (int32_t _4865_i = _11506_; _4865_i < _11507_; ++_4865_i)
            {
              {
                _ptr__4855_ri32[safe_add( _4853_rcodeptr,_4865_i )] = _ptr__4836_wi32[safe_add( _4834_codeptr,_4865_i )];
              }
            }
          }
        }
        {}
      }
      if ((_4828_ncodeatom > (int)0))
      {
        {
          if ((_ptr__4855_ri32[safe_add( _4853_rcodeptr,_4826_nnz )] != _4828_ncodeatom))
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Incorrect codeptr"));
            }
          }
          {}
        }
      }
      {}
    }
  }
  else
  {
    {
      int32_t _4866_perm1 = _4822_xs->alloci32(_4826_nnz);
      ::mosek::fusion::p_ExprCompress::arg_sort(_4821_ws,_4822_xs,_4866_perm1,_4825_nelem,_4826_nnz,_4829_ptr,_4831_nidxs);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4867_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4822_xs)->i32;
      _checked_ptr_1<int32_t> _ptr__4867_xi32(_4867_xi32 ? _4867_xi32->raw() : nullptr,_4867_xi32 ? _4867_xi32->size(0) : 0);
      int32_t _4868_rnnz = (int)0;
      int32_t _4869_rncodeatom = _4828_ncodeatom;
      {
        std::shared_ptr< monty::ndarray< int32_t,1 > > _4870_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->i32;
        _checked_ptr_1<int32_t> _ptr__4870_ri32(_4870_ri32 ? _4870_ri32->raw() : nullptr,_4870_ri32 ? _4870_ri32->size(0) : 0);
        int32_t _11508_ = (int)0;
        int32_t _11509_ = _4825_nelem;
        for (int32_t _4871_i = _11508_; _4871_i < _11509_; ++_4871_i)
        {
          {
            int32_t _4872_pe = _ptr__4836_wi32[safe_add( safe_add( _4829_ptr,_4871_i ),(int)1 )];
            int32_t _4873_pb = _ptr__4836_wi32[safe_add( _4829_ptr,_4871_i )];
            if ((_4873_pb < _4872_pe))
            {
              {
                int32_t _4874_p = _4873_pb;
                while ( (_4874_p < _4872_pe) )
                {
                  {
                    double _4875_c = 0.0;
                    bool _4876_cnonzero = false;
                    int64_t _4877_varidx = _ptr__4837_wi64[safe_add( _4831_nidxs,_ptr__4867_xi32[safe_add( _4866_perm1,_4874_p )] )];
                    int32_t _4878_p0 = _4874_p;
                    while ( ((_4874_p < _4872_pe) && (_ptr__4837_wi64[safe_add( _4831_nidxs,_ptr__4867_xi32[safe_add( _4866_perm1,_4874_p )] )] == _4877_varidx)) )
                    {
                      {
                        double _4879_ci = _ptr__4838_wf64[safe_add( _4832_cof,_ptr__4867_xi32[safe_add( _4866_perm1,_4874_p )] )];
                        _4876_cnonzero = (_4876_cnonzero || (!((_4879_ci <= 0.0) && (_4879_ci >= 0.0))));
                        _4875_c += _4879_ci;
                        ++ _4874_p;
                      }
                    }
                    if ((_4876_cnonzero || (_4828_ncodeatom > (int)0)))
                    {
                      {
                        ++ _4868_rnnz;
                        if (((safe_add( _4878_p0,(int)1 ) < _4874_p) && (_4828_ncodeatom > (int)0)))
                        {
                          {
                            _4869_rncodeatom += (int)1;
                          }
                        }
                        {}
                      }
                    }
                    {}
                  }
                }
              }
            }
            {}
          }
        }
      }
      _4820_rs->alloc_expr(_4823_nd,_4825_nelem,_4868_rnnz,_4827_hassp,_4869_rncodeatom);
      int32_t _4880_rnidx = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->nidxs_base;
      int32_t _4881_rshape = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->shape_base;
      int32_t _4882_rsp = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->sp_base;
      int32_t _4883_rcof = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->cof_base;
      int32_t _4884_rptr = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->ptr_base;
      int32_t _4885_rcode = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->code_base;
      int32_t _4886_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->codeptr_base;
      int32_t _4887_rcconst = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _4888_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__4888_ri32(_4888_ri32 ? _4888_ri32->raw() : nullptr,_4888_ri32 ? _4888_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4889_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__4889_ri64(_4889_ri64 ? _4889_ri64->raw() : nullptr,_4889_ri64 ? _4889_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _4890_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4820_rs)->f64;
      _checked_ptr_1<double> _ptr__4890_rf64(_4890_rf64 ? _4890_rf64->raw() : nullptr,_4890_rf64 ? _4890_rf64->size(0) : 0);
      {
        int32_t _11510_ = (int)0;
        int32_t _11511_ = _4823_nd;
        for (int32_t _4891_i = _11510_; _4891_i < _11511_; ++_4891_i)
        {
          {
            _ptr__4888_ri32[safe_add( _4881_rshape,_4891_i )] = _ptr__4836_wi32[safe_add( _4824_shape,_4891_i )];
          }
        }
        if (_4827_hassp)
        {
          {
            int32_t _11512_ = (int)0;
            int32_t _11513_ = _4825_nelem;
            for (int32_t _4892_i = _11512_; _4892_i < _11513_; ++_4892_i)
            {
              {
                _ptr__4889_ri64[safe_add( _4882_rsp,_4892_i )] = _ptr__4837_wi64[safe_add( _4830_sp,_4892_i )];
              }
            }
          }
        }
        {}
        int32_t _4893_nzi = (int)0;
        int32_t _4894_codei = (int)0;
        {
          _ptr__4888_ri32[_4884_rptr] = (int)0;
          if ((_4869_rncodeatom > (int)0))
          {
            {
              _ptr__4888_ri32[_4886_rcodeptr] = (int)0;
            }
          }
          {}
          int32_t _11514_ = (int)0;
          int32_t _11515_ = _4825_nelem;
          for (int32_t _4895_elmi = _11514_; _4895_elmi < _11515_; ++_4895_elmi)
          {
            {
              int32_t _4896_pe = _ptr__4836_wi32[safe_add( safe_add( _4829_ptr,_4895_elmi ),(int)1 )];
              int32_t _4897_pb = _ptr__4836_wi32[safe_add( _4829_ptr,_4895_elmi )];
              if ((_4897_pb < _4896_pe))
              {
                {
                  int32_t _4898_p = _4897_pb;
                  int32_t _4899_p0 = _4898_p;
                  while ( (_4898_p < _4896_pe) )
                  {
                    {
                      double _4900_c = 0.0;
                      bool _4901_cnonzero = false;
                      int32_t _4902_p0e = safe_add( _4898_p,(int)1 );
                      int32_t _4903_p0b = _4898_p;
                      int64_t _4904_varidx = _ptr__4837_wi64[safe_add( _4831_nidxs,_ptr__4867_xi32[safe_add( _4866_perm1,_4903_p0b )] )];
                      while ( ((_4902_p0e < _4896_pe) && (_ptr__4837_wi64[safe_add( _4831_nidxs,_ptr__4867_xi32[safe_add( _4866_perm1,_4902_p0e )] )] == _4904_varidx)) )
                      {
                        {
                          ++ _4902_p0e;
                        }
                      }
                      if ((_4828_ncodeatom > (int)0))
                      {
                        {
                          while ( (_4898_p < _4902_p0e) )
                          {
                            {
                              double _4905_ci = _ptr__4838_wf64[safe_add( _4832_cof,_ptr__4867_xi32[safe_add( _4866_perm1,_4898_p )] )];
                              _4901_cnonzero = (_4901_cnonzero || (!((_4905_ci <= 0.0) && (_4905_ci >= 0.0))));
                              _4900_c += _4905_ci;
                              int32_t _11516_ = _ptr__4836_wi32[safe_add( _4834_codeptr,_ptr__4867_xi32[safe_add( _4866_perm1,_4898_p )] )];
                              int32_t _11517_ = _ptr__4836_wi32[safe_add( safe_add( _4834_codeptr,_ptr__4867_xi32[safe_add( _4866_perm1,_4898_p )] ),(int)1 )];
                              for (int32_t _4906_l = _11516_; _4906_l < _11517_; ++_4906_l)
                              {
                                {
                                  _ptr__4888_ri32[safe_add( _4885_rcode,_4894_codei )] = _ptr__4836_wi32[safe_add( _4833_code,_4906_l )];
                                  _ptr__4890_rf64[safe_add( _4887_rcconst,_4894_codei )] = _ptr__4838_wf64[safe_add( _4835_cconst,_4906_l )];
                                  ++ _4894_codei;
                                }
                              }
                              ++ _4898_p;
                            }
                          }
                          if (((_4902_p0e - _4903_p0b) > (int)1))
                          {
                            {
                              _ptr__4888_ri32[safe_add( _4885_rcode,_4894_codei )] = 8;
                              _ptr__4890_rf64[safe_add( _4887_rcconst,_4894_codei )] = (_4902_p0e - _4903_p0b);
                              ++ _4894_codei;
                            }
                          }
                          {}
                          _ptr__4888_ri32[safe_add( safe_add( _4886_rcodeptr,_4893_nzi ),(int)1 )] = _4894_codei;
                          _ptr__4889_ri64[safe_add( _4880_rnidx,_4893_nzi )] = _4904_varidx;
                          _ptr__4890_rf64[safe_add( _4883_rcof,_4893_nzi )] = _4900_c;
                          ++ _4893_nzi;
                        }
                      }
                      else
                      {
                        {
                          while ( (_4898_p < _4902_p0e) )
                          {
                            {
                              double _4907_ci = _ptr__4838_wf64[safe_add( _4832_cof,_ptr__4867_xi32[safe_add( _4866_perm1,_4898_p )] )];
                              _4901_cnonzero = (_4901_cnonzero || (!((_4907_ci <= 0.0) && (_4907_ci >= 0.0))));
                              _4900_c += _4907_ci;
                              ++ _4898_p;
                            }
                          }
                          if (_4901_cnonzero)
                          {
                            {
                              _ptr__4889_ri64[safe_add( _4880_rnidx,_4893_nzi )] = _4904_varidx;
                              _ptr__4890_rf64[safe_add( _4883_rcof,_4893_nzi )] = _4900_c;
                              ++ _4893_nzi;
                            }
                          }
                          {}
                        }
                      }
                    }
                  }
                }
              }
              {}
              _ptr__4888_ri32[safe_add( safe_add( _4884_rptr,_4895_elmi ),(int)1 )] = _4893_nzi;
            }
          }
        }
        if ((_4869_rncodeatom != _4894_codei))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid ncodeatom"));
          }
        }
        {}
        if ((_4893_nzi != _4868_rnnz))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid nnz"));
          }
        }
        {}
        if ((_4868_rnnz != _ptr__4888_ri32[safe_add( _4884_rptr,_4825_nelem )]))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid ptr"));
          }
        }
        {}
      }
      if ((_4869_rncodeatom > (int)0))
      {
        {
          if ((_ptr__4888_ri32[safe_add( _4886_rcodeptr,_4868_rnnz )] != _4869_rncodeatom))
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Incorrect codeptr"));
            }
          }
          {}
        }
      }
      {}
    }
  }
  _4822_xs->clear();
}
// End mosek.fusion.ExprCompress.eval_continue

// Begin mosek.fusion.ExprCompress.eval
// Method mosek.fusion.ExprCompress.eval @ bld/grindsted/final/default/src/fusion/ExprCompress.monty:21:6-24:7
void mosek::fusion::ExprCompress :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4908_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4909_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4910_xs,bool _4911_cache_eval) { mosek::fusion::p_ExprCompress::_get_impl(this)->eval(_4908_rs,_4909_ws,_4910_xs,_4911_cache_eval); }
void mosek::fusion::p_ExprCompress::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4908_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4909_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4910_xs,bool _4911_cache_eval)
{
  expr->recursive_eval(_4909_ws,_4908_rs,_4910_xs,_4911_cache_eval);
  _pubthis->eval_continue(_4908_rs,_4909_ws,_4910_xs);
}
// End mosek.fusion.ExprCompress.eval

// Begin mosek.fusion.ExprCompress.toString
// Method mosek.fusion.ExprCompress.toString @ bld/grindsted/final/default/src/fusion/ExprCompress.monty:14:6-130
std::string mosek::fusion::ExprCompress :: toString() { return mosek::fusion::p_ExprCompress::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprCompress::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprCompress("))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprCompress.toString

void mosek::fusion::p_ExprCompress::destroy()
{
  expr.reset();
}
void mosek::fusion::ExprCompress::destroy() { mosek::fusion::p_ExprCompress::_get_impl(this)->destroy(); }
// } class ExprCompress
// class ExprConst { // @ bld/grindsted/final/default/src/fusion/ExprConst.monty:4:4-84:5
mosek::fusion::ExprConst::ExprConst(mosek::fusion::p_ExprConst *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprConst()" << this << std::endl; */ }
mosek::fusion::ExprConst::~ExprConst() {  /* std::cout << "~ExprConst()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprConst::p_ExprConst
  (::mosek::fusion::ExprConst * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprConst.ctor @ bld/grindsted/final/default/src/fusion/ExprConst.monty:37:6-42:7
mosek::fusion::ExprConst::t mosek::fusion::p_ExprConst::_new_ExprConst
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _4912_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4913_sparsity,
    std::shared_ptr< monty::ndarray< double,1 > > _4914_bfix)
{ return new mosek::fusion::ExprConst(_4912_shape,_4913_sparsity,_4914_bfix); }
mosek::fusion::ExprConst::ExprConst
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _4912_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4913_sparsity,
    std::shared_ptr< monty::ndarray< double,1 > > _4914_bfix) : 
   ExprConst(new mosek::fusion::p_ExprConst(this))
{ mosek::fusion::p_ExprConst::_get_impl(this)->_initialize(_4912_shape,_4913_sparsity,_4914_bfix); }
void mosek::fusion::p_ExprConst::_initialize  (std::shared_ptr< monty::ndarray< int32_t,1 > > _4912_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4913_sparsity,
    std::shared_ptr< monty::ndarray< double,1 > > _4914_bfix)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__4912_shape(_4912_shape ? _4912_shape->raw() : nullptr, _4912_shape ? _4912_shape->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__4913_sparsity(_4913_sparsity ? _4913_sparsity->raw() : nullptr, _4913_sparsity ? _4913_sparsity->size(0) : 0);
    _checked_ptr_1<double> _ptr__4914_bfix(_4914_bfix ? _4914_bfix->raw() : nullptr, _4914_bfix ? _4914_bfix->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(nullptr,_4912_shape);
    mosek::fusion::p_ExprConst::_get_impl(::mosek::fusion::ExprConst::t(_pubthis))->bfix = ::mosek::fusion::Utils::Tools::arraycopy(_4914_bfix);
    std::shared_ptr< monty::ndarray< int64_t,1 > > _11518_;
    bool _11519_ = (NULL != _4913_sparsity.get());
    if (_11519_)
    {
      _11518_ = ::mosek::fusion::Utils::Tools::arraycopy(_4913_sparsity);
    }
    else
    {
      _11518_ = nullptr;
    }
    mosek::fusion::p_ExprConst::_get_impl(::mosek::fusion::ExprConst::t(_pubthis))->sparsity = _11518_;
    ::mosek::fusion::p_ExprConst::validate(_4912_shape,_4914_bfix,_4913_sparsity);
  }
}
// mosek.fusion.ExprConst.ctor

// mosek.fusion.ExprConst.ctor @ bld/grindsted/final/default/src/fusion/ExprConst.monty:28:6-35:7
mosek::fusion::ExprConst::t mosek::fusion::p_ExprConst::_new_ExprConst
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _4915_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4916_sparsity,
    double _4917_bfix)
{ return new mosek::fusion::ExprConst(_4915_shape,_4916_sparsity,_4917_bfix); }
mosek::fusion::ExprConst::ExprConst
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _4915_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4916_sparsity,
    double _4917_bfix) : 
   ExprConst(new mosek::fusion::p_ExprConst(this))
{ mosek::fusion::p_ExprConst::_get_impl(this)->_initialize(_4915_shape,_4916_sparsity,_4917_bfix); }
void mosek::fusion::p_ExprConst::_initialize  (std::shared_ptr< monty::ndarray< int32_t,1 > > _4915_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4916_sparsity,
    double _4917_bfix)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__4915_shape(_4915_shape ? _4915_shape->raw() : nullptr, _4915_shape ? _4915_shape->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__4916_sparsity(_4916_sparsity ? _4916_sparsity->raw() : nullptr, _4916_sparsity ? _4916_sparsity->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(nullptr,_4915_shape);
    int64_t _11520_;
    bool _11521_ = (NULL == _4916_sparsity.get());
    if (_11521_)
    {
      _11520_ = ::mosek::fusion::p_Set::size(_4915_shape);
    }
    else
    {
      _11520_ = (int)((_4916_sparsity)->size(0));
    }
    int64_t _4918_n = _11520_;
    std::vector<double> _11522_;
    for (int64_t _4919_i = (int)0, _11523_ = _4918_n; _4919_i < _11523_ ; ++_4919_i)
    {
      _11522_.push_back(_4917_bfix);
    }
    auto _11524_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_11522_.size()),_11522_.begin(),_11522_.end()));
    mosek::fusion::p_ExprConst::_get_impl(::mosek::fusion::ExprConst::t(_pubthis))->bfix = _11524_;
    std::shared_ptr< monty::ndarray< int64_t,1 > > _11525_;
    bool _11526_ = (NULL != _4916_sparsity.get());
    if (_11526_)
    {
      _11525_ = ::mosek::fusion::Utils::Tools::arraycopy(_4916_sparsity);
    }
    else
    {
      _11525_ = nullptr;
    }
    mosek::fusion::p_ExprConst::_get_impl(::mosek::fusion::ExprConst::t(_pubthis))->sparsity = _11525_;
    ::mosek::fusion::p_ExprConst::validate(_4915_shape,mosek::fusion::p_ExprConst::_get_impl(::mosek::fusion::ExprConst::t(_pubthis))->bfix,_4916_sparsity);
  }
}
// mosek.fusion.ExprConst.ctor

// Begin mosek.fusion.ExprConst.eval
// Method mosek.fusion.ExprConst.eval @ bld/grindsted/final/default/src/fusion/ExprConst.monty:48:6-83:7
void mosek::fusion::ExprConst :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4920_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4921_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4922_xs,bool _4923_cache_eval) { mosek::fusion::p_ExprConst::_get_impl(this)->eval(_4920_rs,_4921_ws,_4922_xs,_4923_cache_eval); }
void mosek::fusion::p_ExprConst::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4920_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4921_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4922_xs,bool _4923_cache_eval)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4924_shape = _pubthis->getShape();
  _checked_ptr_1<int32_t> _ptr__4924_shape(_4924_shape ? _4924_shape->raw() : nullptr,_4924_shape ? _4924_shape->size(0) : 0);
  int32_t _4925_nd = (int)((_4924_shape)->size(0));
  int32_t _4926_nnz = (int)0;
  int32_t _11527_ = (int)0;
  int32_t _11528_ = (int)((bfix)->size(0));
  for (int32_t _4927_i = _11527_; _4927_i < _11528_; ++_4927_i)
  {
    {
      if ((!((((*bfix)(_4927_i)) <= 0.0) && (((*bfix)(_4927_i)) >= 0.0))))
      {
        {
          ++ _4926_nnz;
        }
      }
      {}
    }
  }
  int32_t _4928_nelem = (int)((bfix)->size(0));
  bool _4929_hassp = ((NULL != sparsity.get()) && ((int)((sparsity)->size(0)) < ::mosek::fusion::p_Set::size(_4924_shape)));
  _4920_rs->alloc_expr(_4925_nd,_4928_nelem,_4926_nnz,_4929_hassp,(int)0);
  int32_t _4930_rshape = mosek::fusion::p_WorkStack::_get_impl(_4920_rs)->shape_base;
  int32_t _4931_rptr = mosek::fusion::p_WorkStack::_get_impl(_4920_rs)->ptr_base;
  int32_t _4932_rsp = mosek::fusion::p_WorkStack::_get_impl(_4920_rs)->sp_base;
  int32_t _4933_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_4920_rs)->nidxs_base;
  int32_t _4934_rcof = mosek::fusion::p_WorkStack::_get_impl(_4920_rs)->cof_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4935_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4920_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__4935_ri32(_4935_ri32 ? _4935_ri32->raw() : nullptr,_4935_ri32 ? _4935_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4936_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4920_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__4936_ri64(_4936_ri64 ? _4936_ri64->raw() : nullptr,_4936_ri64 ? _4936_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4937_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4920_rs)->f64;
  _checked_ptr_1<double> _ptr__4937_rf64(_4937_rf64 ? _4937_rf64->raw() : nullptr,_4937_rf64 ? _4937_rf64->size(0) : 0);
  int32_t _11529_ = (int)0;
  int32_t _11530_ = _4925_nd;
  for (int32_t _4938_i = _11529_; _4938_i < _11530_; ++_4938_i)
  {
    {
      _ptr__4935_ri32[safe_add( _4930_rshape,_4938_i )] = _ptr__4924_shape[_4938_i];
    }
  }
  int32_t _4939_nzi = (int)0;
  _ptr__4935_ri32[_4931_rptr] = (int)0;
  if (_4929_hassp)
  {
    {
      int32_t _11531_ = (int)0;
      int32_t _11532_ = _4928_nelem;
      for (int32_t _4940_i = _11531_; _4940_i < _11532_; ++_4940_i)
      {
        {
          _ptr__4936_ri64[safe_add( _4932_rsp,_4940_i )] = ((*sparsity)(_4940_i));
        }
      }
    }
  }
  {}
  int32_t _11533_ = (int)0;
  int32_t _11534_ = _4928_nelem;
  for (int32_t _4941_i = _11533_; _4941_i < _11534_; ++_4941_i)
  {
    {
      if ((!((((*bfix)(_4941_i)) <= 0.0) && (((*bfix)(_4941_i)) >= 0.0))))
      {
        {
          _ptr__4936_ri64[safe_add( _4933_rnidxs,_4939_nzi )] = (int)0;
          _ptr__4937_rf64[safe_add( _4934_rcof,_4939_nzi )] = ((*bfix)(_4941_i));
          ++ _4939_nzi;
        }
      }
      {}
      _ptr__4935_ri32[safe_add( safe_add( _4931_rptr,_4941_i ),(int)1 )] = _4939_nzi;
    }
  }
}
// End mosek.fusion.ExprConst.eval

// Begin mosek.fusion.ExprConst.recursive_eval
// Method mosek.fusion.ExprConst.recursive_eval @ bld/grindsted/final/default/src/fusion/ExprConst.monty:46:6-125
void mosek::fusion::ExprConst :: recursive_eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4942_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4943_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4944_xs,bool _4945_cache_eval) { mosek::fusion::p_ExprConst::_get_impl(this)->recursive_eval(_4942_rs,_4943_ws,_4944_xs,_4945_cache_eval); }
void mosek::fusion::p_ExprConst::recursive_eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4942_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4943_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4944_xs,bool _4945_cache_eval)
{
  _pubthis->eval(_4942_rs,_4943_ws,_4944_xs,_4945_cache_eval);
}
// End mosek.fusion.ExprConst.recursive_eval

// Begin mosek.fusion.ExprConst.validate
// Method mosek.fusion.ExprConst.validate @ bld/grindsted/final/default/src/fusion/ExprConst.monty:10:6-26:7
void mosek::fusion::p_ExprConst::validate(std::shared_ptr< monty::ndarray< int32_t,1 > > _4946_shape,std::shared_ptr< monty::ndarray< double,1 > > _4947_bfix,std::shared_ptr< monty::ndarray< int64_t,1 > > _4948_sparsity)
{
  _checked_ptr_1<int32_t> _ptr__4946_shape(_4946_shape ? _4946_shape->raw() : nullptr, _4946_shape ? _4946_shape->size(0) : 0);
  _checked_ptr_1<double> _ptr__4947_bfix(_4947_bfix ? _4947_bfix->raw() : nullptr, _4947_bfix ? _4947_bfix->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__4948_sparsity(_4948_sparsity ? _4948_sparsity->raw() : nullptr, _4948_sparsity ? _4948_sparsity->size(0) : 0);
  int64_t _4949_sz = ::mosek::fusion::p_Set::size(_4946_shape);
  if ((NULL != _4948_sparsity.get()))
  {
    {
      if (((int)((_4948_sparsity)->size(0)) != (int)((_4947_bfix)->size(0))))
      {
        {
          throw ::mosek::fusion::LengthError(std::string ("Mismatching data lengths"));
        }
      }
      {}
      bool _4950_err = false;
      int32_t _11535_ = (int)0;
      int32_t _11536_ = (int)((_4948_sparsity)->size(0));
      for (int32_t _4951_i = _11535_; _4951_i < _11536_; ++_4951_i)
      {
        {
          if (((_ptr__4948_sparsity[_4951_i] < (int)0) || (_ptr__4948_sparsity[_4951_i] >= _4949_sz)))
          {
            {
              _4950_err = true;
            }
          }
          {}
        }
      }
      if (_4950_err)
      {
        {
          throw ::mosek::fusion::IndexError(std::string ("Invalid sparsity index"));
        }
      }
      {}
    }
  }
  else
  {
    {
      if (((int)((_4947_bfix)->size(0)) != _4949_sz))
      {
        {
          throw ::mosek::fusion::LengthError(std::string ("Mismatching data length"));
        }
      }
      {}
    }
  }
}
// End mosek.fusion.ExprConst.validate

// Begin mosek.fusion.ExprConst.toString
// Method mosek.fusion.ExprConst.toString @ bld/grindsted/final/default/src/fusion/ExprConst.monty:8:6-63
std::string mosek::fusion::ExprConst :: toString() { return mosek::fusion::p_ExprConst::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprConst::toString()
{
  return std::string ("ExprConst()");
}
// End mosek.fusion.ExprConst.toString

void mosek::fusion::p_ExprConst::destroy()
{
  sparsity.reset();
  bfix.reset();
}
void mosek::fusion::ExprConst::destroy() { mosek::fusion::p_ExprConst::_get_impl(this)->destroy(); }
// } class ExprConst
// class ExprPick { // @ bld/grindsted/final/default/src/fusion/ExprSlice.monty:187:4-390:5
mosek::fusion::ExprPick::ExprPick(mosek::fusion::p_ExprPick *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprPick()" << this << std::endl; */ }
mosek::fusion::ExprPick::~ExprPick() {  /* std::cout << "~ExprPick()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprPick::p_ExprPick
  (::mosek::fusion::ExprPick * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprPick.ctor @ bld/grindsted/final/default/src/fusion/ExprSlice.monty:210:6-239:7
mosek::fusion::ExprPick::t mosek::fusion::p_ExprPick::_new_ExprPick
  (monty::rc_ptr< ::mosek::fusion::Expression > _4952_expr,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _4953_idxs)
{ return new mosek::fusion::ExprPick(_4952_expr,_4953_idxs); }
mosek::fusion::ExprPick::ExprPick
  (monty::rc_ptr< ::mosek::fusion::Expression > _4952_expr,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _4953_idxs) : 
   ExprPick(new mosek::fusion::p_ExprPick(this))
{ mosek::fusion::p_ExprPick::_get_impl(this)->_initialize(_4952_expr,_4953_idxs); }
void mosek::fusion::p_ExprPick::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _4952_expr,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _4953_idxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_4952_expr->__mosek_2fusion_2Expression__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_4953_idxs)->size(0)))}));
    std::shared_ptr< monty::ndarray< int32_t,1 > > _4954_shape = _4952_expr->getShape();
    _checked_ptr_1<int32_t> _ptr__4954_shape(_4954_shape ? _4954_shape->raw() : nullptr,_4954_shape ? _4954_shape->size(0) : 0);
    int32_t _4955_nd = (int)((_4954_shape)->size(0));
    mosek::fusion::p_ExprPick::_get_impl(::mosek::fusion::ExprPick::t(_pubthis))->expr = _4952_expr;
    mosek::fusion::p_ExprPick::_get_impl(::mosek::fusion::ExprPick::t(_pubthis))->idxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)((_4953_idxs)->size(0)))));
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4956_this_idxs = mosek::fusion::p_ExprPick::_get_impl(::mosek::fusion::ExprPick::t(_pubthis))->idxs;
    _checked_ptr_1<int64_t> _ptr__4956_this_idxs(_4956_this_idxs ? _4956_this_idxs->raw() : nullptr,_4956_this_idxs ? _4956_this_idxs->size(0) : 0);
    if (((int)((_4953_idxs)->size(1)) != _4955_nd))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching shape and index dimensions"));
      }
    }
    {}
    bool _4957_wrongindex = false;
    int32_t _11537_ = (int)0;
    int32_t _11538_ = (int)((_4953_idxs)->size(0));
    for (int32_t _4958_i = _11537_; _4958_i < _11538_; ++_4958_i)
    {
      {
        int32_t _11539_ = (int)0;
        int32_t _11540_ = _4955_nd;
        for (int32_t _4959_j = _11539_; _4959_j < _11540_; ++_4959_j)
        {
          {
            if (((((*_4953_idxs)(_4958_i,_4959_j)) < (int)0) || (((*_4953_idxs)(_4958_i,_4959_j)) >= _ptr__4954_shape[_4959_j])))
            {
              {
                _4957_wrongindex = true;
              }
            }
            {}
          }
        }
      }
    }
    if (_4957_wrongindex)
    {
      {
        throw ::mosek::fusion::IndexError(std::string ("Pick index out of bounds"));
      }
    }
    {}
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _4960_st = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_4955_nd)));
      _checked_ptr_1<int64_t> _ptr__4960_st(_4960_st ? _4960_st->raw() : nullptr,_4960_st ? _4960_st->size(0) : 0);
      _ptr__4960_st[(_4955_nd - (int)1)] = (int)1;
      int32_t _11541_ = (int)1;
      int32_t _11542_ = _4955_nd;
      for (int32_t _4961_i = _11541_; _4961_i < _11542_; ++_4961_i)
      {
        {
          _ptr__4960_st[((_4955_nd - _4961_i) - (int)1)] = safe_mul( _ptr__4960_st[(_4955_nd - _4961_i)],_ptr__4954_shape[(_4955_nd - _4961_i)] );
        }
      }
      int32_t _11543_ = (int)0;
      int32_t _11544_ = (int)((_4953_idxs)->size(0));
      for (int32_t _4962_i = _11543_; _4962_i < _11544_; ++_4962_i)
      {
        {
          int64_t _4963_ii = (int64_t)0;
          int32_t _11545_ = (int)0;
          int32_t _11546_ = _4955_nd;
          for (int32_t _4964_j = _11545_; _4964_j < _11546_; ++_4964_j)
          {
            {
              _4963_ii += safe_mul( _ptr__4960_st[_4964_j],((*_4953_idxs)(_4962_i,_4964_j)) );
            }
          }
          _ptr__4956_this_idxs[_4962_i] = _4963_ii;
        }
      }
    }
  }
}
// mosek.fusion.ExprPick.ctor

// mosek.fusion.ExprPick.ctor @ bld/grindsted/final/default/src/fusion/ExprSlice.monty:191:6-206:7
mosek::fusion::ExprPick::t mosek::fusion::p_ExprPick::_new_ExprPick
  (monty::rc_ptr< ::mosek::fusion::Expression > _4965_expr,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4966_idxs)
{ return new mosek::fusion::ExprPick(_4965_expr,_4966_idxs); }
mosek::fusion::ExprPick::ExprPick
  (monty::rc_ptr< ::mosek::fusion::Expression > _4965_expr,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4966_idxs) : 
   ExprPick(new mosek::fusion::p_ExprPick(this))
{ mosek::fusion::p_ExprPick::_get_impl(this)->_initialize(_4965_expr,_4966_idxs); }
void mosek::fusion::p_ExprPick::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _4965_expr,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _4966_idxs)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int64_t> _ptr__4966_idxs(_4966_idxs ? _4966_idxs->raw() : nullptr, _4966_idxs ? _4966_idxs->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(_4965_expr->__mosek_2fusion_2Expression__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_4966_idxs)->size(0)))}));
    mosek::fusion::p_ExprPick::_get_impl(::mosek::fusion::ExprPick::t(_pubthis))->expr = _4965_expr;
    std::shared_ptr< monty::ndarray< int32_t,1 > > _4967_shape = _4965_expr->getShape();
    _checked_ptr_1<int32_t> _ptr__4967_shape(_4967_shape ? _4967_shape->raw() : nullptr,_4967_shape ? _4967_shape->size(0) : 0);
    int64_t _4968_size = ::mosek::fusion::p_Set::size(_4967_shape);
    bool _4969_wrongindex = false;
    int32_t _11547_ = (int)0;
    int32_t _11548_ = (int)((_4966_idxs)->size(0));
    for (int32_t _4970_i = _11547_; _4970_i < _11548_; ++_4970_i)
    {
      {
        if (((_ptr__4966_idxs[_4970_i] < (int)0) || (_ptr__4966_idxs[_4970_i] >= _4968_size)))
        {
          {
            _4969_wrongindex = true;
          }
        }
        {}
      }
    }
    if (_4969_wrongindex)
    {
      {
        throw ::mosek::fusion::IndexError(std::string ("Pick index out of bounds"));
      }
    }
    {}
    mosek::fusion::p_ExprPick::_get_impl(::mosek::fusion::ExprPick::t(_pubthis))->idxs = ::mosek::fusion::Utils::Tools::arraycopy(_4966_idxs);
  }
}
// mosek.fusion.ExprPick.ctor

// Begin mosek.fusion.ExprPick.eval
// Method mosek.fusion.ExprPick.eval @ bld/grindsted/final/default/src/fusion/ExprSlice.monty:241:6-389:7
void mosek::fusion::ExprPick :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4971_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4972_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4973_xs,bool _4974_cache_eval) { mosek::fusion::p_ExprPick::_get_impl(this)->eval(_4971_rs,_4972_ws,_4973_xs,_4974_cache_eval); }
void mosek::fusion::p_ExprPick::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _4971_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _4972_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _4973_xs,bool _4974_cache_eval)
{
  expr->recursive_eval(_4972_ws,_4971_rs,_4973_xs,_4974_cache_eval);
  _4972_ws->pop_expr();
  int32_t _4975_nd = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->nd;
  int32_t _4976_shape = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->shape_base;
  int32_t _4977_nelem = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->nelem;
  int32_t _4978_nnz = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->nnz;
  int32_t _4979_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->ncodeatom;
  bool _4980_hassp = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->hassp;
  int32_t _4981_ptr_base = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->ptr_base;
  int32_t _4982_sp_base = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->sp_base;
  int32_t _4983_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->nidxs_base;
  int32_t _4984_cof_base = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->cof_base;
  int32_t _4985_code = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->code_base;
  int32_t _4986_codeptr = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->codeptr_base;
  int32_t _4987_cconst = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _4988_wi32 = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__4988_wi32(_4988_wi32 ? _4988_wi32->raw() : nullptr,_4988_wi32 ? _4988_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4989_wi64 = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__4989_wi64(_4989_wi64 ? _4989_wi64->raw() : nullptr,_4989_wi64 ? _4989_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _4990_wf64 = mosek::fusion::p_WorkStack::_get_impl(_4972_ws)->f64;
  _checked_ptr_1<double> _ptr__4990_wf64(_4990_wf64 ? _4990_wf64->raw() : nullptr,_4990_wf64 ? _4990_wf64->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _4991_idxs = mosek::fusion::p_ExprPick::_get_impl(::mosek::fusion::ExprPick::t(_pubthis))->idxs;
  _checked_ptr_1<int64_t> _ptr__4991_idxs(_4991_idxs ? _4991_idxs->raw() : nullptr,_4991_idxs ? _4991_idxs->size(0) : 0);
  if ((!_4980_hassp))
  {
    {
      int32_t _4992_rnelem = (int)((_4991_idxs)->size(0));
      int32_t _4993_rnd = (int)1;
      int32_t _4994_rnnz = (int)0;
      int32_t _4995_rncodeatom = (int)0;
      int32_t _11549_ = (int)0;
      int32_t _11550_ = (int)((_4991_idxs)->size(0));
      for (int32_t _4996_i = _11549_; _4996_i < _11550_; ++_4996_i)
      {
        {
          _4994_rnnz += (_ptr__4988_wi32[safe_add( safe_add( _4981_ptr_base,_ptr__4991_idxs[_4996_i] ),(int)1 )] - _ptr__4988_wi32[safe_add( _4981_ptr_base,_ptr__4991_idxs[_4996_i] )]);
          if ((_4979_ncodeatom > (int)0))
          {
            {
              _4995_rncodeatom += (_ptr__4988_wi32[safe_add( _4986_codeptr,_ptr__4988_wi32[safe_add( safe_add( _4981_ptr_base,_ptr__4991_idxs[_4996_i] ),(int)1 )] )] - _ptr__4988_wi32[safe_add( _4986_codeptr,_ptr__4988_wi32[safe_add( _4981_ptr_base,_ptr__4991_idxs[_4996_i] )] )]);
            }
          }
          {}
        }
      }
      _4971_rs->alloc_expr(_4993_rnd,_4992_rnelem,_4994_rnnz,false,_4995_rncodeatom);
      int32_t _4997_rcof_base = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->cof_base;
      int32_t _4998_rnidxs_base = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->nidxs_base;
      int32_t _4999_rptr_base = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->ptr_base;
      int32_t _5000_rshape_base = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->shape_base;
      int32_t _5001_rcode = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->code_base;
      int32_t _5002_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->codeptr_base;
      int32_t _5003_rcconst = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->cconst_base;
      {
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5004_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__5004_ri32(_5004_ri32 ? _5004_ri32->raw() : nullptr,_5004_ri32 ? _5004_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _5005_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__5005_ri64(_5005_ri64 ? _5005_ri64->raw() : nullptr,_5005_ri64 ? _5005_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _5006_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->f64;
      _checked_ptr_1<double> _ptr__5006_rf64(_5006_rf64 ? _5006_rf64->raw() : nullptr,_5006_rf64 ? _5006_rf64->size(0) : 0);
      _ptr__5004_ri32[_5000_rshape_base] = (int)((_4991_idxs)->size(0));
      int32_t _5007_codei = (int)0;
      int32_t _5008_knz = (int)0;
      _ptr__5004_ri32[_4999_rptr_base] = (int)0;
      if ((_4995_rncodeatom > (int)0))
      {
        {
          _ptr__5004_ri32[_5002_rcodeptr] = (int)0;
        }
      }
      {}
      int32_t _11551_ = (int)0;
      int32_t _11552_ = (int)((_4991_idxs)->size(0));
      for (int32_t _5009_i = _11551_; _5009_i < _11552_; ++_5009_i)
      {
        {
          int32_t _11553_ = _ptr__4988_wi32[safe_add( _4981_ptr_base,_ptr__4991_idxs[_5009_i] )];
          int32_t _11554_ = _ptr__4988_wi32[safe_add( safe_add( _4981_ptr_base,_ptr__4991_idxs[_5009_i] ),(int)1 )];
          for (int32_t _5010_j = _11553_; _5010_j < _11554_; ++_5010_j)
          {
            {
              _ptr__5005_ri64[safe_add( _4998_rnidxs_base,_5008_knz )] = _ptr__4989_wi64[safe_add( _4983_nidxs_base,_5010_j )];
              _ptr__5006_rf64[safe_add( _4997_rcof_base,_5008_knz )] = _ptr__4990_wf64[safe_add( _4984_cof_base,_5010_j )];
              if ((_4995_rncodeatom > (int)0))
              {
                {
                  int32_t _11555_ = _ptr__4988_wi32[safe_add( _4986_codeptr,_5010_j )];
                  int32_t _11556_ = _ptr__4988_wi32[safe_add( safe_add( _4986_codeptr,_5010_j ),(int)1 )];
                  for (int32_t _5011_k = _11555_; _5011_k < _11556_; ++_5011_k)
                  {
                    {
                      _ptr__5004_ri32[safe_add( _5001_rcode,_5007_codei )] = _ptr__4988_wi32[safe_add( _4985_code,_5011_k )];
                      _ptr__5006_rf64[safe_add( _5003_rcconst,_5007_codei )] = _ptr__4990_wf64[safe_add( _4987_cconst,_5011_k )];
                      ++ _5007_codei;
                    }
                  }
                  _ptr__5004_ri32[safe_add( safe_add( _5002_rcodeptr,_5008_knz ),(int)1 )] = _5007_codei;
                }
              }
              {}
              ++ _5008_knz;
            }
          }
          _ptr__5004_ri32[safe_add( safe_add( _4999_rptr_base,_5009_i ),(int)1 )] = _5008_knz;
        }
      }
    }
  }
  else
  {
    {
      int32_t _5012_rnd = (int)1;
      int32_t _5013_rnelem = (int)((_4991_idxs)->size(0));
      int32_t _5014_rnnz = (int)0;
      int32_t _5015_rncodeatom = (int)0;
      std::shared_ptr< monty::ndarray< int64_t,1 > > _5016_idxs = mosek::fusion::p_ExprPick::_get_impl(::mosek::fusion::ExprPick::t(_pubthis))->idxs;
      _checked_ptr_1<int64_t> _ptr__5016_idxs(_5016_idxs ? _5016_idxs->raw() : nullptr,_5016_idxs ? _5016_idxs->size(0) : 0);
      int32_t _5017_tidxs = _4973_xs->alloci32((int)((_5016_idxs)->size(0)));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5018_xi32 = mosek::fusion::p_WorkStack::_get_impl(_4973_xs)->i32;
      _checked_ptr_1<int32_t> _ptr__5018_xi32(_5018_xi32 ? _5018_xi32->raw() : nullptr,_5018_xi32 ? _5018_xi32->size(0) : 0);
      int32_t _11557_ = (int)0;
      int32_t _11558_ = (int)((_5016_idxs)->size(0));
      for (int32_t _5019_i = _11557_; _5019_i < _11558_; ++_5019_i)
      {
        {
          int32_t _5020_b1 = _4977_nelem;
          int32_t _5021_b0 = (int)0;
          while ( (_5021_b0 < _5020_b1) )
          {
            {
              int32_t _5022_pi = (safe_add( _5020_b1,_5021_b0 ) / (int)2);
              if ((_ptr__4989_wi64[safe_add( _4982_sp_base,_5022_pi )] >= _ptr__5016_idxs[_5019_i]))
              {
                {
                  _5020_b1 = _5022_pi;
                }
              }
              else
              {
                {
                  _5021_b0 = safe_add( _5022_pi,(int)1 );
                }
              }
            }
          }
          if (((_5021_b0 < _4977_nelem) && (_ptr__4989_wi64[safe_add( _4982_sp_base,_5021_b0 )] == _ptr__5016_idxs[_5019_i])))
          {
            {
              _ptr__5018_xi32[safe_add( _5017_tidxs,_5019_i )] = _5021_b0;
              _5014_rnnz += (_ptr__4988_wi32[safe_add( safe_add( _4981_ptr_base,_5021_b0 ),(int)1 )] - _ptr__4988_wi32[safe_add( _4981_ptr_base,_5021_b0 )]);
              if ((_4979_ncodeatom > (int)0))
              {
                {
                  _5015_rncodeatom += (_ptr__4988_wi32[safe_add( _4986_codeptr,_ptr__4988_wi32[safe_add( safe_add( _4981_ptr_base,_ptr__5016_idxs[_5019_i] ),(int)1 )] )] - _ptr__4988_wi32[safe_add( _4986_codeptr,_ptr__4988_wi32[safe_add( _4981_ptr_base,_ptr__5016_idxs[_5019_i] )] )]);
                }
              }
              {}
            }
          }
          else
          {
            {
              _ptr__5018_xi32[safe_add( _5017_tidxs,_5019_i )] = (-(int)1);
            }
          }
        }
      }
      _4971_rs->alloc_expr(_5012_rnd,_5013_rnelem,_5014_rnnz,false,_5015_rncodeatom);
      int32_t _5023_rptr = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->ptr_base;
      int32_t _5024_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->nidxs_base;
      int32_t _5025_rcof = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->cof_base;
      int32_t _5026_rshape = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->shape_base;
      int32_t _5027_rcode = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->code_base;
      int32_t _5028_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->codeptr_base;
      int32_t _5029_rcconst = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5030_ri32 = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__5030_ri32(_5030_ri32 ? _5030_ri32->raw() : nullptr,_5030_ri32 ? _5030_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _5031_ri64 = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__5031_ri64(_5031_ri64 ? _5031_ri64->raw() : nullptr,_5031_ri64 ? _5031_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _5032_rf64 = mosek::fusion::p_WorkStack::_get_impl(_4971_rs)->f64;
      _checked_ptr_1<double> _ptr__5032_rf64(_5032_rf64 ? _5032_rf64->raw() : nullptr,_5032_rf64 ? _5032_rf64->size(0) : 0);
      _ptr__5030_ri32[_5026_rshape] = (int)((_5016_idxs)->size(0));
      _ptr__5030_ri32[_5023_rptr] = (int)0;
      if ((_5015_rncodeatom > (int)0))
      {
        {
          _ptr__5030_ri32[_5028_rcodeptr] = (int)0;
        }
      }
      {}
      int32_t _5033_codei = (int)0;
      int32_t _5034_k = (int)0;
      int32_t _11559_ = (int)0;
      int32_t _11560_ = (int)((_5016_idxs)->size(0));
      for (int32_t _5035_i = _11559_; _5035_i < _11560_; ++_5035_i)
      {
        {
          if ((_ptr__5018_xi32[safe_add( _5017_tidxs,_5035_i )] >= (int)0))
          {
            {
              int32_t _5036_b0 = _ptr__5018_xi32[safe_add( _5017_tidxs,_5035_i )];
              int32_t _11561_ = _ptr__4988_wi32[safe_add( _4981_ptr_base,_5036_b0 )];
              int32_t _11562_ = _ptr__4988_wi32[safe_add( safe_add( _4981_ptr_base,_5036_b0 ),(int)1 )];
              for (int32_t _5037_j = _11561_; _5037_j < _11562_; ++_5037_j)
              {
                {
                  _ptr__5031_ri64[safe_add( _5024_rnidxs,_5034_k )] = _ptr__4989_wi64[safe_add( _4983_nidxs_base,_5037_j )];
                  _ptr__5032_rf64[safe_add( _5025_rcof,_5034_k )] = _ptr__4990_wf64[safe_add( _4984_cof_base,_5037_j )];
                  if ((_5015_rncodeatom > (int)0))
                  {
                    {
                      int32_t _11563_ = _ptr__4988_wi32[safe_add( _4986_codeptr,_5037_j )];
                      int32_t _11564_ = _ptr__4988_wi32[safe_add( safe_add( _4986_codeptr,_5037_j ),(int)1 )];
                      for (int32_t _5038_l = _11563_; _5038_l < _11564_; ++_5038_l)
                      {
                        {
                          _ptr__5030_ri32[safe_add( _5027_rcode,_5033_codei )] = _ptr__4988_wi32[safe_add( _4985_code,_5038_l )];
                          _ptr__5032_rf64[safe_add( _5029_rcconst,_5033_codei )] = _ptr__4990_wf64[safe_add( _4987_cconst,_5038_l )];
                          ++ _5033_codei;
                        }
                      }
                      _ptr__5030_ri32[safe_add( safe_add( _5028_rcodeptr,_5034_k ),(int)1 )] = _5033_codei;
                    }
                  }
                  {}
                  ++ _5034_k;
                }
              }
            }
          }
          {}
          _ptr__5030_ri32[safe_add( safe_add( _5023_rptr,_5035_i ),(int)1 )] = _5034_k;
        }
      }
    }
  }
}
// End mosek.fusion.ExprPick.eval

// Begin mosek.fusion.ExprPick.toString
// Method mosek.fusion.ExprPick.toString @ bld/grindsted/final/default/src/fusion/ExprSlice.monty:208:6-62
std::string mosek::fusion::ExprPick :: toString() { return mosek::fusion::p_ExprPick::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprPick::toString()
{
  return std::string ("ExprPick()");
}
// End mosek.fusion.ExprPick.toString

void mosek::fusion::p_ExprPick::destroy()
{
  idxs.reset();
  expr.reset();
}
void mosek::fusion::ExprPick::destroy() { mosek::fusion::p_ExprPick::_get_impl(this)->destroy(); }
// } class ExprPick
// class ExprSlice { // @ bld/grindsted/final/default/src/fusion/ExprSlice.monty:4:4-183:5
mosek::fusion::ExprSlice::ExprSlice(mosek::fusion::p_ExprSlice *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprSlice()" << this << std::endl; */ }
mosek::fusion::ExprSlice::~ExprSlice() {  /* std::cout << "~ExprSlice()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprSlice::p_ExprSlice
  (::mosek::fusion::ExprSlice * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprSlice.ctor @ bld/grindsted/final/default/src/fusion/ExprSlice.monty:28:6-34:7
mosek::fusion::ExprSlice::t mosek::fusion::p_ExprSlice::_new_ExprSlice
  (monty::rc_ptr< ::mosek::fusion::Expression > _5039_expr,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5040_first,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5041_last)
{ return new mosek::fusion::ExprSlice(_5039_expr,_5040_first,_5041_last); }
mosek::fusion::ExprSlice::ExprSlice
  (monty::rc_ptr< ::mosek::fusion::Expression > _5039_expr,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5040_first,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5041_last) : 
   ExprSlice(new mosek::fusion::p_ExprSlice(this))
{ mosek::fusion::p_ExprSlice::_get_impl(this)->_initialize(_5039_expr,_5040_first,_5041_last); }
void mosek::fusion::p_ExprSlice::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _5039_expr,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5040_first,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5041_last)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__5040_first(_5040_first ? _5040_first->raw() : nullptr, _5040_first ? _5040_first->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__5041_last(_5041_last ? _5041_last->raw() : nullptr, _5041_last ? _5041_last->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(_5039_expr->__mosek_2fusion_2Expression__getModel(),::mosek::fusion::p_ExprSlice::makeShape(_5039_expr->getShape(),_5040_first,_5041_last));
    mosek::fusion::p_ExprSlice::_get_impl(::mosek::fusion::ExprSlice::t(_pubthis))->expr = _5039_expr;
    mosek::fusion::p_ExprSlice::_get_impl(::mosek::fusion::ExprSlice::t(_pubthis))->first = _5040_first;
    mosek::fusion::p_ExprSlice::_get_impl(::mosek::fusion::ExprSlice::t(_pubthis))->last = _5041_last;
  }
}
// mosek.fusion.ExprSlice.ctor

// Begin mosek.fusion.ExprSlice.eval
// Method mosek.fusion.ExprSlice.eval @ bld/grindsted/final/default/src/fusion/ExprSlice.monty:36:6-182:7
void mosek::fusion::ExprSlice :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5042_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5043_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5044_xs,bool _5045_cache_eval) { mosek::fusion::p_ExprSlice::_get_impl(this)->eval(_5042_rs,_5043_ws,_5044_xs,_5045_cache_eval); }
void mosek::fusion::p_ExprSlice::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5042_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5043_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5044_xs,bool _5045_cache_eval)
{
  expr->recursive_eval(_5043_ws,_5042_rs,_5044_xs,_5045_cache_eval);
  _5043_ws->pop_expr();
  int32_t _5046_nd = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->nd;
  int32_t _5047_nelem = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->nelem;
  int32_t _5048_nnz = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->nnz;
  int32_t _5049_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->ncodeatom;
  bool _5050_hassp = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->hassp;
  int32_t _5051_shape_base = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->shape_base;
  int32_t _5052_ptr_base = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->ptr_base;
  int32_t _5053_sp_base = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->sp_base;
  int32_t _5054_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->nidxs_base;
  int32_t _5055_cof_base = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->cof_base;
  int32_t _5056_code = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->code_base;
  int32_t _5057_codeptr = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->codeptr_base;
  int32_t _5058_cconst = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5059_wi32 = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__5059_wi32(_5059_wi32 ? _5059_wi32->raw() : nullptr,_5059_wi32 ? _5059_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5060_wi64 = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__5060_wi64(_5060_wi64 ? _5060_wi64->raw() : nullptr,_5060_wi64 ? _5060_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5061_wf64 = mosek::fusion::p_WorkStack::_get_impl(_5043_ws)->f64;
  _checked_ptr_1<double> _ptr__5061_wf64(_5061_wf64 ? _5061_wf64->raw() : nullptr,_5061_wf64 ? _5061_wf64->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5062_st = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_5046_nd)));
  _checked_ptr_1<int64_t> _ptr__5062_st(_5062_st ? _5062_st->raw() : nullptr,_5062_st ? _5062_st->size(0) : 0);
  _ptr__5062_st[(_5046_nd - (int)1)] = (int)1;
  int32_t _11565_ = (int)1;
  int32_t _11566_ = _5046_nd;
  for (int32_t _5063_i = _11565_; _5063_i < _11566_; ++_5063_i)
  {
    {
      _ptr__5062_st[((_5046_nd - _5063_i) - (int)1)] = safe_mul( _ptr__5062_st[(_5046_nd - _5063_i)],_ptr__5059_wi32[(safe_add( _5051_shape_base,_5046_nd ) - _5063_i)] );
    }
  }
  int32_t _5064_rncodeatom = (int)0;
  int32_t _5065_rnelem = (int)0;
  int32_t _5066_rnnz = (int)0;
  if (_5050_hassp)
  {
    {
      int32_t _11567_ = (int)0;
      int32_t _11568_ = _5047_nelem;
      for (int32_t _5067_i = _11567_; _5067_i < _11568_; ++_5067_i)
      {
        {
          bool _5068_in_bounds = true;
          int32_t _11569_ = (int)0;
          int32_t _11570_ = _5046_nd;
          for (int32_t _5069_j = _11569_; _5069_j < _11570_; ++_5069_j)
          {
            {
              int64_t _5070_kj = ((_ptr__5060_wi64[safe_add( _5053_sp_base,_5067_i )] / _ptr__5062_st[_5069_j]) % _ptr__5059_wi32[safe_add( _5051_shape_base,_5069_j )]);
              _5068_in_bounds = (_5068_in_bounds && ((_5070_kj >= ((*first)(_5069_j))) && (_5070_kj < ((*last)(_5069_j)))));
            }
          }
          if (_5068_in_bounds)
          {
            {
              _5066_rnnz += (_ptr__5059_wi32[safe_add( safe_add( _5052_ptr_base,_5067_i ),(int)1 )] - _ptr__5059_wi32[safe_add( _5052_ptr_base,_5067_i )]);
              if ((_5049_ncodeatom > (int)0))
              {
                {
                  _5064_rncodeatom += (_ptr__5059_wi32[safe_add( _5057_codeptr,_ptr__5059_wi32[safe_add( safe_add( _5052_ptr_base,_5067_i ),(int)1 )] )] - _ptr__5059_wi32[safe_add( _5057_codeptr,_ptr__5059_wi32[safe_add( _5052_ptr_base,_5067_i )] )]);
                }
              }
              {}
              ++ _5065_rnelem;
            }
          }
          {}
        }
      }
    }
  }
  else
  {
    {
      _5065_rnelem = (int)1;
      int32_t _11571_ = (int)0;
      int32_t _11572_ = _5046_nd;
      for (int32_t _5071_i = _11571_; _5071_i < _11572_; ++_5071_i)
      {
        {
          _5065_rnelem *= (((*last)(_5071_i)) - ((*first)(_5071_i)));
        }
      }
      int32_t _11573_ = (int)0;
      int32_t _11574_ = _5047_nelem;
      for (int32_t _5072_i = _11573_; _5072_i < _11574_; ++_5072_i)
      {
        {
          bool _5073_in_bounds = true;
          int32_t _11575_ = (int)0;
          int32_t _11576_ = _5046_nd;
          for (int32_t _5074_j = _11575_; _5074_j < _11576_; ++_5074_j)
          {
            {
              int64_t _5075_kj = ((_5072_i / _ptr__5062_st[_5074_j]) % _ptr__5059_wi32[safe_add( _5051_shape_base,_5074_j )]);
              _5073_in_bounds = (_5073_in_bounds && ((_5075_kj >= ((*first)(_5074_j))) && (_5075_kj < ((*last)(_5074_j)))));
            }
          }
          if (_5073_in_bounds)
          {
            {
              _5066_rnnz += (_ptr__5059_wi32[safe_add( safe_add( _5052_ptr_base,_5072_i ),(int)1 )] - _ptr__5059_wi32[safe_add( _5052_ptr_base,_5072_i )]);
              if ((_5049_ncodeatom > (int)0))
              {
                {
                  _5064_rncodeatom += (_ptr__5059_wi32[safe_add( _5057_codeptr,_ptr__5059_wi32[safe_add( safe_add( _5052_ptr_base,_5072_i ),(int)1 )] )] - _ptr__5059_wi32[safe_add( _5057_codeptr,_ptr__5059_wi32[safe_add( _5052_ptr_base,_5072_i )] )]);
                }
              }
              {}
            }
          }
          {}
        }
      }
    }
  }
  std::vector<int32_t> _11577_;
  for (int32_t _5077_i = (int)0, _11578_ = _5046_nd; _5077_i < _11578_ ; ++_5077_i)
  {
    _11577_.push_back((((*last)(_5077_i)) - ((*first)(_5077_i))));
  }
  auto _11579_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11577_.size()),_11577_.begin(),_11577_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5076_rshape = _11579_;
  _checked_ptr_1<int32_t> _ptr__5076_rshape(_5076_rshape ? _5076_rshape->raw() : nullptr,_5076_rshape ? _5076_rshape->size(0) : 0);
  bool _5078_rhassp = (_5065_rnelem < ::mosek::fusion::p_Set::size(_5076_rshape));
  _5042_rs->alloc_expr(_5046_nd,_5065_rnelem,_5066_rnnz,_5078_rhassp,_5064_rncodeatom);
  int32_t _5079_rshape_base = mosek::fusion::p_WorkStack::_get_impl(_5042_rs)->shape_base;
  int32_t _5080_rcof_base = mosek::fusion::p_WorkStack::_get_impl(_5042_rs)->cof_base;
  int32_t _5081_rnidx_base = mosek::fusion::p_WorkStack::_get_impl(_5042_rs)->nidxs_base;
  int32_t _11580_;
  bool _11581_ = _5078_rhassp;
  if (_11581_)
  {
    _11580_ = mosek::fusion::p_WorkStack::_get_impl(_5042_rs)->sp_base;
  }
  else
  {
    _11580_ = _5042_rs->alloci64(_5065_rnelem);
  }
  int32_t _5082_rsp_base = _11580_;
  int32_t _5083_rptr_base = mosek::fusion::p_WorkStack::_get_impl(_5042_rs)->ptr_base;
  int32_t _5084_rcode = mosek::fusion::p_WorkStack::_get_impl(_5042_rs)->code_base;
  int32_t _5085_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5042_rs)->codeptr_base;
  int32_t _5086_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5042_rs)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5087_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5042_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__5087_ri32(_5087_ri32 ? _5087_ri32->raw() : nullptr,_5087_ri32 ? _5087_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5088_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5042_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__5088_ri64(_5088_ri64 ? _5088_ri64->raw() : nullptr,_5088_ri64 ? _5088_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5089_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5042_rs)->f64;
  _checked_ptr_1<double> _ptr__5089_rf64(_5089_rf64 ? _5089_rf64->raw() : nullptr,_5089_rf64 ? _5089_rf64->size(0) : 0);
  int32_t _11582_ = (int)0;
  int32_t _11583_ = _5046_nd;
  for (int32_t _5090_i = _11582_; _5090_i < _11583_; ++_5090_i)
  {
    {
      _ptr__5087_ri32[safe_add( _5079_rshape_base,_5090_i )] = _ptr__5076_rshape[_5090_i];
    }
  }
  _ptr__5087_ri32[_5083_rptr_base] = (int)0;
  if ((_5064_rncodeatom > (int)0))
  {
    {
      _ptr__5087_ri32[_5085_rcodeptr] = (int)0;
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5091_rst = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_5046_nd)));
  _checked_ptr_1<int64_t> _ptr__5091_rst(_5091_rst ? _5091_rst->raw() : nullptr,_5091_rst ? _5091_rst->size(0) : 0);
  _ptr__5091_rst[(_5046_nd - (int)1)] = (int)1;
  int32_t _11584_ = (int)1;
  int32_t _11585_ = _5046_nd;
  for (int32_t _5092_j = _11584_; _5092_j < _11585_; ++_5092_j)
  {
    {
      _ptr__5091_rst[((_5046_nd - _5092_j) - (int)1)] = safe_mul( _ptr__5091_rst[(_5046_nd - _5092_j)],_ptr__5076_rshape[(_5046_nd - _5092_j)] );
    }
  }
  int32_t _5093_codei = (int)0;
  int32_t _5094_kelem = (int)0;
  int32_t _5095_knz = (int)0;
  if (_5050_hassp)
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5096_key = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5046_nd)));
      _checked_ptr_1<int32_t> _ptr__5096_key(_5096_key ? _5096_key->raw() : nullptr,_5096_key ? _5096_key->size(0) : 0);
      int32_t _11586_ = (int)0;
      int32_t _11587_ = _5047_nelem;
      for (int32_t _5097_i = _11586_; _5097_i < _11587_; ++_5097_i)
      {
        {
          bool _5098_in_bounds = true;
          int32_t _11588_ = (int)0;
          int32_t _11589_ = _5046_nd;
          for (int32_t _5099_j = _11588_; _5099_j < _11589_; ++_5099_j)
          {
            {
              _ptr__5096_key[_5099_j] = (int32_t)((_ptr__5060_wi64[safe_add( _5053_sp_base,_5097_i )] / _ptr__5062_st[_5099_j]) % _ptr__5059_wi32[safe_add( _5051_shape_base,_5099_j )]);
              _5098_in_bounds = (_5098_in_bounds && ((_ptr__5096_key[_5099_j] >= ((*first)(_5099_j))) && (_ptr__5096_key[_5099_j] < ((*last)(_5099_j)))));
            }
          }
          if (_5098_in_bounds)
          {
            {
              int32_t _11590_ = _ptr__5059_wi32[safe_add( _5052_ptr_base,_5097_i )];
              int32_t _11591_ = _ptr__5059_wi32[safe_add( safe_add( _5052_ptr_base,_5097_i ),(int)1 )];
              for (int32_t _5100_j = _11590_; _5100_j < _11591_; ++_5100_j)
              {
                {
                  _ptr__5088_ri64[safe_add( _5081_rnidx_base,_5095_knz )] = _ptr__5060_wi64[safe_add( _5054_nidxs_base,_5100_j )];
                  _ptr__5089_rf64[safe_add( _5080_rcof_base,_5095_knz )] = _ptr__5061_wf64[safe_add( _5055_cof_base,_5100_j )];
                  if ((_5064_rncodeatom > (int)0))
                  {
                    {
                      int32_t _11592_ = _ptr__5059_wi32[safe_add( _5057_codeptr,_5100_j )];
                      int32_t _11593_ = _ptr__5059_wi32[safe_add( safe_add( _5057_codeptr,_5100_j ),(int)1 )];
                      for (int32_t _5101_k = _11592_; _5101_k < _11593_; ++_5101_k)
                      {
                        {
                          _ptr__5087_ri32[safe_add( _5084_rcode,_5093_codei )] = _ptr__5059_wi32[safe_add( _5056_code,_5101_k )];
                          _ptr__5089_rf64[safe_add( _5086_rcconst,_5093_codei )] = _ptr__5061_wf64[safe_add( _5058_cconst,_5101_k )];
                          ++ _5093_codei;
                        }
                      }
                      _ptr__5087_ri32[safe_add( safe_add( _5085_rcodeptr,_5095_knz ),(int)1 )] = _5093_codei;
                    }
                  }
                  {}
                  ++ _5095_knz;
                }
              }
              int64_t _5102_newidx = (int64_t)0;
              int32_t _11594_ = (int)0;
              int32_t _11595_ = _5046_nd;
              for (int32_t _5103_j = _11594_; _5103_j < _11595_; ++_5103_j)
              {
                {
                  _5102_newidx += safe_mul( _ptr__5091_rst[_5103_j],(_ptr__5096_key[_5103_j] - ((*first)(_5103_j))) );
                }
              }
              _ptr__5088_ri64[safe_add( _5082_rsp_base,_5094_kelem )] = _5102_newidx;
              _ptr__5087_ri32[safe_add( safe_add( _5083_rptr_base,_5094_kelem ),(int)1 )] = _5095_knz;
              ++ _5094_kelem;
            }
          }
          {}
        }
      }
    }
  }
  else
  {
    {
      int32_t _11596_ = (int)0;
      int32_t _11597_ = _5047_nelem;
      for (int32_t _5104_i = _11596_; _5104_i < _11597_; ++_5104_i)
      {
        {
          bool _5105_in_bounds = true;
          int32_t _11598_ = (int)0;
          int32_t _11599_ = _5046_nd;
          for (int32_t _5106_j = _11598_; _5106_j < _11599_; ++_5106_j)
          {
            {
              int64_t _5107_kj = ((_5104_i / _ptr__5062_st[_5106_j]) % _ptr__5059_wi32[safe_add( _5051_shape_base,_5106_j )]);
              _5105_in_bounds = (_5105_in_bounds && ((_5107_kj >= ((*first)(_5106_j))) && (_5107_kj < ((*last)(_5106_j)))));
            }
          }
          if (_5105_in_bounds)
          {
            {
              int32_t _11600_ = _ptr__5059_wi32[safe_add( _5052_ptr_base,_5104_i )];
              int32_t _11601_ = _ptr__5059_wi32[safe_add( safe_add( _5052_ptr_base,_5104_i ),(int)1 )];
              for (int32_t _5108_j = _11600_; _5108_j < _11601_; ++_5108_j)
              {
                {
                  _ptr__5088_ri64[safe_add( _5081_rnidx_base,_5095_knz )] = _ptr__5060_wi64[safe_add( _5054_nidxs_base,_5108_j )];
                  _ptr__5089_rf64[safe_add( _5080_rcof_base,_5095_knz )] = _ptr__5061_wf64[safe_add( _5055_cof_base,_5108_j )];
                  if ((_5064_rncodeatom > (int)0))
                  {
                    {
                      int32_t _11602_ = _ptr__5059_wi32[safe_add( _5057_codeptr,_5108_j )];
                      int32_t _11603_ = _ptr__5059_wi32[safe_add( safe_add( _5057_codeptr,_5108_j ),(int)1 )];
                      for (int32_t _5109_k = _11602_; _5109_k < _11603_; ++_5109_k)
                      {
                        {
                          _ptr__5087_ri32[safe_add( _5084_rcode,_5093_codei )] = _ptr__5059_wi32[safe_add( _5056_code,_5109_k )];
                          _ptr__5089_rf64[safe_add( _5086_rcconst,_5093_codei )] = _ptr__5061_wf64[safe_add( _5058_cconst,_5109_k )];
                          ++ _5093_codei;
                        }
                      }
                      _ptr__5087_ri32[safe_add( safe_add( _5085_rcodeptr,_5095_knz ),(int)1 )] = _5093_codei;
                    }
                  }
                  {}
                  ++ _5095_knz;
                }
              }
              _ptr__5087_ri32[safe_add( safe_add( _5083_rptr_base,_5094_kelem ),(int)1 )] = _5095_knz;
              ++ _5094_kelem;
            }
          }
          {}
        }
      }
    }
  }
  if ((!_5078_rhassp))
  {
    {
      _5042_rs->popi64(_5065_rnelem);
    }
  }
  {}
}
// End mosek.fusion.ExprSlice.eval

// Begin mosek.fusion.ExprSlice.makeShape
// Method mosek.fusion.ExprSlice.makeShape @ bld/grindsted/final/default/src/fusion/ExprSlice.monty:17:6-24:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_ExprSlice::makeShape(std::shared_ptr< monty::ndarray< int32_t,1 > > _5110_shape,std::shared_ptr< monty::ndarray< int32_t,1 > > _5111_first,std::shared_ptr< monty::ndarray< int32_t,1 > > _5112_last)
{
  _checked_ptr_1<int32_t> _ptr__5110_shape(_5110_shape ? _5110_shape->raw() : nullptr, _5110_shape ? _5110_shape->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__5111_first(_5111_first ? _5111_first->raw() : nullptr, _5111_first ? _5111_first->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__5112_last(_5112_last ? _5112_last->raw() : nullptr, _5112_last ? _5112_last->size(0) : 0);
  if ((((int)((_5110_shape)->size(0)) != (int)((_5111_first)->size(0))) || ((int)((_5110_shape)->size(0)) != (int)((_5112_last)->size(0)))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Invalid or mismatching index lengths"));
    }
  }
  {}
  int32_t _11604_ = (int)0;
  int32_t _11605_ = (int)((_5110_shape)->size(0));
  for (int32_t _5113_i = _11604_; _5113_i < _11605_; ++_5113_i)
  {
    {
      if (((_ptr__5111_first[_5113_i] < (int)0) || ((_ptr__5112_last[_5113_i] < _ptr__5111_first[_5113_i]) || (_ptr__5112_last[_5113_i] > _ptr__5110_shape[_5113_i]))))
      {
        {
          throw ::mosek::fusion::IndexError(std::string ("Slice is out of bounds"));
        }
      }
      {}
    }
  }
  std::vector<int32_t> _11606_;
  for (int32_t _5114_i = (int)0, _11607_ = (int)((_5110_shape)->size(0)); _5114_i < _11607_ ; ++_5114_i)
  {
    _11606_.push_back((_ptr__5112_last[_5114_i] - _ptr__5111_first[_5114_i]));
  }
  auto _11608_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11606_.size()),_11606_.begin(),_11606_.end()));
  return _11608_;
}
// End mosek.fusion.ExprSlice.makeShape

// Begin mosek.fusion.ExprSlice.toString
// Method mosek.fusion.ExprSlice.toString @ bld/grindsted/final/default/src/fusion/ExprSlice.monty:9:6-15:7
std::string mosek::fusion::ExprSlice :: toString() { return mosek::fusion::p_ExprSlice::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprSlice::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _5115_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprSlice(["))->__mosek_2fusion_2Utils_2StringBuffer__a(((*first)((int)0)))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (":"))->__mosek_2fusion_2Utils_2StringBuffer__a(((*last)((int)0)));
  int32_t _11609_ = (int)1;
  int32_t _11610_ = (int)((first)->size(0));
  for (int32_t _5116_i = _11609_; _5116_i < _11610_; ++_5116_i)
  {
    {
      _5115_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*first)(_5116_i)))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (":"))->__mosek_2fusion_2Utils_2StringBuffer__a(((*last)(_5116_i)));
    }
  }
  _5115_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("],"))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"));
  return _5115_sb->toString();
}
// End mosek.fusion.ExprSlice.toString

void mosek::fusion::p_ExprSlice::destroy()
{
  last.reset();
  first.reset();
  expr.reset();
}
void mosek::fusion::ExprSlice::destroy() { mosek::fusion::p_ExprSlice::_get_impl(this)->destroy(); }
// } class ExprSlice
// class ExprPermuteDims { // @ bld/grindsted/final/default/src/fusion/ExprTranspose.monty:207:4-697:5
mosek::fusion::ExprPermuteDims::ExprPermuteDims(mosek::fusion::p_ExprPermuteDims *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprPermuteDims()" << this << std::endl; */ }
mosek::fusion::ExprPermuteDims::~ExprPermuteDims() {  /* std::cout << "~ExprPermuteDims()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprPermuteDims::p_ExprPermuteDims
  (::mosek::fusion::ExprPermuteDims * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprPermuteDims.ctor @ bld/grindsted/final/default/src/fusion/ExprTranspose.monty:221:6-238:7
mosek::fusion::ExprPermuteDims::t mosek::fusion::p_ExprPermuteDims::_new_ExprPermuteDims
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _5117_perm,
    monty::rc_ptr< ::mosek::fusion::Expression > _5118_expr)
{ return new mosek::fusion::ExprPermuteDims(_5117_perm,_5118_expr); }
mosek::fusion::ExprPermuteDims::ExprPermuteDims
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _5117_perm,
    monty::rc_ptr< ::mosek::fusion::Expression > _5118_expr) : 
   ExprPermuteDims(new mosek::fusion::p_ExprPermuteDims(this))
{ mosek::fusion::p_ExprPermuteDims::_get_impl(this)->_initialize(_5117_perm,_5118_expr); }
void mosek::fusion::p_ExprPermuteDims::_initialize  (std::shared_ptr< monty::ndarray< int32_t,1 > > _5117_perm,
    monty::rc_ptr< ::mosek::fusion::Expression > _5118_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__5117_perm(_5117_perm ? _5117_perm->raw() : nullptr, _5117_perm ? _5117_perm->size(0) : 0);
    mosek::fusion::p_ExprPermuteDims::_initialize(_5117_perm,_5118_expr,(int)1);
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5119_shape = _5118_expr->getShape();
    _checked_ptr_1<int32_t> _ptr__5119_shape(_5119_shape ? _5119_shape->raw() : nullptr,_5119_shape ? _5119_shape->size(0) : 0);
    if (((int)((_5117_perm)->size(0)) != (int)((_5119_shape)->size(0))))
    {
      {
        throw ::mosek::fusion::LengthError(std::string ("Invalid dimension permutation length"));
      }
    }
    {}
    std::vector<int32_t> _11611_;
    for (int32_t _5121_i = (int)0, _11612_ = (int)((_5117_perm)->size(0)); _5121_i < _11612_ ; ++_5121_i)
    {
      _11611_.push_back((int)0);
    }
    auto _11613_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11611_.size()),_11611_.begin(),_11611_.end()));
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5120_check = _11613_;
    _checked_ptr_1<int32_t> _ptr__5120_check(_5120_check ? _5120_check->raw() : nullptr,_5120_check ? _5120_check->size(0) : 0);
    int32_t _11614_ = (int)0;
    int32_t _11615_ = (int)((_5120_check)->size(0));
    for (int32_t _5122_i = _11614_; _5122_i < _11615_; ++_5122_i)
    {
      {
        if (((_ptr__5117_perm[_5122_i] < (int)0) || (_ptr__5117_perm[_5122_i] > (int)((_5119_shape)->size(0)))))
        {
          {
            throw ::mosek::fusion::LengthError(std::string ("Invalid dimension permutation index"));
          }
        }
        {}
        ++ _ptr__5120_check[_ptr__5117_perm[_5122_i]];
      }
    }
    int32_t _11616_ = (int)0;
    int32_t _11617_ = (int)((_5120_check)->size(0));
    for (int32_t _5123_i = _11616_; _5123_i < _11617_; ++_5123_i)
    {
      {
        if (((_ptr__5120_check[_5123_i] < (int)1) || (_ptr__5120_check[_5123_i] > (int)1)))
        {
          {
            throw ::mosek::fusion::LengthError(std::string ("Dimension permutation contains duplicates"));
          }
        }
        {}
      }
    }
  }
}
// mosek.fusion.ExprPermuteDims.ctor

// mosek.fusion.ExprPermuteDims.ctor @ bld/grindsted/final/default/src/fusion/ExprTranspose.monty:215:6-219:7
mosek::fusion::ExprPermuteDims::t mosek::fusion::p_ExprPermuteDims::_new_ExprPermuteDims
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _5124_perm,
    monty::rc_ptr< ::mosek::fusion::Expression > _5125_expr,
    int32_t _5126_validated)
{ return new mosek::fusion::ExprPermuteDims(_5124_perm,_5125_expr,_5126_validated); }
mosek::fusion::ExprPermuteDims::ExprPermuteDims
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _5124_perm,
    monty::rc_ptr< ::mosek::fusion::Expression > _5125_expr,
    int32_t _5126_validated) : 
   ExprPermuteDims(new mosek::fusion::p_ExprPermuteDims(this))
{ mosek::fusion::p_ExprPermuteDims::_get_impl(this)->_initialize(_5124_perm,_5125_expr,_5126_validated); }
void mosek::fusion::p_ExprPermuteDims::_initialize  (std::shared_ptr< monty::ndarray< int32_t,1 > > _5124_perm,
    monty::rc_ptr< ::mosek::fusion::Expression > _5125_expr,
    int32_t _5126_validated)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__5124_perm(_5124_perm ? _5124_perm->raw() : nullptr, _5124_perm ? _5124_perm->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(_5125_expr->__mosek_2fusion_2Expression__getModel(),::mosek::fusion::p_ExprPermuteDims::computeshape(_5124_perm,_5125_expr->getShape()));
    mosek::fusion::p_ExprPermuteDims::_get_impl(::mosek::fusion::ExprPermuteDims::t(_pubthis))->expr = _5125_expr;
    dperm = ::mosek::fusion::Utils::Tools::arraycopy(_5124_perm);
  }
}
// mosek.fusion.ExprPermuteDims.ctor

// Begin mosek.fusion.ExprPermuteDims.eval
// Method mosek.fusion.ExprPermuteDims.eval @ bld/grindsted/final/default/src/fusion/ExprTranspose.monty:240:6-355:7
void mosek::fusion::ExprPermuteDims :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5127_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5128_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5129_xs,bool _5130_cache_eval) { mosek::fusion::p_ExprPermuteDims::_get_impl(this)->eval(_5127_rs,_5128_ws,_5129_xs,_5130_cache_eval); }
void mosek::fusion::p_ExprPermuteDims::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5127_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5128_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5129_xs,bool _5130_cache_eval)
{
  expr->recursive_eval(_5128_ws,_5127_rs,_5129_xs,_5130_cache_eval);
  _5128_ws->pop_expr();
  int32_t _5131_nd = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->nd;
  int32_t _5132_nelem = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->nelem;
  int32_t _5133_nnz = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->nnz;
  int32_t _5134_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->ncodeatom;
  bool _5135_hassp = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->hassp;
  int32_t _5136_shape_base = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->shape_base;
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5137_stride = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_5131_nd)));
  _checked_ptr_1<int64_t> _ptr__5137_stride(_5137_stride ? _5137_stride->raw() : nullptr,_5137_stride ? _5137_stride->size(0) : 0);
  _ptr__5137_stride[(_5131_nd - (int)1)] = (int)1;
  int32_t _11618_ = (int)1;
  int32_t _11619_ = _5131_nd;
  for (int32_t _5138_i = _11618_; _5138_i < _11619_; ++_5138_i)
  {
    {
      _ptr__5137_stride[((_5131_nd - _5138_i) - (int)1)] = safe_mul( _ptr__5137_stride[(_5131_nd - _5138_i)],((*mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->i32)((safe_add( _5136_shape_base,_5131_nd ) - _5138_i))) );
    }
  }
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5139_dstride = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_5131_nd)));
  _checked_ptr_1<int64_t> _ptr__5139_dstride(_5139_dstride ? _5139_dstride->raw() : nullptr,_5139_dstride ? _5139_dstride->size(0) : 0);
  _ptr__5139_dstride[(_5131_nd - (int)1)] = (int)1;
  int32_t _11620_ = (int)1;
  int32_t _11621_ = _5131_nd;
  for (int32_t _5140_i = _11620_; _5140_i < _11621_; ++_5140_i)
  {
    {
      _ptr__5139_dstride[((_5131_nd - _5140_i) - (int)1)] = safe_mul( _ptr__5139_dstride[(_5131_nd - _5140_i)],((*mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->i32)(safe_add( _5136_shape_base,((*dperm)((_5131_nd - _5140_i))) ))) );
    }
  }
  int32_t _5141_eptr_base = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->ptr_base;
  int32_t _5142_esp_base = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->sp_base;
  int32_t _5143_enidxs_base = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->nidxs_base;
  int32_t _5144_ecof_base = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->cof_base;
  int32_t _5145_code = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->code_base;
  int32_t _5146_codeptr = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->codeptr_base;
  int32_t _5147_cconst = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5148_wi32 = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__5148_wi32(_5148_wi32 ? _5148_wi32->raw() : nullptr,_5148_wi32 ? _5148_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5149_wi64 = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__5149_wi64(_5149_wi64 ? _5149_wi64->raw() : nullptr,_5149_wi64 ? _5149_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5150_wf64 = mosek::fusion::p_WorkStack::_get_impl(_5128_ws)->f64;
  _checked_ptr_1<double> _ptr__5150_wf64(_5150_wf64 ? _5150_wf64->raw() : nullptr,_5150_wf64 ? _5150_wf64->size(0) : 0);
  _5127_rs->alloc_expr(_5131_nd,_5132_nelem,_5133_nnz,_5135_hassp,_5134_ncodeatom);
  int32_t _5151_rptr_base = mosek::fusion::p_WorkStack::_get_impl(_5127_rs)->ptr_base;
  int32_t _5152_rshape = mosek::fusion::p_WorkStack::_get_impl(_5127_rs)->shape_base;
  int32_t _5153_rnidxs_base = mosek::fusion::p_WorkStack::_get_impl(_5127_rs)->nidxs_base;
  int32_t _5154_rsp_base = mosek::fusion::p_WorkStack::_get_impl(_5127_rs)->sp_base;
  int32_t _5155_rcof_base = mosek::fusion::p_WorkStack::_get_impl(_5127_rs)->cof_base;
  int32_t _5156_rcode = mosek::fusion::p_WorkStack::_get_impl(_5127_rs)->code_base;
  int32_t _5157_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5127_rs)->codeptr_base;
  int32_t _5158_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5127_rs)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5159_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5127_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__5159_ri32(_5159_ri32 ? _5159_ri32->raw() : nullptr,_5159_ri32 ? _5159_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5160_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5127_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__5160_ri64(_5160_ri64 ? _5160_ri64->raw() : nullptr,_5160_ri64 ? _5160_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5161_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5127_rs)->f64;
  _checked_ptr_1<double> _ptr__5161_rf64(_5161_rf64 ? _5161_rf64->raw() : nullptr,_5161_rf64 ? _5161_rf64->size(0) : 0);
  int32_t _11622_ = (int)0;
  int32_t _11623_ = _5131_nd;
  for (int32_t _5162_i = _11622_; _5162_i < _11623_; ++_5162_i)
  {
    {
      _ptr__5159_ri32[safe_add( _5152_rshape,_5162_i )] = _ptr__5148_wi32[safe_add( _5136_shape_base,((*dperm)(_5162_i)) )];
    }
  }
  if (_5135_hassp)
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _5163_sp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_5132_nelem)));
      _checked_ptr_1<int64_t> _ptr__5163_sp(_5163_sp ? _5163_sp->raw() : nullptr,_5163_sp ? _5163_sp->size(0) : 0);
      {
        std::shared_ptr< monty::ndarray< int64_t,1 > > _5164_idx = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_5131_nd)));
        _checked_ptr_1<int64_t> _ptr__5164_idx(_5164_idx ? _5164_idx->raw() : nullptr,_5164_idx ? _5164_idx->size(0) : 0);
        int32_t _11624_ = (int)0;
        int32_t _11625_ = _5132_nelem;
        for (int32_t _5165_i = _11624_; _5165_i < _11625_; ++_5165_i)
        {
          {
            int64_t _5166_k = _ptr__5149_wi64[safe_add( _5142_esp_base,_5165_i )];
            int32_t _11626_ = (int)0;
            int32_t _11627_ = _5131_nd;
            for (int32_t _5167_j = _11626_; _5167_j < _11627_; ++_5167_j)
            {
              {
                _ptr__5164_idx[_5167_j] = (_5166_k / _ptr__5137_stride[_5167_j]);
                _5166_k %= _ptr__5137_stride[_5167_j];
              }
            }
            int64_t _5168_p = _ptr__5164_idx[((*dperm)((int)0))];
            int32_t _11628_ = (int)1;
            int32_t _11629_ = _5131_nd;
            for (int32_t _5169_j = _11628_; _5169_j < _11629_; ++_5169_j)
            {
              {
                _5168_p = safe_add( safe_mul( _5168_p,_ptr__5159_ri32[safe_add( _5152_rshape,_5169_j )] ),_ptr__5164_idx[((*dperm)(_5169_j))] );
              }
            }
            _ptr__5163_sp[_5165_i] = _5168_p;
          }
        }
      }
      std::vector<int64_t> _11630_;
      for (int32_t _5171_i = (int)0, _11631_ = _5132_nelem; _5171_i < _11631_ ; ++_5171_i)
      {
        _11630_.push_back(_5171_i);
      }
      auto _11632_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_11630_.size()),_11630_.begin(),_11630_.end()));
      std::shared_ptr< monty::ndarray< int64_t,1 > > _5170_perm = _11632_;
      _checked_ptr_1<int64_t> _ptr__5170_perm(_5170_perm ? _5170_perm->raw() : nullptr,_5170_perm ? _5170_perm->size(0) : 0);
      ::mosek::fusion::p_CommonTools::argQsort(_5170_perm,_5163_sp,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),(int64_t)((int)0),(int64_t)(_5132_nelem));
      _ptr__5159_ri32[_5151_rptr_base] = (int)0;
      if ((_5134_ncodeatom > (int)0))
      {
        {
          _ptr__5159_ri32[_5157_rcodeptr] = (int)0;
        }
      }
      {}
      int32_t _5172_codei = (int)0;
      int32_t _5173_kelem = (int)0;
      int32_t _5174_knz = (int)0;
      int32_t _11633_ = (int)0;
      int32_t _11634_ = _5132_nelem;
      for (int32_t _5175_i = _11633_; _5175_i < _11634_; ++_5175_i)
      {
        {
          int64_t _5176_ii = _ptr__5170_perm[_5175_i];
          int32_t _11635_ = _ptr__5148_wi32[safe_add( _5141_eptr_base,_5176_ii )];
          int32_t _11636_ = _ptr__5148_wi32[safe_add( safe_add( _5141_eptr_base,_5176_ii ),(int)1 )];
          for (int32_t _5177_j = _11635_; _5177_j < _11636_; ++_5177_j)
          {
            {
              _ptr__5160_ri64[safe_add( _5153_rnidxs_base,_5174_knz )] = _ptr__5149_wi64[safe_add( _5143_enidxs_base,_5177_j )];
              _ptr__5161_rf64[safe_add( _5155_rcof_base,_5174_knz )] = _ptr__5150_wf64[safe_add( _5144_ecof_base,_5177_j )];
              if ((_5134_ncodeatom > (int)0))
              {
                {
                  int32_t _11637_ = _ptr__5148_wi32[safe_add( _5146_codeptr,_5177_j )];
                  int32_t _11638_ = _ptr__5148_wi32[safe_add( safe_add( _5146_codeptr,_5177_j ),(int)1 )];
                  for (int32_t _5178_l = _11637_; _5178_l < _11638_; ++_5178_l)
                  {
                    {
                      _ptr__5159_ri32[safe_add( _5156_rcode,_5172_codei )] = _ptr__5148_wi32[safe_add( _5145_code,_5178_l )];
                      _ptr__5161_rf64[safe_add( _5158_rcconst,_5172_codei )] = _ptr__5150_wf64[safe_add( _5147_cconst,_5178_l )];
                      ++ _5172_codei;
                    }
                  }
                  _ptr__5159_ri32[safe_add( safe_add( _5157_rcodeptr,_5174_knz ),(int)1 )] = _5172_codei;
                }
              }
              {}
              ++ _5174_knz;
            }
          }
          _ptr__5160_ri64[safe_add( _5154_rsp_base,_5175_i )] = _ptr__5163_sp[_5176_ii];
          ++ _5173_kelem;
          _ptr__5159_ri32[safe_add( safe_add( _5151_rptr_base,_5175_i ),(int)1 )] = _5174_knz;
        }
      }
    }
  }
  else
  {
    {
      _ptr__5159_ri32[_5151_rptr_base] = (int)0;
      if ((_5134_ncodeatom > (int)0))
      {
        {
          _ptr__5159_ri32[_5157_rcodeptr] = (int)0;
        }
      }
      {}
      int32_t _5179_codei = (int)0;
      int32_t _5180_kelem = (int)0;
      int32_t _5181_knz = (int)0;
      int32_t _11639_ = (int)0;
      int32_t _11640_ = _5132_nelem;
      for (int32_t _5182_i = _11639_; _5182_i < _11640_; ++_5182_i)
      {
        {
          int64_t _5183_ii = (int64_t)0;
          int64_t _5184_k = _5182_i;
          int32_t _11641_ = (int)0;
          int32_t _11642_ = _5131_nd;
          for (int32_t _5185_j = _11641_; _5185_j < _11642_; ++_5185_j)
          {
            {
              _5183_ii += safe_mul( (_5184_k / _ptr__5139_dstride[_5185_j]),_ptr__5137_stride[((*dperm)(_5185_j))] );
              _5184_k %= _ptr__5139_dstride[_5185_j];
            }
          }
          int32_t _11643_ = _ptr__5148_wi32[safe_add( _5141_eptr_base,_5183_ii )];
          int32_t _11644_ = _ptr__5148_wi32[safe_add( safe_add( _5141_eptr_base,_5183_ii ),(int)1 )];
          for (int32_t _5186_j = _11643_; _5186_j < _11644_; ++_5186_j)
          {
            {
              _ptr__5160_ri64[safe_add( _5153_rnidxs_base,_5181_knz )] = _ptr__5149_wi64[safe_add( _5143_enidxs_base,_5186_j )];
              _ptr__5161_rf64[safe_add( _5155_rcof_base,_5181_knz )] = _ptr__5150_wf64[safe_add( _5144_ecof_base,_5186_j )];
              if ((_5134_ncodeatom > (int)0))
              {
                {
                  int32_t _11645_ = _ptr__5148_wi32[safe_add( _5146_codeptr,_5186_j )];
                  int32_t _11646_ = _ptr__5148_wi32[safe_add( safe_add( _5146_codeptr,_5186_j ),(int)1 )];
                  for (int32_t _5187_l = _11645_; _5187_l < _11646_; ++_5187_l)
                  {
                    {
                      _ptr__5159_ri32[safe_add( _5156_rcode,_5179_codei )] = _ptr__5148_wi32[safe_add( _5145_code,_5187_l )];
                      _ptr__5161_rf64[safe_add( _5158_rcconst,_5179_codei )] = _ptr__5150_wf64[safe_add( _5147_cconst,_5187_l )];
                      ++ _5179_codei;
                    }
                  }
                  _ptr__5159_ri32[safe_add( safe_add( _5157_rcodeptr,_5181_knz ),(int)1 )] = _5179_codei;
                }
              }
              {}
              ++ _5181_knz;
            }
          }
          ++ _5180_kelem;
          _ptr__5159_ri32[safe_add( _5151_rptr_base,_5180_kelem )] = _5181_knz;
        }
      }
    }
  }
}
// End mosek.fusion.ExprPermuteDims.eval

// Begin mosek.fusion.ExprPermuteDims.computeshape
// Method mosek.fusion.ExprPermuteDims.computeshape @ bld/grindsted/final/default/src/fusion/ExprTranspose.monty:211:6-213:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_ExprPermuteDims::computeshape(std::shared_ptr< monty::ndarray< int32_t,1 > > _5188_perm,std::shared_ptr< monty::ndarray< int32_t,1 > > _5189_shape)
{
  _checked_ptr_1<int32_t> _ptr__5188_perm(_5188_perm ? _5188_perm->raw() : nullptr, _5188_perm ? _5188_perm->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__5189_shape(_5189_shape ? _5189_shape->raw() : nullptr, _5189_shape ? _5189_shape->size(0) : 0);
  std::vector<int32_t> _11647_;
  for (int32_t _5190_i = (int)0, _11648_ = (int)((_5188_perm)->size(0)); _5190_i < _11648_ ; ++_5190_i)
  {
    _11647_.push_back(_ptr__5189_shape[_ptr__5188_perm[_5190_i]]);
  }
  auto _11649_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11647_.size()),_11647_.begin(),_11647_.end()));
  return _11649_;
}
// End mosek.fusion.ExprPermuteDims.computeshape

void mosek::fusion::p_ExprPermuteDims::destroy()
{
  dperm.reset();
  expr.reset();
}
void mosek::fusion::ExprPermuteDims::destroy() { mosek::fusion::p_ExprPermuteDims::_get_impl(this)->destroy(); }
// } class ExprPermuteDims
// class ExprTranspose { // @ bld/grindsted/final/default/src/fusion/ExprTranspose.monty:4:4-199:5
mosek::fusion::ExprTranspose::ExprTranspose(mosek::fusion::p_ExprTranspose *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprTranspose()" << this << std::endl; */ }
mosek::fusion::ExprTranspose::~ExprTranspose() {  /* std::cout << "~ExprTranspose()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprTranspose::p_ExprTranspose
  (::mosek::fusion::ExprTranspose * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprTranspose.ctor @ bld/grindsted/final/default/src/fusion/ExprTranspose.monty:18:6-21:7
mosek::fusion::ExprTranspose::t mosek::fusion::p_ExprTranspose::_new_ExprTranspose
  (monty::rc_ptr< ::mosek::fusion::Expression > _5191_expr)
{ return new mosek::fusion::ExprTranspose(_5191_expr); }
mosek::fusion::ExprTranspose::ExprTranspose
  (monty::rc_ptr< ::mosek::fusion::Expression > _5191_expr) : 
   ExprTranspose(new mosek::fusion::p_ExprTranspose(this))
{ mosek::fusion::p_ExprTranspose::_get_impl(this)->_initialize(_5191_expr); }
void mosek::fusion::p_ExprTranspose::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _5191_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_5191_expr->__mosek_2fusion_2Expression__getModel(),::mosek::fusion::p_ExprTranspose::transposeShape(_5191_expr->getShape()));
    mosek::fusion::p_ExprTranspose::_get_impl(::mosek::fusion::ExprTranspose::t(_pubthis))->expr = _5191_expr;
  }
}
// mosek.fusion.ExprTranspose.ctor

// Begin mosek.fusion.ExprTranspose.eval
// Method mosek.fusion.ExprTranspose.eval @ bld/grindsted/final/default/src/fusion/ExprTranspose.monty:23:6-149:7
void mosek::fusion::ExprTranspose :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5192_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5193_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5194_xs,bool _5195_cache_eval) { mosek::fusion::p_ExprTranspose::_get_impl(this)->eval(_5192_rs,_5193_ws,_5194_xs,_5195_cache_eval); }
void mosek::fusion::p_ExprTranspose::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5192_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5193_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5194_xs,bool _5195_cache_eval)
{
  monty::rc_ptr< ::mosek::fusion::Expression > _11650_ = expr;
  if (false) {}
  else if (nullptr != dynamic_cast<::mosek::fusion::ExprTranspose*>(_11650_.get()))
  {
    ::mosek::fusion::ExprTranspose::t _5196_e (dynamic_cast<::mosek::fusion::ExprTranspose*>(_11650_.get()));
    {
      mosek::fusion::p_ExprTranspose::_get_impl(_5196_e)->expr->recursive_eval(_5192_rs,_5193_ws,_5194_xs,_5195_cache_eval);
    }
  }
  else
  {
    mosek::fusion::Expression::t _5197_expr = _11650_;
    {
      _5197_expr->recursive_eval(_5193_ws,_5192_rs,_5194_xs,_5195_cache_eval);
      _5193_ws->pop_expr();
      if ((mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->nd != (int)2))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions"));
        }
      }
      else
      {
        {
          int32_t _5198_shape_base = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->shape_base;
          int32_t _5199_nelem = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->nelem;
          int32_t _5200_nnz = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->nnz;
          bool _5201_hassp = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->hassp;
          int32_t _5202_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->ncodeatom;
          int32_t _5203_eptr_base = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->ptr_base;
          int32_t _5204_esp_base = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->sp_base;
          int32_t _5205_enidx_base = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->nidxs_base;
          int32_t _5206_ecof_base = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->cof_base;
          int32_t _5207_code = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->code_base;
          int32_t _5208_codeptr = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->codeptr_base;
          int32_t _5209_cconst = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->cconst_base;
          int32_t _5210_dim0 = ((*mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->i32)(_5198_shape_base));
          int32_t _5211_dim1 = ((*mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->i32)(safe_add( _5198_shape_base,(int)1 )));
          std::shared_ptr< monty::ndarray< int32_t,1 > > _5212_wi32 = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->i32;
          _checked_ptr_1<int32_t> _ptr__5212_wi32(_5212_wi32 ? _5212_wi32->raw() : nullptr,_5212_wi32 ? _5212_wi32->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _5213_wi64 = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->i64;
          _checked_ptr_1<int64_t> _ptr__5213_wi64(_5213_wi64 ? _5213_wi64->raw() : nullptr,_5213_wi64 ? _5213_wi64->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _5214_wf64 = mosek::fusion::p_WorkStack::_get_impl(_5193_ws)->f64;
          _checked_ptr_1<double> _ptr__5214_wf64(_5214_wf64 ? _5214_wf64->raw() : nullptr,_5214_wf64 ? _5214_wf64->size(0) : 0);
          _5192_rs->alloc_expr((int)2,_5199_nelem,_5200_nnz,_5201_hassp,_5202_ncodeatom);
          int32_t _5215_rptr_base = mosek::fusion::p_WorkStack::_get_impl(_5192_rs)->ptr_base;
          int32_t _5216_rnidx_base = mosek::fusion::p_WorkStack::_get_impl(_5192_rs)->nidxs_base;
          int32_t _5217_rsp_base = mosek::fusion::p_WorkStack::_get_impl(_5192_rs)->sp_base;
          int32_t _5218_rcof_base = mosek::fusion::p_WorkStack::_get_impl(_5192_rs)->cof_base;
          int32_t _5219_rshape_base = mosek::fusion::p_WorkStack::_get_impl(_5192_rs)->shape_base;
          int32_t _5220_rcode = mosek::fusion::p_WorkStack::_get_impl(_5192_rs)->code_base;
          int32_t _5221_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5192_rs)->codeptr_base;
          int32_t _5222_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5192_rs)->cconst_base;
          std::shared_ptr< monty::ndarray< int32_t,1 > > _5223_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5192_rs)->i32;
          _checked_ptr_1<int32_t> _ptr__5223_ri32(_5223_ri32 ? _5223_ri32->raw() : nullptr,_5223_ri32 ? _5223_ri32->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _5224_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5192_rs)->i64;
          _checked_ptr_1<int64_t> _ptr__5224_ri64(_5224_ri64 ? _5224_ri64->raw() : nullptr,_5224_ri64 ? _5224_ri64->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _5225_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5192_rs)->f64;
          _checked_ptr_1<double> _ptr__5225_rf64(_5225_rf64 ? _5225_rf64->raw() : nullptr,_5225_rf64 ? _5225_rf64->size(0) : 0);
          _ptr__5223_ri32[_5219_rshape_base] = _5211_dim1;
          _ptr__5223_ri32[safe_add( _5219_rshape_base,(int)1 )] = _5210_dim0;
          _ptr__5223_ri32[_5215_rptr_base] = (int)0;
          if ((_5202_ncodeatom > (int)0))
          {
            {
              _ptr__5223_ri32[_5221_rcodeptr] = (int)0;
            }
          }
          {}
          if (_5201_hassp)
          {
            {
              int32_t _5226_perm = _5194_xs->alloci32(_5199_nelem);
              int32_t _5227_ptr = _5194_xs->alloci32(safe_add( _5211_dim1,(int)1 ));
              std::shared_ptr< monty::ndarray< int32_t,1 > > _5228_xi32 = mosek::fusion::p_WorkStack::_get_impl(_5194_xs)->i32;
              _checked_ptr_1<int32_t> _ptr__5228_xi32(_5228_xi32 ? _5228_xi32->raw() : nullptr,_5228_xi32 ? _5228_xi32->size(0) : 0);
              {
                int32_t _11651_ = (int)0;
                int32_t _11652_ = safe_add( _5211_dim1,(int)1 );
                for (int32_t _5229_i = _11651_; _5229_i < _11652_; ++_5229_i)
                {
                  {
                    _ptr__5228_xi32[safe_add( _5227_ptr,_5229_i )] = (int)0;
                  }
                }
                int32_t _11653_ = (int)0;
                int32_t _11654_ = _5199_nelem;
                for (int32_t _5230_i = _11653_; _5230_i < _11654_; ++_5230_i)
                {
                  {
                    ++ _ptr__5228_xi32[safe_add( safe_add( _5227_ptr,(_ptr__5213_wi64[safe_add( _5204_esp_base,_5230_i )] % _5211_dim1) ),(int)1 )];
                  }
                }
                int32_t _11655_ = (int)0;
                int32_t _11656_ = _5211_dim1;
                for (int32_t _5231_i = _11655_; _5231_i < _11656_; ++_5231_i)
                {
                  {
                    _ptr__5228_xi32[safe_add( safe_add( _5227_ptr,_5231_i ),(int)1 )] += _ptr__5228_xi32[safe_add( _5227_ptr,_5231_i )];
                  }
                }
                int32_t _11657_ = (int)0;
                int32_t _11658_ = _5199_nelem;
                for (int32_t _5232_i = _11657_; _5232_i < _11658_; ++_5232_i)
                {
                  {
                    int64_t _5233_j = (_ptr__5213_wi64[safe_add( _5204_esp_base,_5232_i )] % _5211_dim1);
                    _ptr__5228_xi32[safe_add( _5226_perm,_ptr__5228_xi32[safe_add( _5227_ptr,_5233_j )] )] = _5232_i;
                    ++ _ptr__5228_xi32[safe_add( _5227_ptr,_5233_j )];
                  }
                }
                _ptr__5223_ri32[_5215_rptr_base] = (int)0;
                int32_t _5234_codei = (int)0;
                int32_t _5235_p = (int)0;
                int32_t _11659_ = (int)0;
                int32_t _11660_ = _5199_nelem;
                for (int32_t _5236_i = _11659_; _5236_i < _11660_; ++_5236_i)
                {
                  {
                    int32_t _5237_j = _ptr__5228_xi32[safe_add( _5226_perm,_5236_i )];
                    int32_t _11661_ = _ptr__5212_wi32[safe_add( _5203_eptr_base,_5237_j )];
                    int32_t _11662_ = _ptr__5212_wi32[safe_add( safe_add( _5203_eptr_base,_5237_j ),(int)1 )];
                    for (int32_t _5238_k = _11661_; _5238_k < _11662_; ++_5238_k)
                    {
                      {
                        _ptr__5224_ri64[safe_add( _5216_rnidx_base,_5235_p )] = _ptr__5213_wi64[safe_add( _5205_enidx_base,_5238_k )];
                        _ptr__5225_rf64[safe_add( _5218_rcof_base,_5235_p )] = _ptr__5214_wf64[safe_add( _5206_ecof_base,_5238_k )];
                        if ((_5202_ncodeatom > (int)0))
                        {
                          {
                            int32_t _11663_ = _ptr__5212_wi32[safe_add( _5208_codeptr,_5238_k )];
                            int32_t _11664_ = _ptr__5212_wi32[safe_add( safe_add( _5208_codeptr,_5238_k ),(int)1 )];
                            for (int32_t _5239_l = _11663_; _5239_l < _11664_; ++_5239_l)
                            {
                              {
                                _ptr__5223_ri32[safe_add( _5220_rcode,_5234_codei )] = _ptr__5212_wi32[safe_add( _5207_code,_5239_l )];
                                _ptr__5225_rf64[safe_add( _5222_rcconst,_5234_codei )] = _ptr__5214_wf64[safe_add( _5209_cconst,_5239_l )];
                                ++ _5234_codei;
                              }
                            }
                            _ptr__5223_ri32[safe_add( safe_add( _5221_rcodeptr,_5235_p ),(int)1 )] = _5234_codei;
                          }
                        }
                        {}
                        ++ _5235_p;
                      }
                    }
                    int64_t _5240_ii = (_ptr__5213_wi64[safe_add( _5204_esp_base,_5237_j )] / _5211_dim1);
                    int64_t _5241_jj = (_ptr__5213_wi64[safe_add( _5204_esp_base,_5237_j )] % _5211_dim1);
                    _ptr__5223_ri32[safe_add( safe_add( _5215_rptr_base,_5236_i ),(int)1 )] = _5235_p;
                    _ptr__5224_ri64[safe_add( _5217_rsp_base,_5236_i )] = safe_add( safe_mul( _5241_jj,_5210_dim0 ),_5240_ii );
                  }
                }
              }
            }
          }
          else
          {
            {
              _ptr__5223_ri32[_5215_rptr_base] = (int)0;
              int32_t _5242_codei = (int)0;
              int32_t _5243_rinz = (int)0;
              int32_t _5244_wi = (int)0;
              int32_t _11665_ = (int)0;
              int32_t _11666_ = _5211_dim1;
              for (int32_t _5245_i = _11665_; _5245_i < _11666_; ++_5245_i)
              {
                {
                  int32_t _11667_ = (int)0;
                  int32_t _11668_ = _5210_dim0;
                  for (int32_t _5246_j = _11667_; _5246_j < _11668_; ++_5246_j)
                  {
                    {
                      int32_t _5247_p = safe_add( safe_mul( _5246_j,_5211_dim1 ),_5245_i );
                      int32_t _11669_ = _ptr__5212_wi32[safe_add( _5203_eptr_base,_5247_p )];
                      int32_t _11670_ = _ptr__5212_wi32[safe_add( safe_add( _5203_eptr_base,_5247_p ),(int)1 )];
                      for (int32_t _5248_k = _11669_; _5248_k < _11670_; ++_5248_k)
                      {
                        {
                          _ptr__5224_ri64[safe_add( _5216_rnidx_base,_5243_rinz )] = _ptr__5213_wi64[safe_add( _5205_enidx_base,_5248_k )];
                          _ptr__5225_rf64[safe_add( _5218_rcof_base,_5243_rinz )] = _ptr__5214_wf64[safe_add( _5206_ecof_base,_5248_k )];
                          if ((_5202_ncodeatom > (int)0))
                          {
                            {
                              int32_t _11671_ = _ptr__5212_wi32[safe_add( _5208_codeptr,_5248_k )];
                              int32_t _11672_ = _ptr__5212_wi32[safe_add( safe_add( _5208_codeptr,_5248_k ),(int)1 )];
                              for (int32_t _5249_l = _11671_; _5249_l < _11672_; ++_5249_l)
                              {
                                {
                                  _ptr__5223_ri32[safe_add( _5220_rcode,_5242_codei )] = _ptr__5212_wi32[safe_add( _5207_code,_5249_l )];
                                  _ptr__5225_rf64[safe_add( _5222_rcconst,_5242_codei )] = _ptr__5214_wf64[safe_add( _5209_cconst,_5249_l )];
                                  ++ _5242_codei;
                                }
                              }
                              _ptr__5223_ri32[safe_add( safe_add( _5221_rcodeptr,_5243_rinz ),(int)1 )] = _5242_codei;
                            }
                          }
                          {}
                          ++ _5243_rinz;
                        }
                      }
                      _ptr__5223_ri32[safe_add( safe_add( _5215_rptr_base,_5244_wi ),(int)1 )] = _5243_rinz;
                      ++ _5244_wi;
                    }
                  }
                }
              }
            }
          }
          _5194_xs->clear();
        }
      }
    }
  }
}
// End mosek.fusion.ExprTranspose.eval

// Begin mosek.fusion.ExprTranspose.toString
// Method mosek.fusion.ExprTranspose.toString @ bld/grindsted/final/default/src/fusion/ExprTranspose.monty:14:6-16:7
std::string mosek::fusion::ExprTranspose :: toString() { return mosek::fusion::p_ExprTranspose::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprTranspose::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprTranspose("))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprTranspose.toString

// Begin mosek.fusion.ExprTranspose.transposeShape
// Method mosek.fusion.ExprTranspose.transposeShape @ bld/grindsted/final/default/src/fusion/ExprTranspose.monty:7:6-12:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_ExprTranspose::transposeShape(std::shared_ptr< monty::ndarray< int32_t,1 > > _5250_shape)
{
  _checked_ptr_1<int32_t> _ptr__5250_shape(_5250_shape ? _5250_shape->raw() : nullptr, _5250_shape ? _5250_shape->size(0) : 0);
  if (((int)((_5250_shape)->size(0)) != (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions"));
    }
  }
  else
  {
    {
      return std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_ptr__5250_shape[(int)1]),(int32_t)(_ptr__5250_shape[(int)0])});
    }
  }
}
// End mosek.fusion.ExprTranspose.transposeShape

void mosek::fusion::p_ExprTranspose::destroy()
{
  expr.reset();
}
void mosek::fusion::ExprTranspose::destroy() { mosek::fusion::p_ExprTranspose::_get_impl(this)->destroy(); }
// } class ExprTranspose
// class ExprRepeat { // @ bld/grindsted/final/default/src/fusion/ExprStack.monty:520:4-835:5
mosek::fusion::ExprRepeat::ExprRepeat(mosek::fusion::p_ExprRepeat *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprRepeat()" << this << std::endl; */ }
mosek::fusion::ExprRepeat::~ExprRepeat() {  /* std::cout << "~ExprRepeat()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprRepeat::p_ExprRepeat
  (::mosek::fusion::ExprRepeat * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprRepeat.ctor @ bld/grindsted/final/default/src/fusion/ExprStack.monty:544:6-549:7
mosek::fusion::ExprRepeat::t mosek::fusion::p_ExprRepeat::_new_ExprRepeat
  (monty::rc_ptr< ::mosek::fusion::Expression > _5251_expr,
    int32_t _5252_dim,
    int32_t _5253_n)
{ return new mosek::fusion::ExprRepeat(_5251_expr,_5252_dim,_5253_n); }
mosek::fusion::ExprRepeat::ExprRepeat
  (monty::rc_ptr< ::mosek::fusion::Expression > _5251_expr,
    int32_t _5252_dim,
    int32_t _5253_n) : 
   ExprRepeat(new mosek::fusion::p_ExprRepeat(this))
{ mosek::fusion::p_ExprRepeat::_get_impl(this)->_initialize(_5251_expr,_5252_dim,_5253_n); }
void mosek::fusion::p_ExprRepeat::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _5251_expr,
    int32_t _5252_dim,
    int32_t _5253_n)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_5251_expr->__mosek_2fusion_2Expression__getModel(),::mosek::fusion::p_ExprRepeat::getshape(_5251_expr,_5252_dim,_5253_n));
    mosek::fusion::p_ExprRepeat::_get_impl(::mosek::fusion::ExprRepeat::t(_pubthis))->expr = _5251_expr;
    mosek::fusion::p_ExprRepeat::_get_impl(::mosek::fusion::ExprRepeat::t(_pubthis))->dim = _5252_dim;
    mosek::fusion::p_ExprRepeat::_get_impl(::mosek::fusion::ExprRepeat::t(_pubthis))->n = _5253_n;
  }
}
// mosek.fusion.ExprRepeat.ctor

// Begin mosek.fusion.ExprRepeat.eval
// Method mosek.fusion.ExprRepeat.eval @ bld/grindsted/final/default/src/fusion/ExprStack.monty:551:6-680:7
void mosek::fusion::ExprRepeat :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5254_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5255_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5256_xs,bool _5257_cache_eval) { mosek::fusion::p_ExprRepeat::_get_impl(this)->eval(_5254_rs,_5255_ws,_5256_xs,_5257_cache_eval); }
void mosek::fusion::p_ExprRepeat::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5254_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5255_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5256_xs,bool _5257_cache_eval)
{
  expr->recursive_eval(_5255_ws,_5254_rs,_5256_xs,_5257_cache_eval);
  _5255_ws->pop_expr();
  int32_t _5258_nd = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->nd;
  int32_t _5259_shape = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->shape_base;
  int32_t _5260_nelem = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->nelem;
  int32_t _5261_nnz = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->nnz;
  int32_t _5262_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->ncodeatom;
  bool _5263_hassp = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->hassp;
  int32_t _5264_ptr = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->ptr_base;
  int32_t _5265_sp = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->sp_base;
  int32_t _5266_nidxs = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->nidxs_base;
  int32_t _5267_cof = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->cof_base;
  int32_t _5268_code = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->code_base;
  int32_t _5269_codeptr = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->codeptr_base;
  int32_t _5270_cconst = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5271_wi32 = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__5271_wi32(_5271_wi32 ? _5271_wi32->raw() : nullptr,_5271_wi32 ? _5271_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5272_wi64 = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__5272_wi64(_5272_wi64 ? _5272_wi64->raw() : nullptr,_5272_wi64 ? _5272_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5273_wf64 = mosek::fusion::p_WorkStack::_get_impl(_5255_ws)->f64;
  _checked_ptr_1<double> _ptr__5273_wf64(_5273_wf64 ? _5273_wf64->raw() : nullptr,_5273_wf64 ? _5273_wf64->size(0) : 0);
  int32_t _11673_;
  bool _11674_ = (dim < _5258_nd);
  if (_11674_)
  {
    _11673_ = _5258_nd;
  }
  else
  {
    _11673_ = safe_add( _5258_nd,(int)1 );
  }
  int32_t _5274_rnd = _11673_;
  int32_t _5275_rnelem = safe_mul( _5260_nelem,n );
  int32_t _5276_rnnz = safe_mul( _5261_nnz,n );
  int32_t _5277_rncodeatom = safe_mul( _5262_ncodeatom,n );
  _5254_rs->alloc_expr(_5274_rnd,_5275_rnelem,_5276_rnnz,_5263_hassp,_5277_rncodeatom);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5278_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5254_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__5278_ri32(_5278_ri32 ? _5278_ri32->raw() : nullptr,_5278_ri32 ? _5278_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5279_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5254_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__5279_ri64(_5279_ri64 ? _5279_ri64->raw() : nullptr,_5279_ri64 ? _5279_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5280_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5254_rs)->f64;
  _checked_ptr_1<double> _ptr__5280_rf64(_5280_rf64 ? _5280_rf64->raw() : nullptr,_5280_rf64 ? _5280_rf64->size(0) : 0);
  int32_t _5281_rshape = mosek::fusion::p_WorkStack::_get_impl(_5254_rs)->shape_base;
  int32_t _5282_rptr = mosek::fusion::p_WorkStack::_get_impl(_5254_rs)->ptr_base;
  int32_t _5283_rsp = mosek::fusion::p_WorkStack::_get_impl(_5254_rs)->sp_base;
  int32_t _5284_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_5254_rs)->nidxs_base;
  int32_t _5285_rcof = mosek::fusion::p_WorkStack::_get_impl(_5254_rs)->cof_base;
  int32_t _5286_rcode = mosek::fusion::p_WorkStack::_get_impl(_5254_rs)->code_base;
  int32_t _5287_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5254_rs)->codeptr_base;
  int32_t _5288_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5254_rs)->cconst_base;
  int32_t _5289_d0 = (int)1;
  int32_t _11675_ = (int)0;
  int32_t _11676_ = dim;
  for (int32_t _5290_i = _11675_; _5290_i < _11676_; ++_5290_i)
  {
    {
      _5289_d0 *= _ptr__5271_wi32[safe_add( _5259_shape,_5290_i )];
    }
  }
  int32_t _11677_;
  bool _11678_ = (dim < _5258_nd);
  if (_11678_)
  {
    _11677_ = _ptr__5271_wi32[safe_add( _5259_shape,dim )];
  }
  else
  {
    _11677_ = (int)1;
  }
  int32_t _5291_d1 = _11677_;
  int32_t _5292_rd1 = safe_mul( n,_5291_d1 );
  int32_t _5293_d2 = (int)1;
  int32_t _11679_ = safe_add( dim,(int)1 );
  int32_t _11680_ = _5258_nd;
  for (int32_t _5294_i = _11679_; _5294_i < _11680_; ++_5294_i)
  {
    {
      _5293_d2 *= _ptr__5271_wi32[safe_add( _5259_shape,_5294_i )];
    }
  }
  {
    int32_t _11681_ = (int)0;
    int32_t _11682_ = _5258_nd;
    for (int32_t _5295_i = _11681_; _5295_i < _11682_; ++_5295_i)
    {
      {
        _ptr__5278_ri32[safe_add( _5281_rshape,_5295_i )] = _ptr__5271_wi32[safe_add( _5259_shape,_5295_i )];
      }
    }
    _ptr__5278_ri32[safe_add( _5281_rshape,dim )] = _5292_rd1;
    _ptr__5278_ri32[_5282_rptr] = (int)0;
    if ((_5277_rncodeatom != (int)0))
    {
      {
        _ptr__5278_ri32[_5287_rcodeptr] = (int)0;
      }
    }
    {}
    if (_5263_hassp)
    {
      {
        int32_t _5296_codei = (int)0;
        int32_t _5297_ni = (int)0;
        int32_t _5298_ei = (int)0;
        int32_t _5299_elmi = (int)0;
        int32_t _5300_nzi = (int)0;
        while ( (_5298_ei < _5260_nelem) )
        {
          {
            int64_t _5301_nidx = _ptr__5272_wi64[safe_add( _5265_sp,_5298_ei )];
            int64_t _5302_ninext = safe_add( (_5301_nidx - (_5301_nidx % safe_mul( _5291_d1,_5293_d2 ))),safe_mul( _5291_d1,_5293_d2 ) );
            int32_t _5303_eb = _5298_ei;
            ++ _5298_ei;
            while ( ((_5298_ei < _5260_nelem) && (_ptr__5272_wi64[safe_add( _5265_sp,_5298_ei )] < _5302_ninext)) )
            {
              {
                ++ _5298_ei;
              }
            }
            int32_t _5304_ee = _5298_ei;
            int32_t _11683_ = (int)0;
            int32_t _11684_ = n;
            for (int32_t _5305_i = _11683_; _5305_i < _11684_; ++_5305_i)
            {
              {
                int32_t _11685_ = _5303_eb;
                int32_t _11686_ = _5304_ee;
                for (int32_t _5306_j = _11685_; _5306_j < _11686_; ++_5306_j)
                {
                  {
                    int64_t _5307_i0 = (_ptr__5272_wi64[safe_add( _5265_sp,_5306_j )] / safe_mul( _5291_d1,_5293_d2 ));
                    int64_t _5308_i1 = ((_ptr__5272_wi64[safe_add( _5265_sp,_5306_j )] / _5293_d2) % _5291_d1);
                    int64_t _5309_i2 = (_ptr__5272_wi64[safe_add( _5265_sp,_5306_j )] % _5293_d2);
                    int32_t _11687_ = _ptr__5271_wi32[safe_add( _5264_ptr,_5306_j )];
                    int32_t _11688_ = _ptr__5271_wi32[safe_add( safe_add( _5264_ptr,_5306_j ),(int)1 )];
                    for (int32_t _5310_k = _11687_; _5310_k < _11688_; ++_5310_k)
                    {
                      {
                        _ptr__5279_ri64[safe_add( _5284_rnidxs,_5300_nzi )] = _ptr__5272_wi64[safe_add( _5266_nidxs,_5310_k )];
                        _ptr__5280_rf64[safe_add( _5285_rcof,_5300_nzi )] = _ptr__5273_wf64[safe_add( _5267_cof,_5310_k )];
                        if ((_5262_ncodeatom > (int)0))
                        {
                          {
                            int32_t _11689_ = _ptr__5271_wi32[safe_add( _5269_codeptr,_5310_k )];
                            int32_t _11690_ = _ptr__5271_wi32[safe_add( safe_add( _5269_codeptr,_5310_k ),(int)1 )];
                            for (int32_t _5311_l = _11689_; _5311_l < _11690_; ++_5311_l)
                            {
                              {
                                _ptr__5278_ri32[safe_add( _5286_rcode,_5296_codei )] = _ptr__5271_wi32[safe_add( _5268_code,_5311_l )];
                                _ptr__5280_rf64[safe_add( _5288_rcconst,_5296_codei )] = _ptr__5273_wf64[safe_add( _5270_cconst,_5311_l )];
                                ++ _5296_codei;
                              }
                            }
                            _ptr__5278_ri32[safe_add( safe_add( _5287_rcodeptr,_5300_nzi ),(int)1 )] = _5296_codei;
                          }
                        }
                        {}
                        ++ _5300_nzi;
                      }
                    }
                    _ptr__5278_ri32[safe_add( safe_add( _5282_rptr,_5299_elmi ),(int)1 )] = _5300_nzi;
                    _ptr__5279_ri64[safe_add( _5283_rsp,_5299_elmi )] = safe_add( safe_mul( safe_add( safe_add( safe_mul( _5307_i0,_5292_rd1 ),safe_mul( _5305_i,_5291_d1 ) ),_5308_i1 ),_5293_d2 ),_5309_i2 );
                    ++ _5299_elmi;
                  }
                }
              }
            }
          }
        }
      }
    }
    else
    {
      {
        int32_t _5312_codei = (int)0;
        int32_t _5313_elmi = (int)0;
        int32_t _5314_nzi = (int)0;
        int32_t _5315_p0 = (int)0;
        int32_t _11691_ = (int)0;
        int32_t _11692_ = _5289_d0;
        for (int32_t _5316_i0 = _11691_; _5316_i0 < _11692_; ++_5316_i0)
        {
          {
            int32_t _11693_ = (int)0;
            int32_t _11694_ = n;
            for (int32_t _5317_i1 = _11693_; _5317_i1 < _11694_; ++_5317_i1)
            {
              {
                int32_t _5318_p = safe_mul( safe_mul( _5316_i0,_5291_d1 ),_5293_d2 );
                int32_t _11695_ = (int)0;
                int32_t _11696_ = safe_mul( _5291_d1,_5293_d2 );
                for (int32_t _5319_i2 = _11695_; _5319_i2 < _11696_; ++_5319_i2)
                {
                  {
                    int32_t _11697_ = _ptr__5271_wi32[safe_add( _5264_ptr,_5318_p )];
                    int32_t _11698_ = _ptr__5271_wi32[safe_add( safe_add( _5264_ptr,_5318_p ),(int)1 )];
                    for (int32_t _5320_k = _11697_; _5320_k < _11698_; ++_5320_k)
                    {
                      {
                        _ptr__5279_ri64[safe_add( _5284_rnidxs,_5314_nzi )] = _ptr__5272_wi64[safe_add( _5266_nidxs,_5320_k )];
                        _ptr__5280_rf64[safe_add( _5285_rcof,_5314_nzi )] = _ptr__5273_wf64[safe_add( _5267_cof,_5320_k )];
                        if ((_5262_ncodeatom > (int)0))
                        {
                          {
                            int32_t _11699_ = _ptr__5271_wi32[safe_add( _5269_codeptr,_5320_k )];
                            int32_t _11700_ = _ptr__5271_wi32[safe_add( safe_add( _5269_codeptr,_5320_k ),(int)1 )];
                            for (int32_t _5321_l = _11699_; _5321_l < _11700_; ++_5321_l)
                            {
                              {
                                _ptr__5278_ri32[safe_add( _5286_rcode,_5312_codei )] = _ptr__5271_wi32[safe_add( _5268_code,_5321_l )];
                                _ptr__5280_rf64[safe_add( _5288_rcconst,_5312_codei )] = _ptr__5273_wf64[safe_add( _5270_cconst,_5321_l )];
                                ++ _5312_codei;
                              }
                            }
                            _ptr__5278_ri32[safe_add( safe_add( _5287_rcodeptr,_5314_nzi ),(int)1 )] = _5312_codei;
                          }
                        }
                        {}
                        ++ _5314_nzi;
                      }
                    }
                    _ptr__5278_ri32[safe_add( safe_add( _5282_rptr,_5313_elmi ),(int)1 )] = _5314_nzi;
                    ++ _5313_elmi;
                    ++ _5318_p;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
// End mosek.fusion.ExprRepeat.eval

// Begin mosek.fusion.ExprRepeat.getshape
// Method mosek.fusion.ExprRepeat.getshape @ bld/grindsted/final/default/src/fusion/ExprStack.monty:529:6-542:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_ExprRepeat::getshape(monty::rc_ptr< ::mosek::fusion::Expression > _5322_e,int32_t _5323_dim,int32_t _5324_n)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5325_shape_ = _5322_e->getShape();
  _checked_ptr_1<int32_t> _ptr__5325_shape_(_5325_shape_ ? _5325_shape_->raw() : nullptr,_5325_shape_ ? _5325_shape_->size(0) : 0);
  int32_t _5326_nd = (int)((_5325_shape_)->size(0));
  if ((_5323_dim < _5326_nd))
  {
    {
      _ptr__5325_shape_[_5323_dim] *= _5324_n;
      return _5325_shape_;
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _11701_;
      bool _11702_ = (_5323_dim == _5326_nd);
      if (_11702_)
      {
        _11701_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _5326_nd,(int)1 ))));
      }
      else
      {
        _11701_ = _5325_shape_;
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5327_shape = _11701_;
      _checked_ptr_1<int32_t> _ptr__5327_shape(_5327_shape ? _5327_shape->raw() : nullptr,_5327_shape ? _5327_shape->size(0) : 0);
      int32_t _11703_ = (int)0;
      int32_t _11704_ = _5326_nd;
      for (int32_t _5328_i = _11703_; _5328_i < _11704_; ++_5328_i)
      {
        {
          _ptr__5327_shape[_5328_i] = _ptr__5325_shape_[_5328_i];
        }
      }
      _ptr__5327_shape[_5323_dim] = _5324_n;
      return _5327_shape;
    }
  }
}
// End mosek.fusion.ExprRepeat.getshape

// Begin mosek.fusion.ExprRepeat.toString
// Method mosek.fusion.ExprRepeat.toString @ bld/grindsted/final/default/src/fusion/ExprStack.monty:525:6-527:7
std::string mosek::fusion::ExprRepeat :: toString() { return mosek::fusion::p_ExprRepeat::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprRepeat::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprRepeat(dim="))->__mosek_2fusion_2Utils_2StringBuffer__a(dim)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprRepeat.toString

void mosek::fusion::p_ExprRepeat::destroy()
{
  expr.reset();
}
void mosek::fusion::ExprRepeat::destroy() { mosek::fusion::p_ExprRepeat::_get_impl(this)->destroy(); }
// } class ExprRepeat
// class ExprStack { // @ bld/grindsted/final/default/src/fusion/ExprStack.monty:4:4-516:5
mosek::fusion::ExprStack::ExprStack(mosek::fusion::p_ExprStack *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprStack()" << this << std::endl; */ }
mosek::fusion::ExprStack::~ExprStack() {  /* std::cout << "~ExprStack()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprStack::p_ExprStack
  (::mosek::fusion::ExprStack * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprStack.ctor @ bld/grindsted/final/default/src/fusion/ExprStack.monty:49:6-53:7
mosek::fusion::ExprStack::t mosek::fusion::p_ExprStack::_new_ExprStack
  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _5329_exprs,
    int32_t _5330_dim)
{ return new mosek::fusion::ExprStack(_5329_exprs,_5330_dim); }
mosek::fusion::ExprStack::ExprStack
  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _5329_exprs,
    int32_t _5330_dim) : 
   ExprStack(new mosek::fusion::p_ExprStack(this))
{ mosek::fusion::p_ExprStack::_get_impl(this)->_initialize(_5329_exprs,_5330_dim); }
void mosek::fusion::p_ExprStack::_initialize  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _5329_exprs,
    int32_t _5330_dim)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(::mosek::fusion::p_BaseExpression::modelFrom(_5329_exprs),::mosek::fusion::p_ExprStack::getshape(_5329_exprs,_5330_dim));
    std::vector<monty::rc_ptr< ::mosek::fusion::Expression >> _11705_;
    for (int32_t _5331_i = (int)0, _11706_ = (int)((_5329_exprs)->size(0)); _5331_i < _11706_ ; ++_5331_i)
    {
      _11705_.push_back(((*_5329_exprs)(_5331_i)));
    }
    auto _11707_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >(monty::shape(_11705_.size()),_11705_.begin(),_11705_.end()));
    mosek::fusion::p_ExprStack::_get_impl(::mosek::fusion::ExprStack::t(_pubthis))->exprs = _11707_;
    mosek::fusion::p_ExprStack::_get_impl(::mosek::fusion::ExprStack::t(_pubthis))->dim = _5330_dim;
  }
}
// mosek.fusion.ExprStack.ctor

// Begin mosek.fusion.ExprStack.eval
// Method mosek.fusion.ExprStack.eval @ bld/grindsted/final/default/src/fusion/ExprStack.monty:55:6-390:7
void mosek::fusion::ExprStack :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5332_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5333_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5334_xs,bool _5335_cache_eval) { mosek::fusion::p_ExprStack::_get_impl(this)->eval(_5332_rs,_5333_ws,_5334_xs,_5335_cache_eval); }
void mosek::fusion::p_ExprStack::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5332_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5333_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5334_xs,bool _5335_cache_eval)
{
  int32_t _5336_n = (int)((exprs)->size(0));
  if ((_5336_n == (int)1))
  {
    {
      ((*exprs)((int)0))->recursive_eval(_5332_rs,_5333_ws,_5334_xs,_5335_cache_eval);
    }
  }
  else
  {
    {
      int32_t _11708_ = (int)0;
      int32_t _11709_ = _5336_n;
      for (int32_t _5337_i = _11708_; _5337_i < _11709_; ++_5337_i)
      {
        {
          ((*exprs)(((_5336_n - _5337_i) - (int)1)))->recursive_eval(_5333_ws,_5332_rs,_5334_xs,_5335_cache_eval);
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5338_nds = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5338_nds(_5338_nds ? _5338_nds->raw() : nullptr,_5338_nds ? _5338_nds->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5339_shape_base = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5339_shape_base(_5339_shape_base ? _5339_shape_base->raw() : nullptr,_5339_shape_base ? _5339_shape_base->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5340_nelem = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5340_nelem(_5340_nelem ? _5340_nelem->raw() : nullptr,_5340_nelem ? _5340_nelem->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5341_nnz = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5341_nnz(_5341_nnz ? _5341_nnz->raw() : nullptr,_5341_nnz ? _5341_nnz->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5342_ncodeatom = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5342_ncodeatom(_5342_ncodeatom ? _5342_ncodeatom->raw() : nullptr,_5342_ncodeatom ? _5342_ncodeatom->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5343_hassp = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5343_hassp(_5343_hassp ? _5343_hassp->raw() : nullptr,_5343_hassp ? _5343_hassp->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5344_ptr_base = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5344_ptr_base(_5344_ptr_base ? _5344_ptr_base->raw() : nullptr,_5344_ptr_base ? _5344_ptr_base->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5345_nidxs_base = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5345_nidxs_base(_5345_nidxs_base ? _5345_nidxs_base->raw() : nullptr,_5345_nidxs_base ? _5345_nidxs_base->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5346_sp_base = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5346_sp_base(_5346_sp_base ? _5346_sp_base->raw() : nullptr,_5346_sp_base ? _5346_sp_base->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5347_cof_base = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5347_cof_base(_5347_cof_base ? _5347_cof_base->raw() : nullptr,_5347_cof_base ? _5347_cof_base->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5348_code = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5348_code(_5348_code ? _5348_code->raw() : nullptr,_5348_code ? _5348_code->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5349_codeptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5349_codeptr(_5349_codeptr ? _5349_codeptr->raw() : nullptr,_5349_codeptr ? _5349_codeptr->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5350_cconst = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5350_cconst(_5350_cconst ? _5350_cconst->raw() : nullptr,_5350_cconst ? _5350_cconst->size(0) : 0);
      int32_t _11710_ = (int)0;
      int32_t _11711_ = _5336_n;
      for (int32_t _5351_i = _11710_; _5351_i < _11711_; ++_5351_i)
      {
        {
          _5333_ws->pop_expr();
          _ptr__5338_nds[_5351_i] = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->nd;
          _ptr__5339_shape_base[_5351_i] = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->shape_base;
          _ptr__5340_nelem[_5351_i] = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->nelem;
          _ptr__5341_nnz[_5351_i] = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->nnz;
          _ptr__5342_ncodeatom[_5351_i] = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->ncodeatom;
          int32_t _11712_;
          bool _11713_ = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->hassp;
          if (_11713_)
          {
            _11712_ = (int)1;
          }
          else
          {
            _11712_ = (int)0;
          }
          _ptr__5343_hassp[_5351_i] = _11712_;
          _ptr__5344_ptr_base[_5351_i] = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->ptr_base;
          _ptr__5346_sp_base[_5351_i] = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->sp_base;
          _ptr__5345_nidxs_base[_5351_i] = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->nidxs_base;
          _ptr__5347_cof_base[_5351_i] = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->cof_base;
          _ptr__5348_code[_5351_i] = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->code_base;
          _ptr__5349_codeptr[_5351_i] = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->codeptr_base;
          _ptr__5350_cconst[_5351_i] = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->cconst_base;
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5352_wi32 = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->i32;
      _checked_ptr_1<int32_t> _ptr__5352_wi32(_5352_wi32 ? _5352_wi32->raw() : nullptr,_5352_wi32 ? _5352_wi32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _5353_wi64 = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->i64;
      _checked_ptr_1<int64_t> _ptr__5353_wi64(_5353_wi64 ? _5353_wi64->raw() : nullptr,_5353_wi64 ? _5353_wi64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _5354_wf64 = mosek::fusion::p_WorkStack::_get_impl(_5333_ws)->f64;
      _checked_ptr_1<double> _ptr__5354_wf64(_5354_wf64 ? _5354_wf64->raw() : nullptr,_5354_wf64 ? _5354_wf64->size(0) : 0);
      int32_t _5355_nd = _ptr__5338_nds[(int)0];
      int32_t _5356_shape = _ptr__5339_shape_base[(int)0];
      bool _5357_dense = (_ptr__5343_hassp[(int)0] == (int)0);
      bool _5358_mismatching_dims = false;
      int32_t _11714_ = (int)1;
      int32_t _11715_ = _5336_n;
      for (int32_t _5359_i = _11714_; _5359_i < _11715_; ++_5359_i)
      {
        {
          _5358_mismatching_dims = (_5358_mismatching_dims || ((dim != _5359_i) && (_ptr__5338_nds[_5359_i] != _5355_nd)));
          if ((!_5358_mismatching_dims))
          {
            {
              int32_t _11716_ = (int)0;
              int32_t _11717_ = dim;
              for (int32_t _5360_j = _11716_; _5360_j < _11717_; ++_5360_j)
              {
                {
                  _5358_mismatching_dims = (_5358_mismatching_dims || (_ptr__5352_wi32[safe_add( _5356_shape,_5360_j )] != _ptr__5352_wi32[safe_add( _ptr__5339_shape_base[_5359_i],_5360_j )]));
                }
              }
            }
          }
          {}
          if ((!_5358_mismatching_dims))
          {
            {
              int32_t _11718_ = safe_add( dim,(int)1 );
              int32_t _11719_ = _5355_nd;
              for (int32_t _5361_j = _11718_; _5361_j < _11719_; ++_5361_j)
              {
                {
                  _5358_mismatching_dims = (_5358_mismatching_dims || (_ptr__5352_wi32[safe_add( _5356_shape,_5361_j )] != _ptr__5352_wi32[safe_add( _ptr__5339_shape_base[_5359_i],_5361_j )]));
                }
              }
            }
          }
          {}
          _5357_dense = (_5357_dense && ((int)0 == _ptr__5343_hassp[_5359_i]));
        }
      }
      if (_5358_mismatching_dims)
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Mismatching expression dimensions"));
        }
      }
      {}
      int32_t _5362_sdim = (int)0;
      if ((dim < _5355_nd))
      {
        {
          int32_t _11720_ = (int)0;
          int32_t _11721_ = _5336_n;
          for (int32_t _5363_i = _11720_; _5363_i < _11721_; ++_5363_i)
          {
            {
              _5362_sdim += _ptr__5352_wi32[safe_add( _ptr__5339_shape_base[_5363_i],dim )];
            }
          }
        }
      }
      else
      {
        {
          _5362_sdim = _5336_n;
        }
      }
      int32_t _11722_;
      bool _11723_ = (dim < _5355_nd);
      if (_11723_)
      {
        _11722_ = _5355_nd;
      }
      else
      {
        _11722_ = safe_add( _5355_nd,(int)1 );
      }
      int32_t _5364_rnd = _11722_;
      if ((_5364_rnd != _pubthis->getND()))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Mismatching dimensions"));
        }
      }
      {}
      int32_t _5365_rncodeatom = (int)0;
      int32_t _5366_rnelem = (int)0;
      int32_t _5367_rnnz = (int)0;
      bool _5368_parameterized = false;
      {
        int32_t _11724_ = (int)0;
        int32_t _11725_ = _5336_n;
        for (int32_t _5369_i = _11724_; _5369_i < _11725_; ++_5369_i)
        {
          {
            _5368_parameterized = (_5368_parameterized || (_ptr__5342_ncodeatom[_5369_i] > (int)0));
          }
        }
        int32_t _11726_ = (int)0;
        int32_t _11727_ = _5336_n;
        for (int32_t _5370_i = _11726_; _5370_i < _11727_; ++_5370_i)
        {
          {
            _5367_rnnz += _ptr__5341_nnz[_5370_i];
          }
        }
        int32_t _11728_ = (int)0;
        int32_t _11729_ = _5336_n;
        for (int32_t _5371_i = _11728_; _5371_i < _11729_; ++_5371_i)
        {
          {
            _5366_rnelem += _ptr__5340_nelem[_5371_i];
          }
        }
        if (_5368_parameterized)
        {
          {
            int32_t _11730_ = (int)0;
            int32_t _11731_ = _5336_n;
            for (int32_t _5372_i = _11730_; _5372_i < _11731_; ++_5372_i)
            {
              {
                int32_t _11732_;
                bool _11733_ = (_ptr__5342_ncodeatom[_5372_i] > (int)0);
                if (_11733_)
                {
                  _11732_ = _ptr__5342_ncodeatom[_5372_i];
                }
                else
                {
                  _11732_ = _ptr__5341_nnz[_5372_i];
                }
                _5365_rncodeatom += _11732_;
              }
            }
          }
        }
        {}
      }
      int32_t _5373_d0 = (int)1;
      int32_t _11734_ = (int)0;
      int32_t _11735_ = dim;
      for (int32_t _5374_i = _11734_; _5374_i < _11735_; ++_5374_i)
      {
        {
          _5373_d0 *= _ptr__5352_wi32[safe_add( _5356_shape,_5374_i )];
        }
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _11736_;
      bool _11737_ = (dim < _5355_nd);
      if (_11737_)
      {
        std::vector<int32_t> _11738_;
        for (int32_t _5376_i = (int)0, _11739_ = _5336_n; _5376_i < _11739_ ; ++_5376_i)
        {
          _11738_.push_back(_ptr__5352_wi32[safe_add( _ptr__5339_shape_base[_5376_i],dim )]);
        }
        auto _11740_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11738_.size()),_11738_.begin(),_11738_.end()));
        _11736_ = _11740_;
      }
      else
      {
        std::vector<int32_t> _11741_;
        for (int32_t _5377_i = (int)0, _11742_ = _5336_n; _5377_i < _11742_ ; ++_5377_i)
        {
          _11741_.push_back((int)1);
        }
        auto _11743_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_11741_.size()),_11741_.begin(),_11741_.end()));
        _11736_ = _11743_;
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5375_d1s = _11736_;
      _checked_ptr_1<int32_t> _ptr__5375_d1s(_5375_d1s ? _5375_d1s->raw() : nullptr,_5375_d1s ? _5375_d1s->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5378_offset = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5336_n)));
      _checked_ptr_1<int32_t> _ptr__5378_offset(_5378_offset ? _5378_offset->raw() : nullptr,_5378_offset ? _5378_offset->size(0) : 0);
      _ptr__5378_offset[(int)0] = (int)0;
      int32_t _11744_ = (int)1;
      int32_t _11745_ = _5336_n;
      for (int32_t _5379_i = _11744_; _5379_i < _11745_; ++_5379_i)
      {
        {
          _ptr__5378_offset[_5379_i] = safe_add( _ptr__5378_offset[(_5379_i - (int)1)],_ptr__5375_d1s[(_5379_i - (int)1)] );
        }
      }
      int32_t _5380_d1 = (int)0;
      int32_t _11746_ = (int)0;
      int32_t _11747_ = _5336_n;
      for (int32_t _5381_i = _11746_; _5381_i < _11747_; ++_5381_i)
      {
        {
          _5380_d1 += _ptr__5375_d1s[_5381_i];
        }
      }
      int32_t _5382_d2 = (int)1;
      int32_t _11748_ = safe_add( dim,(int)1 );
      int32_t _11749_ = _5355_nd;
      for (int32_t _5383_i = _11748_; _5383_i < _11749_; ++_5383_i)
      {
        {
          _5382_d2 *= _ptr__5352_wi32[safe_add( _5356_shape,_5383_i )];
        }
      }
      if (_5357_dense)
      {
        {
          _5332_rs->alloc_expr(_5364_rnd,_5366_rnelem,_5367_rnnz,false,_5365_rncodeatom);
          int32_t _5384_rptr = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->ptr_base;
          int32_t _5385_rshape = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->shape_base;
          int32_t _5386_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->nidxs_base;
          int32_t _5387_rcof = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->cof_base;
          int32_t _5388_rcode = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->code_base;
          int32_t _5389_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->codeptr_base;
          int32_t _5390_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->cconst_base;
          std::shared_ptr< monty::ndarray< int32_t,1 > > _5391_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->i32;
          _checked_ptr_1<int32_t> _ptr__5391_ri32(_5391_ri32 ? _5391_ri32->raw() : nullptr,_5391_ri32 ? _5391_ri32->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _5392_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->i64;
          _checked_ptr_1<int64_t> _ptr__5392_ri64(_5392_ri64 ? _5392_ri64->raw() : nullptr,_5392_ri64 ? _5392_ri64->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _5393_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->f64;
          _checked_ptr_1<double> _ptr__5393_rf64(_5393_rf64 ? _5393_rf64->raw() : nullptr,_5393_rf64 ? _5393_rf64->size(0) : 0);
          int32_t _11750_;
          bool _11751_ = (_5365_rncodeatom > (int)0);
          if (_11751_)
          {
            _11750_ = _5334_xs->alloci32(safe_add( _5366_rnelem,(int)1 ));
          }
          else
          {
            _11750_ = (-(int)9999);
          }
          int32_t _5394_xcodeptr = _11750_;
          std::shared_ptr< monty::ndarray< int32_t,1 > > _5395_xi32 = mosek::fusion::p_WorkStack::_get_impl(_5334_xs)->i32;
          _checked_ptr_1<int32_t> _ptr__5395_xi32(_5395_xi32 ? _5395_xi32->raw() : nullptr,_5395_xi32 ? _5395_xi32->size(0) : 0);
          int32_t _11752_ = (int)0;
          int32_t _11753_ = _5355_nd;
          for (int32_t _5396_i = _11752_; _5396_i < _11753_; ++_5396_i)
          {
            {
              _ptr__5391_ri32[safe_add( _5385_rshape,_5396_i )] = _ptr__5352_wi32[safe_add( _5356_shape,_5396_i )];
            }
          }
          _ptr__5391_ri32[safe_add( _5385_rshape,dim )] = _5362_sdim;
          {
            int32_t _5397_codei = (int)0;
            int32_t _5398_elmi = (int)0;
            int32_t _5399_nzi = (int)0;
            _ptr__5391_ri32[_5384_rptr] = (int)0;
            if (_5368_parameterized)
            {
              {
                _ptr__5391_ri32[_5389_rcodeptr] = (int)0;
              }
            }
            {}
            int32_t _11754_ = (int)0;
            int32_t _11755_ = _5373_d0;
            for (int32_t _5400_i0 = _11754_; _5400_i0 < _11755_; ++_5400_i0)
            {
              {
                int32_t _11756_ = (int)0;
                int32_t _11757_ = _5336_n;
                for (int32_t _5401_i = _11756_; _5401_i < _11757_; ++_5401_i)
                {
                  {
                    int32_t _11758_ = (int)0;
                    int32_t _11759_ = _ptr__5375_d1s[_5401_i];
                    for (int32_t _5402_i1z = _11758_; _5402_i1z < _11759_; ++_5402_i1z)
                    {
                      {
                        int32_t _11760_ = (int)0;
                        int32_t _11761_ = _5382_d2;
                        for (int32_t _5403_i2 = _11760_; _5403_i2 < _11761_; ++_5403_i2)
                        {
                          {
                            int32_t _5404_j = safe_add( safe_add( safe_mul( safe_mul( _5400_i0,_ptr__5375_d1s[_5401_i] ),_5382_d2 ),safe_mul( _5402_i1z,_5382_d2 ) ),_5403_i2 );
                            int32_t _11762_ = _ptr__5352_wi32[safe_add( _ptr__5344_ptr_base[_5401_i],_5404_j )];
                            int32_t _11763_ = _ptr__5352_wi32[safe_add( safe_add( _ptr__5344_ptr_base[_5401_i],_5404_j ),(int)1 )];
                            for (int32_t _5405_k = _11762_; _5405_k < _11763_; ++_5405_k)
                            {
                              {
                                _ptr__5392_ri64[safe_add( _5386_rnidxs,_5399_nzi )] = _ptr__5353_wi64[safe_add( _ptr__5345_nidxs_base[_5401_i],_5405_k )];
                                _ptr__5393_rf64[safe_add( _5387_rcof,_5399_nzi )] = _ptr__5354_wf64[safe_add( _ptr__5347_cof_base[_5401_i],_5405_k )];
                                if ((_ptr__5342_ncodeatom[_5401_i] > (int)0))
                                {
                                  {
                                    int32_t _11764_ = _ptr__5352_wi32[safe_add( _ptr__5349_codeptr[_5401_i],_5405_k )];
                                    int32_t _11765_ = _ptr__5352_wi32[safe_add( safe_add( _ptr__5349_codeptr[_5401_i],_5405_k ),(int)1 )];
                                    for (int32_t _5406_l = _11764_; _5406_l < _11765_; ++_5406_l)
                                    {
                                      {
                                        _ptr__5391_ri32[safe_add( _5388_rcode,_5397_codei )] = _ptr__5352_wi32[safe_add( _ptr__5348_code[_5401_i],_5406_l )];
                                        _ptr__5393_rf64[safe_add( _5390_rcconst,_5397_codei )] = _ptr__5354_wf64[safe_add( _ptr__5350_cconst[_5401_i],_5406_l )];
                                        ++ _5397_codei;
                                      }
                                    }
                                    _ptr__5391_ri32[safe_add( safe_add( _5389_rcodeptr,_5399_nzi ),(int)1 )] = _5397_codei;
                                  }
                                }
                                else if(_5368_parameterized)
                                {
                                  {
                                    _ptr__5391_ri32[safe_add( _5388_rcode,_5397_codei )] = 2;
                                    _ptr__5393_rf64[safe_add( _5390_rcconst,_5397_codei )] = 0.0;
                                    ++ _5397_codei;
                                    _ptr__5391_ri32[safe_add( safe_add( _5389_rcodeptr,_5399_nzi ),(int)1 )] = _5397_codei;
                                  }
                                }
                                {}
                                ++ _5399_nzi;
                              }
                            }
                            _ptr__5391_ri32[safe_add( safe_add( _5384_rptr,_5398_elmi ),(int)1 )] = _5399_nzi;
                            ++ _5398_elmi;
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      else
      {
        {
          int32_t _5407_rshapesize = (int)1;
          int32_t _11766_ = (int)0;
          int32_t _11767_ = dim;
          for (int32_t _5408_i = _11766_; _5408_i < _11767_; ++_5408_i)
          {
            {
              _5407_rshapesize *= _ptr__5352_wi32[safe_add( _5356_shape,_5408_i )];
            }
          }
          _5407_rshapesize *= _5362_sdim;
          int32_t _11768_ = safe_add( dim,(int)1 );
          int32_t _11769_ = _5355_nd;
          for (int32_t _5409_i = _11768_; _5409_i < _11769_; ++_5409_i)
          {
            {
              _5407_rshapesize *= _ptr__5352_wi32[safe_add( _5356_shape,_5409_i )];
            }
          }
          bool _5410_rhassp = (_5366_rnelem < _5407_rshapesize);
          _5332_rs->alloc_expr(_5364_rnd,_5366_rnelem,_5367_rnnz,_5410_rhassp,_5365_rncodeatom);
          int32_t _5411_rptr = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->ptr_base;
          int32_t _5412_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->nidxs_base;
          int32_t _11770_;
          bool _11771_ = _5410_rhassp;
          if (_11771_)
          {
            _11770_ = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->sp_base;
          }
          else
          {
            _11770_ = _5332_rs->alloci64(_5366_rnelem);
          }
          int32_t _5413_rsp = _11770_;
          int32_t _5414_rcof = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->cof_base;
          int32_t _5415_rcode = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->code_base;
          int32_t _5416_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->codeptr_base;
          int32_t _5417_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->cconst_base;
          int32_t _5418_rshape = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->shape_base;
          int32_t _11772_ = (int)0;
          int32_t _11773_ = _5355_nd;
          for (int32_t _5419_i = _11772_; _5419_i < _11773_; ++_5419_i)
          {
            {
              ((*mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->i32)(safe_add( _5418_rshape,_5419_i ))) = _ptr__5352_wi32[safe_add( _5356_shape,_5419_i )];
            }
          }
          ((*mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->i32)(safe_add( _5418_rshape,dim ))) = _5362_sdim;
          std::shared_ptr< monty::ndarray< int32_t,1 > > _5420_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->i32;
          _checked_ptr_1<int32_t> _ptr__5420_ri32(_5420_ri32 ? _5420_ri32->raw() : nullptr,_5420_ri32 ? _5420_ri32->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _5421_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->i64;
          _checked_ptr_1<int64_t> _ptr__5421_ri64(_5421_ri64 ? _5421_ri64->raw() : nullptr,_5421_ri64 ? _5421_ri64->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _5422_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5332_rs)->f64;
          _checked_ptr_1<double> _ptr__5422_rf64(_5422_rf64 ? _5422_rf64->raw() : nullptr,_5422_rf64 ? _5422_rf64->size(0) : 0);
          if ((dim == (int)0))
          {
            {
              int32_t _5423_codei = (int)0;
              int32_t _5424_nzi = (int)0;
              int32_t _5425_elmi = (int)0;
              int64_t _5426_spofs = (int64_t)0;
              _ptr__5420_ri32[_5411_rptr] = (int)0;
              if ((_5365_rncodeatom > (int)0))
              {
                {
                  _ptr__5420_ri32[_5416_rcodeptr] = (int)0;
                }
              }
              {}
              int32_t _11774_ = (int)0;
              int32_t _11775_ = _5336_n;
              for (int32_t _5427_i = _11774_; _5427_i < _11775_; ++_5427_i)
              {
                {
                  int32_t _11776_ = (int)0;
                  int32_t _11777_ = _ptr__5340_nelem[_5427_i];
                  for (int32_t _5428_j = _11776_; _5428_j < _11777_; ++_5428_j)
                  {
                    {
                      int32_t _11778_ = _ptr__5352_wi32[safe_add( _ptr__5344_ptr_base[_5427_i],_5428_j )];
                      int32_t _11779_ = _ptr__5352_wi32[safe_add( safe_add( _ptr__5344_ptr_base[_5427_i],_5428_j ),(int)1 )];
                      for (int32_t _5429_k = _11778_; _5429_k < _11779_; ++_5429_k)
                      {
                        {
                          _ptr__5421_ri64[safe_add( _5412_rnidxs,_5424_nzi )] = _ptr__5353_wi64[safe_add( _ptr__5345_nidxs_base[_5427_i],_5429_k )];
                          _ptr__5422_rf64[safe_add( _5414_rcof,_5424_nzi )] = _ptr__5354_wf64[safe_add( _ptr__5347_cof_base[_5427_i],_5429_k )];
                          if ((_ptr__5342_ncodeatom[_5427_i] > (int)0))
                          {
                            {
                              int32_t _11780_ = _ptr__5352_wi32[safe_add( _ptr__5349_codeptr[_5427_i],_5429_k )];
                              int32_t _11781_ = _ptr__5352_wi32[safe_add( safe_add( _ptr__5349_codeptr[_5427_i],_5429_k ),(int)1 )];
                              for (int32_t _5430_l = _11780_; _5430_l < _11781_; ++_5430_l)
                              {
                                {
                                  _ptr__5420_ri32[safe_add( _5415_rcode,_5423_codei )] = _ptr__5352_wi32[safe_add( _ptr__5348_code[_5427_i],_5430_l )];
                                  _ptr__5422_rf64[safe_add( _5417_rcconst,_5423_codei )] = _ptr__5354_wf64[safe_add( _ptr__5350_cconst[_5427_i],_5430_l )];
                                  ++ _5423_codei;
                                }
                              }
                              _ptr__5420_ri32[safe_add( safe_add( _5416_rcodeptr,_5424_nzi ),(int)1 )] = _5423_codei;
                            }
                          }
                          else if((_5365_rncodeatom > (int)0))
                          {
                            {
                              _ptr__5420_ri32[safe_add( _5415_rcode,_5423_codei )] = 2;
                              _ptr__5422_rf64[safe_add( _5417_rcconst,_5423_codei )] = 0.0;
                              ++ _5423_codei;
                              _ptr__5420_ri32[safe_add( safe_add( _5416_rcodeptr,_5424_nzi ),(int)1 )] = _5423_codei;
                            }
                          }
                          {}
                          ++ _5424_nzi;
                        }
                      }
                      _ptr__5420_ri32[safe_add( safe_add( _5411_rptr,_5425_elmi ),(int)1 )] = _5424_nzi;
                      if ((_ptr__5343_hassp[_5427_i] != (int)0))
                      {
                        {
                          _ptr__5421_ri64[safe_add( _5413_rsp,_5425_elmi )] = safe_add( _5426_spofs,_ptr__5353_wi64[safe_add( _ptr__5346_sp_base[_5427_i],_5428_j )] );
                        }
                      }
                      else
                      {
                        {
                          _ptr__5421_ri64[safe_add( _5413_rsp,_5425_elmi )] = safe_add( _5426_spofs,_5428_j );
                        }
                      }
                      ++ _5425_elmi;
                    }
                  }
                  int64_t _5431_sz = (int64_t)1;
                  int32_t _11782_ = (int)0;
                  int32_t _11783_ = _5355_nd;
                  for (int32_t _5432_j = _11782_; _5432_j < _11783_; ++_5432_j)
                  {
                    {
                      _5431_sz *= _ptr__5352_wi32[safe_add( _ptr__5339_shape_base[_5427_i],_5432_j )];
                    }
                  }
                  _5426_spofs += _5431_sz;
                }
              }
            }
          }
          else
          {
            {
              int32_t _5433_maxdim = (int)0;
              int32_t _11784_ = (int)0;
              int32_t _11785_ = _5364_rnd;
              for (int32_t _5434_i = _11784_; _5434_i < _11785_; ++_5434_i)
              {
                {
                  if ((_5433_maxdim < _ptr__5420_ri32[safe_add( _5418_rshape,_5434_i )]))
                  {
                    {
                      _5433_maxdim = _ptr__5420_ri32[safe_add( _5418_rshape,_5434_i )];
                    }
                  }
                  {}
                }
              }
              int32_t _5435_tsp = _5334_xs->alloci64(_5366_rnelem);
              int32_t _5436_ti = _5334_xs->alloci32(_5366_rnelem);
              int32_t _5437_tj = _5334_xs->alloci32(_5366_rnelem);
              int32_t _5438_curperm = _5334_xs->alloci32(_5366_rnelem);
              int32_t _5439_tgtperm = _5334_xs->alloci32(_5366_rnelem);
              int32_t _5440_xptr = _5334_xs->alloci32(safe_add( _5433_maxdim,(int)1 ));
              std::shared_ptr< monty::ndarray< int32_t,1 > > _5441_xi32 = mosek::fusion::p_WorkStack::_get_impl(_5334_xs)->i32;
              _checked_ptr_1<int32_t> _ptr__5441_xi32(_5441_xi32 ? _5441_xi32->raw() : nullptr,_5441_xi32 ? _5441_xi32->size(0) : 0);
              std::shared_ptr< monty::ndarray< int64_t,1 > > _5442_xi64 = mosek::fusion::p_WorkStack::_get_impl(_5334_xs)->i64;
              _checked_ptr_1<int64_t> _ptr__5442_xi64(_5442_xi64 ? _5442_xi64->raw() : nullptr,_5442_xi64 ? _5442_xi64->size(0) : 0);
              {
                int32_t _5443_elmi = (int)0;
                int32_t _11786_ = (int)0;
                int32_t _11787_ = _5336_n;
                for (int32_t _5444_i = _11786_; _5444_i < _11787_; ++_5444_i)
                {
                  {
                    int32_t _5445_d1 = _ptr__5375_d1s[_5444_i];
                    int32_t _5446_s0 = safe_mul( _5445_d1,_5382_d2 );
                    int32_t _5447_s1 = _5382_d2;
                    if ((_ptr__5343_hassp[_5444_i] != (int)0))
                    {
                      {
                        int32_t _11788_ = (int)0;
                        int32_t _11789_ = _ptr__5340_nelem[_5444_i];
                        for (int32_t _5448_j = _11788_; _5448_j < _11789_; ++_5448_j)
                        {
                          {
                            int64_t _5449_i0 = (_ptr__5353_wi64[safe_add( _ptr__5346_sp_base[_5444_i],_5448_j )] / _5446_s0);
                            int64_t _5450_i1 = ((_ptr__5353_wi64[safe_add( _ptr__5346_sp_base[_5444_i],_5448_j )] / _5447_s1) % _5445_d1);
                            int64_t _5451_i2 = (_ptr__5353_wi64[safe_add( _ptr__5346_sp_base[_5444_i],_5448_j )] % _5382_d2);
                            _ptr__5442_xi64[safe_add( _5435_tsp,_5443_elmi )] = safe_add( safe_mul( safe_add( safe_add( safe_mul( _5449_i0,_5362_sdim ),_5450_i1 ),_ptr__5378_offset[_5444_i] ),_5382_d2 ),_5451_i2 );
                            _ptr__5441_xi32[safe_add( _5436_ti,_5443_elmi )] = _5444_i;
                            _ptr__5441_xi32[safe_add( _5437_tj,_5443_elmi )] = _5448_j;
                            ++ _5443_elmi;
                          }
                        }
                      }
                    }
                    else
                    {
                      {
                        int32_t _11790_ = (int)0;
                        int32_t _11791_ = _ptr__5340_nelem[_5444_i];
                        for (int32_t _5452_j = _11790_; _5452_j < _11791_; ++_5452_j)
                        {
                          {
                            int64_t _5453_i0 = ((int64_t)_5452_j / _5446_s0);
                            int64_t _5454_i1 = (((int64_t)_5452_j / _5447_s1) % _5445_d1);
                            int64_t _5455_i2 = ((int64_t)_5452_j % _5382_d2);
                            _ptr__5442_xi64[safe_add( _5435_tsp,_5443_elmi )] = safe_add( safe_mul( safe_add( safe_add( safe_mul( _5453_i0,_5362_sdim ),_5454_i1 ),_ptr__5378_offset[_5444_i] ),_5382_d2 ),_5455_i2 );
                            _ptr__5441_xi32[safe_add( _5436_ti,_5443_elmi )] = _5444_i;
                            _ptr__5441_xi32[safe_add( _5437_tj,_5443_elmi )] = _5452_j;
                            ++ _5443_elmi;
                          }
                        }
                      }
                    }
                  }
                }
              }
              {
                std::shared_ptr< monty::ndarray< int64_t,1 > > _5456_s = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_5364_rnd)));
                _checked_ptr_1<int64_t> _ptr__5456_s(_5456_s ? _5456_s->raw() : nullptr,_5456_s ? _5456_s->size(0) : 0);
                _ptr__5456_s[(_5364_rnd - (int)1)] = (int)1;
                int32_t _11792_ = (int)1;
                int32_t _11793_ = _5364_rnd;
                for (int32_t _5457_i = _11792_; _5457_i < _11793_; ++_5457_i)
                {
                  {
                    _ptr__5456_s[((_5364_rnd - _5457_i) - (int)1)] = safe_mul( _ptr__5456_s[(_5364_rnd - _5457_i)],_ptr__5420_ri32[(safe_add( _5418_rshape,_5364_rnd ) - _5457_i)] );
                  }
                }
                int32_t _11794_ = (int)0;
                int32_t _11795_ = _5366_rnelem;
                for (int32_t _5458_i = _11794_; _5458_i < _11795_; ++_5458_i)
                {
                  {
                    _ptr__5441_xi32[safe_add( _5438_curperm,_5458_i )] = _5458_i;
                  }
                }
                int32_t _11796_ = (int)0;
                int32_t _11797_ = _5364_rnd;
                for (int32_t _5459_ii = _11796_; _5459_ii < _11797_; ++_5459_ii)
                {
                  {
                    int32_t _5460_i = ((_5364_rnd - _5459_ii) - (int)1);
                    int32_t _5461_di = _ptr__5420_ri32[safe_add( _5418_rshape,_5460_i )];
                    int32_t _11798_ = (int)0;
                    int32_t _11799_ = safe_add( _5461_di,(int)1 );
                    for (int32_t _5462_k = _11798_; _5462_k < _11799_; ++_5462_k)
                    {
                      {
                        _ptr__5441_xi32[safe_add( _5440_xptr,_5462_k )] = (int)0;
                      }
                    }
                    int32_t _11800_ = (int)0;
                    int32_t _11801_ = _5366_rnelem;
                    for (int32_t _5463_kk = _11800_; _5463_kk < _11801_; ++_5463_kk)
                    {
                      {
                        int32_t _5464_k = _ptr__5441_xi32[safe_add( _5438_curperm,_5463_kk )];
                        int64_t _5465_sub = ((_ptr__5442_xi64[safe_add( _5435_tsp,_5464_k )] / _ptr__5456_s[_5460_i]) % _5461_di);
                        ++ _ptr__5441_xi32[safe_add( safe_add( _5440_xptr,_5465_sub ),(int)1 )];
                      }
                    }
                    {
                      int32_t _11802_ = (int)0;
                      int32_t _11803_ = _5461_di;
                      for (int32_t _5466_k = _11802_; _5466_k < _11803_; ++_5466_k)
                      {
                        {
                          _ptr__5441_xi32[safe_add( safe_add( _5440_xptr,_5466_k ),(int)1 )] += _ptr__5441_xi32[safe_add( _5440_xptr,_5466_k )];
                        }
                      }
                      int32_t _11804_ = (int)0;
                      int32_t _11805_ = _5366_rnelem;
                      for (int32_t _5467_kk = _11804_; _5467_kk < _11805_; ++_5467_kk)
                      {
                        {
                          int32_t _5468_k = _ptr__5441_xi32[safe_add( _5438_curperm,_5467_kk )];
                          int64_t _5469_sub = ((_ptr__5442_xi64[safe_add( _5435_tsp,_5468_k )] / _ptr__5456_s[_5460_i]) % _5461_di);
                          _ptr__5441_xi32[safe_add( _5439_tgtperm,_ptr__5441_xi32[safe_add( _5440_xptr,_5469_sub )] )] = _5468_k;
                          ++ _ptr__5441_xi32[safe_add( _5440_xptr,_5469_sub )];
                        }
                      }
                    }
                    int32_t _5470_tmp = _5438_curperm;
                    _5438_curperm = _5439_tgtperm;
                    _5439_tgtperm = _5470_tmp;
                  }
                }
              }
              {
                int32_t _5471_codei = (int)0;
                int32_t _5472_nzi = (int)0;
                _ptr__5420_ri32[_5411_rptr] = (int)0;
                if ((_5365_rncodeatom > (int)0))
                {
                  {
                    _ptr__5420_ri32[_5416_rcodeptr] = (int)0;
                  }
                }
                {}
                int32_t _11806_ = (int)0;
                int32_t _11807_ = _5366_rnelem;
                for (int32_t _5473_elmi = _11806_; _5473_elmi < _11807_; ++_5473_elmi)
                {
                  {
                    int32_t _5474_pelmi = _ptr__5441_xi32[safe_add( _5438_curperm,_5473_elmi )];
                    int32_t _5475_i = _ptr__5441_xi32[safe_add( _5436_ti,_5474_pelmi )];
                    int32_t _5476_j = _ptr__5441_xi32[safe_add( _5437_tj,_5474_pelmi )];
                    int32_t _11808_ = _ptr__5352_wi32[safe_add( _ptr__5344_ptr_base[_5475_i],_5476_j )];
                    int32_t _11809_ = _ptr__5352_wi32[safe_add( safe_add( _ptr__5344_ptr_base[_5475_i],_5476_j ),(int)1 )];
                    for (int32_t _5477_k = _11808_; _5477_k < _11809_; ++_5477_k)
                    {
                      {
                        _ptr__5421_ri64[safe_add( _5412_rnidxs,_5472_nzi )] = _ptr__5353_wi64[safe_add( _ptr__5345_nidxs_base[_5475_i],_5477_k )];
                        _ptr__5422_rf64[safe_add( _5414_rcof,_5472_nzi )] = _ptr__5354_wf64[safe_add( _ptr__5347_cof_base[_5475_i],_5477_k )];
                        if ((_ptr__5342_ncodeatom[_5475_i] > (int)0))
                        {
                          {
                            int32_t _11810_ = _ptr__5352_wi32[safe_add( _ptr__5349_codeptr[_5475_i],_5477_k )];
                            int32_t _11811_ = _ptr__5352_wi32[safe_add( safe_add( _ptr__5349_codeptr[_5475_i],_5477_k ),(int)1 )];
                            for (int32_t _5478_l = _11810_; _5478_l < _11811_; ++_5478_l)
                            {
                              {
                                _ptr__5420_ri32[safe_add( _5415_rcode,_5471_codei )] = _ptr__5352_wi32[safe_add( _ptr__5348_code[_5475_i],_5478_l )];
                                _ptr__5422_rf64[safe_add( _5417_rcconst,_5471_codei )] = _ptr__5354_wf64[safe_add( _ptr__5350_cconst[_5475_i],_5478_l )];
                                ++ _5471_codei;
                              }
                            }
                            _ptr__5420_ri32[safe_add( safe_add( _5416_rcodeptr,_5472_nzi ),(int)1 )] = _5471_codei;
                          }
                        }
                        else if(_5368_parameterized)
                        {
                          {
                            _ptr__5420_ri32[safe_add( _5415_rcode,_5471_codei )] = 2;
                            _ptr__5422_rf64[safe_add( _5417_rcconst,_5471_codei )] = 0.0;
                            ++ _5471_codei;
                            _ptr__5420_ri32[safe_add( safe_add( _5416_rcodeptr,_5472_nzi ),(int)1 )] = _5471_codei;
                          }
                        }
                        {}
                        ++ _5472_nzi;
                      }
                    }
                    _ptr__5420_ri32[safe_add( safe_add( _5411_rptr,_5473_elmi ),(int)1 )] = _5472_nzi;
                    _ptr__5421_ri64[safe_add( _5413_rsp,_5473_elmi )] = _ptr__5442_xi64[safe_add( _5435_tsp,_5474_pelmi )];
                  }
                }
              }
            }
          }
          if ((!_5410_rhassp))
          {
            {
              _5332_rs->popi64(_5366_rnelem);
            }
          }
          {}
        }
      }
    }
  }
}
// End mosek.fusion.ExprStack.eval

// Begin mosek.fusion.ExprStack.getshape
// Method mosek.fusion.ExprStack.getshape @ bld/grindsted/final/default/src/fusion/ExprStack.monty:16:6-47:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_ExprStack::getshape(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _5479_es,int32_t _5480_dim)
{
  if (((int)((_5479_es)->size(0)) == (int)0))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Cannot stack empty list"));
    }
  }
  else if(((int)((_5479_es)->size(0)) == (int)1))
  {
    {
      return ((*_5479_es)((int)0))->getShape();
    }
  }
  else
  {
    {
      std::vector<std::shared_ptr< monty::ndarray< int32_t,1 > >> _11812_;
      for (int32_t _5482_i = (int)0, _11813_ = (int)((_5479_es)->size(0)); _5482_i < _11813_ ; ++_5482_i)
      {
        _11812_.push_back(((*_5479_es)(_5482_i))->getShape());
      }
      auto _11814_ = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 >(monty::shape(_11812_.size()),_11812_.begin(),_11812_.end()));
      std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _5481_shapes = _11814_;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5483_shape = ((*_5481_shapes)((int)0));
      _checked_ptr_1<int32_t> _ptr__5483_shape(_5483_shape ? _5483_shape->raw() : nullptr,_5483_shape ? _5483_shape->size(0) : 0);
      int32_t _5484_nd = (int)((_5483_shape)->size(0));
      int32_t _11815_ = (int)1;
      int32_t _11816_ = (int)((_5481_shapes)->size(0));
      for (int32_t _5485_i = _11815_; _5485_i < _11816_; ++_5485_i)
      {
        {
          if ((_5484_nd != (int)((((*_5481_shapes)(_5485_i)))->size(0))))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Mismatching expression dimensions"));
            }
          }
          {}
          int32_t _11817_ = (int)0;
          int32_t _11818_ = _5480_dim;
          for (int32_t _5486_j = _11817_; _5486_j < _11818_; ++_5486_j)
          {
            {
              if ((_ptr__5483_shape[_5486_j] != ((*((*_5481_shapes)(_5485_i)))(_5486_j))))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("mismatching expression dimensions"));
                }
              }
              {}
            }
          }
          int32_t _11819_ = safe_add( _5480_dim,(int)1 );
          int32_t _11820_ = _5484_nd;
          for (int32_t _5487_j = _11819_; _5487_j < _11820_; ++_5487_j)
          {
            {
              if ((_ptr__5483_shape[_5487_j] != ((*((*_5481_shapes)(_5485_i)))(_5487_j))))
              {
                {
                  throw ::mosek::fusion::DimensionError(std::string ("mismatching expression dimensions"));
                }
              }
              {}
            }
          }
        }
      }
      if ((_5480_dim == _5484_nd))
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _5488_resshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _5484_nd,(int)1 ))));
          _checked_ptr_1<int32_t> _ptr__5488_resshape(_5488_resshape ? _5488_resshape->raw() : nullptr,_5488_resshape ? _5488_resshape->size(0) : 0);
          int32_t _11821_ = (int)0;
          int32_t _11822_ = _5484_nd;
          for (int32_t _5489_i = _11821_; _5489_i < _11822_; ++_5489_i)
          {
            {
              _ptr__5488_resshape[_5489_i] = _ptr__5483_shape[_5489_i];
            }
          }
          _ptr__5488_resshape[_5484_nd] = (int)((_5481_shapes)->size(0));
          return _5488_resshape;
        }
      }
      else
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _5490_resshape = _5483_shape;
          _checked_ptr_1<int32_t> _ptr__5490_resshape(_5490_resshape ? _5490_resshape->raw() : nullptr,_5490_resshape ? _5490_resshape->size(0) : 0);
          int32_t _11823_ = (int)1;
          int32_t _11824_ = (int)((_5481_shapes)->size(0));
          for (int32_t _5491_i = _11823_; _5491_i < _11824_; ++_5491_i)
          {
            {
              _ptr__5490_resshape[_5480_dim] += ((*((*_5481_shapes)(_5491_i)))(_5480_dim));
            }
          }
          return _5490_resshape;
        }
      }
    }
  }
}
// End mosek.fusion.ExprStack.getshape

// Begin mosek.fusion.ExprStack.toString
// Method mosek.fusion.ExprStack.toString @ bld/grindsted/final/default/src/fusion/ExprStack.monty:8:6-14:7
std::string mosek::fusion::ExprStack :: toString() { return mosek::fusion::p_ExprStack::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprStack::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _5492_b = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprStack(dim="))->__mosek_2fusion_2Utils_2StringBuffer__a(dim)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",["))->__mosek_2fusion_2Utils_2StringBuffer__a(((*exprs)((int)0))->toString());
  int32_t _11825_ = (int)1;
  int32_t _11826_ = (int)((exprs)->size(0));
  for (int32_t _5493_i = _11825_; _5493_i < _11826_; ++_5493_i)
  {
    {
      _5492_b->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*exprs)(_5493_i))->toString());
    }
  }
  _5492_b->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("])"));
  return _5492_b->toString();
}
// End mosek.fusion.ExprStack.toString

void mosek::fusion::p_ExprStack::destroy()
{
  exprs.reset();
}
void mosek::fusion::ExprStack::destroy() { mosek::fusion::p_ExprStack::_get_impl(this)->destroy(); }
// } class ExprStack
// class ExprInner { // @ bld/grindsted/final/default/src/fusion/ExprMul.monty:2097:4-2290:5
mosek::fusion::ExprInner::ExprInner(mosek::fusion::p_ExprInner *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprInner()" << this << std::endl; */ }
mosek::fusion::ExprInner::~ExprInner() {  /* std::cout << "~ExprInner()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprInner::p_ExprInner
  (::mosek::fusion::ExprInner * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprInner.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:2129:6-2158:7
mosek::fusion::ExprInner::t mosek::fusion::p_ExprInner::_new_ExprInner
  (monty::rc_ptr< ::mosek::fusion::Expression > _5494_expr3,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _5495_vsub3,
    std::shared_ptr< monty::ndarray< double,1 > > _5496_vcof3)
{ return new mosek::fusion::ExprInner(_5494_expr3,_5495_vsub3,_5496_vcof3); }
mosek::fusion::ExprInner::ExprInner
  (monty::rc_ptr< ::mosek::fusion::Expression > _5494_expr3,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _5495_vsub3,
    std::shared_ptr< monty::ndarray< double,1 > > _5496_vcof3) : 
   ExprInner(new mosek::fusion::p_ExprInner(this))
{ mosek::fusion::p_ExprInner::_get_impl(this)->_initialize(_5494_expr3,_5495_vsub3,_5496_vcof3); }
void mosek::fusion::p_ExprInner::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _5494_expr3,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _5495_vsub3,
    std::shared_ptr< monty::ndarray< double,1 > > _5496_vcof3)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int64_t> _ptr__5495_vsub3(_5495_vsub3 ? _5495_vsub3->raw() : nullptr, _5495_vsub3 ? _5495_vsub3->size(0) : 0);
    _checked_ptr_1<double> _ptr__5496_vcof3(_5496_vcof3 ? _5496_vcof3->raw() : nullptr, _5496_vcof3 ? _5496_vcof3->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(_5494_expr3->__mosek_2fusion_2Expression__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))));
    mosek::fusion::p_ExprInner::_get_impl(::mosek::fusion::ExprInner::t(_pubthis))->expr = _5494_expr3;
    mosek::fusion::p_ExprInner::_get_impl(::mosek::fusion::ExprInner::t(_pubthis))->vsub = _5495_vsub3;
    mosek::fusion::p_ExprInner::_get_impl(::mosek::fusion::ExprInner::t(_pubthis))->vcof = _5496_vcof3;
    if (((int)((_5495_vsub3)->size(0)) != (int)((_5496_vcof3)->size(0))))
    {
      {
        throw ::mosek::fusion::LengthError(std::string ("Mismatching lengths of vcof and vsub"));
      }
    }
    {}
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5497_shp = _5494_expr3->getShape();
    _checked_ptr_1<int32_t> _ptr__5497_shp(_5497_shp ? _5497_shp->raw() : nullptr,_5497_shp ? _5497_shp->size(0) : 0);
    int64_t _5498_size = ::mosek::fusion::p_Set::size(_5497_shp);
    bool _5499_err_sorted = false;
    bool _5500_err_bounds = false;
    {
      int32_t _11827_ = (int)1;
      int32_t _11828_ = (int)((_5495_vsub3)->size(0));
      for (int32_t _5501_i = _11827_; _5501_i < _11828_; ++_5501_i)
      {
        {
          if ((_ptr__5495_vsub3[_5501_i] <= _ptr__5495_vsub3[(_5501_i - (int)1)]))
          {
            {
              _5499_err_sorted = true;
            }
          }
          {}
        }
      }
      if (((int)((_5495_vsub3)->size(0)) > (int)0))
      {
        {
          if (((_ptr__5495_vsub3[(int)0] < (int)0) || (_ptr__5495_vsub3[((int)((_5495_vsub3)->size(0)) - (int)1)] > _5498_size)))
          {
            {
              _5500_err_bounds = true;
            }
          }
          {}
        }
      }
      {}
    }
    if (_5499_err_sorted)
    {
      {
        throw ::mosek::fusion::IndexError(std::string ("Unordered coefficcient subscripts"));
      }
    }
    {}
    if (_5500_err_bounds)
    {
      {
        throw ::mosek::fusion::IndexError(std::string ("Coefficient subscript out of bounds"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprInner.ctor

// mosek.fusion.ExprInner.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:2120:6-2127:7
mosek::fusion::ExprInner::t mosek::fusion::p_ExprInner::_new_ExprInner
  (monty::rc_ptr< ::mosek::fusion::Expression > _5502_expr2,
    std::shared_ptr< monty::ndarray< double,1 > > _5503_vcof2)
{ return new mosek::fusion::ExprInner(_5502_expr2,_5503_vcof2); }
mosek::fusion::ExprInner::ExprInner
  (monty::rc_ptr< ::mosek::fusion::Expression > _5502_expr2,
    std::shared_ptr< monty::ndarray< double,1 > > _5503_vcof2) : 
   ExprInner(new mosek::fusion::p_ExprInner(this))
{ mosek::fusion::p_ExprInner::_get_impl(this)->_initialize(_5502_expr2,_5503_vcof2); }
void mosek::fusion::p_ExprInner::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _5502_expr2,
    std::shared_ptr< monty::ndarray< double,1 > > _5503_vcof2)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__5503_vcof2(_5503_vcof2 ? _5503_vcof2->raw() : nullptr, _5503_vcof2 ? _5503_vcof2->size(0) : 0);
    mosek::fusion::p_ExprInner::_initialize(_5502_expr2,::mosek::fusion::p_ExprInner::range((int)((_5503_vcof2)->size(0))),_5503_vcof2);
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5504_eshape = _5502_expr2->getShape();
    _checked_ptr_1<int32_t> _ptr__5504_eshape(_5504_eshape ? _5504_eshape->raw() : nullptr,_5504_eshape ? _5504_eshape->size(0) : 0);
    if ((((int)((_5504_eshape)->size(0)) != (int)1) || (_ptr__5504_eshape[(int)0] != (int)((_5503_vcof2)->size(0)))))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching dimensions of operands"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprInner.ctor

// mosek.fusion.ExprInner.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:2116:6-2118:7
mosek::fusion::ExprInner::t mosek::fusion::p_ExprInner::_new_ExprInner
  (monty::rc_ptr< ::mosek::fusion::Expression > _5505_expr1,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _5506_vsub1,
    std::shared_ptr< monty::ndarray< double,1 > > _5507_vcof1)
{ return new mosek::fusion::ExprInner(_5505_expr1,_5506_vsub1,_5507_vcof1); }
mosek::fusion::ExprInner::ExprInner
  (monty::rc_ptr< ::mosek::fusion::Expression > _5505_expr1,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _5506_vsub1,
    std::shared_ptr< monty::ndarray< double,1 > > _5507_vcof1) : 
   ExprInner(new mosek::fusion::p_ExprInner(this))
{ mosek::fusion::p_ExprInner::_get_impl(this)->_initialize(_5505_expr1,_5506_vsub1,_5507_vcof1); }
void mosek::fusion::p_ExprInner::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _5505_expr1,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _5506_vsub1,
    std::shared_ptr< monty::ndarray< double,1 > > _5507_vcof1)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__5507_vcof1(_5507_vcof1 ? _5507_vcof1->raw() : nullptr, _5507_vcof1 ? _5507_vcof1->size(0) : 0);
    mosek::fusion::p_ExprInner::_initialize(_5505_expr1,::mosek::fusion::p_ExprInner::convert(_5505_expr1->getShape(),_5506_vsub1),_5507_vcof1);
  }
}
// mosek.fusion.ExprInner.ctor

// Begin mosek.fusion.ExprInner.eval
// Method mosek.fusion.ExprInner.eval @ bld/grindsted/final/default/src/fusion/ExprMul.monty:2160:6-2289:7
void mosek::fusion::ExprInner :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5508_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5509_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5510_xs,bool _5511_cache_eval) { mosek::fusion::p_ExprInner::_get_impl(this)->eval(_5508_rs,_5509_ws,_5510_xs,_5511_cache_eval); }
void mosek::fusion::p_ExprInner::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5508_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5509_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5510_xs,bool _5511_cache_eval)
{
  expr->recursive_eval(_5509_ws,_5508_rs,_5510_xs,_5511_cache_eval);
  _5509_ws->pop_expr();
  int32_t _5512_nd = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->nd;
  int32_t _5513_nelem = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->nelem;
  int32_t _5514_nnz = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->nnz;
  int32_t _5515_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->ncodeatom;
  bool _5516_hassp = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->hassp;
  int32_t _5517_shape = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->shape_base;
  int32_t _5518_ptr = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->ptr_base;
  int32_t _5519_nidxs = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->nidxs_base;
  int32_t _5520_sp = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->sp_base;
  int32_t _5521_cof = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->cof_base;
  int32_t _5522_code = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->code_base;
  int32_t _5523_codeptr = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->codeptr_base;
  int32_t _5524_cconst = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5525_wi32 = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__5525_wi32(_5525_wi32 ? _5525_wi32->raw() : nullptr,_5525_wi32 ? _5525_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5526_wi64 = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__5526_wi64(_5526_wi64 ? _5526_wi64->raw() : nullptr,_5526_wi64 ? _5526_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5527_wf64 = mosek::fusion::p_WorkStack::_get_impl(_5509_ws)->f64;
  _checked_ptr_1<double> _ptr__5527_wf64(_5527_wf64 ? _5527_wf64->raw() : nullptr,_5527_wf64 ? _5527_wf64->size(0) : 0);
  int32_t _5528_rnnz = (int)0;
  if (_5516_hassp)
  {
    {
      int32_t _5529_i1 = (int)0;
      int32_t _5530_i0 = (int)0;
      while ( ((_5530_i0 < (int)((vsub)->size(0))) && (_5529_i1 < _5513_nelem)) )
      {
        {
          if ((_ptr__5526_wi64[safe_add( _5520_sp,_5529_i1 )] < ((*vsub)(_5530_i0))))
          {
            {
              ++ _5529_i1;
            }
          }
          else if((_ptr__5526_wi64[safe_add( _5520_sp,_5529_i1 )] > ((*vsub)(_5530_i0))))
          {
            {
              ++ _5530_i0;
            }
          }
          else
          {
            {
              _5528_rnnz += (_ptr__5525_wi32[safe_add( safe_add( _5518_ptr,_5529_i1 ),(int)1 )] - _ptr__5525_wi32[safe_add( _5518_ptr,_5529_i1 )]);
              ++ _5530_i0;
              ++ _5529_i1;
            }
          }
        }
      }
    }
  }
  else
  {
    {
      int32_t _11829_ = (int)0;
      int32_t _11830_ = (int)((vsub)->size(0));
      for (int32_t _5531_i = _11829_; _5531_i < _11830_; ++_5531_i)
      {
        {
          _5528_rnnz += (_ptr__5525_wi32[safe_add( safe_add( _5518_ptr,((*vsub)(_5531_i)) ),(int)1 )] - _ptr__5525_wi32[safe_add( _5518_ptr,((*vsub)(_5531_i)) )]);
        }
      }
    }
  }
  int32_t _11831_;
  bool _11832_ = (_5515_ncodeatom > (int)0);
  if (_11832_)
  {
    _11831_ = safe_add( _5515_ncodeatom,safe_mul( (int)2,_5514_nnz ) );
  }
  else
  {
    _11831_ = (int)0;
  }
  int32_t _5532_rncodeatom = _11831_;
  _5508_rs->alloc_expr((int)0,(int)1,_5528_rnnz,false,_5532_rncodeatom);
  int32_t _5533_rptr = mosek::fusion::p_WorkStack::_get_impl(_5508_rs)->ptr_base;
  int32_t _5534_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_5508_rs)->nidxs_base;
  int32_t _5535_rcof = mosek::fusion::p_WorkStack::_get_impl(_5508_rs)->cof_base;
  int32_t _5536_rcode = mosek::fusion::p_WorkStack::_get_impl(_5508_rs)->code_base;
  int32_t _5537_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5508_rs)->codeptr_base;
  int32_t _5538_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5508_rs)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5539_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5508_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__5539_ri32(_5539_ri32 ? _5539_ri32->raw() : nullptr,_5539_ri32 ? _5539_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5540_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5508_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__5540_ri64(_5540_ri64 ? _5540_ri64->raw() : nullptr,_5540_ri64 ? _5540_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5541_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5508_rs)->f64;
  _checked_ptr_1<double> _ptr__5541_rf64(_5541_rf64 ? _5541_rf64->raw() : nullptr,_5541_rf64 ? _5541_rf64->size(0) : 0);
  _ptr__5539_ri32[_5533_rptr] = (int)0;
  _ptr__5539_ri32[safe_add( _5533_rptr,(int)1 )] = _5528_rnnz;
  if ((_5532_rncodeatom > (int)0))
  {
    {
      _ptr__5539_ri32[_5537_rcodeptr] = (int)0;
    }
  }
  {}
  int32_t _5542_codei = (int)0;
  int32_t _5543_k = (int)0;
  if (_5516_hassp)
  {
    {
      int32_t _5544_i1 = (int)0;
      int32_t _5545_i0 = (int)0;
      while ( ((_5545_i0 < (int)((vsub)->size(0))) && (_5544_i1 < _5513_nelem)) )
      {
        {
          if ((_ptr__5526_wi64[safe_add( _5520_sp,_5544_i1 )] < ((*vsub)(_5545_i0))))
          {
            {
              ++ _5544_i1;
            }
          }
          else if((_ptr__5526_wi64[safe_add( _5520_sp,_5544_i1 )] > ((*vsub)(_5545_i0))))
          {
            {
              ++ _5545_i0;
            }
          }
          else
          {
            {
              int32_t _5546_p0 = _ptr__5525_wi32[safe_add( _5518_ptr,_5544_i1 )];
              int32_t _5547_p1 = _ptr__5525_wi32[safe_add( safe_add( _5518_ptr,_5544_i1 ),(int)1 )];
              int32_t _11833_ = _5546_p0;
              int32_t _11834_ = _5547_p1;
              for (int32_t _5548_j = _11833_; _5548_j < _11834_; ++_5548_j)
              {
                {
                  _ptr__5540_ri64[safe_add( _5534_rnidxs,_5543_k )] = _ptr__5526_wi64[safe_add( _5519_nidxs,_5548_j )];
                  _ptr__5541_rf64[safe_add( _5535_rcof,_5543_k )] = (((*vcof)(_5545_i0)) * _ptr__5527_wf64[safe_add( _5521_cof,_5548_j )]);
                  if ((_5532_rncodeatom > (int)0))
                  {
                    {
                      int32_t _11835_ = _ptr__5525_wi32[safe_add( _5523_codeptr,_5548_j )];
                      int32_t _11836_ = _ptr__5525_wi32[safe_add( safe_add( _5523_codeptr,_5548_j ),(int)1 )];
                      for (int32_t _5549_l = _11835_; _5549_l < _11836_; ++_5549_l)
                      {
                        {
                          _ptr__5539_ri32[safe_add( _5536_rcode,_5542_codei )] = _ptr__5525_wi32[safe_add( _5522_code,_5549_l )];
                          _ptr__5541_rf64[safe_add( _5538_rcconst,_5542_codei )] = _ptr__5527_wf64[safe_add( _5524_cconst,_5549_l )];
                          ++ _5542_codei;
                        }
                      }
                      _ptr__5539_ri32[safe_add( _5536_rcode,_5542_codei )] = 2;
                      _ptr__5541_rf64[safe_add( _5538_rcconst,_5542_codei )] = ((*vcof)(_5545_i0));
                      ++ _5542_codei;
                      _ptr__5539_ri32[safe_add( _5536_rcode,_5542_codei )] = 5;
                      ++ _5542_codei;
                      _ptr__5539_ri32[safe_add( safe_add( _5537_rcodeptr,_5543_k ),(int)1 )] = _5542_codei;
                    }
                  }
                  {}
                  ++ _5543_k;
                }
              }
              ++ _5545_i0;
              ++ _5544_i1;
            }
          }
        }
      }
    }
  }
  else
  {
    {
      int32_t _11837_ = (int)0;
      int32_t _11838_ = (int)((vsub)->size(0));
      for (int32_t _5550_i = _11837_; _5550_i < _11838_; ++_5550_i)
      {
        {
          int32_t _5551_p0 = _ptr__5525_wi32[safe_add( _5518_ptr,((*vsub)(_5550_i)) )];
          int32_t _5552_p1 = _ptr__5525_wi32[safe_add( safe_add( _5518_ptr,((*vsub)(_5550_i)) ),(int)1 )];
          int32_t _11839_ = _5551_p0;
          int32_t _11840_ = _5552_p1;
          for (int32_t _5553_j = _11839_; _5553_j < _11840_; ++_5553_j)
          {
            {
              _ptr__5540_ri64[safe_add( _5534_rnidxs,_5543_k )] = _ptr__5526_wi64[safe_add( _5519_nidxs,_5553_j )];
              _ptr__5541_rf64[safe_add( _5535_rcof,_5543_k )] = (((*vcof)(_5550_i)) * _ptr__5527_wf64[safe_add( _5521_cof,_5553_j )]);
              if ((_5532_rncodeatom > (int)0))
              {
                {
                  int32_t _11841_ = _ptr__5525_wi32[safe_add( _5523_codeptr,_5553_j )];
                  int32_t _11842_ = _ptr__5525_wi32[safe_add( safe_add( _5523_codeptr,_5553_j ),(int)1 )];
                  for (int32_t _5554_l = _11841_; _5554_l < _11842_; ++_5554_l)
                  {
                    {
                      _ptr__5539_ri32[safe_add( _5536_rcode,_5542_codei )] = _ptr__5525_wi32[safe_add( _5522_code,_5554_l )];
                      _ptr__5541_rf64[safe_add( _5538_rcconst,_5542_codei )] = _ptr__5527_wf64[safe_add( _5524_cconst,_5554_l )];
                      ++ _5542_codei;
                    }
                  }
                  _ptr__5539_ri32[safe_add( _5536_rcode,_5542_codei )] = 2;
                  _ptr__5541_rf64[safe_add( _5538_rcconst,_5542_codei )] = ((*vcof)(_5550_i));
                  ++ _5542_codei;
                  _ptr__5539_ri32[safe_add( _5536_rcode,_5542_codei )] = 5;
                  ++ _5542_codei;
                  _ptr__5539_ri32[safe_add( safe_add( _5537_rcodeptr,_5543_k ),(int)1 )] = _5542_codei;
                }
              }
              {}
              ++ _5543_k;
            }
          }
        }
      }
    }
  }
}
// End mosek.fusion.ExprInner.eval

// Begin mosek.fusion.ExprInner.range
// Method mosek.fusion.ExprInner.range @ bld/grindsted/final/default/src/fusion/ExprMul.monty:2114:6-90
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::p_ExprInner::range(int32_t _5555_n)
{
  std::vector<int64_t> _11843_;
  for (int32_t _5556_i = (int)0, _11844_ = _5555_n; _5556_i < _11844_ ; ++_5556_i)
  {
    _11843_.push_back(_5556_i);
  }
  auto _11845_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_11843_.size()),_11843_.begin(),_11843_.end()));
  return _11845_;
}
// End mosek.fusion.ExprInner.range

// Begin mosek.fusion.ExprInner.convert
// Method mosek.fusion.ExprInner.convert @ bld/grindsted/final/default/src/fusion/ExprMul.monty:2104:6-2112:7
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::p_ExprInner::convert(std::shared_ptr< monty::ndarray< int32_t,1 > > _5557_shape,std::shared_ptr< monty::ndarray< int32_t,2 > > _5558_vsub)
{
  _checked_ptr_1<int32_t> _ptr__5557_shape(_5557_shape ? _5557_shape->raw() : nullptr, _5557_shape ? _5557_shape->size(0) : 0);
  int32_t _5559_nd = (int)((_5557_shape)->size(0));
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5560_s = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_5559_nd)));
  _checked_ptr_1<int64_t> _ptr__5560_s(_5560_s ? _5560_s->raw() : nullptr,_5560_s ? _5560_s->size(0) : 0);
  _ptr__5560_s[(_5559_nd - (int)1)] = (int)1;
  int32_t _11846_ = (int)1;
  int32_t _11847_ = _5559_nd;
  for (int32_t _5561_i = _11846_; _5561_i < _11847_; ++_5561_i)
  {
    {
      _ptr__5560_s[((_5559_nd - _5561_i) - (int)1)] = safe_mul( _ptr__5560_s[(_5559_nd - _5561_i)],_ptr__5557_shape[(_5559_nd - _5561_i)] );
    }
  }
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5562_res = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)((_5558_vsub)->size(0)))));
  _checked_ptr_1<int64_t> _ptr__5562_res(_5562_res ? _5562_res->raw() : nullptr,_5562_res ? _5562_res->size(0) : 0);
  int32_t _11848_ = (int)0;
  int32_t _11849_ = (int)((_5558_vsub)->size(0));
  for (int32_t _5563_i = _11848_; _5563_i < _11849_; ++_5563_i)
  {
    {
      int32_t _11850_ = (int)0;
      int32_t _11851_ = _5559_nd;
      for (int32_t _5564_j = _11850_; _5564_j < _11851_; ++_5564_j)
      {
        {
          _ptr__5562_res[_5563_i] += safe_mul( _ptr__5560_s[_5564_j],((*_5558_vsub)(_5563_i,_5564_j)) );
        }
      }
    }
  }
  return _5562_res;
}
// End mosek.fusion.ExprInner.convert

// Begin mosek.fusion.ExprInner.toString
// Method mosek.fusion.ExprInner.toString @ bld/grindsted/final/default/src/fusion/ExprMul.monty:2102:6-64
std::string mosek::fusion::ExprInner :: toString() { return mosek::fusion::p_ExprInner::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprInner::toString()
{
  return std::string ("ExprInner()");
}
// End mosek.fusion.ExprInner.toString

void mosek::fusion::p_ExprInner::destroy()
{
  vcof.reset();
  vsub.reset();
  expr.reset();
}
void mosek::fusion::ExprInner::destroy() { mosek::fusion::p_ExprInner::_get_impl(this)->destroy(); }
// } class ExprInner
// class ExprMulDiagRight { // @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1738:4-2093:5
mosek::fusion::ExprMulDiagRight::ExprMulDiagRight(mosek::fusion::p_ExprMulDiagRight *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulDiagRight()" << this << std::endl; */ }
mosek::fusion::ExprMulDiagRight::~ExprMulDiagRight() {  /* std::cout << "~ExprMulDiagRight()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulDiagRight::p_ExprMulDiagRight
  (::mosek::fusion::ExprMulDiagRight * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulDiagRight.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1824:6-1842:7
mosek::fusion::ExprMulDiagRight::t mosek::fusion::p_ExprMulDiagRight::_new_ExprMulDiagRight
  (int32_t _5565_mdim0,
    int32_t _5566_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5567_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5568_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5569_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5570_expr,
    int32_t _5571_validated)
{ return new mosek::fusion::ExprMulDiagRight(_5565_mdim0,_5566_mdim1,_5567_msubi,_5568_msubj,_5569_mval,_5570_expr,_5571_validated); }
mosek::fusion::ExprMulDiagRight::ExprMulDiagRight
  (int32_t _5565_mdim0,
    int32_t _5566_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5567_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5568_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5569_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5570_expr,
    int32_t _5571_validated) : 
   ExprMulDiagRight(new mosek::fusion::p_ExprMulDiagRight(this))
{ mosek::fusion::p_ExprMulDiagRight::_get_impl(this)->_initialize(_5565_mdim0,_5566_mdim1,_5567_msubi,_5568_msubj,_5569_mval,_5570_expr,_5571_validated); }
void mosek::fusion::p_ExprMulDiagRight::_initialize  (int32_t _5565_mdim0,
    int32_t _5566_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5567_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5568_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5569_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5570_expr,
    int32_t _5571_validated)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__5567_msubi(_5567_msubi ? _5567_msubi->raw() : nullptr, _5567_msubi ? _5567_msubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__5568_msubj(_5568_msubj ? _5568_msubj->raw() : nullptr, _5568_msubj ? _5568_msubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__5569_mval(_5569_mval ? _5569_mval->raw() : nullptr, _5569_mval ? _5569_mval->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(_5570_expr->__mosek_2fusion_2Expression__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_5566_mdim1)}));
    mosek::fusion::p_ExprMulDiagRight::_get_impl(::mosek::fusion::ExprMulDiagRight::t(_pubthis))->mdim0 = _5565_mdim0;
    mosek::fusion::p_ExprMulDiagRight::_get_impl(::mosek::fusion::ExprMulDiagRight::t(_pubthis))->mdim1 = _5566_mdim1;
    mosek::fusion::p_ExprMulDiagRight::_get_impl(::mosek::fusion::ExprMulDiagRight::t(_pubthis))->msubi = _5567_msubi;
    mosek::fusion::p_ExprMulDiagRight::_get_impl(::mosek::fusion::ExprMulDiagRight::t(_pubthis))->msubj = _5568_msubj;
    mosek::fusion::p_ExprMulDiagRight::_get_impl(::mosek::fusion::ExprMulDiagRight::t(_pubthis))->mval = _5569_mval;
    mosek::fusion::p_ExprMulDiagRight::_get_impl(::mosek::fusion::ExprMulDiagRight::t(_pubthis))->expr = _5570_expr;
  }
}
// mosek.fusion.ExprMulDiagRight.ctor

// mosek.fusion.ExprMulDiagRight.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1812:6-1822:7
mosek::fusion::ExprMulDiagRight::t mosek::fusion::p_ExprMulDiagRight::_new_ExprMulDiagRight
  (int32_t _5572_mdim0,
    int32_t _5573_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5574_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5575_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5576_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5577_expr)
{ return new mosek::fusion::ExprMulDiagRight(_5572_mdim0,_5573_mdim1,_5574_msubi,_5575_msubj,_5576_mval,_5577_expr); }
mosek::fusion::ExprMulDiagRight::ExprMulDiagRight
  (int32_t _5572_mdim0,
    int32_t _5573_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5574_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5575_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5576_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5577_expr) : 
   ExprMulDiagRight(new mosek::fusion::p_ExprMulDiagRight(this))
{ mosek::fusion::p_ExprMulDiagRight::_get_impl(this)->_initialize(_5572_mdim0,_5573_mdim1,_5574_msubi,_5575_msubj,_5576_mval,_5577_expr); }
void mosek::fusion::p_ExprMulDiagRight::_initialize  (int32_t _5572_mdim0,
    int32_t _5573_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5574_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5575_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5576_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5577_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__5574_msubi(_5574_msubi ? _5574_msubi->raw() : nullptr, _5574_msubi ? _5574_msubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__5575_msubj(_5575_msubj ? _5575_msubj->raw() : nullptr, _5575_msubj ? _5575_msubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__5576_mval(_5576_mval ? _5576_mval->raw() : nullptr, _5576_mval ? _5576_mval->size(0) : 0);
    mosek::fusion::p_ExprMulDiagRight::_initialize(_5572_mdim0,_5573_mdim1,_5574_msubi,_5575_msubj,_5576_mval,_5577_expr,::mosek::fusion::p_ExprMulDiagRight::validate(_5572_mdim0,_5573_mdim1,_5574_msubi,_5575_msubj,_5576_mval,_5577_expr));
  }
}
// mosek.fusion.ExprMulDiagRight.ctor

// Begin mosek.fusion.ExprMulDiagRight.eval
// Method mosek.fusion.ExprMulDiagRight.eval @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1845:6-2092:7
void mosek::fusion::ExprMulDiagRight :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5578_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5579_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5580_xs,bool _5581_cache_eval) { mosek::fusion::p_ExprMulDiagRight::_get_impl(this)->eval(_5578_rs,_5579_ws,_5580_xs,_5581_cache_eval); }
void mosek::fusion::p_ExprMulDiagRight::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5578_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5579_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5580_xs,bool _5581_cache_eval)
{
  mosek::fusion::p_ExprMulDiagRight::_get_impl(::mosek::fusion::ExprMulDiagRight::t(_pubthis))->expr->recursive_eval(_5579_ws,_5578_rs,_5580_xs,_5581_cache_eval);
  _5579_ws->pop_expr();
  int32_t _5582_nd = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->nd;
  int32_t _5583_nnz = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->nnz;
  int32_t _5584_nelem = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->nelem;
  int32_t _5585_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->ncodeatom;
  bool _5586_hassp = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->hassp;
  int32_t _5587_shape = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->shape_base;
  int32_t _5588_ptr = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->ptr_base;
  int32_t _5589_sp = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->sp_base;
  int32_t _5590_nidxs = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->nidxs_base;
  int32_t _5591_cof = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->cof_base;
  int32_t _5592_codeptr = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->codeptr_base;
  int32_t _5593_code = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->code_base;
  int32_t _5594_cconst = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5595_wi32 = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__5595_wi32(_5595_wi32 ? _5595_wi32->raw() : nullptr,_5595_wi32 ? _5595_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5596_wi64 = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__5596_wi64(_5596_wi64 ? _5596_wi64->raw() : nullptr,_5596_wi64 ? _5596_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5597_wf64 = mosek::fusion::p_WorkStack::_get_impl(_5579_ws)->f64;
  _checked_ptr_1<double> _ptr__5597_wf64(_5597_wf64 ? _5597_wf64->raw() : nullptr,_5597_wf64 ? _5597_wf64->size(0) : 0);
  int32_t _5598_edim0 = _ptr__5595_wi32[_5587_shape];
  int32_t _5599_edim1 = _ptr__5595_wi32[safe_add( _5587_shape,(int)1 )];
  int32_t _5600_mnnz = (int)((mval)->size(0));
  int32_t _5601_xmperm = _5580_xs->alloci32(_5600_mnnz);
  int32_t _5602_xmcolptr = _5580_xs->alloci32(safe_add( mdim1,(int)1 ));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5603_xi32 = mosek::fusion::p_WorkStack::_get_impl(_5580_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__5603_xi32(_5603_xi32 ? _5603_xi32->raw() : nullptr,_5603_xi32 ? _5603_xi32->size(0) : 0);
  {
    int32_t _11852_ = (int)0;
    int32_t _11853_ = safe_add( mdim1,(int)1 );
    for (int32_t _5604_i = _11852_; _5604_i < _11853_; ++_5604_i)
    {
      {
        _ptr__5603_xi32[safe_add( _5602_xmcolptr,_5604_i )] = (int)0;
      }
    }
    int32_t _11854_ = (int)0;
    int32_t _11855_ = _5600_mnnz;
    for (int32_t _5605_i = _11854_; _5605_i < _11855_; ++_5605_i)
    {
      {
        ++ _ptr__5603_xi32[safe_add( safe_add( _5602_xmcolptr,((*msubj)(_5605_i)) ),(int)1 )];
      }
    }
    int32_t _11856_ = (int)0;
    int32_t _11857_ = mdim1;
    for (int32_t _5606_i = _11856_; _5606_i < _11857_; ++_5606_i)
    {
      {
        _ptr__5603_xi32[safe_add( safe_add( _5602_xmcolptr,_5606_i ),(int)1 )] += _ptr__5603_xi32[safe_add( _5602_xmcolptr,_5606_i )];
      }
    }
    int32_t _11858_ = (int)0;
    int32_t _11859_ = _5600_mnnz;
    for (int32_t _5607_i = _11858_; _5607_i < _11859_; ++_5607_i)
    {
      {
        _ptr__5603_xi32[safe_add( _5601_xmperm,_ptr__5603_xi32[safe_add( _5602_xmcolptr,((*msubj)(_5607_i)) )] )] = _5607_i;
        ++ _ptr__5603_xi32[safe_add( _5602_xmcolptr,((*msubj)(_5607_i)) )];
      }
    }
    int32_t _11860_ = (int)0;
    int32_t _11861_ = mdim1;
    for (int32_t _5608_i = _11860_; _5608_i < _11861_; ++_5608_i)
    {
      {
        _ptr__5603_xi32[(safe_add( _5602_xmcolptr,mdim1 ) - _5608_i)] = _ptr__5603_xi32[((safe_add( _5602_xmcolptr,mdim1 ) - _5608_i) - (int)1)];
      }
    }
    _ptr__5603_xi32[_5602_xmcolptr] = (int)0;
  }
  int32_t _5609_rncodeatom = (int)0;
  int32_t _5610_rnnz = (int)0;
  int32_t _5611_rnelem = (int)0;
  if ((!_5586_hassp))
  {
    {
      int32_t _5612_i1 = (int)0;
      while ( (_5612_i1 < _5600_mnnz) )
      {
        {
          int32_t _5613_mcol = ((*msubj)(_ptr__5603_xi32[safe_add( _5601_xmperm,_5612_i1 )]));
          int32_t _5614_b1 = _5612_i1;
          while ( ((_5612_i1 < _5600_mnnz) && (_5613_mcol == ((*msubj)(_ptr__5603_xi32[safe_add( _5601_xmperm,_5612_i1 )])))) )
          {
            {
              ++ _5612_i1;
            }
          }
          int32_t _11862_ = _5614_b1;
          int32_t _11863_ = _5612_i1;
          for (int32_t _5615_i = _11862_; _5615_i < _11863_; ++_5615_i)
          {
            {
              int32_t _5616_eidx = safe_add( safe_mul( ((*msubj)(_ptr__5603_xi32[safe_add( _5601_xmperm,_5615_i )])),_5599_edim1 ),((*msubi)(_ptr__5603_xi32[safe_add( _5601_xmperm,_5615_i )])) );
              _5610_rnnz += (_ptr__5595_wi32[safe_add( safe_add( _5588_ptr,_5616_eidx ),(int)1 )] - _ptr__5595_wi32[safe_add( _5588_ptr,_5616_eidx )]);
              if ((_5585_ncodeatom > (int)0))
              {
                {
                  _5609_rncodeatom += safe_add( (_ptr__5595_wi32[safe_add( _5592_codeptr,_ptr__5595_wi32[safe_add( safe_add( _5588_ptr,_5616_eidx ),(int)1 )] )] - _ptr__5595_wi32[safe_add( _5592_codeptr,_ptr__5595_wi32[safe_add( _5588_ptr,_5616_eidx )] )]),safe_mul( (int)2,(_ptr__5595_wi32[safe_add( safe_add( _5588_ptr,_5616_eidx ),(int)1 )] - _ptr__5595_wi32[safe_add( _5588_ptr,_5616_eidx )]) ) );
                }
              }
              {}
            }
          }
          ++ _5611_rnelem;
        }
      }
    }
  }
  else
  {
    {
      int32_t _5617_i1 = (int)0;
      int32_t _5618_i0 = (int)0;
      int32_t _11864_ = (int)0;
      int32_t _11865_ = mdim1;
      for (int32_t _5619_i = _11864_; _5619_i < _11865_; ++_5619_i)
      {
        {
          int32_t _5620_b1 = _5617_i1;
          int32_t _5621_b0 = _5618_i0;
          while ( ((_5617_i1 < _5600_mnnz) && (_5619_i == ((*msubj)(_ptr__5603_xi32[safe_add( _5601_xmperm,_5617_i1 )])))) )
          {
            {
              ++ _5617_i1;
            }
          }
          while ( ((_5618_i0 < _5584_nelem) && (_5619_i == (_ptr__5596_wi64[safe_add( _5589_sp,_5618_i0 )] / _5599_edim1))) )
          {
            {
              ++ _5618_i0;
            }
          }
          int32_t _5622_ii1 = _5620_b1;
          int32_t _5623_ii0 = _5621_b0;
          int32_t _5624_rownnz = (int)0;
          while ( ((_5623_ii0 < _5618_i0) && (_5622_ii1 < _5617_i1)) )
          {
            {
              if (((_ptr__5596_wi64[safe_add( _5589_sp,_5623_ii0 )] % _5599_edim1) < ((*msubi)(_ptr__5603_xi32[safe_add( _5601_xmperm,_5622_ii1 )]))))
              {
                {
                  ++ _5623_ii0;
                }
              }
              else if(((_ptr__5596_wi64[safe_add( _5589_sp,_5623_ii0 )] % _5599_edim1) > ((*msubi)(_ptr__5603_xi32[safe_add( _5601_xmperm,_5622_ii1 )]))))
              {
                {
                  ++ _5622_ii1;
                }
              }
              else
              {
                {
                  _5610_rnnz += (_ptr__5595_wi32[safe_add( safe_add( _5588_ptr,_5623_ii0 ),(int)1 )] - _ptr__5595_wi32[safe_add( _5588_ptr,_5623_ii0 )]);
                  if ((_5585_ncodeatom > (int)0))
                  {
                    {
                      _5609_rncodeatom += safe_add( (_ptr__5595_wi32[safe_add( _5592_codeptr,_ptr__5595_wi32[safe_add( safe_add( _5588_ptr,_5623_ii0 ),(int)1 )] )] - _ptr__5595_wi32[safe_add( _5592_codeptr,_ptr__5595_wi32[safe_add( _5588_ptr,_5623_ii0 )] )]),safe_mul( (int)2,(_ptr__5595_wi32[safe_add( safe_add( _5588_ptr,_5623_ii0 ),(int)1 )] - _ptr__5595_wi32[safe_add( _5588_ptr,_5623_ii0 )]) ) );
                    }
                  }
                  {}
                  ++ _5624_rownnz;
                  ++ _5623_ii0;
                  ++ _5622_ii1;
                }
              }
            }
          }
          if ((_5624_rownnz > (int)0))
          {
            {
              ++ _5611_rnelem;
            }
          }
          {}
        }
      }
    }
  }
  bool _5625_rhassp = (_5611_rnelem < _5598_edim0);
  _5578_rs->alloc_expr((int)1,_5611_rnelem,_5610_rnnz,_5625_rhassp,_5609_rncodeatom);
  int32_t _5626_rptr = mosek::fusion::p_WorkStack::_get_impl(_5578_rs)->ptr_base;
  int32_t _5627_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_5578_rs)->nidxs_base;
  int32_t _11866_;
  bool _11867_ = _5625_rhassp;
  if (_11867_)
  {
    _11866_ = mosek::fusion::p_WorkStack::_get_impl(_5578_rs)->sp_base;
  }
  else
  {
    _11866_ = _5578_rs->alloci64(_5611_rnelem);
  }
  int32_t _5628_rsp = _11866_;
  int32_t _5629_rcof = mosek::fusion::p_WorkStack::_get_impl(_5578_rs)->cof_base;
  int32_t _5630_rshape = mosek::fusion::p_WorkStack::_get_impl(_5578_rs)->shape_base;
  int32_t _5631_rcode = mosek::fusion::p_WorkStack::_get_impl(_5578_rs)->code_base;
  int32_t _5632_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5578_rs)->codeptr_base;
  int32_t _5633_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5578_rs)->cconst_base;
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5634_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5578_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__5634_ri64(_5634_ri64 ? _5634_ri64->raw() : nullptr,_5634_ri64 ? _5634_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5635_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5578_rs)->f64;
  _checked_ptr_1<double> _ptr__5635_rf64(_5635_rf64 ? _5635_rf64->raw() : nullptr,_5635_rf64 ? _5635_rf64->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5636_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5578_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__5636_ri32(_5636_ri32 ? _5636_ri32->raw() : nullptr,_5636_ri32 ? _5636_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5637_xi32 = mosek::fusion::p_WorkStack::_get_impl(_5580_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__5637_xi32(_5637_xi32 ? _5637_xi32->raw() : nullptr,_5637_xi32 ? _5637_xi32->size(0) : 0);
  {
    int32_t _5638_codei = (int)0;
    int32_t _5639_nzi = (int)0;
    int32_t _5640_elmi = (int)0;
    _ptr__5636_ri32[_5626_rptr] = (int)0;
    if ((_5609_rncodeatom > (int)0))
    {
      {
        _ptr__5636_ri32[_5632_rcodeptr] = (int)0;
      }
    }
    {}
    _ptr__5636_ri32[_5630_rshape] = mdim1;
    if ((!_5586_hassp))
    {
      {
        int32_t _5641_i1 = (int)0;
        while ( (_5641_i1 < _5600_mnnz) )
        {
          {
            int32_t _5642_mcol = ((*msubj)(_ptr__5637_xi32[safe_add( _5601_xmperm,_5641_i1 )]));
            int32_t _5643_b1 = _5641_i1;
            while ( ((_5641_i1 < _5600_mnnz) && (_5642_mcol == ((*msubj)(_ptr__5637_xi32[safe_add( _5601_xmperm,_5641_i1 )])))) )
            {
              {
                ++ _5641_i1;
              }
            }
            int32_t _11868_ = _5643_b1;
            int32_t _11869_ = _5641_i1;
            for (int32_t _5644_i = _11868_; _5644_i < _11869_; ++_5644_i)
            {
              {
                int32_t _5645_midx = _ptr__5637_xi32[safe_add( _5601_xmperm,_5644_i )];
                int32_t _5646_eidx = safe_add( safe_mul( ((*msubj)(_5645_midx)),_5599_edim1 ),((*msubi)(_5645_midx)) );
                int32_t _11870_ = _ptr__5595_wi32[safe_add( _5588_ptr,_5646_eidx )];
                int32_t _11871_ = _ptr__5595_wi32[safe_add( safe_add( _5588_ptr,_5646_eidx ),(int)1 )];
                for (int32_t _5647_j = _11870_; _5647_j < _11871_; ++_5647_j)
                {
                  {
                    _ptr__5634_ri64[safe_add( _5627_rnidxs,_5639_nzi )] = _ptr__5596_wi64[safe_add( _5590_nidxs,_5647_j )];
                    _ptr__5635_rf64[safe_add( _5629_rcof,_5639_nzi )] = (_ptr__5597_wf64[safe_add( _5591_cof,_5647_j )] * ((*mval)(_5645_midx)));
                    if ((_5585_ncodeatom > (int)0))
                    {
                      {
                        int32_t _11872_ = _ptr__5595_wi32[safe_add( _5592_codeptr,_5647_j )];
                        int32_t _11873_ = _ptr__5595_wi32[safe_add( safe_add( _5592_codeptr,_5647_j ),(int)1 )];
                        for (int32_t _5648_k = _11872_; _5648_k < _11873_; ++_5648_k)
                        {
                          {
                            _ptr__5636_ri32[safe_add( _5631_rcode,_5638_codei )] = _ptr__5595_wi32[safe_add( _5593_code,_5648_k )];
                            _ptr__5635_rf64[safe_add( _5633_rcconst,_5638_codei )] = _ptr__5597_wf64[safe_add( _5594_cconst,_5648_k )];
                            ++ _5638_codei;
                          }
                        }
                        _ptr__5636_ri32[safe_add( _5631_rcode,_5638_codei )] = 2;
                        _ptr__5635_rf64[safe_add( _5633_rcconst,_5638_codei )] = ((*mval)(_5645_midx));
                        ++ _5638_codei;
                        _ptr__5636_ri32[safe_add( _5631_rcode,_5638_codei )] = 5;
                        ++ _5638_codei;
                        _ptr__5636_ri32[safe_add( safe_add( _5632_rcodeptr,_5639_nzi ),(int)1 )] = _5638_codei;
                      }
                    }
                    {}
                    ++ _5639_nzi;
                  }
                }
              }
            }
            _ptr__5634_ri64[safe_add( _5628_rsp,_5640_elmi )] = _5642_mcol;
            _ptr__5636_ri32[safe_add( safe_add( _5626_rptr,_5640_elmi ),(int)1 )] = _5639_nzi;
            ++ _5640_elmi;
          }
        }
      }
    }
    else
    {
      {
        int32_t _5649_i1 = (int)0;
        int32_t _5650_i0 = (int)0;
        int32_t _11874_ = (int)0;
        int32_t _11875_ = mdim1;
        for (int32_t _5651_i = _11874_; _5651_i < _11875_; ++_5651_i)
        {
          {
            int32_t _5652_b1 = _5649_i1;
            int32_t _5653_b0 = _5650_i0;
            while ( ((_5650_i0 < _5584_nelem) && (_5651_i == (_ptr__5596_wi64[safe_add( _5589_sp,_5650_i0 )] / _5599_edim1))) )
            {
              {
                ++ _5650_i0;
              }
            }
            while ( ((_5649_i1 < _5600_mnnz) && (_5651_i == ((*msubj)(_ptr__5637_xi32[safe_add( _5601_xmperm,_5649_i1 )])))) )
            {
              {
                ++ _5649_i1;
              }
            }
            int32_t _5654_ii1 = _5652_b1;
            int32_t _5655_ii0 = _5653_b0;
            int32_t _5656_rownnz = (int)0;
            while ( ((_5655_ii0 < _5650_i0) && (_5654_ii1 < _5649_i1)) )
            {
              {
                if (((_ptr__5596_wi64[safe_add( _5589_sp,_5655_ii0 )] % _5599_edim1) < ((*msubi)(_ptr__5637_xi32[safe_add( _5601_xmperm,_5654_ii1 )]))))
                {
                  {
                    ++ _5655_ii0;
                  }
                }
                else if(((_ptr__5596_wi64[safe_add( _5589_sp,_5655_ii0 )] % _5599_edim1) > ((*msubi)(_ptr__5637_xi32[safe_add( _5601_xmperm,_5654_ii1 )]))))
                {
                  {
                    ++ _5654_ii1;
                  }
                }
                else
                {
                  {
                    int32_t _5657_midx = _ptr__5637_xi32[safe_add( _5601_xmperm,_5654_ii1 )];
                    int32_t _11876_ = _ptr__5595_wi32[safe_add( _5588_ptr,_5655_ii0 )];
                    int32_t _11877_ = _ptr__5595_wi32[safe_add( safe_add( _5588_ptr,_5655_ii0 ),(int)1 )];
                    for (int32_t _5658_j = _11876_; _5658_j < _11877_; ++_5658_j)
                    {
                      {
                        _ptr__5634_ri64[safe_add( _5627_rnidxs,_5639_nzi )] = _ptr__5596_wi64[safe_add( _5590_nidxs,_5658_j )];
                        _ptr__5635_rf64[safe_add( _5629_rcof,_5639_nzi )] = (_ptr__5597_wf64[safe_add( _5591_cof,_5658_j )] * ((*mval)(_5657_midx)));
                        if ((_5585_ncodeatom > (int)0))
                        {
                          {
                            int32_t _11878_ = _ptr__5595_wi32[safe_add( _5592_codeptr,_5658_j )];
                            int32_t _11879_ = _ptr__5595_wi32[safe_add( safe_add( _5592_codeptr,_5658_j ),(int)1 )];
                            for (int32_t _5659_k = _11878_; _5659_k < _11879_; ++_5659_k)
                            {
                              {
                                _ptr__5636_ri32[safe_add( _5631_rcode,_5638_codei )] = _ptr__5595_wi32[safe_add( _5593_code,_5659_k )];
                                _ptr__5635_rf64[safe_add( _5633_rcconst,_5638_codei )] = _ptr__5597_wf64[safe_add( _5594_cconst,_5659_k )];
                                ++ _5638_codei;
                              }
                            }
                            _ptr__5636_ri32[safe_add( _5631_rcode,_5638_codei )] = 2;
                            _ptr__5635_rf64[safe_add( _5633_rcconst,_5638_codei )] = ((*mval)(_5657_midx));
                            ++ _5638_codei;
                            _ptr__5636_ri32[safe_add( _5631_rcode,_5638_codei )] = 5;
                            ++ _5638_codei;
                            _ptr__5636_ri32[safe_add( safe_add( _5632_rcodeptr,_5639_nzi ),(int)1 )] = _5638_codei;
                          }
                        }
                        {}
                        ++ _5639_nzi;
                      }
                    }
                    ++ _5656_rownnz;
                    ++ _5655_ii0;
                    ++ _5654_ii1;
                  }
                }
              }
            }
            if ((_5656_rownnz > (int)0))
            {
              {
                _ptr__5636_ri32[safe_add( safe_add( _5626_rptr,_5640_elmi ),(int)1 )] = _5639_nzi;
                _ptr__5634_ri64[safe_add( _5628_rsp,_5640_elmi )] = _5651_i;
                ++ _5640_elmi;
              }
            }
            {}
          }
        }
      }
    }
    if ((!_5625_rhassp))
    {
      {
        _5578_rs->popi64(_5611_rnelem);
      }
    }
    {}
    if ((!(_5610_rnnz == _5639_nzi)))
    {
      {
        throw ::mosek::fusion::UnexpectedError(std::string ("Incorrect number of non-zeros"));
      }
    }
    {}
    if ((!(_5611_rnelem == _5640_elmi)))
    {
      {
        throw ::mosek::fusion::UnexpectedError(std::string ("Incorrect number of elements"));
      }
    }
    {}
  }
  _5580_xs->clear();
}
// End mosek.fusion.ExprMulDiagRight.eval

// Begin mosek.fusion.ExprMulDiagRight.validate
// Method mosek.fusion.ExprMulDiagRight.validate @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1751:6-1797:7
int32_t mosek::fusion::p_ExprMulDiagRight::validate(int32_t _5660_mdim0,int32_t _5661_mdim1,std::shared_ptr< monty::ndarray< int32_t,1 > > _5662_msubi,std::shared_ptr< monty::ndarray< int32_t,1 > > _5663_msubj,std::shared_ptr< monty::ndarray< double,1 > > _5664_mval,monty::rc_ptr< ::mosek::fusion::Expression > _5665_expr)
{
  _checked_ptr_1<int32_t> _ptr__5662_msubi(_5662_msubi ? _5662_msubi->raw() : nullptr, _5662_msubi ? _5662_msubi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__5663_msubj(_5663_msubj ? _5663_msubj->raw() : nullptr, _5663_msubj ? _5663_msubj->size(0) : 0);
  _checked_ptr_1<double> _ptr__5664_mval(_5664_mval ? _5664_mval->raw() : nullptr, _5664_mval ? _5664_mval->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5666_eshape = _5665_expr->getShape();
  _checked_ptr_1<int32_t> _ptr__5666_eshape(_5666_eshape ? _5666_eshape->raw() : nullptr,_5666_eshape ? _5666_eshape->size(0) : 0);
  if (((int)((_5666_eshape)->size(0)) > (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions"));
    }
  }
  {}
  int32_t _5667_edim0 = _ptr__5666_eshape[(int)0];
  int32_t _5668_edim1 = _ptr__5666_eshape[(int)1];
  if (((_5660_mdim0 < (int)0) || ((_5661_mdim1 < (int)0) || ((_5667_edim0 < (int)0) || (_5668_edim1 < (int)0)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions"));
    }
  }
  {}
  if (((_5660_mdim0 != _5668_edim1) || (_5661_mdim1 != _5667_edim0)))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
    }
  }
  {}
  if ((((int)((_5662_msubi)->size(0)) != (int)((_5663_msubj)->size(0))) || ((int)((_5662_msubi)->size(0)) != (int)((_5664_mval)->size(0)))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Invalid matrix data"));
    }
  }
  {}
  int32_t _5669_mnnz = (int)((_5662_msubi)->size(0));
  bool _5670_err_data = false;
  bool _5671_err_sorted = false;
  {
    int32_t _11880_ = (int)0;
    int32_t _11881_ = _5669_mnnz;
    for (int32_t _5672_i = _11880_; _5672_i < _11881_; ++_5672_i)
    {
      {
        if (((_ptr__5662_msubi[_5672_i] < (int)0) || ((_ptr__5662_msubi[_5672_i] >= _5660_mdim0) || ((_ptr__5663_msubj[_5672_i] < (int)0) || (_ptr__5663_msubj[_5672_i] >= _5661_mdim1)))))
        {
          {
            _5670_err_data = true;
          }
        }
        {}
      }
    }
    int32_t _11882_ = (int)0;
    int32_t _11883_ = (_5669_mnnz - (int)1);
    for (int32_t _5673_i = _11882_; _5673_i < _11883_; ++_5673_i)
    {
      {
        if (((_ptr__5662_msubi[_5673_i] > _ptr__5662_msubi[safe_add( _5673_i,(int)1 )]) || ((_ptr__5662_msubi[_5673_i] == _ptr__5662_msubi[safe_add( _5673_i,(int)1 )]) && (_ptr__5663_msubj[_5673_i] >= _ptr__5663_msubj[safe_add( _5673_i,(int)1 )]))))
        {
          {
            _5671_err_sorted = true;
          }
        }
        {}
      }
    }
  }
  if (_5670_err_data)
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Invalid matrix data"));
    }
  }
  {}
  if (_5671_err_sorted)
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Unsorted matrix data"));
    }
  }
  {}
  return (int)1;
}
// End mosek.fusion.ExprMulDiagRight.validate

// Begin mosek.fusion.ExprMulDiagRight.toString
// Method mosek.fusion.ExprMulDiagRight.toString @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1749:6-137
std::string mosek::fusion::ExprMulDiagRight :: toString() { return mosek::fusion::p_ExprMulDiagRight::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulDiagRight::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulDiagRight("))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",m)"))->toString();
}
// End mosek.fusion.ExprMulDiagRight.toString

void mosek::fusion::p_ExprMulDiagRight::destroy()
{
  expr.reset();
  mval.reset();
  msubj.reset();
  msubi.reset();
}
void mosek::fusion::ExprMulDiagRight::destroy() { mosek::fusion::p_ExprMulDiagRight::_get_impl(this)->destroy(); }
// } class ExprMulDiagRight
// class ExprMulDiagLeft { // @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1355:4-1724:5
mosek::fusion::ExprMulDiagLeft::ExprMulDiagLeft(mosek::fusion::p_ExprMulDiagLeft *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulDiagLeft()" << this << std::endl; */ }
mosek::fusion::ExprMulDiagLeft::~ExprMulDiagLeft() {  /* std::cout << "~ExprMulDiagLeft()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulDiagLeft::p_ExprMulDiagLeft
  (::mosek::fusion::ExprMulDiagLeft * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulDiagLeft.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1440:6-1459:7
mosek::fusion::ExprMulDiagLeft::t mosek::fusion::p_ExprMulDiagLeft::_new_ExprMulDiagLeft
  (int32_t _5674_mdim0,
    int32_t _5675_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5676_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5677_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5678_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5679_expr,
    int32_t _5680_validated)
{ return new mosek::fusion::ExprMulDiagLeft(_5674_mdim0,_5675_mdim1,_5676_msubi,_5677_msubj,_5678_mval,_5679_expr,_5680_validated); }
mosek::fusion::ExprMulDiagLeft::ExprMulDiagLeft
  (int32_t _5674_mdim0,
    int32_t _5675_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5676_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5677_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5678_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5679_expr,
    int32_t _5680_validated) : 
   ExprMulDiagLeft(new mosek::fusion::p_ExprMulDiagLeft(this))
{ mosek::fusion::p_ExprMulDiagLeft::_get_impl(this)->_initialize(_5674_mdim0,_5675_mdim1,_5676_msubi,_5677_msubj,_5678_mval,_5679_expr,_5680_validated); }
void mosek::fusion::p_ExprMulDiagLeft::_initialize  (int32_t _5674_mdim0,
    int32_t _5675_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5676_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5677_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5678_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5679_expr,
    int32_t _5680_validated)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__5676_msubi(_5676_msubi ? _5676_msubi->raw() : nullptr, _5676_msubi ? _5676_msubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__5677_msubj(_5677_msubj ? _5677_msubj->raw() : nullptr, _5677_msubj ? _5677_msubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__5678_mval(_5678_mval ? _5678_mval->raw() : nullptr, _5678_mval ? _5678_mval->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(_5679_expr->__mosek_2fusion_2Expression__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_5674_mdim0)}));
    mosek::fusion::p_ExprMulDiagLeft::_get_impl(::mosek::fusion::ExprMulDiagLeft::t(_pubthis))->mdim0 = _5674_mdim0;
    mosek::fusion::p_ExprMulDiagLeft::_get_impl(::mosek::fusion::ExprMulDiagLeft::t(_pubthis))->mdim1 = _5675_mdim1;
    mosek::fusion::p_ExprMulDiagLeft::_get_impl(::mosek::fusion::ExprMulDiagLeft::t(_pubthis))->msubi = _5676_msubi;
    mosek::fusion::p_ExprMulDiagLeft::_get_impl(::mosek::fusion::ExprMulDiagLeft::t(_pubthis))->msubj = _5677_msubj;
    mosek::fusion::p_ExprMulDiagLeft::_get_impl(::mosek::fusion::ExprMulDiagLeft::t(_pubthis))->mval = _5678_mval;
    mosek::fusion::p_ExprMulDiagLeft::_get_impl(::mosek::fusion::ExprMulDiagLeft::t(_pubthis))->expr = _5679_expr;
  }
}
// mosek.fusion.ExprMulDiagLeft.ctor

// mosek.fusion.ExprMulDiagLeft.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1428:6-1438:7
mosek::fusion::ExprMulDiagLeft::t mosek::fusion::p_ExprMulDiagLeft::_new_ExprMulDiagLeft
  (int32_t _5681_mdim0,
    int32_t _5682_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5683_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5684_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5685_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5686_expr)
{ return new mosek::fusion::ExprMulDiagLeft(_5681_mdim0,_5682_mdim1,_5683_msubi,_5684_msubj,_5685_mval,_5686_expr); }
mosek::fusion::ExprMulDiagLeft::ExprMulDiagLeft
  (int32_t _5681_mdim0,
    int32_t _5682_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5683_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5684_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5685_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5686_expr) : 
   ExprMulDiagLeft(new mosek::fusion::p_ExprMulDiagLeft(this))
{ mosek::fusion::p_ExprMulDiagLeft::_get_impl(this)->_initialize(_5681_mdim0,_5682_mdim1,_5683_msubi,_5684_msubj,_5685_mval,_5686_expr); }
void mosek::fusion::p_ExprMulDiagLeft::_initialize  (int32_t _5681_mdim0,
    int32_t _5682_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5683_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5684_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5685_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5686_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__5683_msubi(_5683_msubi ? _5683_msubi->raw() : nullptr, _5683_msubi ? _5683_msubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__5684_msubj(_5684_msubj ? _5684_msubj->raw() : nullptr, _5684_msubj ? _5684_msubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__5685_mval(_5685_mval ? _5685_mval->raw() : nullptr, _5685_mval ? _5685_mval->size(0) : 0);
    mosek::fusion::p_ExprMulDiagLeft::_initialize(_5681_mdim0,_5682_mdim1,_5683_msubi,_5684_msubj,_5685_mval,_5686_expr,::mosek::fusion::p_ExprMulDiagLeft::validate(_5681_mdim0,_5682_mdim1,_5683_msubi,_5684_msubj,_5685_mval,_5686_expr));
  }
}
// mosek.fusion.ExprMulDiagLeft.ctor

// Begin mosek.fusion.ExprMulDiagLeft.eval
// Method mosek.fusion.ExprMulDiagLeft.eval @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1462:6-1723:7
void mosek::fusion::ExprMulDiagLeft :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5687_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5688_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5689_xs,bool _5690_cache_eval) { mosek::fusion::p_ExprMulDiagLeft::_get_impl(this)->eval(_5687_rs,_5688_ws,_5689_xs,_5690_cache_eval); }
void mosek::fusion::p_ExprMulDiagLeft::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5687_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5688_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5689_xs,bool _5690_cache_eval)
{
  mosek::fusion::p_ExprMulDiagLeft::_get_impl(::mosek::fusion::ExprMulDiagLeft::t(_pubthis))->expr->recursive_eval(_5688_ws,_5687_rs,_5689_xs,_5690_cache_eval);
  _5688_ws->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5691_wi32 = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__5691_wi32(_5691_wi32 ? _5691_wi32->raw() : nullptr,_5691_wi32 ? _5691_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5692_wi64 = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__5692_wi64(_5692_wi64 ? _5692_wi64->raw() : nullptr,_5692_wi64 ? _5692_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5693_wf64 = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->f64;
  _checked_ptr_1<double> _ptr__5693_wf64(_5693_wf64 ? _5693_wf64->raw() : nullptr,_5693_wf64 ? _5693_wf64->size(0) : 0);
  int32_t _5694_nd = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->nd;
  int32_t _5695_nelem = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->nelem;
  int32_t _5696_nnz = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->nnz;
  bool _5697_hassp = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->hassp;
  int32_t _5698_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->ncodeatom;
  int32_t _5699_ptr = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->ptr_base;
  int32_t _5700_code = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->code_base;
  int32_t _5701_cconst = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->cconst_base;
  int32_t _5702_codeptr = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->codeptr_base;
  int32_t _5703_shape = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->shape_base;
  int32_t _5704_sp = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->sp_base;
  int32_t _5705_nidxs = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->nidxs_base;
  int32_t _5706_cof = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->cof_base;
  int32_t _5707_consts = mosek::fusion::p_WorkStack::_get_impl(_5688_ws)->cconst_base;
  if ((_5694_nd != (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operator shape for multiplication"));
    }
  }
  {}
  int32_t _5708_edim0 = _ptr__5691_wi32[_5703_shape];
  int32_t _5709_edim1 = _ptr__5691_wi32[safe_add( _5703_shape,(int)1 )];
  int32_t _5710_mnumnz = (int)((msubi)->size(0));
  if ((!_5697_hassp))
  {
    {
      int32_t _5711_rnnz = (int)0;
      int32_t _5712_rnelem = (int)0;
      int32_t _5713_rncodeatom = (int)0;
      int32_t _5714_i = (int)0;
      while ( (_5714_i < (int)((msubi)->size(0))) )
      {
        {
          int32_t _5715_i0 = ((*msubi)(_5714_i));
          while ( ((_5714_i < (int)((msubi)->size(0))) && (((*msubi)(_5714_i)) == _5715_i0)) )
          {
            {
              int32_t _5716_idx = safe_add( safe_mul( ((*msubj)(_5714_i)),_5709_edim1 ),((*msubi)(_5714_i)) );
              _5711_rnnz += (_ptr__5691_wi32[safe_add( safe_add( _5699_ptr,_5716_idx ),(int)1 )] - _ptr__5691_wi32[safe_add( _5699_ptr,_5716_idx )]);
              if ((_5698_ncodeatom > (int)0))
              {
                {
                  _5713_rncodeatom += safe_add( (_ptr__5691_wi32[safe_add( _5702_codeptr,_ptr__5691_wi32[safe_add( safe_add( _5699_ptr,_5716_idx ),(int)1 )] )] - _ptr__5691_wi32[safe_add( _5702_codeptr,_ptr__5691_wi32[safe_add( _5699_ptr,_5716_idx )] )]),safe_mul( (int)2,(_ptr__5691_wi32[safe_add( safe_add( _5699_ptr,_5716_idx ),(int)1 )] - _ptr__5691_wi32[safe_add( _5699_ptr,_5716_idx )]) ) );
                }
              }
              {}
              ++ _5714_i;
            }
          }
          ++ _5712_rnelem;
        }
      }
      bool _5717_rhassp = (_5712_rnelem < mdim0);
      _5687_rs->alloc_expr((int)1,_5712_rnelem,_5711_rnnz,_5717_rhassp,_5713_rncodeatom);
      int32_t _5718_rptr = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->ptr_base;
      int32_t _5719_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->nidxs_base;
      int32_t _11884_;
      bool _11885_ = _5717_rhassp;
      if (_11885_)
      {
        _11884_ = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->sp_base;
      }
      else
      {
        _11884_ = _5687_rs->alloci64(_5712_rnelem);
      }
      int32_t _5720_rsp = _11884_;
      int32_t _5721_rcof = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->cof_base;
      int32_t _5722_rshape = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->shape_base;
      int32_t _5723_rcode = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->code_base;
      int32_t _5724_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->codeptr_base;
      int32_t _5725_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int64_t,1 > > _5726_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__5726_ri64(_5726_ri64 ? _5726_ri64->raw() : nullptr,_5726_ri64 ? _5726_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _5727_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->f64;
      _checked_ptr_1<double> _ptr__5727_rf64(_5727_rf64 ? _5727_rf64->raw() : nullptr,_5727_rf64 ? _5727_rf64->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5728_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__5728_ri32(_5728_ri32 ? _5728_ri32->raw() : nullptr,_5728_ri32 ? _5728_ri32->size(0) : 0);
      {
        _ptr__5728_ri32[_5718_rptr] = (int)0;
        if ((_5698_ncodeatom > (int)0))
        {
          {
            _ptr__5728_ri32[_5724_rcodeptr] = (int)0;
          }
        }
        {}
        _ptr__5728_ri32[_5722_rshape] = mdim0;
        int32_t _5729_nzi = (int)0;
        int32_t _5730_elmi = (int)0;
        int32_t _5731_codei = (int)0;
        {
        }
        {
          int32_t _5732_i = (int)0;
          while ( (_5732_i < (int)((msubi)->size(0))) )
          {
            {
              int32_t _5733_i0 = ((*msubi)(_5732_i));
              while ( ((_5732_i < (int)((msubi)->size(0))) && (((*msubi)(_5732_i)) == _5733_i0)) )
              {
                {
                  int32_t _5734_idx = safe_add( safe_mul( ((*msubj)(_5732_i)),_5709_edim1 ),((*msubi)(_5732_i)) );
                  int32_t _11886_ = _ptr__5691_wi32[safe_add( _5699_ptr,_5734_idx )];
                  int32_t _11887_ = _ptr__5691_wi32[safe_add( safe_add( _5699_ptr,_5734_idx ),(int)1 )];
                  for (int32_t _5735_j = _11886_; _5735_j < _11887_; ++_5735_j)
                  {
                    {
                      _ptr__5726_ri64[safe_add( _5719_rnidxs,_5729_nzi )] = _ptr__5692_wi64[safe_add( _5705_nidxs,_5735_j )];
                      _ptr__5727_rf64[safe_add( _5721_rcof,_5729_nzi )] = (_ptr__5693_wf64[safe_add( _5706_cof,_5735_j )] * ((*mval)(_5732_i)));
                      if ((_5713_rncodeatom > (int)0))
                      {
                        {
                          int32_t _11888_ = _ptr__5691_wi32[safe_add( _5702_codeptr,_5735_j )];
                          int32_t _11889_ = _ptr__5691_wi32[safe_add( safe_add( _5702_codeptr,_5735_j ),(int)1 )];
                          for (int32_t _5736_k = _11888_; _5736_k < _11889_; ++_5736_k)
                          {
                            {
                              _ptr__5728_ri32[safe_add( _5723_rcode,_5731_codei )] = _ptr__5691_wi32[safe_add( _5700_code,_5736_k )];
                              _ptr__5727_rf64[safe_add( _5725_rcconst,_5731_codei )] = _ptr__5693_wf64[safe_add( _5701_cconst,_5736_k )];
                              ++ _5731_codei;
                            }
                          }
                          _ptr__5728_ri32[safe_add( _5723_rcode,_5731_codei )] = 2;
                          _ptr__5727_rf64[safe_add( _5725_rcconst,_5731_codei )] = ((*mval)(_5732_i));
                          ++ _5731_codei;
                          _ptr__5728_ri32[safe_add( _5723_rcode,_5731_codei )] = 5;
                          ++ _5731_codei;
                          _ptr__5728_ri32[safe_add( safe_add( _5724_rcodeptr,_5729_nzi ),(int)1 )] = _5731_codei;
                        }
                      }
                      {}
                      ++ _5729_nzi;
                    }
                  }
                  ++ _5732_i;
                }
              }
              _ptr__5728_ri32[safe_add( safe_add( _5718_rptr,_5730_elmi ),(int)1 )] = _5729_nzi;
              _ptr__5726_ri64[safe_add( _5720_rsp,_5730_elmi )] = _5733_i0;
              ++ _5730_elmi;
            }
          }
        }
      }
      if ((!_5717_rhassp))
      {
        {
          _5687_rs->popi64(_5712_rnelem);
        }
      }
      {}
    }
  }
  else
  {
    {
      int32_t _5737_xecolptr = _5689_xs->alloci32(safe_add( _5709_edim1,(int)1 ));
      int32_t _5738_xeperm = _5689_xs->alloci32(_5695_nelem);
      int32_t _5739_xmptr = _5689_xs->alloci32(safe_add( mdim0,(int)1 ));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5740_xi32 = mosek::fusion::p_WorkStack::_get_impl(_5689_xs)->i32;
      _checked_ptr_1<int32_t> _ptr__5740_xi32(_5740_xi32 ? _5740_xi32->raw() : nullptr,_5740_xi32 ? _5740_xi32->size(0) : 0);
      int32_t _5741_rncodeatom = (int)0;
      int32_t _5742_rnnz = (int)0;
      int32_t _5743_rnelem = (int)0;
      {
        int32_t _11890_ = (int)0;
        int32_t _11891_ = safe_add( _5709_edim1,(int)1 );
        for (int32_t _5744_i = _11890_; _5744_i < _11891_; ++_5744_i)
        {
          {
            _ptr__5740_xi32[safe_add( _5737_xecolptr,_5744_i )] = (int)0;
          }
        }
        int32_t _11892_ = (int)0;
        int32_t _11893_ = _5695_nelem;
        for (int32_t _5745_i = _11892_; _5745_i < _11893_; ++_5745_i)
        {
          {
            ++ _ptr__5740_xi32[safe_add( safe_add( _5737_xecolptr,(_ptr__5692_wi64[safe_add( _5704_sp,_5745_i )] % _5709_edim1) ),(int)1 )];
          }
        }
        int32_t _11894_ = (int)0;
        int32_t _11895_ = _5709_edim1;
        for (int32_t _5746_i = _11894_; _5746_i < _11895_; ++_5746_i)
        {
          {
            _ptr__5740_xi32[safe_add( safe_add( _5737_xecolptr,_5746_i ),(int)1 )] += _ptr__5740_xi32[safe_add( _5737_xecolptr,_5746_i )];
          }
        }
        int32_t _11896_ = (int)0;
        int32_t _11897_ = _5695_nelem;
        for (int32_t _5747_i = _11896_; _5747_i < _11897_; ++_5747_i)
        {
          {
            int64_t _5748_ej = (_ptr__5692_wi64[safe_add( _5704_sp,_5747_i )] % _5709_edim1);
            _ptr__5740_xi32[safe_add( _5738_xeperm,_ptr__5740_xi32[safe_add( _5737_xecolptr,_5748_ej )] )] = _5747_i;
            ++ _ptr__5740_xi32[safe_add( _5737_xecolptr,_5748_ej )];
          }
        }
        int32_t _11898_ = (int)0;
        int32_t _11899_ = _5709_edim1;
        for (int32_t _5749_i = _11898_; _5749_i < _11899_; ++_5749_i)
        {
          {
            _ptr__5740_xi32[(safe_add( _5737_xecolptr,_5709_edim1 ) - _5749_i)] = _ptr__5740_xi32[((safe_add( _5737_xecolptr,_5709_edim1 ) - _5749_i) - (int)1)];
          }
        }
        _ptr__5740_xi32[_5737_xecolptr] = (int)0;
        int32_t _5750_ie = (int)0;
        int32_t _5751_im = (int)0;
        while ( ((_5751_im < (int)((msubi)->size(0))) && (_5750_ie < _5695_nelem)) )
        {
          {
            if ((((*msubi)(_5751_im)) < (_ptr__5692_wi64[safe_add( _5704_sp,_ptr__5740_xi32[safe_add( _5738_xeperm,_5750_ie )] )] % _5709_edim1)))
            {
              {
                ++ _5751_im;
              }
            }
            else if((((*msubi)(_5751_im)) > (_ptr__5692_wi64[safe_add( _5704_sp,_ptr__5740_xi32[safe_add( _5738_xeperm,_5750_ie )] )] % _5709_edim1)))
            {
              {
                ++ _5750_ie;
              }
            }
            else
            {
              {
                int32_t _5752_elmnnz = (int)0;
                int64_t _5753_ecol = (_ptr__5692_wi64[safe_add( _5704_sp,_ptr__5740_xi32[safe_add( _5738_xeperm,_5750_ie )] )] % _5709_edim1);
                int32_t _5754_mb = _5751_im;
                while ( ((_5751_im < (int)((msubi)->size(0))) && (((*msubi)(_5751_im)) == ((*msubi)(_5754_mb)))) )
                {
                  {
                    ++ _5751_im;
                  }
                }
                int32_t _5755_eb = _5750_ie;
                while ( ((_5750_ie < _5695_nelem) && ((_ptr__5692_wi64[safe_add( _5704_sp,_ptr__5740_xi32[safe_add( _5738_xeperm,_5750_ie )] )] % _5709_edim1) == _5753_ecol)) )
                {
                  {
                    ++ _5750_ie;
                  }
                }
                int32_t _5756_i1 = _5755_eb;
                int32_t _5757_i0 = _5754_mb;
                int32_t _5758_elmnz = (int)0;
                while ( ((_5757_i0 < _5751_im) && (_5756_i1 < _5750_ie)) )
                {
                  {
                    int32_t _5759_eidx = _ptr__5740_xi32[safe_add( _5738_xeperm,_5756_i1 )];
                    if ((((*msubj)(_5757_i0)) < (_ptr__5692_wi64[safe_add( _5704_sp,_5759_eidx )] / _5709_edim1)))
                    {
                      {
                        ++ _5757_i0;
                      }
                    }
                    else if((((*msubj)(_5757_i0)) > (_ptr__5692_wi64[safe_add( _5704_sp,_5759_eidx )] / _5709_edim1)))
                    {
                      {
                        ++ _5756_i1;
                      }
                    }
                    else
                    {
                      {
                        _5742_rnnz += (_ptr__5691_wi32[safe_add( safe_add( _5699_ptr,_5759_eidx ),(int)1 )] - _ptr__5691_wi32[safe_add( _5699_ptr,_5759_eidx )]);
                        if ((_5698_ncodeatom > (int)0))
                        {
                          {
                            _5741_rncodeatom += safe_add( (_ptr__5691_wi32[safe_add( _5702_codeptr,_ptr__5691_wi32[safe_add( safe_add( _5699_ptr,_5759_eidx ),(int)1 )] )] - _ptr__5691_wi32[safe_add( _5702_codeptr,_ptr__5691_wi32[safe_add( _5699_ptr,_5759_eidx )] )]),safe_mul( (int)2,(_ptr__5691_wi32[safe_add( safe_add( _5699_ptr,_5759_eidx ),(int)1 )] - _ptr__5691_wi32[safe_add( _5699_ptr,_5759_eidx )]) ) );
                          }
                        }
                        {}
                        ++ _5758_elmnz;
                        ++ _5757_i0;
                        ++ _5756_i1;
                      }
                    }
                  }
                }
                if ((_5758_elmnz > (int)0))
                {
                  {
                    ++ _5743_rnelem;
                  }
                }
                {}
              }
            }
          }
        }
      }
      bool _5760_rhassp = (_5743_rnelem < mdim0);
      _5687_rs->alloc_expr((int)1,_5743_rnelem,_5742_rnnz,_5760_rhassp,_5741_rncodeatom);
      int32_t _5761_rptr = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->ptr_base;
      int32_t _5762_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->nidxs_base;
      int32_t _11900_;
      bool _11901_ = _5760_rhassp;
      if (_11901_)
      {
        _11900_ = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->sp_base;
      }
      else
      {
        _11900_ = _5687_rs->alloci64(_5743_rnelem);
      }
      int32_t _5763_rsp = _11900_;
      int32_t _5764_rcof = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->cof_base;
      int32_t _5765_rshape = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->shape_base;
      int32_t _5766_rcode = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->code_base;
      int32_t _5767_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->codeptr_base;
      int32_t _5768_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int64_t,1 > > _5769_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__5769_ri64(_5769_ri64 ? _5769_ri64->raw() : nullptr,_5769_ri64 ? _5769_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _5770_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->f64;
      _checked_ptr_1<double> _ptr__5770_rf64(_5770_rf64 ? _5770_rf64->raw() : nullptr,_5770_rf64 ? _5770_rf64->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5771_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5687_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__5771_ri32(_5771_ri32 ? _5771_ri32->raw() : nullptr,_5771_ri32 ? _5771_ri32->size(0) : 0);
      {
        int32_t _5772_elmi = (int)0;
        int32_t _5773_nzi = (int)0;
        int32_t _5774_codei = (int)0;
        int32_t _5775_ie = (int)0;
        int32_t _5776_im = (int)0;
        _ptr__5771_ri32[_5761_rptr] = (int)0;
        if ((_5698_ncodeatom > (int)0))
        {
          {
            _ptr__5771_ri32[_5767_rcodeptr] = (int)0;
          }
        }
        {}
        _ptr__5771_ri32[_5765_rshape] = mdim0;
        while ( ((_5776_im < (int)((msubi)->size(0))) && (_5775_ie < _5695_nelem)) )
        {
          {
            if ((((*msubi)(_5776_im)) < (_ptr__5692_wi64[safe_add( _5704_sp,_ptr__5740_xi32[safe_add( _5738_xeperm,_5775_ie )] )] % _5709_edim1)))
            {
              {
                ++ _5776_im;
              }
            }
            else if((((*msubi)(_5776_im)) > (_ptr__5692_wi64[safe_add( _5704_sp,_ptr__5740_xi32[safe_add( _5738_xeperm,_5775_ie )] )] % _5709_edim1)))
            {
              {
                ++ _5775_ie;
              }
            }
            else
            {
              {
                int32_t _5777_elmnnz = (int)0;
                int64_t _5778_ecol = (_ptr__5692_wi64[safe_add( _5704_sp,_ptr__5740_xi32[safe_add( _5738_xeperm,_5775_ie )] )] % _5709_edim1);
                int32_t _5779_mb = _5776_im;
                while ( ((_5776_im < (int)((msubi)->size(0))) && (((*msubi)(_5776_im)) == ((*msubi)(_5779_mb)))) )
                {
                  {
                    ++ _5776_im;
                  }
                }
                int32_t _5780_eb = _5775_ie;
                while ( ((_5775_ie < _5695_nelem) && ((_ptr__5692_wi64[safe_add( _5704_sp,_ptr__5740_xi32[safe_add( _5738_xeperm,_5775_ie )] )] % _5709_edim1) == _5778_ecol)) )
                {
                  {
                    ++ _5775_ie;
                  }
                }
                int32_t _5781_i1 = _5780_eb;
                int32_t _5782_i0 = _5779_mb;
                int32_t _5783_elmnz = (int)0;
                int32_t _5784_mrow = ((*msubi)(_5779_mb));
                while ( ((_5782_i0 < _5776_im) && (_5781_i1 < _5775_ie)) )
                {
                  {
                    int32_t _5785_eidx = _ptr__5740_xi32[safe_add( _5738_xeperm,_5781_i1 )];
                    if ((((*msubj)(_5782_i0)) < (_ptr__5692_wi64[safe_add( _5704_sp,_5785_eidx )] / _5709_edim1)))
                    {
                      {
                        ++ _5782_i0;
                      }
                    }
                    else if((((*msubj)(_5782_i0)) > (_ptr__5692_wi64[safe_add( _5704_sp,_5785_eidx )] / _5709_edim1)))
                    {
                      {
                        ++ _5781_i1;
                      }
                    }
                    else
                    {
                      {
                        int32_t _11902_ = _ptr__5691_wi32[safe_add( _5699_ptr,_5785_eidx )];
                        int32_t _11903_ = _ptr__5691_wi32[safe_add( safe_add( _5699_ptr,_5785_eidx ),(int)1 )];
                        for (int32_t _5786_j = _11902_; _5786_j < _11903_; ++_5786_j)
                        {
                          {
                            _ptr__5769_ri64[safe_add( _5762_rnidxs,_5773_nzi )] = _ptr__5692_wi64[safe_add( _5705_nidxs,_5786_j )];
                            _ptr__5770_rf64[safe_add( _5764_rcof,_5773_nzi )] = (_ptr__5693_wf64[safe_add( _5706_cof,_5786_j )] * ((*mval)(_5782_i0)));
                            if ((_5698_ncodeatom > (int)0))
                            {
                              {
                                int32_t _11904_ = _ptr__5691_wi32[safe_add( _5702_codeptr,_5786_j )];
                                int32_t _11905_ = _ptr__5691_wi32[safe_add( safe_add( _5702_codeptr,_5786_j ),(int)1 )];
                                for (int32_t _5787_k = _11904_; _5787_k < _11905_; ++_5787_k)
                                {
                                  {
                                    _ptr__5771_ri32[safe_add( _5766_rcode,_5774_codei )] = _ptr__5691_wi32[safe_add( _5700_code,_5787_k )];
                                    _ptr__5770_rf64[safe_add( _5768_rcconst,_5774_codei )] = _ptr__5693_wf64[safe_add( _5701_cconst,_5787_k )];
                                    ++ _5774_codei;
                                  }
                                }
                                _ptr__5771_ri32[safe_add( _5766_rcode,_5774_codei )] = 2;
                                _ptr__5770_rf64[safe_add( _5768_rcconst,_5774_codei )] = ((*mval)(_5782_i0));
                                ++ _5774_codei;
                                _ptr__5771_ri32[safe_add( _5766_rcode,_5774_codei )] = 5;
                                ++ _5774_codei;
                                _ptr__5771_ri32[safe_add( safe_add( _5767_rcodeptr,_5773_nzi ),(int)1 )] = _5774_codei;
                              }
                            }
                            {}
                            ++ _5773_nzi;
                            ++ _5783_elmnz;
                          }
                        }
                        ++ _5782_i0;
                        ++ _5781_i1;
                      }
                    }
                  }
                }
                if ((_5783_elmnz > (int)0))
                {
                  {
                    _ptr__5771_ri32[safe_add( safe_add( _5761_rptr,_5772_elmi ),(int)1 )] = _5773_nzi;
                    _ptr__5769_ri64[safe_add( _5763_rsp,_5772_elmi )] = _5784_mrow;
                    ++ _5772_elmi;
                  }
                }
                {}
              }
            }
          }
        }
        if ((_5773_nzi != _5742_rnnz))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Incorrect number of non-zeros"));
          }
        }
        {}
        if ((_5772_elmi != _5743_rnelem))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Incorrect number of elements"));
          }
        }
        {}
      }
      if ((!_5760_rhassp))
      {
        {
          _5687_rs->popi64(_5743_rnelem);
        }
      }
      {}
    }
  }
  _5689_xs->clear();
}
// End mosek.fusion.ExprMulDiagLeft.eval

// Begin mosek.fusion.ExprMulDiagLeft.validate
// Method mosek.fusion.ExprMulDiagLeft.validate @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1368:6-1412:7
int32_t mosek::fusion::p_ExprMulDiagLeft::validate(int32_t _5788_mdim0,int32_t _5789_mdim1,std::shared_ptr< monty::ndarray< int32_t,1 > > _5790_msubi,std::shared_ptr< monty::ndarray< int32_t,1 > > _5791_msubj,std::shared_ptr< monty::ndarray< double,1 > > _5792_mval,monty::rc_ptr< ::mosek::fusion::Expression > _5793_expr)
{
  _checked_ptr_1<int32_t> _ptr__5790_msubi(_5790_msubi ? _5790_msubi->raw() : nullptr, _5790_msubi ? _5790_msubi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__5791_msubj(_5791_msubj ? _5791_msubj->raw() : nullptr, _5791_msubj ? _5791_msubj->size(0) : 0);
  _checked_ptr_1<double> _ptr__5792_mval(_5792_mval ? _5792_mval->raw() : nullptr, _5792_mval ? _5792_mval->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5794_eshape = _5793_expr->getShape();
  _checked_ptr_1<int32_t> _ptr__5794_eshape(_5794_eshape ? _5794_eshape->raw() : nullptr,_5794_eshape ? _5794_eshape->size(0) : 0);
  if (((int)((_5794_eshape)->size(0)) != (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions"));
    }
  }
  {}
  int32_t _5795_edim0 = _ptr__5794_eshape[(int)0];
  int32_t _5796_edim1 = _ptr__5794_eshape[(int)1];
  if (((_5788_mdim0 < (int)0) || (_5789_mdim1 < (int)0)))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions"));
    }
  }
  {}
  if (((_5789_mdim1 != _5795_edim0) || (_5788_mdim0 != _5796_edim1)))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
    }
  }
  {}
  if ((((int)((_5790_msubi)->size(0)) != (int)((_5791_msubj)->size(0))) || ((int)((_5790_msubi)->size(0)) != (int)((_5792_mval)->size(0)))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Invalid matrix data"));
    }
  }
  {}
  int32_t _5797_mnnz = (int)((_5790_msubi)->size(0));
  bool _5798_err_data = false;
  bool _5799_err_sorted = false;
  {
    int32_t _11906_ = (int)0;
    int32_t _11907_ = _5797_mnnz;
    for (int32_t _5800_i = _11906_; _5800_i < _11907_; ++_5800_i)
    {
      {
        if (((_ptr__5790_msubi[_5800_i] < (int)0) || ((_ptr__5790_msubi[_5800_i] >= _5788_mdim0) || ((_ptr__5791_msubj[_5800_i] < (int)0) || (_ptr__5791_msubj[_5800_i] >= _5789_mdim1)))))
        {
          {
            _5798_err_data = true;
          }
        }
        {}
      }
    }
    int32_t _11908_ = (int)0;
    int32_t _11909_ = (_5797_mnnz - (int)1);
    for (int32_t _5801_i = _11908_; _5801_i < _11909_; ++_5801_i)
    {
      {
        if (((_ptr__5790_msubi[_5801_i] > _ptr__5790_msubi[safe_add( _5801_i,(int)1 )]) || ((_ptr__5790_msubi[_5801_i] == _ptr__5790_msubi[safe_add( _5801_i,(int)1 )]) && (_ptr__5791_msubj[_5801_i] >= _ptr__5791_msubj[safe_add( _5801_i,(int)1 )]))))
        {
          {
            _5799_err_sorted = true;
          }
        }
        {}
      }
    }
  }
  if (_5798_err_data)
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Invalid matrix data"));
    }
  }
  {}
  if (_5799_err_sorted)
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Unsorted matrix data"));
    }
  }
  {}
  return (int)1;
}
// End mosek.fusion.ExprMulDiagLeft.validate

// Begin mosek.fusion.ExprMulDiagLeft.toString
// Method mosek.fusion.ExprMulDiagLeft.toString @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1366:6-136
std::string mosek::fusion::ExprMulDiagLeft :: toString() { return mosek::fusion::p_ExprMulDiagLeft::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulDiagLeft::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulDiagLeft(m,"))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprMulDiagLeft.toString

void mosek::fusion::p_ExprMulDiagLeft::destroy()
{
  expr.reset();
  mval.reset();
  msubj.reset();
  msubi.reset();
}
void mosek::fusion::ExprMulDiagLeft::destroy() { mosek::fusion::p_ExprMulDiagLeft::_get_impl(this)->destroy(); }
// } class ExprMulDiagLeft
// class ExprMulElement { // @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1139:4-1339:5
mosek::fusion::ExprMulElement::ExprMulElement(mosek::fusion::p_ExprMulElement *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulElement()" << this << std::endl; */ }
mosek::fusion::ExprMulElement::~ExprMulElement() {  /* std::cout << "~ExprMulElement()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulElement::p_ExprMulElement
  (::mosek::fusion::ExprMulElement * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulElement.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1154:6-1179:7
mosek::fusion::ExprMulElement::t mosek::fusion::p_ExprMulElement::_new_ExprMulElement
  (std::shared_ptr< monty::ndarray< double,1 > > _5802_mcof,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _5803_msp,
    monty::rc_ptr< ::mosek::fusion::Expression > _5804_expr)
{ return new mosek::fusion::ExprMulElement(_5802_mcof,_5803_msp,_5804_expr); }
mosek::fusion::ExprMulElement::ExprMulElement
  (std::shared_ptr< monty::ndarray< double,1 > > _5802_mcof,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _5803_msp,
    monty::rc_ptr< ::mosek::fusion::Expression > _5804_expr) : 
   ExprMulElement(new mosek::fusion::p_ExprMulElement(this))
{ mosek::fusion::p_ExprMulElement::_get_impl(this)->_initialize(_5802_mcof,_5803_msp,_5804_expr); }
void mosek::fusion::p_ExprMulElement::_initialize  (std::shared_ptr< monty::ndarray< double,1 > > _5802_mcof,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _5803_msp,
    monty::rc_ptr< ::mosek::fusion::Expression > _5804_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__5802_mcof(_5802_mcof ? _5802_mcof->raw() : nullptr, _5802_mcof ? _5802_mcof->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__5803_msp(_5803_msp ? _5803_msp->raw() : nullptr, _5803_msp ? _5803_msp->size(0) : 0);
    mosek::fusion::p_ExprMulElement::_initialize(_5802_mcof,_5803_msp,_5804_expr,(int)1);
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5805_eshape = _5804_expr->getShape();
    _checked_ptr_1<int32_t> _ptr__5805_eshape(_5805_eshape ? _5805_eshape->raw() : nullptr,_5805_eshape ? _5805_eshape->size(0) : 0);
    if (((int)((_5802_mcof)->size(0)) != (int)((_5803_msp)->size(0))))
    {
      {
        throw ::mosek::fusion::LengthError(std::string ("Invalid matrix specification"));
      }
    }
    {}
    int64_t _5806_sz = ::mosek::fusion::p_Set::size(_5805_eshape);
    bool _5807_err_data = false;
    bool _5808_err_sorted = false;
    {
      int32_t _11910_ = (int)0;
      int32_t _11911_ = (int)((_5803_msp)->size(0));
      for (int32_t _5809_i = _11910_; _5809_i < _11911_; ++_5809_i)
      {
        {
          if (((_ptr__5803_msp[_5809_i] < (int)0) || (_ptr__5803_msp[_5809_i] >= _5806_sz)))
          {
            {
              _5807_err_data = true;
            }
          }
          {}
        }
      }
      int32_t _11912_ = (int)0;
      int32_t _11913_ = ((int)((_5803_msp)->size(0)) - (int)1);
      for (int32_t _5810_i = _11912_; _5810_i < _11913_; ++_5810_i)
      {
        {
          if ((_ptr__5803_msp[_5810_i] >= _ptr__5803_msp[safe_add( _5810_i,(int)1 )]))
          {
            {
              _5808_err_sorted = true;
            }
          }
          {}
        }
      }
    }
    if (_5807_err_data)
    {
      {
        throw ::mosek::fusion::IndexError(std::string ("Invalid matrix data"));
      }
    }
    {}
    if (_5808_err_sorted)
    {
      {
        throw ::mosek::fusion::IndexError(std::string ("Matrix data not sorted"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprMulElement.ctor

// mosek.fusion.ExprMulElement.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1147:6-1152:7
mosek::fusion::ExprMulElement::t mosek::fusion::p_ExprMulElement::_new_ExprMulElement
  (std::shared_ptr< monty::ndarray< double,1 > > _5811_cof,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _5812_msp,
    monty::rc_ptr< ::mosek::fusion::Expression > _5813_expr,
    int32_t _5814_validated)
{ return new mosek::fusion::ExprMulElement(_5811_cof,_5812_msp,_5813_expr,_5814_validated); }
mosek::fusion::ExprMulElement::ExprMulElement
  (std::shared_ptr< monty::ndarray< double,1 > > _5811_cof,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _5812_msp,
    monty::rc_ptr< ::mosek::fusion::Expression > _5813_expr,
    int32_t _5814_validated) : 
   ExprMulElement(new mosek::fusion::p_ExprMulElement(this))
{ mosek::fusion::p_ExprMulElement::_get_impl(this)->_initialize(_5811_cof,_5812_msp,_5813_expr,_5814_validated); }
void mosek::fusion::p_ExprMulElement::_initialize  (std::shared_ptr< monty::ndarray< double,1 > > _5811_cof,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _5812_msp,
    monty::rc_ptr< ::mosek::fusion::Expression > _5813_expr,
    int32_t _5814_validated)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__5811_cof(_5811_cof ? _5811_cof->raw() : nullptr, _5811_cof ? _5811_cof->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__5812_msp(_5812_msp ? _5812_msp->raw() : nullptr, _5812_msp ? _5812_msp->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(_5813_expr->__mosek_2fusion_2Expression__getModel(),_5813_expr->getShape());
    mosek::fusion::p_ExprMulElement::_get_impl(::mosek::fusion::ExprMulElement::t(_pubthis))->expr = _5813_expr;
    mosek::fusion::p_ExprMulElement::_get_impl(::mosek::fusion::ExprMulElement::t(_pubthis))->mcof = _5811_cof;
    mosek::fusion::p_ExprMulElement::_get_impl(::mosek::fusion::ExprMulElement::t(_pubthis))->msp = _5812_msp;
  }
}
// mosek.fusion.ExprMulElement.ctor

// Begin mosek.fusion.ExprMulElement.eval
// Method mosek.fusion.ExprMulElement.eval @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1181:6-1338:7
void mosek::fusion::ExprMulElement :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5815_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5816_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5817_xs,bool _5818_cache_eval) { mosek::fusion::p_ExprMulElement::_get_impl(this)->eval(_5815_rs,_5816_ws,_5817_xs,_5818_cache_eval); }
void mosek::fusion::p_ExprMulElement::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5815_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5816_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5817_xs,bool _5818_cache_eval)
{
  expr->recursive_eval(_5816_ws,_5815_rs,_5817_xs,_5818_cache_eval);
  _5816_ws->pop_expr();
  int32_t _5819_nd = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->nd;
  int32_t _5820_nelem = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->nelem;
  int32_t _5821_nnz = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->nnz;
  int32_t _5822_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->ncodeatom;
  bool _5823_hassp = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->hassp;
  int32_t _5824_shape = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->shape_base;
  int32_t _5825_ptr = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->ptr_base;
  int32_t _5826_nidxs = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->nidxs_base;
  int32_t _5827_sp = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->sp_base;
  int32_t _5828_cof = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->cof_base;
  int32_t _5829_code = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->code_base;
  int32_t _5830_codeptr = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->codeptr_base;
  int32_t _5831_cconst = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5832_wi32 = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__5832_wi32(_5832_wi32 ? _5832_wi32->raw() : nullptr,_5832_wi32 ? _5832_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5833_wi64 = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__5833_wi64(_5833_wi64 ? _5833_wi64->raw() : nullptr,_5833_wi64 ? _5833_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5834_wf64 = mosek::fusion::p_WorkStack::_get_impl(_5816_ws)->f64;
  _checked_ptr_1<double> _ptr__5834_wf64(_5834_wf64 ? _5834_wf64->raw() : nullptr,_5834_wf64 ? _5834_wf64->size(0) : 0);
  int32_t _5835_rncodeatom = (int)0;
  int32_t _5836_rnnz = (int)0;
  int32_t _5837_rnelem = (int)0;
  if ((!_5823_hassp))
  {
    {
      _5837_rnelem = (int)((msp)->size(0));
      int32_t _11914_ = (int)0;
      int32_t _11915_ = (int)((msp)->size(0));
      for (int32_t _5838_i = _11914_; _5838_i < _11915_; ++_5838_i)
      {
        {
          _5836_rnnz += (_ptr__5832_wi32[safe_add( safe_add( _5825_ptr,((*msp)(_5838_i)) ),(int)1 )] - _ptr__5832_wi32[safe_add( _5825_ptr,((*msp)(_5838_i)) )]);
        }
      }
      if ((_5822_ncodeatom > (int)0))
      {
        {
          int32_t _11916_ = (int)0;
          int32_t _11917_ = (int)((msp)->size(0));
          for (int32_t _5839_i = _11916_; _5839_i < _11917_; ++_5839_i)
          {
            {
              _5835_rncodeatom += safe_add( (_ptr__5832_wi32[safe_add( _5830_codeptr,_ptr__5832_wi32[safe_add( safe_add( _5825_ptr,((*msp)(_5839_i)) ),(int)1 )] )] - _ptr__5832_wi32[safe_add( _5830_codeptr,_ptr__5832_wi32[safe_add( _5825_ptr,((*msp)(_5839_i)) )] )]),safe_mul( (int)2,(_ptr__5832_wi32[safe_add( safe_add( _5825_ptr,((*msp)(_5839_i)) ),(int)1 )] - _ptr__5832_wi32[safe_add( _5825_ptr,((*msp)(_5839_i)) )]) ) );
            }
          }
        }
      }
      {}
    }
  }
  else
  {
    {
      int32_t _5840_e0 = (int)((msp)->size(0));
      int32_t _5841_i0 = (int)0;
      int32_t _5842_e1 = _5820_nelem;
      int32_t _5843_i1 = (int)0;
      while ( ((_5841_i0 < _5840_e0) && (_5843_i1 < _5842_e1)) )
      {
        {
          if ((((*msp)(_5841_i0)) < _ptr__5833_wi64[safe_add( _5827_sp,_5843_i1 )]))
          {
            {
              ++ _5841_i0;
            }
          }
          else if((((*msp)(_5841_i0)) > _ptr__5833_wi64[safe_add( _5827_sp,_5843_i1 )]))
          {
            {
              ++ _5843_i1;
            }
          }
          else
          {
            {
              _5836_rnnz += (_ptr__5832_wi32[safe_add( safe_add( _5825_ptr,_5843_i1 ),(int)1 )] - _ptr__5832_wi32[safe_add( _5825_ptr,_5843_i1 )]);
              if ((_5822_ncodeatom > (int)0))
              {
                {
                  _5835_rncodeatom += safe_add( (_ptr__5832_wi32[safe_add( _5830_codeptr,_ptr__5832_wi32[safe_add( safe_add( _5825_ptr,_5843_i1 ),(int)1 )] )] - _ptr__5832_wi32[safe_add( _5830_codeptr,_ptr__5832_wi32[safe_add( _5825_ptr,_5843_i1 )] )]),safe_mul( (int)2,(_ptr__5832_wi32[safe_add( safe_add( _5825_ptr,_5843_i1 ),(int)1 )] - _ptr__5832_wi32[safe_add( _5825_ptr,_5843_i1 )]) ) );
                }
              }
              {}
              ++ _5841_i0;
              ++ _5843_i1;
              ++ _5837_rnelem;
            }
          }
        }
      }
    }
  }
  int64_t _5844_rsize = (int64_t)1;
  int32_t _11918_ = (int)0;
  int32_t _11919_ = _5819_nd;
  for (int32_t _5845_i = _11918_; _5845_i < _11919_; ++_5845_i)
  {
    {
      _5844_rsize *= _ptr__5832_wi32[safe_add( _5824_shape,_5845_i )];
    }
  }
  bool _5846_rhassp = (_5837_rnelem < _5844_rsize);
  int32_t _5847_rnd = _5819_nd;
  _5815_rs->alloc_expr(_5847_rnd,_5837_rnelem,_5836_rnnz,_5846_rhassp,_5835_rncodeatom);
  int32_t _5848_rptr = mosek::fusion::p_WorkStack::_get_impl(_5815_rs)->ptr_base;
  int32_t _5849_rshape = mosek::fusion::p_WorkStack::_get_impl(_5815_rs)->shape_base;
  int32_t _5850_rnidx = mosek::fusion::p_WorkStack::_get_impl(_5815_rs)->nidxs_base;
  int32_t _11920_;
  bool _11921_ = _5846_rhassp;
  if (_11921_)
  {
    _11920_ = mosek::fusion::p_WorkStack::_get_impl(_5815_rs)->sp_base;
  }
  else
  {
    _11920_ = _5815_rs->alloci64(_5837_rnelem);
  }
  int32_t _5851_rsp = _11920_;
  int32_t _5852_rcof = mosek::fusion::p_WorkStack::_get_impl(_5815_rs)->cof_base;
  int32_t _5853_rcode = mosek::fusion::p_WorkStack::_get_impl(_5815_rs)->code_base;
  int32_t _5854_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5815_rs)->codeptr_base;
  int32_t _5855_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5815_rs)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5856_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5815_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__5856_ri32(_5856_ri32 ? _5856_ri32->raw() : nullptr,_5856_ri32 ? _5856_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5857_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5815_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__5857_ri64(_5857_ri64 ? _5857_ri64->raw() : nullptr,_5857_ri64 ? _5857_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5858_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5815_rs)->f64;
  _checked_ptr_1<double> _ptr__5858_rf64(_5858_rf64 ? _5858_rf64->raw() : nullptr,_5858_rf64 ? _5858_rf64->size(0) : 0);
  {
    int32_t _5859_codei = (int)0;
    int32_t _5860_elmi = (int)0;
    int32_t _5861_nzi = (int)0;
    _ptr__5856_ri32[_5848_rptr] = (int)0;
    if ((_5835_rncodeatom > (int)0))
    {
      {
        _ptr__5856_ri32[_5854_rcodeptr] = (int)0;
      }
    }
    {}
    int32_t _11922_ = (int)0;
    int32_t _11923_ = _5847_rnd;
    for (int32_t _5862_i = _11922_; _5862_i < _11923_; ++_5862_i)
    {
      {
        _ptr__5856_ri32[safe_add( _5849_rshape,_5862_i )] = _ptr__5832_wi32[safe_add( _5824_shape,_5862_i )];
      }
    }
    if ((!_5823_hassp))
    {
      {
        int32_t _11924_ = (int)0;
        int32_t _11925_ = (int)((msp)->size(0));
        for (int32_t _5863_i = _11924_; _5863_i < _11925_; ++_5863_i)
        {
          {
            int32_t _5864_p0 = _ptr__5832_wi32[safe_add( _5825_ptr,((*msp)(_5863_i)) )];
            int32_t _5865_p1 = _ptr__5832_wi32[safe_add( safe_add( _5825_ptr,((*msp)(_5863_i)) ),(int)1 )];
            int32_t _11926_ = _5864_p0;
            int32_t _11927_ = _5865_p1;
            for (int32_t _5866_p = _11926_; _5866_p < _11927_; ++_5866_p)
            {
              {
                _ptr__5857_ri64[safe_add( _5850_rnidx,_5861_nzi )] = _ptr__5833_wi64[safe_add( _5826_nidxs,_5866_p )];
                _ptr__5858_rf64[safe_add( _5852_rcof,_5861_nzi )] = (_ptr__5834_wf64[safe_add( _5828_cof,_5866_p )] * ((*mcof)(_5863_i)));
                if ((_5822_ncodeatom > (int)0))
                {
                  {
                    int32_t _11928_ = _ptr__5832_wi32[safe_add( _5830_codeptr,_5866_p )];
                    int32_t _11929_ = _ptr__5832_wi32[safe_add( safe_add( _5830_codeptr,_5866_p ),(int)1 )];
                    for (int32_t _5867_l = _11928_; _5867_l < _11929_; ++_5867_l)
                    {
                      {
                        _ptr__5856_ri32[safe_add( _5853_rcode,_5859_codei )] = _ptr__5832_wi32[safe_add( _5829_code,_5867_l )];
                        _ptr__5858_rf64[safe_add( _5855_rcconst,_5859_codei )] = _ptr__5834_wf64[safe_add( _5831_cconst,_5867_l )];
                        ++ _5859_codei;
                      }
                    }
                    _ptr__5856_ri32[safe_add( _5853_rcode,_5859_codei )] = 2;
                    _ptr__5858_rf64[safe_add( _5855_rcconst,_5859_codei )] = ((*mcof)(_5863_i));
                    ++ _5859_codei;
                    _ptr__5856_ri32[safe_add( _5853_rcode,_5859_codei )] = 5;
                    ++ _5859_codei;
                    _ptr__5856_ri32[safe_add( safe_add( _5854_rcodeptr,_5861_nzi ),(int)1 )] = _5859_codei;
                  }
                }
                {}
                ++ _5861_nzi;
              }
            }
            _ptr__5856_ri32[safe_add( safe_add( _5848_rptr,_5863_i ),(int)1 )] = _5861_nzi;
            _ptr__5857_ri64[safe_add( _5851_rsp,_5863_i )] = ((*msp)(_5863_i));
          }
        }
      }
    }
    else
    {
      {
        int32_t _5868_e0 = (int)((msp)->size(0));
        int32_t _5869_i0 = (int)0;
        int32_t _5870_e1 = _5820_nelem;
        int32_t _5871_i1 = (int)0;
        while ( ((_5869_i0 < _5868_e0) && (_5871_i1 < _5870_e1)) )
        {
          {
            if ((((*msp)(_5869_i0)) < _ptr__5833_wi64[safe_add( _5827_sp,_5871_i1 )]))
            {
              {
                ++ _5869_i0;
              }
            }
            else if((((*msp)(_5869_i0)) > _ptr__5833_wi64[safe_add( _5827_sp,_5871_i1 )]))
            {
              {
                ++ _5871_i1;
              }
            }
            else
            {
              {
                int32_t _5872_p0 = _ptr__5832_wi32[safe_add( _5825_ptr,_5871_i1 )];
                int32_t _5873_p1 = _ptr__5832_wi32[safe_add( safe_add( _5825_ptr,_5871_i1 ),(int)1 )];
                int32_t _11930_ = _5872_p0;
                int32_t _11931_ = _5873_p1;
                for (int32_t _5874_j = _11930_; _5874_j < _11931_; ++_5874_j)
                {
                  {
                    _ptr__5857_ri64[safe_add( _5850_rnidx,_5861_nzi )] = _ptr__5833_wi64[safe_add( _5826_nidxs,_5874_j )];
                    _ptr__5858_rf64[safe_add( _5852_rcof,_5861_nzi )] = (_ptr__5834_wf64[safe_add( _5826_nidxs,_5874_j )] * ((*mcof)(_5869_i0)));
                    if ((_5822_ncodeatom > (int)0))
                    {
                      {
                        int32_t _11932_ = _ptr__5832_wi32[safe_add( _5830_codeptr,_5874_j )];
                        int32_t _11933_ = _ptr__5832_wi32[safe_add( safe_add( _5830_codeptr,_5874_j ),(int)1 )];
                        for (int32_t _5875_l = _11932_; _5875_l < _11933_; ++_5875_l)
                        {
                          {
                            _ptr__5856_ri32[safe_add( _5853_rcode,_5859_codei )] = _ptr__5832_wi32[safe_add( _5829_code,_5875_l )];
                            _ptr__5858_rf64[safe_add( _5855_rcconst,_5859_codei )] = _ptr__5834_wf64[safe_add( _5831_cconst,_5875_l )];
                            ++ _5859_codei;
                          }
                        }
                        _ptr__5856_ri32[safe_add( _5853_rcode,_5859_codei )] = 2;
                        _ptr__5858_rf64[safe_add( _5855_rcconst,_5859_codei )] = ((*mcof)(_5869_i0));
                        ++ _5859_codei;
                        _ptr__5856_ri32[safe_add( _5853_rcode,_5859_codei )] = 5;
                        ++ _5859_codei;
                        _ptr__5856_ri32[safe_add( safe_add( _5854_rcodeptr,_5861_nzi ),(int)1 )] = _5859_codei;
                      }
                    }
                    {}
                    ++ _5861_nzi;
                  }
                }
                _ptr__5856_ri32[safe_add( safe_add( _5848_rptr,_5860_elmi ),(int)1 )] = _5861_nzi;
                _ptr__5857_ri64[safe_add( _5851_rsp,_5860_elmi )] = ((*msp)(_5869_i0));
                ++ _5860_elmi;
                ++ _5869_i0;
                ++ _5871_i1;
              }
            }
          }
        }
      }
    }
  }
  if ((!_5846_rhassp))
  {
    {
      _5815_rs->popi64(_5837_rnelem);
    }
  }
  {}
}
// End mosek.fusion.ExprMulElement.eval

// Begin mosek.fusion.ExprMulElement.toString
// Method mosek.fusion.ExprMulElement.toString @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1145:6-135
std::string mosek::fusion::ExprMulElement :: toString() { return mosek::fusion::p_ExprMulElement::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulElement::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulElement(M,"))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprMulElement.toString

void mosek::fusion::p_ExprMulElement::destroy()
{
  expr.reset();
  msp.reset();
  mcof.reset();
}
void mosek::fusion::ExprMulElement::destroy() { mosek::fusion::p_ExprMulElement::_get_impl(this)->destroy(); }
// } class ExprMulElement
// class ExprMulScalarConst { // @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1036:4-1127:5
mosek::fusion::ExprMulScalarConst::ExprMulScalarConst(mosek::fusion::p_ExprMulScalarConst *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulScalarConst()" << this << std::endl; */ }
mosek::fusion::ExprMulScalarConst::~ExprMulScalarConst() {  /* std::cout << "~ExprMulScalarConst()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulScalarConst::p_ExprMulScalarConst
  (::mosek::fusion::ExprMulScalarConst * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulScalarConst.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1045:6-1050:7
mosek::fusion::ExprMulScalarConst::t mosek::fusion::p_ExprMulScalarConst::_new_ExprMulScalarConst
  (double _5876_c,
    monty::rc_ptr< ::mosek::fusion::Expression > _5877_expr)
{ return new mosek::fusion::ExprMulScalarConst(_5876_c,_5877_expr); }
mosek::fusion::ExprMulScalarConst::ExprMulScalarConst
  (double _5876_c,
    monty::rc_ptr< ::mosek::fusion::Expression > _5877_expr) : 
   ExprMulScalarConst(new mosek::fusion::p_ExprMulScalarConst(this))
{ mosek::fusion::p_ExprMulScalarConst::_get_impl(this)->_initialize(_5876_c,_5877_expr); }
void mosek::fusion::p_ExprMulScalarConst::_initialize  (double _5876_c,
    monty::rc_ptr< ::mosek::fusion::Expression > _5877_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_5877_expr->__mosek_2fusion_2Expression__getModel(),_5877_expr->getShape());
    mosek::fusion::p_ExprMulScalarConst::_get_impl(::mosek::fusion::ExprMulScalarConst::t(_pubthis))->c = _5876_c;
    mosek::fusion::p_ExprMulScalarConst::_get_impl(::mosek::fusion::ExprMulScalarConst::t(_pubthis))->expr = _5877_expr;
  }
}
// mosek.fusion.ExprMulScalarConst.ctor

// Begin mosek.fusion.ExprMulScalarConst.eval
// Method mosek.fusion.ExprMulScalarConst.eval @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1052:6-1126:7
void mosek::fusion::ExprMulScalarConst :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5878_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5879_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5880_xs,bool _5881_cache_eval) { mosek::fusion::p_ExprMulScalarConst::_get_impl(this)->eval(_5878_rs,_5879_ws,_5880_xs,_5881_cache_eval); }
void mosek::fusion::p_ExprMulScalarConst::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5878_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5879_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5880_xs,bool _5881_cache_eval)
{
  expr->recursive_eval(_5879_ws,_5878_rs,_5880_xs,_5881_cache_eval);
  _5879_ws->pop_expr();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5882_wi32 = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__5882_wi32(_5882_wi32 ? _5882_wi32->raw() : nullptr,_5882_wi32 ? _5882_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5883_wi64 = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__5883_wi64(_5883_wi64 ? _5883_wi64->raw() : nullptr,_5883_wi64 ? _5883_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5884_wf64 = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->f64;
  _checked_ptr_1<double> _ptr__5884_wf64(_5884_wf64 ? _5884_wf64->raw() : nullptr,_5884_wf64 ? _5884_wf64->size(0) : 0);
  int32_t _5885_nd = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->nd;
  int32_t _5886_nelem = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->nelem;
  int32_t _5887_nnz = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->nnz;
  bool _5888_hassp = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->hassp;
  int32_t _5889_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->ncodeatom;
  int32_t _5890_ptr = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->ptr_base;
  int32_t _5891_code = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->code_base;
  int32_t _5892_cconst = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->cconst_base;
  int32_t _5893_codeptr = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->codeptr_base;
  int32_t _5894_shape = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->shape_base;
  int32_t _5895_sp = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->sp_base;
  int32_t _5896_nidxs = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->nidxs_base;
  int32_t _5897_cof = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->cof_base;
  int32_t _5898_consts = mosek::fusion::p_WorkStack::_get_impl(_5879_ws)->cconst_base;
  int32_t _11934_;
  bool _11935_ = (_5889_ncodeatom == (int)0);
  if (_11935_)
  {
    _11934_ = (int)0;
  }
  else
  {
    _11934_ = safe_add( _5889_ncodeatom,safe_mul( (int)2,_5887_nnz ) );
  }
  int32_t _5899_rncodeatom = _11934_;
  _5878_rs->alloc_expr(_5885_nd,_5886_nelem,_5887_nnz,_5888_hassp,_5899_rncodeatom);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5900_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5878_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__5900_ri64(_5900_ri64 ? _5900_ri64->raw() : nullptr,_5900_ri64 ? _5900_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5901_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5878_rs)->f64;
  _checked_ptr_1<double> _ptr__5901_rf64(_5901_rf64 ? _5901_rf64->raw() : nullptr,_5901_rf64 ? _5901_rf64->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5902_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5878_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__5902_ri32(_5902_ri32 ? _5902_ri32->raw() : nullptr,_5902_ri32 ? _5902_ri32->size(0) : 0);
  int32_t _5903_rptr = mosek::fusion::p_WorkStack::_get_impl(_5878_rs)->ptr_base;
  int32_t _5904_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_5878_rs)->nidxs_base;
  int32_t _5905_rcof = mosek::fusion::p_WorkStack::_get_impl(_5878_rs)->cof_base;
  int32_t _5906_rcode = mosek::fusion::p_WorkStack::_get_impl(_5878_rs)->code_base;
  int32_t _5907_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5878_rs)->codeptr_base;
  int32_t _5908_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5878_rs)->cconst_base;
  bool _5909_rhassp = mosek::fusion::p_WorkStack::_get_impl(_5878_rs)->hassp;
  int32_t _5910_rshape = mosek::fusion::p_WorkStack::_get_impl(_5878_rs)->shape_base;
  int32_t _5911_rsp = mosek::fusion::p_WorkStack::_get_impl(_5878_rs)->sp_base;
  {
    int32_t _11936_ = (int)0;
    int32_t _11937_ = safe_add( _5886_nelem,(int)1 );
    for (int32_t _5912_i = _11936_; _5912_i < _11937_; ++_5912_i)
    {
      {
        _ptr__5902_ri32[safe_add( _5903_rptr,_5912_i )] = _ptr__5882_wi32[safe_add( _5890_ptr,_5912_i )];
      }
    }
    int32_t _11938_ = (int)0;
    int32_t _11939_ = _5887_nnz;
    for (int32_t _5913_i = _11938_; _5913_i < _11939_; ++_5913_i)
    {
      {
        _ptr__5900_ri64[safe_add( _5904_rnidxs,_5913_i )] = _ptr__5883_wi64[safe_add( _5896_nidxs,_5913_i )];
        _ptr__5901_rf64[safe_add( _5905_rcof,_5913_i )] = (_ptr__5884_wf64[safe_add( _5897_cof,_5913_i )] * c);
      }
    }
    if (_5888_hassp)
    {
      {
        int32_t _11940_ = (int)0;
        int32_t _11941_ = _5886_nelem;
        for (int32_t _5914_i = _11940_; _5914_i < _11941_; ++_5914_i)
        {
          {
            _ptr__5900_ri64[safe_add( _5911_rsp,_5914_i )] = _ptr__5883_wi64[safe_add( _5895_sp,_5914_i )];
          }
        }
      }
    }
    {}
    int32_t _11942_ = (int)0;
    int32_t _11943_ = _5885_nd;
    for (int32_t _5915_i = _11942_; _5915_i < _11943_; ++_5915_i)
    {
      {
        _ptr__5902_ri32[safe_add( _5910_rshape,_5915_i )] = _ptr__5882_wi32[safe_add( _5894_shape,_5915_i )];
      }
    }
    if ((_5889_ncodeatom > (int)0))
    {
      {
        _ptr__5902_ri32[_5907_rcodeptr] = (int)0;
        int32_t _5916_codei = (int)0;
        int32_t _11944_ = (int)0;
        int32_t _11945_ = _5887_nnz;
        for (int32_t _5917_j = _11944_; _5917_j < _11945_; ++_5917_j)
        {
          {
            int32_t _11946_ = _ptr__5882_wi32[safe_add( _5893_codeptr,_5917_j )];
            int32_t _11947_ = _ptr__5882_wi32[safe_add( safe_add( _5893_codeptr,_5917_j ),(int)1 )];
            for (int32_t _5918_k = _11946_; _5918_k < _11947_; ++_5918_k)
            {
              {
                _ptr__5902_ri32[safe_add( _5906_rcode,_5916_codei )] = _ptr__5882_wi32[safe_add( _5891_code,_5918_k )];
                _ptr__5901_rf64[safe_add( _5908_rcconst,_5916_codei )] = _ptr__5884_wf64[safe_add( _5892_cconst,_5918_k )];
                ++ _5916_codei;
              }
            }
            _ptr__5902_ri32[safe_add( _5906_rcode,_5916_codei )] = 2;
            _ptr__5901_rf64[safe_add( _5908_rcconst,_5916_codei )] = c;
            ++ _5916_codei;
            _ptr__5902_ri32[safe_add( _5906_rcode,_5916_codei )] = 5;
            ++ _5916_codei;
            _ptr__5902_ri32[safe_add( safe_add( _5907_rcodeptr,_5917_j ),(int)1 )] = _5916_codei;
          }
        }
      }
    }
    {}
  }
}
// End mosek.fusion.ExprMulScalarConst.eval

// Begin mosek.fusion.ExprMulScalarConst.toString
// Method mosek.fusion.ExprMulScalarConst.toString @ bld/grindsted/final/default/src/fusion/ExprMul.monty:1043:6-73
std::string mosek::fusion::ExprMulScalarConst :: toString() { return mosek::fusion::p_ExprMulScalarConst::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulScalarConst::toString()
{
  return std::string ("ExprMulScalarConst()");
}
// End mosek.fusion.ExprMulScalarConst.toString

void mosek::fusion::p_ExprMulScalarConst::destroy()
{
  expr.reset();
}
void mosek::fusion::ExprMulScalarConst::destroy() { mosek::fusion::p_ExprMulScalarConst::_get_impl(this)->destroy(); }
// } class ExprMulScalarConst
// class ExprScalarMul { // @ bld/grindsted/final/default/src/fusion/ExprMul.monty:832:4-1025:5
mosek::fusion::ExprScalarMul::ExprScalarMul(mosek::fusion::p_ExprScalarMul *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprScalarMul()" << this << std::endl; */ }
mosek::fusion::ExprScalarMul::~ExprScalarMul() {  /* std::cout << "~ExprScalarMul()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprScalarMul::p_ExprScalarMul
  (::mosek::fusion::ExprScalarMul * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprScalarMul.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:911:6-930:7
mosek::fusion::ExprScalarMul::t mosek::fusion::p_ExprScalarMul::_new_ExprScalarMul
  (int32_t _5919_mdim0,
    int32_t _5920_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5921_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5922_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5923_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5924_expr,
    int32_t _5925_validated)
{ return new mosek::fusion::ExprScalarMul(_5919_mdim0,_5920_mdim1,_5921_msubi,_5922_msubj,_5923_mval,_5924_expr,_5925_validated); }
mosek::fusion::ExprScalarMul::ExprScalarMul
  (int32_t _5919_mdim0,
    int32_t _5920_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5921_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5922_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5923_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5924_expr,
    int32_t _5925_validated) : 
   ExprScalarMul(new mosek::fusion::p_ExprScalarMul(this))
{ mosek::fusion::p_ExprScalarMul::_get_impl(this)->_initialize(_5919_mdim0,_5920_mdim1,_5921_msubi,_5922_msubj,_5923_mval,_5924_expr,_5925_validated); }
void mosek::fusion::p_ExprScalarMul::_initialize  (int32_t _5919_mdim0,
    int32_t _5920_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5921_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5922_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5923_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5924_expr,
    int32_t _5925_validated)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__5921_msubi(_5921_msubi ? _5921_msubi->raw() : nullptr, _5921_msubi ? _5921_msubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__5922_msubj(_5922_msubj ? _5922_msubj->raw() : nullptr, _5922_msubj ? _5922_msubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__5923_mval(_5923_mval ? _5923_mval->raw() : nullptr, _5923_mval ? _5923_mval->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(_5924_expr->__mosek_2fusion_2Expression__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_5919_mdim0),(int32_t)(_5920_mdim1)}));
    mosek::fusion::p_ExprScalarMul::_get_impl(::mosek::fusion::ExprScalarMul::t(_pubthis))->mdim0 = _5919_mdim0;
    mosek::fusion::p_ExprScalarMul::_get_impl(::mosek::fusion::ExprScalarMul::t(_pubthis))->mdim1 = _5920_mdim1;
    mosek::fusion::p_ExprScalarMul::_get_impl(::mosek::fusion::ExprScalarMul::t(_pubthis))->msubi = _5921_msubi;
    mosek::fusion::p_ExprScalarMul::_get_impl(::mosek::fusion::ExprScalarMul::t(_pubthis))->msubj = _5922_msubj;
    mosek::fusion::p_ExprScalarMul::_get_impl(::mosek::fusion::ExprScalarMul::t(_pubthis))->mval = _5923_mval;
    mosek::fusion::p_ExprScalarMul::_get_impl(::mosek::fusion::ExprScalarMul::t(_pubthis))->expr = _5924_expr;
  }
}
// mosek.fusion.ExprScalarMul.ctor

// mosek.fusion.ExprScalarMul.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:899:6-909:7
mosek::fusion::ExprScalarMul::t mosek::fusion::p_ExprScalarMul::_new_ExprScalarMul
  (int32_t _5926_mdim0,
    int32_t _5927_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5928_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5929_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5930_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5931_expr)
{ return new mosek::fusion::ExprScalarMul(_5926_mdim0,_5927_mdim1,_5928_msubi,_5929_msubj,_5930_mval,_5931_expr); }
mosek::fusion::ExprScalarMul::ExprScalarMul
  (int32_t _5926_mdim0,
    int32_t _5927_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5928_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5929_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5930_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5931_expr) : 
   ExprScalarMul(new mosek::fusion::p_ExprScalarMul(this))
{ mosek::fusion::p_ExprScalarMul::_get_impl(this)->_initialize(_5926_mdim0,_5927_mdim1,_5928_msubi,_5929_msubj,_5930_mval,_5931_expr); }
void mosek::fusion::p_ExprScalarMul::_initialize  (int32_t _5926_mdim0,
    int32_t _5927_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5928_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5929_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5930_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5931_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__5928_msubi(_5928_msubi ? _5928_msubi->raw() : nullptr, _5928_msubi ? _5928_msubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__5929_msubj(_5929_msubj ? _5929_msubj->raw() : nullptr, _5929_msubj ? _5929_msubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__5930_mval(_5930_mval ? _5930_mval->raw() : nullptr, _5930_mval ? _5930_mval->size(0) : 0);
    mosek::fusion::p_ExprScalarMul::_initialize(_5926_mdim0,_5927_mdim1,_5928_msubi,_5929_msubj,_5930_mval,_5931_expr,::mosek::fusion::p_ExprScalarMul::validate(_5926_mdim0,_5927_mdim1,_5928_msubi,_5929_msubj,_5930_mval,_5931_expr));
  }
}
// mosek.fusion.ExprScalarMul.ctor

// Begin mosek.fusion.ExprScalarMul.eval
// Method mosek.fusion.ExprScalarMul.eval @ bld/grindsted/final/default/src/fusion/ExprMul.monty:932:6-1024:7
void mosek::fusion::ExprScalarMul :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5932_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5933_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5934_xs,bool _5935_cache_eval) { mosek::fusion::p_ExprScalarMul::_get_impl(this)->eval(_5932_rs,_5933_ws,_5934_xs,_5935_cache_eval); }
void mosek::fusion::p_ExprScalarMul::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _5932_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _5933_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _5934_xs,bool _5935_cache_eval)
{
  mosek::fusion::p_ExprScalarMul::_get_impl(::mosek::fusion::ExprScalarMul::t(_pubthis))->expr->recursive_eval(_5933_ws,_5932_rs,_5934_xs,_5935_cache_eval);
  _5933_ws->pop_expr();
  int32_t _5936_nd = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->nd;
  int32_t _5937_nelem = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->nelem;
  int32_t _5938_nnz = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->nnz;
  bool _5939_hassp = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->hassp;
  int32_t _5940_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->ncodeatom;
  int32_t _5941_ptr = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->ptr_base;
  int32_t _5942_sp = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->sp_base;
  int32_t _5943_nidxs = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->nidxs_base;
  int32_t _5944_cof = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->cof_base;
  int32_t _5945_code = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->code_base;
  int32_t _5946_codeptr = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->codeptr_base;
  int32_t _5947_cconst = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _5948_wi32 = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__5948_wi32(_5948_wi32 ? _5948_wi32->raw() : nullptr,_5948_wi32 ? _5948_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _5949_wi64 = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__5949_wi64(_5949_wi64 ? _5949_wi64->raw() : nullptr,_5949_wi64 ? _5949_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _5950_wf64 = mosek::fusion::p_WorkStack::_get_impl(_5933_ws)->f64;
  _checked_ptr_1<double> _ptr__5950_wf64(_5950_wf64 ? _5950_wf64->raw() : nullptr,_5950_wf64 ? _5950_wf64->size(0) : 0);
  int32_t _5951_mnumnz = (int)((mval)->size(0));
  if ((_5936_nd != (int)0))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid expression shape"));
    }
  }
  {}
  if ((_5937_nelem == (int)0))
  {
    {
      _5932_rs->alloc_expr((int)2,(int)0,(int)0,true);
      ((*mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->i32)(mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->shape_base)) = mdim0;
      ((*mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->i32)(safe_add( mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->shape_base,(int)1 ))) = mdim1;
    }
  }
  else
  {
    {
      int32_t _11948_;
      bool _11949_ = (_5940_ncodeatom > (int)0);
      if (_11949_)
      {
        _11948_ = safe_mul( (int)2,_5938_nnz );
      }
      else
      {
        _11948_ = (int)0;
      }
      int32_t _5952_rncodeatom = safe_mul( _5951_mnumnz,safe_add( _5940_ncodeatom,_11948_ ) );
      _5932_rs->alloc_expr((int)2,_5951_mnumnz,safe_mul( _5951_mnumnz,_5938_nnz ),true,_5952_rncodeatom);
      int32_t _5953_rptr = mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->ptr_base;
      int32_t _5954_rnidx = mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->nidxs_base;
      int32_t _5955_rsp = mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->sp_base;
      int32_t _5956_rcof = mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->cof_base;
      int32_t _5957_rshape = mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->shape_base;
      int32_t _5958_rcode = mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->code_base;
      int32_t _5959_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->codeptr_base;
      int32_t _5960_rcconst = mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _5961_ri32 = mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__5961_ri32(_5961_ri32 ? _5961_ri32->raw() : nullptr,_5961_ri32 ? _5961_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _5962_ri64 = mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__5962_ri64(_5962_ri64 ? _5962_ri64->raw() : nullptr,_5962_ri64 ? _5962_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _5963_rf64 = mosek::fusion::p_WorkStack::_get_impl(_5932_rs)->f64;
      _checked_ptr_1<double> _ptr__5963_rf64(_5963_rf64 ? _5963_rf64->raw() : nullptr,_5963_rf64 ? _5963_rf64->size(0) : 0);
      _ptr__5961_ri32[_5957_rshape] = mdim0;
      _ptr__5961_ri32[safe_add( _5957_rshape,(int)1 )] = mdim1;
      int32_t _5964_codei = (int)0;
      int32_t _5965_nzi = (int)0;
      _ptr__5961_ri32[_5953_rptr] = (int)0;
      if ((_5940_ncodeatom > (int)0))
      {
        {
          _ptr__5961_ri32[_5959_rcodeptr] = (int)0;
          int32_t _11950_ = (int)0;
          int32_t _11951_ = _5951_mnumnz;
          for (int32_t _5966_i = _11950_; _5966_i < _11951_; ++_5966_i)
          {
            {
              int32_t _11952_ = (int)0;
              int32_t _11953_ = _5938_nnz;
              for (int32_t _5967_j = _11952_; _5967_j < _11953_; ++_5967_j)
              {
                {
                  _ptr__5962_ri64[safe_add( _5954_rnidx,_5965_nzi )] = _ptr__5949_wi64[safe_add( _5943_nidxs,_5967_j )];
                  _ptr__5963_rf64[safe_add( _5956_rcof,_5965_nzi )] = (_ptr__5950_wf64[safe_add( _5944_cof,_5967_j )] * ((*mval)(_5966_i)));
                  int32_t _11954_ = _ptr__5948_wi32[safe_add( _5946_codeptr,_5967_j )];
                  int32_t _11955_ = _ptr__5948_wi32[safe_add( safe_add( _5946_codeptr,_5967_j ),(int)1 )];
                  for (int32_t _5968_k = _11954_; _5968_k < _11955_; ++_5968_k)
                  {
                    {
                      _ptr__5961_ri32[safe_add( _5958_rcode,_5964_codei )] = _ptr__5948_wi32[safe_add( _5945_code,_5968_k )];
                      _ptr__5963_rf64[safe_add( _5960_rcconst,_5964_codei )] = _ptr__5950_wf64[safe_add( _5947_cconst,_5968_k )];
                      ++ _5964_codei;
                    }
                  }
                  _ptr__5961_ri32[safe_add( _5958_rcode,_5964_codei )] = 2;
                  _ptr__5963_rf64[safe_add( _5960_rcconst,_5964_codei )] = ((*mval)(_5966_i));
                  ++ _5964_codei;
                  _ptr__5961_ri32[safe_add( _5958_rcode,_5964_codei )] = 5;
                  ++ _5964_codei;
                  _ptr__5961_ri32[safe_add( safe_add( _5959_rcodeptr,_5965_nzi ),(int)1 )] = _5964_codei;
                  ++ _5965_nzi;
                }
              }
              _ptr__5962_ri64[safe_add( _5955_rsp,_5966_i )] = safe_add( safe_mul( ((*msubi)(_5966_i)),mdim1 ),((*msubj)(_5966_i)) );
              _ptr__5961_ri32[safe_add( safe_add( _5953_rptr,_5966_i ),(int)1 )] = _5965_nzi;
            }
          }
        }
      }
      else
      {
        {
          int32_t _11956_ = (int)0;
          int32_t _11957_ = _5951_mnumnz;
          for (int32_t _5969_i = _11956_; _5969_i < _11957_; ++_5969_i)
          {
            {
              int32_t _11958_ = (int)0;
              int32_t _11959_ = _5938_nnz;
              for (int32_t _5970_j = _11958_; _5970_j < _11959_; ++_5970_j)
              {
                {
                  _ptr__5962_ri64[safe_add( _5954_rnidx,_5965_nzi )] = _ptr__5949_wi64[safe_add( _5943_nidxs,_5970_j )];
                  _ptr__5963_rf64[safe_add( _5956_rcof,_5965_nzi )] = (_ptr__5950_wf64[safe_add( _5944_cof,_5970_j )] * ((*mval)(_5969_i)));
                  ++ _5965_nzi;
                }
              }
              _ptr__5962_ri64[safe_add( _5955_rsp,_5969_i )] = safe_add( safe_mul( ((*msubi)(_5969_i)),mdim1 ),((*msubj)(_5969_i)) );
              _ptr__5961_ri32[safe_add( safe_add( _5953_rptr,_5969_i ),(int)1 )] = _5965_nzi;
            }
          }
        }
      }
    }
  }
}
// End mosek.fusion.ExprScalarMul.eval

// Begin mosek.fusion.ExprScalarMul.validate
// Method mosek.fusion.ExprScalarMul.validate @ bld/grindsted/final/default/src/fusion/ExprMul.monty:845:6-884:7
int32_t mosek::fusion::p_ExprScalarMul::validate(int32_t _5971_mdim0,int32_t _5972_mdim1,std::shared_ptr< monty::ndarray< int32_t,1 > > _5973_msubi,std::shared_ptr< monty::ndarray< int32_t,1 > > _5974_msubj,std::shared_ptr< monty::ndarray< double,1 > > _5975_mval,monty::rc_ptr< ::mosek::fusion::Expression > _5976_expr)
{
  _checked_ptr_1<int32_t> _ptr__5973_msubi(_5973_msubi ? _5973_msubi->raw() : nullptr, _5973_msubi ? _5973_msubi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__5974_msubj(_5974_msubj ? _5974_msubj->raw() : nullptr, _5974_msubj ? _5974_msubj->size(0) : 0);
  _checked_ptr_1<double> _ptr__5975_mval(_5975_mval ? _5975_mval->raw() : nullptr, _5975_mval ? _5975_mval->size(0) : 0);
  int32_t _5977_nd = _5976_expr->getND();
  if ((_5977_nd != (int)0))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions"));
    }
  }
  {}
  if (((_5971_mdim0 < (int)0) || (_5972_mdim1 < (int)0)))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions"));
    }
  }
  {}
  if ((((int)((_5973_msubi)->size(0)) != (int)((_5974_msubj)->size(0))) || ((int)((_5973_msubi)->size(0)) != (int)((_5975_mval)->size(0)))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Invalid matrix data"));
    }
  }
  {}
  int32_t _5978_mnnz = (int)((_5973_msubi)->size(0));
  bool _5979_err_data = false;
  bool _5980_err_sorted = false;
  {
    int32_t _11960_ = (int)0;
    int32_t _11961_ = _5978_mnnz;
    for (int32_t _5981_i = _11960_; _5981_i < _11961_; ++_5981_i)
    {
      {
        if (((_ptr__5973_msubi[_5981_i] < (int)0) || ((_ptr__5973_msubi[_5981_i] >= _5971_mdim0) || ((_ptr__5974_msubj[_5981_i] < (int)0) || (_ptr__5974_msubj[_5981_i] >= _5972_mdim1)))))
        {
          {
            _5979_err_data = true;
          }
        }
        {}
      }
    }
    int32_t _11962_ = (int)0;
    int32_t _11963_ = (_5978_mnnz - (int)1);
    for (int32_t _5982_i = _11962_; _5982_i < _11963_; ++_5982_i)
    {
      {
        if (((_ptr__5973_msubi[_5982_i] > _ptr__5973_msubi[safe_add( _5982_i,(int)1 )]) || ((_ptr__5973_msubi[_5982_i] == _ptr__5973_msubi[safe_add( _5982_i,(int)1 )]) && (_ptr__5974_msubj[_5982_i] >= _ptr__5974_msubj[safe_add( _5982_i,(int)1 )]))))
        {
          {
            _5980_err_sorted = true;
          }
        }
        {}
      }
    }
  }
  if (_5979_err_data)
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Invalid matrix data"));
    }
  }
  {}
  if (_5980_err_sorted)
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Unsorted matrix data"));
    }
  }
  {}
  return (int)1;
}
// End mosek.fusion.ExprScalarMul.validate

// Begin mosek.fusion.ExprScalarMul.toString
// Method mosek.fusion.ExprScalarMul.toString @ bld/grindsted/final/default/src/fusion/ExprMul.monty:843:6-134
std::string mosek::fusion::ExprScalarMul :: toString() { return mosek::fusion::p_ExprScalarMul::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprScalarMul::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprScalarMul(M,"))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprScalarMul.toString

void mosek::fusion::p_ExprScalarMul::destroy()
{
  expr.reset();
  mval.reset();
  msubj.reset();
  msubi.reset();
}
void mosek::fusion::ExprScalarMul::destroy() { mosek::fusion::p_ExprScalarMul::_get_impl(this)->destroy(); }
// } class ExprScalarMul
// class ExprCrossDot { // @ bld/grindsted/final/default/src/fusion/ExprMul.monty:15:4-820:5
mosek::fusion::ExprCrossDot::ExprCrossDot(mosek::fusion::p_ExprCrossDot *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprCrossDot()" << this << std::endl; */ }
mosek::fusion::ExprCrossDot::~ExprCrossDot() {  /* std::cout << "~ExprCrossDot()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprCrossDot::p_ExprCrossDot
  (::mosek::fusion::ExprCrossDot * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprCrossDot.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:143:6-166:7
mosek::fusion::ExprCrossDot::t mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot
  (monty::rc_ptr< ::mosek::fusion::Matrix > _5983_m,
    monty::rc_ptr< ::mosek::fusion::Expression > _5984_expr)
{ return new mosek::fusion::ExprCrossDot(_5983_m,_5984_expr); }
mosek::fusion::ExprCrossDot::ExprCrossDot
  (monty::rc_ptr< ::mosek::fusion::Matrix > _5983_m,
    monty::rc_ptr< ::mosek::fusion::Expression > _5984_expr) : 
   ExprCrossDot(new mosek::fusion::p_ExprCrossDot(this))
{ mosek::fusion::p_ExprCrossDot::_get_impl(this)->_initialize(_5983_m,_5984_expr); }
void mosek::fusion::p_ExprCrossDot::_initialize  (monty::rc_ptr< ::mosek::fusion::Matrix > _5983_m,
    monty::rc_ptr< ::mosek::fusion::Expression > _5984_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_5984_expr->__mosek_2fusion_2Expression__getModel(),::mosek::fusion::p_ExprCrossDot::computeshape(_5983_m->numRows(),_5983_m->numColumns(),_5984_expr->getShape()));
    int64_t _5985_nnz = _5983_m->numNonzeros();
    mdim0 = _5983_m->numRows();
    mdim1 = _5983_m->numColumns();
    if (_5983_m->isSparse())
    {
      {
        msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5985_nnz)));
        msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_5985_nnz)));
        mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_5985_nnz)));
        _5983_m->getDataAsTriplets(msubi,msubj,mval);
      }
    }
    else
    {
      {
        mval = _5983_m->getDataAsArray();
        msubi = nullptr;
        msubj = nullptr;
      }
    }
    ::mosek::fusion::p_ExprCrossDot::validate(mdim0,mdim1,msubi,msubj,mval,_5984_expr);
    mosek::fusion::p_ExprCrossDot::_get_impl(::mosek::fusion::ExprCrossDot::t(_pubthis))->expr = _5984_expr;
  }
}
// mosek.fusion.ExprCrossDot.ctor

// mosek.fusion.ExprCrossDot.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:122:6-141:7
mosek::fusion::ExprCrossDot::t mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot
  (int32_t _5986_mdim0,
    int32_t _5987_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5988_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5989_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5990_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5991_expr,
    int32_t _5992_validated)
{ return new mosek::fusion::ExprCrossDot(_5986_mdim0,_5987_mdim1,_5988_msubi,_5989_msubj,_5990_mval,_5991_expr,_5992_validated); }
mosek::fusion::ExprCrossDot::ExprCrossDot
  (int32_t _5986_mdim0,
    int32_t _5987_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5988_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5989_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5990_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5991_expr,
    int32_t _5992_validated) : 
   ExprCrossDot(new mosek::fusion::p_ExprCrossDot(this))
{ mosek::fusion::p_ExprCrossDot::_get_impl(this)->_initialize(_5986_mdim0,_5987_mdim1,_5988_msubi,_5989_msubj,_5990_mval,_5991_expr,_5992_validated); }
void mosek::fusion::p_ExprCrossDot::_initialize  (int32_t _5986_mdim0,
    int32_t _5987_mdim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5988_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5989_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _5990_mval,
    monty::rc_ptr< ::mosek::fusion::Expression > _5991_expr,
    int32_t _5992_validated)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__5988_msubi(_5988_msubi ? _5988_msubi->raw() : nullptr, _5988_msubi ? _5988_msubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__5989_msubj(_5989_msubj ? _5989_msubj->raw() : nullptr, _5989_msubj ? _5989_msubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__5990_mval(_5990_mval ? _5990_mval->raw() : nullptr, _5990_mval ? _5990_mval->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(_5991_expr->__mosek_2fusion_2Expression__getModel(),::mosek::fusion::p_ExprCrossDot::computeshape(_5986_mdim0,_5987_mdim1,_5991_expr->getShape()));
    mosek::fusion::p_ExprCrossDot::_get_impl(::mosek::fusion::ExprCrossDot::t(_pubthis))->mdim0 = _5986_mdim0;
    mosek::fusion::p_ExprCrossDot::_get_impl(::mosek::fusion::ExprCrossDot::t(_pubthis))->mdim1 = _5987_mdim1;
    mosek::fusion::p_ExprCrossDot::_get_impl(::mosek::fusion::ExprCrossDot::t(_pubthis))->msubi = _5988_msubi;
    mosek::fusion::p_ExprCrossDot::_get_impl(::mosek::fusion::ExprCrossDot::t(_pubthis))->msubj = _5989_msubj;
    mosek::fusion::p_ExprCrossDot::_get_impl(::mosek::fusion::ExprCrossDot::t(_pubthis))->mval = _5990_mval;
    mosek::fusion::p_ExprCrossDot::_get_impl(::mosek::fusion::ExprCrossDot::t(_pubthis))->expr = _5991_expr;
  }
}
// mosek.fusion.ExprCrossDot.ctor

// mosek.fusion.ExprCrossDot.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:104:6-112:7
mosek::fusion::ExprCrossDot::t mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot
  (int32_t _5993_mdim0__,
    int32_t _5994_mdim1__,
    std::shared_ptr< monty::ndarray< double,1 > > _5995_mval__,
    monty::rc_ptr< ::mosek::fusion::Expression > _5996_expr__)
{ return new mosek::fusion::ExprCrossDot(_5993_mdim0__,_5994_mdim1__,_5995_mval__,_5996_expr__); }
mosek::fusion::ExprCrossDot::ExprCrossDot
  (int32_t _5993_mdim0__,
    int32_t _5994_mdim1__,
    std::shared_ptr< monty::ndarray< double,1 > > _5995_mval__,
    monty::rc_ptr< ::mosek::fusion::Expression > _5996_expr__) : 
   ExprCrossDot(new mosek::fusion::p_ExprCrossDot(this))
{ mosek::fusion::p_ExprCrossDot::_get_impl(this)->_initialize(_5993_mdim0__,_5994_mdim1__,_5995_mval__,_5996_expr__); }
void mosek::fusion::p_ExprCrossDot::_initialize  (int32_t _5993_mdim0__,
    int32_t _5994_mdim1__,
    std::shared_ptr< monty::ndarray< double,1 > > _5995_mval__,
    monty::rc_ptr< ::mosek::fusion::Expression > _5996_expr__)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__5995_mval__(_5995_mval__ ? _5995_mval__->raw() : nullptr, _5995_mval__ ? _5995_mval__->size(0) : 0);
    mosek::fusion::p_ExprCrossDot::_initialize(_5993_mdim0__,_5994_mdim1__,nullptr,nullptr,_5995_mval__,_5996_expr__,::mosek::fusion::p_ExprCrossDot::validate(_5993_mdim0__,_5994_mdim1__,nullptr,nullptr,_5995_mval__,_5996_expr__));
  }
}
// mosek.fusion.ExprCrossDot.ctor

// mosek.fusion.ExprCrossDot.ctor @ bld/grindsted/final/default/src/fusion/ExprMul.monty:89:6-102:7
mosek::fusion::ExprCrossDot::t mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot
  (int32_t _5997_mdim0_,
    int32_t _5998_mdim1_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5999_msubi_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6000_msubj_,
    std::shared_ptr< monty::ndarray< double,1 > > _6001_mval_,
    monty::rc_ptr< ::mosek::fusion::Expression > _6002_expr_)
{ return new mosek::fusion::ExprCrossDot(_5997_mdim0_,_5998_mdim1_,_5999_msubi_,_6000_msubj_,_6001_mval_,_6002_expr_); }
mosek::fusion::ExprCrossDot::ExprCrossDot
  (int32_t _5997_mdim0_,
    int32_t _5998_mdim1_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5999_msubi_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6000_msubj_,
    std::shared_ptr< monty::ndarray< double,1 > > _6001_mval_,
    monty::rc_ptr< ::mosek::fusion::Expression > _6002_expr_) : 
   ExprCrossDot(new mosek::fusion::p_ExprCrossDot(this))
{ mosek::fusion::p_ExprCrossDot::_get_impl(this)->_initialize(_5997_mdim0_,_5998_mdim1_,_5999_msubi_,_6000_msubj_,_6001_mval_,_6002_expr_); }
void mosek::fusion::p_ExprCrossDot::_initialize  (int32_t _5997_mdim0_,
    int32_t _5998_mdim1_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _5999_msubi_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6000_msubj_,
    std::shared_ptr< monty::ndarray< double,1 > > _6001_mval_,
    monty::rc_ptr< ::mosek::fusion::Expression > _6002_expr_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__5999_msubi_(_5999_msubi_ ? _5999_msubi_->raw() : nullptr, _5999_msubi_ ? _5999_msubi_->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__6000_msubj_(_6000_msubj_ ? _6000_msubj_->raw() : nullptr, _6000_msubj_ ? _6000_msubj_->size(0) : 0);
    _checked_ptr_1<double> _ptr__6001_mval_(_6001_mval_ ? _6001_mval_->raw() : nullptr, _6001_mval_ ? _6001_mval_->size(0) : 0);
    mosek::fusion::p_ExprCrossDot::_initialize(_5997_mdim0_,_5998_mdim1_,_5999_msubi_,_6000_msubj_,_6001_mval_,_6002_expr_,(int)1);
  }
}
// mosek.fusion.ExprCrossDot.ctor

// Begin mosek.fusion.ExprCrossDot.eval
// Method mosek.fusion.ExprCrossDot.eval @ bld/grindsted/final/default/src/fusion/ExprMul.monty:169:6-819:7
void mosek::fusion::ExprCrossDot :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6003_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6004_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6005_xs,bool _6006_cache_eval) { mosek::fusion::p_ExprCrossDot::_get_impl(this)->eval(_6003_rs,_6004_ws,_6005_xs,_6006_cache_eval); }
void mosek::fusion::p_ExprCrossDot::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6003_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6004_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6005_xs,bool _6006_cache_eval)
{
  mosek::fusion::p_ExprCrossDot::_get_impl(::mosek::fusion::ExprCrossDot::t(_pubthis))->expr->recursive_eval(_6004_ws,_6003_rs,_6005_xs,_6006_cache_eval);
  _6004_ws->pop_expr();
  int32_t _6007_nd = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->nd;
  int32_t _6008_nnz = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->nnz;
  int32_t _6009_nelem = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->nelem;
  int32_t _6010_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->ncodeatom;
  bool _6011_hassp = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->hassp;
  int32_t _6012_shape = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->shape_base;
  int32_t _6013_ptr = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->ptr_base;
  int32_t _6014_sp = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->sp_base;
  int32_t _6015_nidxs = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->nidxs_base;
  int32_t _6016_cof = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->cof_base;
  int32_t _6017_codeptr = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->codeptr_base;
  int32_t _6018_code = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->code_base;
  int32_t _6019_cconst = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6020_wi32 = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__6020_wi32(_6020_wi32 ? _6020_wi32->raw() : nullptr,_6020_wi32 ? _6020_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6021_wi64 = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__6021_wi64(_6021_wi64 ? _6021_wi64->raw() : nullptr,_6021_wi64 ? _6021_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6022_wf64 = mosek::fusion::p_WorkStack::_get_impl(_6004_ws)->f64;
  _checked_ptr_1<double> _ptr__6022_wf64(_6022_wf64 ? _6022_wf64->raw() : nullptr,_6022_wf64 ? _6022_wf64->size(0) : 0);
  int32_t _6023_rnnz = (int)0;
  int32_t _6024_rnelm = (int)0;
  bool _6025_rhassp = false;
  int32_t _6026_rncodeatom = (int)0;
  int32_t _6027_edim0 = _ptr__6020_wi32[safe_add( _6012_shape,(int)0 )];
  int32_t _6028_edim1 = _ptr__6020_wi32[safe_add( _6012_shape,(int)1 )];
  int32_t _6029_mnnz = (int)((mval)->size(0));
  if (((NULL == msubi.get()) || (NULL == msubj.get())))
  {
    {
      if ((!_6011_hassp))
      {
        {
          _6023_rnnz = safe_mul( _6008_nnz,mdim0 );
          _6024_rnelm = safe_mul( mdim0,_6027_edim0 );
          int32_t _11964_;
          bool _11965_ = (_6010_ncodeatom > (int)0);
          if (_11965_)
          {
            _11964_ = safe_mul( safe_add( _6010_ncodeatom,safe_mul( _6008_nnz,(int)2 ) ),mdim0 );
          }
          else
          {
            _11964_ = (int)0;
          }
          _6026_rncodeatom = _11964_;
        }
      }
      else
      {
        {
          _6023_rnnz = safe_mul( _6008_nnz,mdim0 );
          int32_t _11966_;
          bool _11967_ = (_6010_ncodeatom > (int)0);
          if (_11967_)
          {
            _11966_ = safe_mul( safe_add( _6010_ncodeatom,safe_mul( _6008_nnz,(int)2 ) ),mdim0 );
          }
          else
          {
            _11966_ = (int)0;
          }
          _6026_rncodeatom = _11966_;
          int32_t _6030_ii = (-(int)1);
          {
            int32_t _6031_ei = (int)0;
            for(;(_6031_ei < _6009_nelem);)
            {
              {
                int64_t _6032_i1 = (_ptr__6021_wi64[safe_add( _6014_sp,_6031_ei )] / _6028_edim1);
                ++ _6031_ei;
                while ( ((_6031_ei < _6009_nelem) && ((_ptr__6021_wi64[safe_add( _6014_sp,_6031_ei )] / _6028_edim1) == _6032_i1)) )
                {
                  {
                    ++ _6031_ei;
                  }
                }
                ++ _6024_rnelm;
              }
            }
          }
          _6024_rnelm *= mdim0;
        }
      }
    }
  }
  else if((!_6011_hassp))
  {
    {
      {
        int32_t _6033_k = (int)0;
        for(;(_6033_k < _6029_mnnz);)
        {
          {
            _6024_rnelm += (int)1;
            int32_t _6034_mptrb = _6033_k;
            int32_t _6035_i0 = ((*msubi)(_6033_k));
            ++ _6033_k;
            while ( ((_6033_k < _6029_mnnz) && (((*msubi)(_6033_k)) == _6035_i0)) )
            {
              {
                ++ _6033_k;
              }
            }
            int32_t _6036_mptre = _6033_k;
            int32_t _11968_ = (int)0;
            int32_t _11969_ = _6027_edim0;
            for (int32_t _6037_i = _11968_; _6037_i < _11969_; ++_6037_i)
            {
              {
                int32_t _11970_ = _6034_mptrb;
                int32_t _11971_ = _6036_mptre;
                for (int32_t _6038_p = _11970_; _6038_p < _11971_; ++_6038_p)
                {
                  {
                    int32_t _6039_j = ((*msubj)(_6038_p));
                    int32_t _6040_pe = _ptr__6020_wi32[safe_add( safe_add( safe_add( _6013_ptr,safe_mul( _6037_i,_6028_edim1 ) ),_6039_j ),(int)1 )];
                    int32_t _6041_pb = _ptr__6020_wi32[safe_add( safe_add( _6013_ptr,safe_mul( _6037_i,_6028_edim1 ) ),_6039_j )];
                    int32_t _6042_nelmnz = (_6040_pe - _6041_pb);
                    _6023_rnnz += _6042_nelmnz;
                    int32_t _11972_;
                    bool _11973_ = (_6010_ncodeatom > (int)0);
                    if (_11973_)
                    {
                      _11972_ = safe_add( (_ptr__6020_wi32[safe_add( _6017_codeptr,_6040_pe )] - _ptr__6020_wi32[safe_add( _6017_codeptr,_6041_pb )]),safe_mul( _6042_nelmnz,(int)2 ) );
                    }
                    else
                    {
                      _11972_ = (int)0;
                    }
                    _6026_rncodeatom += _11972_;
                  }
                }
              }
            }
          }
        }
      }
      _6024_rnelm *= _6027_edim0;
    }
  }
  else
  {
    {
      {
        int32_t _6043_mi = (int)0;
        for(;(_6043_mi < _6029_mnnz);)
        {
          {
            int32_t _6044_mptrb = _6043_mi;
            int32_t _6045_i0 = ((*msubi)(_6043_mi));
            ++ _6043_mi;
            while ( ((_6043_mi < _6029_mnnz) && (((*msubi)(_6043_mi)) == _6045_i0)) )
            {
              {
                ++ _6043_mi;
              }
            }
            int32_t _6046_mptre = _6043_mi;
            {
              int32_t _6047_ei = (int)0;
              for(;(_6047_ei < _6009_nelem);)
              {
                {
                  int32_t _6048_eptrb = _6047_ei;
                  int64_t _6049_i1 = (_ptr__6021_wi64[safe_add( _6014_sp,_6047_ei )] / _6028_edim1);
                  ++ _6047_ei;
                  while ( ((_6047_ei < _6009_nelem) && ((_ptr__6021_wi64[safe_add( _6014_sp,_6047_ei )] / _6028_edim1) == _6049_i1)) )
                  {
                    {
                      ++ _6047_ei;
                    }
                  }
                  int32_t _6050_eptre = _6047_ei;
                  int32_t _6051_relmnnz = (int)0;
                  int32_t _6052_l1 = _6048_eptrb;
                  int32_t _6053_l0 = _6044_mptrb;
                  while ( ((_6053_l0 < _6046_mptre) && (_6052_l1 < _6050_eptre)) )
                  {
                    {
                      if ((((*msubj)(_6053_l0)) < (_ptr__6021_wi64[safe_add( _6014_sp,_6052_l1 )] % _6028_edim1)))
                      {
                        {
                          ++ _6053_l0;
                        }
                      }
                      else if((((*msubj)(_6053_l0)) > (_ptr__6021_wi64[safe_add( _6014_sp,_6052_l1 )] % _6028_edim1)))
                      {
                        {
                          ++ _6052_l1;
                        }
                      }
                      else
                      {
                        {
                          ++ _6051_relmnnz;
                          int32_t _6054_nzb = _ptr__6020_wi32[safe_add( _6013_ptr,_6052_l1 )];
                          int32_t _6055_nze = _ptr__6020_wi32[safe_add( safe_add( _6013_ptr,_6052_l1 ),(int)1 )];
                          int32_t _6056_elmnnz = (_6055_nze - _6054_nzb);
                          _6023_rnnz += _6056_elmnnz;
                          int32_t _11974_;
                          bool _11975_ = (_6010_ncodeatom > (int)0);
                          if (_11975_)
                          {
                            _11974_ = safe_add( (_ptr__6020_wi32[safe_add( _6017_codeptr,_6055_nze )] - _ptr__6020_wi32[safe_add( _6017_codeptr,_6054_nzb )]),safe_mul( _6056_elmnnz,(int)2 ) );
                          }
                          else
                          {
                            _11974_ = (int)0;
                          }
                          _6026_rncodeatom += _11974_;
                          ++ _6053_l0;
                          ++ _6052_l1;
                        }
                      }
                    }
                  }
                  if ((_6051_relmnnz > (int)0))
                  {
                    {
                      ++ _6024_rnelm;
                    }
                  }
                  {}
                }
              }
            }
          }
        }
      }
    }
  }
  bool _6057_rhassp = (_6024_rnelm < safe_mul( _6027_edim0,mdim0 ));
  _6003_rs->alloc_expr((int)2,_6024_rnelm,_6023_rnnz,_6057_rhassp,_6026_rncodeatom);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6058_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6003_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__6058_ri32(_6058_ri32 ? _6058_ri32->raw() : nullptr,_6058_ri32 ? _6058_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6059_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6003_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__6059_ri64(_6059_ri64 ? _6059_ri64->raw() : nullptr,_6059_ri64 ? _6059_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6060_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6003_rs)->f64;
  _checked_ptr_1<double> _ptr__6060_rf64(_6060_rf64 ? _6060_rf64->raw() : nullptr,_6060_rf64 ? _6060_rf64->size(0) : 0);
  int32_t _6061_rncodeatom = mosek::fusion::p_WorkStack::_get_impl(_6003_rs)->ncodeatom;
  int32_t _6062_rshape = mosek::fusion::p_WorkStack::_get_impl(_6003_rs)->shape_base;
  int32_t _6063_rptr = mosek::fusion::p_WorkStack::_get_impl(_6003_rs)->ptr_base;
  int32_t _11976_;
  bool _11977_ = _6057_rhassp;
  if (_11977_)
  {
    _11976_ = mosek::fusion::p_WorkStack::_get_impl(_6003_rs)->sp_base;
  }
  else
  {
    _11976_ = (-(int)9999);
  }
  int32_t _6064_rsp = _11976_;
  int32_t _6065_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_6003_rs)->nidxs_base;
  int32_t _6066_rcof = mosek::fusion::p_WorkStack::_get_impl(_6003_rs)->cof_base;
  int32_t _6067_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_6003_rs)->codeptr_base;
  int32_t _6068_rcode = mosek::fusion::p_WorkStack::_get_impl(_6003_rs)->code_base;
  int32_t _6069_rcconst = mosek::fusion::p_WorkStack::_get_impl(_6003_rs)->cconst_base;
  _ptr__6058_ri32[_6062_rshape] = mdim0;
  _ptr__6058_ri32[safe_add( _6062_rshape,(int)1 )] = _6027_edim0;
  _ptr__6058_ri32[_6063_rptr] = (int)0;
  if ((_6061_rncodeatom > (int)0))
  {
    {
      _ptr__6058_ri32[_6067_rcodeptr] = (int)0;
    }
  }
  {}
  if (((NULL == msubi.get()) || (NULL == msubj.get())))
  {
    {
      if ((!_6011_hassp))
      {
        {
          {
            int32_t _6070_nzi = (int)0;
            int32_t _6071_elmi = (int)0;
            int32_t _11978_ = (int)0;
            int32_t _11979_ = mdim0;
            for (int32_t _6072_i0 = _11978_; _6072_i0 < _11979_; ++_6072_i0)
            {
              {
                ::mosek::fusion::Utils::Tools::arraycopy(_6021_wi64,_6015_nidxs,_6059_ri64,safe_add( _6065_rnidxs,_6070_nzi ),_6008_nnz);
                int32_t _6073_ei = (int)0;
                int32_t _11980_ = (int)0;
                int32_t _11981_ = _6027_edim0;
                for (int32_t _6074_i1 = _11980_; _6074_i1 < _11981_; ++_6074_i1)
                {
                  {
                    int32_t _11982_ = (int)0;
                    int32_t _11983_ = mdim1;
                    for (int32_t _6075_j1 = _11982_; _6075_j1 < _11983_; ++_6075_j1)
                    {
                      {
                        int32_t _11984_ = _ptr__6020_wi32[safe_add( _6013_ptr,_6073_ei )];
                        int32_t _11985_ = _ptr__6020_wi32[safe_add( safe_add( _6013_ptr,_6073_ei ),(int)1 )];
                        for (int32_t _6076_l = _11984_; _6076_l < _11985_; ++_6076_l)
                        {
                          {
                            _ptr__6060_rf64[safe_add( _6066_rcof,_6070_nzi )] = (((*mval)(safe_add( safe_mul( _6072_i0,mdim1 ),_6075_j1 ))) * _ptr__6022_wf64[safe_add( _6016_cof,_6076_l )]);
                            ++ _6070_nzi;
                          }
                        }
                        ++ _6073_ei;
                      }
                    }
                    _ptr__6058_ri32[safe_add( safe_add( _6063_rptr,_6071_elmi ),(int)1 )] = _6070_nzi;
                    ++ _6071_elmi;
                  }
                }
              }
            }
          }
          if ((_6061_rncodeatom > (int)0))
          {
            {
              int32_t _6077_nzi = (int)0;
              int32_t _6078_codei = (int)0;
              int32_t _11986_ = (int)0;
              int32_t _11987_ = mdim0;
              for (int32_t _6079_i0 = _11986_; _6079_i0 < _11987_; ++_6079_i0)
              {
                {
                  int32_t _6080_ei = (int)0;
                  int32_t _11988_ = (int)0;
                  int32_t _11989_ = _6027_edim0;
                  for (int32_t _6081_i1 = _11988_; _6081_i1 < _11989_; ++_6081_i1)
                  {
                    {
                      int32_t _11990_ = (int)0;
                      int32_t _11991_ = mdim1;
                      for (int32_t _6082_j1 = _11990_; _6082_j1 < _11991_; ++_6082_j1)
                      {
                        {
                          int32_t _11992_ = _ptr__6020_wi32[safe_add( _6013_ptr,_6080_ei )];
                          int32_t _11993_ = _ptr__6020_wi32[safe_add( safe_add( _6013_ptr,_6080_ei ),(int)1 )];
                          for (int32_t _6083_l = _11992_; _6083_l < _11993_; ++_6083_l)
                          {
                            {
                              int32_t _11994_ = _ptr__6020_wi32[safe_add( _6017_codeptr,_6083_l )];
                              int32_t _11995_ = _ptr__6020_wi32[safe_add( safe_add( _6017_codeptr,_6083_l ),(int)1 )];
                              for (int32_t _6084_cl = _11994_; _6084_cl < _11995_; ++_6084_cl)
                              {
                                {
                                  _ptr__6058_ri32[safe_add( _6068_rcode,_6078_codei )] = _ptr__6020_wi32[safe_add( _6018_code,_6084_cl )];
                                  _ptr__6060_rf64[safe_add( _6069_rcconst,_6078_codei )] = _ptr__6022_wf64[safe_add( _6019_cconst,_6084_cl )];
                                  ++ _6078_codei;
                                }
                              }
                              _ptr__6058_ri32[safe_add( _6068_rcode,_6078_codei )] = 2;
                              _ptr__6060_rf64[safe_add( _6069_rcconst,_6078_codei )] = ((*mval)(safe_add( safe_mul( _6079_i0,mdim1 ),_6082_j1 )));
                              ++ _6078_codei;
                              _ptr__6058_ri32[safe_add( _6068_rcode,_6078_codei )] = 5;
                              ++ _6078_codei;
                              _ptr__6058_ri32[safe_add( safe_add( _6067_rcodeptr,_6077_nzi ),(int)1 )] = _6078_codei;
                              ++ _6077_nzi;
                            }
                          }
                          ++ _6080_ei;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          {}
        }
      }
      else
      {
        {
          {
            int32_t _6085_nzi = (int)0;
            int32_t _6086_elmi = (int)0;
            int32_t _11996_ = (int)0;
            int32_t _11997_ = mdim0;
            for (int32_t _6087_i0 = _11996_; _6087_i0 < _11997_; ++_6087_i0)
            {
              {
                ::mosek::fusion::Utils::Tools::arraycopy(_6021_wi64,_6015_nidxs,_6059_ri64,safe_add( _6065_rnidxs,_6085_nzi ),_6008_nnz);
                int32_t _6088_ei = (int)0;
                {
                  int32_t _6089_ei = (int)0;
                  for(;(_6089_ei < _6009_nelem);)
                  {
                    {
                      int64_t _6090_i1 = (_ptr__6021_wi64[safe_add( _6014_sp,_6089_ei )] / _6028_edim1);
                      int32_t _6091_ptrb = _6089_ei;
                      ++ _6089_ei;
                      while ( ((_6089_ei < _6009_nelem) && ((_ptr__6021_wi64[safe_add( _6014_sp,_6089_ei )] / _6028_edim1) == _6090_i1)) )
                      {
                        {
                          ++ _6089_ei;
                        }
                      }
                      int32_t _6092_ptre = _6089_ei;
                      int32_t _11998_ = _6091_ptrb;
                      int32_t _11999_ = _6092_ptre;
                      for (int32_t _6093_k = _11998_; _6093_k < _11999_; ++_6093_k)
                      {
                        {
                          int64_t _6094_j = (_ptr__6021_wi64[safe_add( _6014_sp,_6093_k )] % _6028_edim1);
                          int32_t _12000_ = _ptr__6020_wi32[safe_add( _6013_ptr,_6093_k )];
                          int32_t _12001_ = _ptr__6020_wi32[safe_add( safe_add( _6013_ptr,_6093_k ),(int)1 )];
                          for (int32_t _6095_l = _12000_; _6095_l < _12001_; ++_6095_l)
                          {
                            {
                              _ptr__6060_rf64[safe_add( _6066_rcof,_6085_nzi )] = (((*mval)(safe_add( safe_mul( _6087_i0,mdim1 ),_6094_j ))) * _ptr__6022_wf64[safe_add( _6016_cof,_6095_l )]);
                              ++ _6085_nzi;
                            }
                          }
                        }
                      }
                      if (_6057_rhassp)
                      {
                        {
                          _ptr__6059_ri64[safe_add( _6064_rsp,_6086_elmi )] = safe_add( safe_mul( _6087_i0,_6027_edim0 ),_6090_i1 );
                        }
                      }
                      {}
                      ++ _6086_elmi;
                      _ptr__6058_ri32[safe_add( _6063_rptr,_6086_elmi )] = _6085_nzi;
                    }
                  }
                }
              }
            }
          }
          if ((_6061_rncodeatom > (int)0))
          {
            {
              int32_t _6096_nzi = (int)0;
              int32_t _6097_codei = (int)0;
              int32_t _12002_ = (int)0;
              int32_t _12003_ = mdim0;
              for (int32_t _6098_i0 = _12002_; _6098_i0 < _12003_; ++_6098_i0)
              {
                {
                  int32_t _6099_ei = (int)0;
                  {
                    int32_t _6100_ei = (int)0;
                    for(;(_6100_ei < _6009_nelem);)
                    {
                      {
                        int64_t _6101_i1 = (_ptr__6021_wi64[safe_add( _6014_sp,_6100_ei )] / _6028_edim1);
                        int32_t _6102_ptrb = _6100_ei;
                        ++ _6100_ei;
                        while ( ((_6100_ei < _6009_nelem) && ((_ptr__6021_wi64[safe_add( _6014_sp,_6100_ei )] / _6028_edim1) == _6101_i1)) )
                        {
                          {
                            ++ _6100_ei;
                          }
                        }
                        int32_t _6103_ptre = _6100_ei;
                        int32_t _12004_ = _6102_ptrb;
                        int32_t _12005_ = _6103_ptre;
                        for (int32_t _6104_k = _12004_; _6104_k < _12005_; ++_6104_k)
                        {
                          {
                            int64_t _6105_j = (_ptr__6021_wi64[safe_add( _6014_sp,_6104_k )] % _6028_edim1);
                            int32_t _12006_ = _ptr__6020_wi32[safe_add( _6013_ptr,_6104_k )];
                            int32_t _12007_ = _ptr__6020_wi32[safe_add( safe_add( _6013_ptr,_6104_k ),(int)1 )];
                            for (int32_t _6106_l = _12006_; _6106_l < _12007_; ++_6106_l)
                            {
                              {
                                int32_t _12008_ = _ptr__6020_wi32[safe_add( _6017_codeptr,_6106_l )];
                                int32_t _12009_ = _ptr__6020_wi32[safe_add( safe_add( _6017_codeptr,_6106_l ),(int)1 )];
                                for (int32_t _6107_cl = _12008_; _6107_cl < _12009_; ++_6107_cl)
                                {
                                  {
                                    _ptr__6058_ri32[safe_add( _6068_rcode,_6097_codei )] = _ptr__6020_wi32[safe_add( _6018_code,_6107_cl )];
                                    _ptr__6060_rf64[safe_add( _6069_rcconst,_6097_codei )] = _ptr__6022_wf64[safe_add( _6019_cconst,_6107_cl )];
                                    ++ _6097_codei;
                                  }
                                }
                                _ptr__6058_ri32[safe_add( _6068_rcode,_6097_codei )] = 2;
                                _ptr__6060_rf64[safe_add( _6069_rcconst,_6097_codei )] = ((*mval)(safe_add( safe_mul( _6098_i0,_6027_edim0 ),_6105_j )));
                                ++ _6097_codei;
                                _ptr__6058_ri32[safe_add( _6068_rcode,_6097_codei )] = 5;
                                ++ _6097_codei;
                                _ptr__6058_ri32[safe_add( safe_add( _6067_rcodeptr,_6096_nzi ),(int)1 )] = _6097_codei;
                                ++ _6096_nzi;
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          {}
        }
      }
    }
  }
  else if((!_6011_hassp))
  {
    {
      int32_t _6108_nzi = (int)0;
      int32_t _6109_elmi = (int)0;
      int32_t _6110_codei = (int)0;
      {
        int32_t _6111_k = (int)0;
        for(;(_6111_k < _6029_mnnz);)
        {
          {
            int32_t _6112_mptrb = _6111_k;
            int32_t _6113_i0 = ((*msubi)(_6111_k));
            ++ _6111_k;
            while ( ((_6111_k < _6029_mnnz) && (((*msubi)(_6111_k)) == _6113_i0)) )
            {
              {
                ++ _6111_k;
              }
            }
            int32_t _6114_mptre = _6111_k;
            int32_t _12010_ = (int)0;
            int32_t _12011_ = _6027_edim0;
            for (int32_t _6115_i = _12010_; _6115_i < _12011_; ++_6115_i)
            {
              {
                int32_t _12012_ = _6112_mptrb;
                int32_t _12013_ = _6114_mptre;
                for (int32_t _6116_p = _12012_; _6116_p < _12013_; ++_6116_p)
                {
                  {
                    int32_t _6117_esubj = safe_add( safe_mul( _6115_i,_6028_edim1 ),((*msubj)(_6116_p)) );
                    int32_t _12014_ = _ptr__6020_wi32[safe_add( _6013_ptr,_6117_esubj )];
                    int32_t _12015_ = _ptr__6020_wi32[safe_add( safe_add( _6013_ptr,_6117_esubj ),(int)1 )];
                    for (int32_t _6118_l = _12014_; _6118_l < _12015_; ++_6118_l)
                    {
                      {
                        _ptr__6059_ri64[safe_add( _6065_rnidxs,_6108_nzi )] = _ptr__6021_wi64[safe_add( _6015_nidxs,_6118_l )];
                        _ptr__6060_rf64[safe_add( _6066_rcof,_6108_nzi )] = (_ptr__6022_wf64[safe_add( _6016_cof,_6118_l )] * ((*mval)(_6116_p)));
                        if ((_6061_rncodeatom > (int)0))
                        {
                          {
                            int32_t _12016_ = _ptr__6020_wi32[safe_add( _6017_codeptr,_6118_l )];
                            int32_t _12017_ = _ptr__6020_wi32[safe_add( safe_add( _6017_codeptr,_6118_l ),(int)1 )];
                            for (int32_t _6119_cl = _12016_; _6119_cl < _12017_; ++_6119_cl)
                            {
                              {
                                _ptr__6058_ri32[safe_add( _6068_rcode,_6110_codei )] = _ptr__6020_wi32[safe_add( _6018_code,_6119_cl )];
                                _ptr__6060_rf64[safe_add( _6069_rcconst,_6110_codei )] = _ptr__6022_wf64[safe_add( _6019_cconst,_6119_cl )];
                                ++ _6110_codei;
                              }
                            }
                            _ptr__6058_ri32[safe_add( _6068_rcode,_6110_codei )] = 2;
                            _ptr__6060_rf64[safe_add( _6069_rcconst,_6110_codei )] = ((*mval)(_6116_p));
                            ++ _6110_codei;
                            _ptr__6058_ri32[safe_add( _6068_rcode,_6110_codei )] = 5;
                            ++ _6110_codei;
                            _ptr__6058_ri32[safe_add( safe_add( _6067_rcodeptr,_6108_nzi ),(int)1 )] = _6110_codei;
                          }
                        }
                        {}
                        ++ _6108_nzi;
                      }
                    }
                  }
                }
                _ptr__6058_ri32[safe_add( safe_add( _6063_rptr,_6109_elmi ),(int)1 )] = _6108_nzi;
                if (_6057_rhassp)
                {
                  {
                    _ptr__6059_ri64[safe_add( _6064_rsp,_6109_elmi )] = safe_add( safe_mul( _6113_i0,_6027_edim0 ),_6115_i );
                  }
                }
                {}
                ++ _6109_elmi;
              }
            }
          }
        }
      }
      if ((_6108_nzi != _6023_rnnz))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Error in evaluation: Incorrect number of nonzeros"));
        }
      }
      {}
      if ((_6109_elmi != _6024_rnelm))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Error in evaluation: Incorrect number of elements"));
        }
      }
      {}
      if ((_6110_codei != _6061_rncodeatom))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Error in evaluation: Incorrect number of code elements"));
        }
      }
      {}
    }
  }
  else
  {
    {
      {
        int32_t _6120_nzi = (int)0;
        int32_t _6121_elmi = (int)0;
        {
          int32_t _6122_k0 = (int)0;
          for(;(_6122_k0 < _6029_mnnz);)
          {
            {
              int32_t _6123_mptrb = _6122_k0;
              int32_t _6124_i0 = ((*msubi)(_6122_k0));
              ++ _6122_k0;
              while ( ((_6122_k0 < _6029_mnnz) && (((*msubi)(_6122_k0)) == _6124_i0)) )
              {
                {
                  ++ _6122_k0;
                }
              }
              int32_t _6125_mptre = _6122_k0;
              {
                int32_t _6126_k1 = (int)0;
                for(;(_6126_k1 < _6009_nelem);)
                {
                  {
                    int32_t _6127_eptrb = _6126_k1;
                    int64_t _6128_i1 = (_ptr__6021_wi64[safe_add( _6014_sp,_6126_k1 )] / _6028_edim1);
                    ++ _6126_k1;
                    while ( ((_6126_k1 < _6009_nelem) && ((_ptr__6021_wi64[safe_add( _6014_sp,_6126_k1 )] / _6028_edim1) == _6128_i1)) )
                    {
                      {
                        ++ _6126_k1;
                      }
                    }
                    int32_t _6129_eptre = _6126_k1;
                    int32_t _6130_relmnnz = (int)0;
                    int32_t _6131_l1 = _6127_eptrb;
                    int32_t _6132_l0 = _6123_mptrb;
                    while ( ((_6132_l0 < _6125_mptre) && (_6131_l1 < _6129_eptre)) )
                    {
                      {
                        if ((((*msubj)(_6132_l0)) < (_ptr__6021_wi64[safe_add( _6014_sp,_6131_l1 )] % _6028_edim1)))
                        {
                          {
                            ++ _6132_l0;
                          }
                        }
                        else if((((*msubj)(_6132_l0)) > (_ptr__6021_wi64[safe_add( _6014_sp,_6131_l1 )] % _6028_edim1)))
                        {
                          {
                            ++ _6131_l1;
                          }
                        }
                        else
                        {
                          {
                            ++ _6130_relmnnz;
                            int32_t _12018_ = _ptr__6020_wi32[safe_add( _6013_ptr,_6131_l1 )];
                            int32_t _12019_ = _ptr__6020_wi32[safe_add( safe_add( _6013_ptr,_6131_l1 ),(int)1 )];
                            for (int32_t _6133_l = _12018_; _6133_l < _12019_; ++_6133_l)
                            {
                              {
                                _ptr__6059_ri64[safe_add( _6065_rnidxs,_6120_nzi )] = _ptr__6021_wi64[safe_add( _6015_nidxs,_6133_l )];
                                _ptr__6060_rf64[safe_add( _6066_rcof,_6120_nzi )] = (_ptr__6022_wf64[safe_add( _6016_cof,_6133_l )] * ((*mval)(_6132_l0)));
                                ++ _6120_nzi;
                              }
                            }
                            ++ _6132_l0;
                            ++ _6131_l1;
                          }
                        }
                      }
                    }
                    if ((_6130_relmnnz > (int)0))
                    {
                      {
                        _ptr__6058_ri32[safe_add( safe_add( _6063_rptr,_6121_elmi ),(int)1 )] = _6120_nzi;
                        if (_6057_rhassp)
                        {
                          {
                            _ptr__6059_ri64[safe_add( _6064_rsp,_6121_elmi )] = safe_add( safe_mul( _6124_i0,_6027_edim0 ),_6128_i1 );
                          }
                        }
                        {}
                        ++ _6121_elmi;
                      }
                    }
                    {}
                  }
                }
              }
            }
          }
        }
        if ((_6120_nzi != _6023_rnnz))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Error in evaluation: Incorrect number of nonzeros"));
          }
        }
        {}
        if ((_6121_elmi != _6024_rnelm))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Error in evaluation: Incorrect number of elements"));
          }
        }
        {}
      }
      if ((_6061_rncodeatom > (int)0))
      {
        {
          int32_t _6134_nzi = (int)0;
          int32_t _6135_codei = (int)0;
          {
            int32_t _6136_k0 = (int)0;
            for(;(_6136_k0 < _6029_mnnz);)
            {
              {
                int32_t _6137_mptrb = _6136_k0;
                int32_t _6138_i0 = ((*msubi)(_6136_k0));
                ++ _6136_k0;
                while ( ((_6136_k0 < _6029_mnnz) && (((*msubi)(_6136_k0)) == _6138_i0)) )
                {
                  {
                    ++ _6136_k0;
                  }
                }
                int32_t _6139_mptre = _6136_k0;
                {
                  int32_t _6140_k1 = (int)0;
                  for(;(_6140_k1 < _6009_nelem);)
                  {
                    {
                      int32_t _6141_eptrb = _6140_k1;
                      int64_t _6142_i1 = (_ptr__6021_wi64[safe_add( _6014_sp,_6140_k1 )] / _6028_edim1);
                      ++ _6140_k1;
                      while ( ((_6140_k1 < _6009_nelem) && ((_ptr__6021_wi64[safe_add( _6014_sp,_6140_k1 )] / _6028_edim1) == _6142_i1)) )
                      {
                        {
                          ++ _6140_k1;
                        }
                      }
                      int32_t _6143_eptre = _6140_k1;
                      int32_t _6144_relmnnz = (int)0;
                      int32_t _6145_l1 = _6141_eptrb;
                      int32_t _6146_l0 = _6137_mptrb;
                      while ( ((_6146_l0 < _6139_mptre) && (_6145_l1 < _6143_eptre)) )
                      {
                        {
                          if ((((*msubj)(_6146_l0)) < (_ptr__6021_wi64[safe_add( _6014_sp,_6145_l1 )] % _6028_edim1)))
                          {
                            {
                              ++ _6146_l0;
                            }
                          }
                          else if((((*msubj)(_6146_l0)) > (_ptr__6021_wi64[safe_add( _6014_sp,_6145_l1 )] % _6028_edim1)))
                          {
                            {
                              ++ _6145_l1;
                            }
                          }
                          else
                          {
                            {
                              ++ _6144_relmnnz;
                              int32_t _12020_ = _ptr__6020_wi32[safe_add( _6013_ptr,_6145_l1 )];
                              int32_t _12021_ = _ptr__6020_wi32[safe_add( safe_add( _6013_ptr,_6145_l1 ),(int)1 )];
                              for (int32_t _6147_l = _12020_; _6147_l < _12021_; ++_6147_l)
                              {
                                {
                                  int32_t _12022_ = _ptr__6020_wi32[safe_add( _6017_codeptr,_6147_l )];
                                  int32_t _12023_ = _ptr__6020_wi32[safe_add( safe_add( _6017_codeptr,_6147_l ),(int)1 )];
                                  for (int32_t _6148_cl = _12022_; _6148_cl < _12023_; ++_6148_cl)
                                  {
                                    {
                                      _ptr__6058_ri32[safe_add( _6068_rcode,_6135_codei )] = _ptr__6020_wi32[safe_add( _6018_code,_6148_cl )];
                                      _ptr__6060_rf64[safe_add( _6069_rcconst,_6135_codei )] = _ptr__6022_wf64[safe_add( _6019_cconst,_6148_cl )];
                                      ++ _6135_codei;
                                    }
                                  }
                                  _ptr__6058_ri32[safe_add( _6068_rcode,_6135_codei )] = 2;
                                  _ptr__6060_rf64[safe_add( _6069_rcconst,_6135_codei )] = ((*mval)(_6146_l0));
                                  ++ _6135_codei;
                                  _ptr__6058_ri32[safe_add( _6068_rcode,_6135_codei )] = 5;
                                  ++ _6135_codei;
                                  _ptr__6058_ri32[safe_add( safe_add( _6067_rcodeptr,_6134_nzi ),(int)1 )] = _6135_codei;
                                  ++ _6134_nzi;
                                }
                              }
                              ++ _6146_l0;
                              ++ _6145_l1;
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          if ((_6135_codei != _6061_rncodeatom))
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Error in evaluation: Incorrect number of code elements"));
            }
          }
          {}
        }
      }
      {}
    }
  }
}
// End mosek.fusion.ExprCrossDot.eval

// Begin mosek.fusion.ExprCrossDot.computeshape
// Method mosek.fusion.ExprCrossDot.computeshape @ bld/grindsted/final/default/src/fusion/ExprMul.monty:114:6-120:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_ExprCrossDot::computeshape(int32_t _6149_d0,int32_t _6150_d1,std::shared_ptr< monty::ndarray< int32_t,1 > > _6151_ds)
{
  _checked_ptr_1<int32_t> _ptr__6151_ds(_6151_ds ? _6151_ds->raw() : nullptr, _6151_ds ? _6151_ds->size(0) : 0);
  if (((int)((_6151_ds)->size(0)) != (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching dimensions"));
    }
  }
  else if((_6150_d1 != _ptr__6151_ds[(int)1]))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching dimensions"));
    }
  }
  {}
  return std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_6149_d0),(int32_t)(_ptr__6151_ds[(int)0])});
}
// End mosek.fusion.ExprCrossDot.computeshape

// Begin mosek.fusion.ExprCrossDot.validate
// Method mosek.fusion.ExprCrossDot.validate @ bld/grindsted/final/default/src/fusion/ExprMul.monty:28:6-74:7
int32_t mosek::fusion::p_ExprCrossDot::validate(int32_t _6152_mdim0,int32_t _6153_mdim1,std::shared_ptr< monty::ndarray< int32_t,1 > > _6154_msubi,std::shared_ptr< monty::ndarray< int32_t,1 > > _6155_msubj,std::shared_ptr< monty::ndarray< double,1 > > _6156_mval,monty::rc_ptr< ::mosek::fusion::Expression > _6157_expr)
{
  _checked_ptr_1<int32_t> _ptr__6154_msubi(_6154_msubi ? _6154_msubi->raw() : nullptr, _6154_msubi ? _6154_msubi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__6155_msubj(_6155_msubj ? _6155_msubj->raw() : nullptr, _6155_msubj ? _6155_msubj->size(0) : 0);
  _checked_ptr_1<double> _ptr__6156_mval(_6156_mval ? _6156_mval->raw() : nullptr, _6156_mval ? _6156_mval->size(0) : 0);
  if ((_6157_expr->getND() != (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions"));
    }
  }
  {}
  int32_t _6158_edim0 = _6157_expr->getDim((int)0);
  int32_t _6159_edim1 = _6157_expr->getDim((int)1);
  if (((_6152_mdim0 < (int)0) || (_6153_mdim1 < (int)0)))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions"));
    }
  }
  {}
  if ((_6153_mdim1 != _6159_edim1))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
    }
  }
  {}
  if (((NULL != _6154_msubi.get()) && (NULL != _6155_msubj.get())))
  {
    {
      if ((((int)((_6154_msubi)->size(0)) != (int)((_6155_msubj)->size(0))) || ((int)((_6154_msubi)->size(0)) != (int)((_6156_mval)->size(0)))))
      {
        {
          throw ::mosek::fusion::LengthError(std::string ("Invalid matrix data"));
        }
      }
      {}
    }
  }
  else
  {
    {
      if (((int)((_6156_mval)->size(0)) != safe_mul( _6152_mdim0,_6153_mdim1 )))
      {
        {
          throw ::mosek::fusion::LengthError(std::string ("Invalid matrix data"));
        }
      }
      {}
    }
  }
  int32_t _6160_mnnz = (int)((_6156_mval)->size(0));
  bool _6161_err_data = false;
  bool _6162_err_unsorted = false;
  if (((NULL != _6154_msubi.get()) && (NULL != _6155_msubj.get())))
  {
    {
      int32_t _12024_ = (int)0;
      int32_t _12025_ = _6160_mnnz;
      for (int32_t _6163_i = _12024_; _6163_i < _12025_; ++_6163_i)
      {
        {
          _6161_err_data = (_6161_err_data || ((_ptr__6154_msubi[_6163_i] < (int)0) || ((_ptr__6154_msubi[_6163_i] >= _6152_mdim0) || ((_ptr__6155_msubj[_6163_i] < (int)0) || (_ptr__6155_msubj[_6163_i] >= _6153_mdim1)))));
        }
      }
      if ((!_6161_err_data))
      {
        {
          int32_t _12026_ = (int)0;
          int32_t _12027_ = (_6160_mnnz - (int)1);
          for (int32_t _6164_i = _12026_; _6164_i < _12027_; ++_6164_i)
          {
            {
              _6162_err_unsorted = (_6162_err_unsorted || ((_ptr__6154_msubi[_6164_i] > _ptr__6154_msubi[safe_add( _6164_i,(int)1 )]) || ((_ptr__6154_msubi[_6164_i] == _ptr__6154_msubi[safe_add( _6164_i,(int)1 )]) && (_ptr__6155_msubj[_6164_i] >= _ptr__6155_msubj[safe_add( _6164_i,(int)1 )]))));
            }
          }
        }
      }
      {}
    }
  }
  {}
  if (_6161_err_data)
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Invalid matrix data"));
    }
  }
  {}
  if (_6162_err_unsorted)
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Unsorted matrix data"));
    }
  }
  {}
  return (int)1;
}
// End mosek.fusion.ExprCrossDot.validate

// Begin mosek.fusion.ExprCrossDot.toString
// Method mosek.fusion.ExprCrossDot.toString @ bld/grindsted/final/default/src/fusion/ExprMul.monty:24:6-26:7
std::string mosek::fusion::ExprCrossDot :: toString() { return mosek::fusion::p_ExprCrossDot::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprCrossDot::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprCrossDot(M("))->__mosek_2fusion_2Utils_2StringBuffer__a(mdim0)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(mdim1)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("),"))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprCrossDot.toString

void mosek::fusion::p_ExprCrossDot::destroy()
{
  expr.reset();
  mval.reset();
  msubj.reset();
  msubi.reset();
}
void mosek::fusion::ExprCrossDot::destroy() { mosek::fusion::p_ExprCrossDot::_get_impl(this)->destroy(); }
// } class ExprCrossDot
// class ExprMulVar { // @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:121:4-742:5
mosek::fusion::ExprMulVar::ExprMulVar(mosek::fusion::p_ExprMulVar *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulVar()" << this << std::endl; */ }
mosek::fusion::ExprMulVar::~ExprMulVar() {  /* std::cout << "~ExprMulVar()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulVar::p_ExprMulVar
  (::mosek::fusion::ExprMulVar * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulVar.ctor @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:199:6-227:7
mosek::fusion::ExprMulVar::t mosek::fusion::p_ExprMulVar::_new_ExprMulVar
  (bool _6165_left,
    int32_t _6166_mdimi,
    int32_t _6167_mdimj,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6168_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6169_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _6170_mcof,
    monty::rc_ptr< ::mosek::fusion::Variable > _6171_x)
{ return new mosek::fusion::ExprMulVar(_6165_left,_6166_mdimi,_6167_mdimj,_6168_msubi,_6169_msubj,_6170_mcof,_6171_x); }
mosek::fusion::ExprMulVar::ExprMulVar
  (bool _6165_left,
    int32_t _6166_mdimi,
    int32_t _6167_mdimj,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6168_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6169_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _6170_mcof,
    monty::rc_ptr< ::mosek::fusion::Variable > _6171_x) : 
   ExprMulVar(new mosek::fusion::p_ExprMulVar(this))
{ mosek::fusion::p_ExprMulVar::_get_impl(this)->_initialize(_6165_left,_6166_mdimi,_6167_mdimj,_6168_msubi,_6169_msubj,_6170_mcof,_6171_x); }
void mosek::fusion::p_ExprMulVar::_initialize  (bool _6165_left,
    int32_t _6166_mdimi,
    int32_t _6167_mdimj,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6168_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6169_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _6170_mcof,
    monty::rc_ptr< ::mosek::fusion::Variable > _6171_x)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__6168_msubi(_6168_msubi ? _6168_msubi->raw() : nullptr, _6168_msubi ? _6168_msubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__6169_msubj(_6169_msubj ? _6169_msubj->raw() : nullptr, _6169_msubj ? _6169_msubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__6170_mcof(_6170_mcof ? _6170_mcof->raw() : nullptr, _6170_mcof ? _6170_mcof->size(0) : 0);
    mosek::fusion::p_ExprMulVar::_initialize(_6165_left,_6166_mdimi,_6167_mdimj,_6168_msubi,_6169_msubj,_6170_mcof,_6171_x,(int)1);
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6172_xshape = _6171_x->getShape();
    _checked_ptr_1<int32_t> _ptr__6172_xshape(_6172_xshape ? _6172_xshape->raw() : nullptr,_6172_xshape ? _6172_xshape->size(0) : 0);
    int32_t _6173_nd = (int)((_6172_xshape)->size(0));
    if ((_6173_nd != (int)2))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
      }
    }
    else if((_6165_left && (_ptr__6172_xshape[(int)0] != _6167_mdimj)))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
      }
    }
    else if(((!_6165_left) && (_ptr__6172_xshape[(int)1] != _6166_mdimi)))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
      }
    }
    {}
    if ((((int)((_6168_msubi)->size(0)) != (int)((_6169_msubj)->size(0))) || ((int)((_6168_msubi)->size(0)) != (int)((_6170_mcof)->size(0)))))
    {
      {
        throw ::mosek::fusion::LengthError(std::string ("Mismatching matrix data lengths"));
      }
    }
    {}
    validate(_6166_mdimi,_6167_mdimj,_6168_msubi,_6169_msubj,_6170_mcof);
  }
}
// mosek.fusion.ExprMulVar.ctor

// mosek.fusion.ExprMulVar.ctor @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:147:6-171:7
mosek::fusion::ExprMulVar::t mosek::fusion::p_ExprMulVar::_new_ExprMulVar
  (bool _6174_left,
    int32_t _6175_mdimi,
    int32_t _6176_mdimj,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6177_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6178_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _6179_mcof,
    monty::rc_ptr< ::mosek::fusion::Variable > _6180_x,
    int32_t _6181_unchecked_)
{ return new mosek::fusion::ExprMulVar(_6174_left,_6175_mdimi,_6176_mdimj,_6177_msubi,_6178_msubj,_6179_mcof,_6180_x,_6181_unchecked_); }
mosek::fusion::ExprMulVar::ExprMulVar
  (bool _6174_left,
    int32_t _6175_mdimi,
    int32_t _6176_mdimj,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6177_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6178_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _6179_mcof,
    monty::rc_ptr< ::mosek::fusion::Variable > _6180_x,
    int32_t _6181_unchecked_) : 
   ExprMulVar(new mosek::fusion::p_ExprMulVar(this))
{ mosek::fusion::p_ExprMulVar::_get_impl(this)->_initialize(_6174_left,_6175_mdimi,_6176_mdimj,_6177_msubi,_6178_msubj,_6179_mcof,_6180_x,_6181_unchecked_); }
void mosek::fusion::p_ExprMulVar::_initialize  (bool _6174_left,
    int32_t _6175_mdimi,
    int32_t _6176_mdimj,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6177_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6178_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _6179_mcof,
    monty::rc_ptr< ::mosek::fusion::Variable > _6180_x,
    int32_t _6181_unchecked_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__6177_msubi(_6177_msubi ? _6177_msubi->raw() : nullptr, _6177_msubi ? _6177_msubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__6178_msubj(_6178_msubj ? _6178_msubj->raw() : nullptr, _6178_msubj ? _6178_msubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__6179_mcof(_6179_mcof ? _6179_mcof->raw() : nullptr, _6179_mcof ? _6179_mcof->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(_6180_x->__mosek_2fusion_2Expression__getModel(),::mosek::fusion::p_ExprMulVar::resshape(_6175_mdimi,_6176_mdimj,_6180_x->getShape(),_6174_left));
    mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->left = _6174_left;
    mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->x = _6180_x;
    mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->mdimi = _6175_mdimi;
    mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->mdimj = _6176_mdimj;
    mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->msubi = ::mosek::fusion::Utils::Tools::arraycopy(_6177_msubi);
    mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->msubj = ::mosek::fusion::Utils::Tools::arraycopy(_6178_msubj);
    mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->mcof = ::mosek::fusion::Utils::Tools::arraycopy(_6179_mcof);
  }
}
// mosek.fusion.ExprMulVar.ctor

// Begin mosek.fusion.ExprMulVar.eval
// Method mosek.fusion.ExprMulVar.eval @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:705:6-710:7
void mosek::fusion::ExprMulVar :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6182_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6183_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6184_xs,bool _6185_cache_eval) { mosek::fusion::p_ExprMulVar::_get_impl(this)->eval(_6182_rs,_6183_ws,_6184_xs,_6185_cache_eval); }
void mosek::fusion::p_ExprMulVar::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6182_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6183_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6184_xs,bool _6185_cache_eval)
{
  if (left)
  {
    {
      _pubthis->eval_left(_6182_rs,_6183_ws,_6184_xs,_6185_cache_eval);
    }
  }
  else
  {
    {
      _pubthis->eval_right(_6182_rs,_6183_ws,_6184_xs,_6185_cache_eval);
    }
  }
}
// End mosek.fusion.ExprMulVar.eval

// Begin mosek.fusion.ExprMulVar.eval_right
// Method mosek.fusion.ExprMulVar.eval_right @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:411:6-702:7
void mosek::fusion::ExprMulVar :: eval_right(monty::rc_ptr< ::mosek::fusion::WorkStack > _6186_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6187_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6188_xs,bool _6189_cache_eval) { mosek::fusion::p_ExprMulVar::_get_impl(this)->eval_right(_6186_rs,_6187_ws,_6188_xs,_6189_cache_eval); }
void mosek::fusion::p_ExprMulVar::eval_right(monty::rc_ptr< ::mosek::fusion::WorkStack > _6186_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6187_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6188_xs,bool _6189_cache_eval)
{
  int32_t _6190_base_pi32 = mosek::fusion::p_WorkStack::_get_impl(_6187_ws)->pi32;
  int32_t _6191_base_pi64 = mosek::fusion::p_WorkStack::_get_impl(_6187_ws)->pi64;
  int32_t _6192_nx = x->numInst();
  int32_t _6193_nidxs = _6187_ws->alloci64(_6192_nx);
  int32_t _6194_sp = _6187_ws->alloci64(_6192_nx);
  int32_t _6195_xsubi = _6187_ws->alloci32(_6192_nx);
  int32_t _6196_xsubj = _6187_ws->alloci32(_6192_nx);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6197_xshape = x->getShape();
  _checked_ptr_1<int32_t> _ptr__6197_xshape(_6197_xshape ? _6197_xshape->raw() : nullptr,_6197_xshape ? _6197_xshape->size(0) : 0);
  int32_t _6198_nd = (int)((_6197_xshape)->size(0));
  int64_t _6199_x_total_size = safe_mul( _ptr__6197_xshape[(int)0],_ptr__6197_xshape[(int)1] );
  int32_t _6200_xdim1 = _ptr__6197_xshape[(int)1];
  int32_t _6201_xdim0 = _ptr__6197_xshape[(int)0];
  int32_t _6202_ptr = _6187_ws->alloci32(safe_add( _6201_xdim0,(int)1 ));
  int32_t _6203_numm = (int)((mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->msubi)->size(0));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6204_msubi = mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->msubi;
  _checked_ptr_1<int32_t> _ptr__6204_msubi(_6204_msubi ? _6204_msubi->raw() : nullptr,_6204_msubi ? _6204_msubi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6205_msubj = mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->msubj;
  _checked_ptr_1<int32_t> _ptr__6205_msubj(_6205_msubj ? _6205_msubj->raw() : nullptr,_6205_msubj ? _6205_msubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6206_mcof = mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->mcof;
  _checked_ptr_1<double> _ptr__6206_mcof(_6206_mcof ? _6206_mcof->raw() : nullptr,_6206_mcof ? _6206_mcof->size(0) : 0);
  int32_t _6207_mdim0 = mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->mdimi;
  int32_t _6208_mdim1 = mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->mdimj;
  bool _6209_m_is_dense = ((_6203_numm / _6207_mdim0) == _6208_mdim1);
  int32_t _6210_perm = _6187_ws->alloci32(_6203_numm);
  int32_t _6211_mptr = _6187_ws->alloci32(safe_add( mdimj,(int)1 ));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6212_wi32 = mosek::fusion::p_WorkStack::_get_impl(_6187_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__6212_wi32(_6212_wi32 ? _6212_wi32->raw() : nullptr,_6212_wi32 ? _6212_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6213_wi64 = mosek::fusion::p_WorkStack::_get_impl(_6187_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__6213_wi64(_6213_wi64 ? _6213_wi64->raw() : nullptr,_6213_wi64 ? _6213_wi64->size(0) : 0);
  int32_t _6214_nnz = (int)0;
  int32_t _6215_nelem = (int)0;
  x->inst(_6194_sp,_6213_wi64,_6193_nidxs,_6213_wi64);
  if (_6209_m_is_dense)
  {
    {
      int32_t _6216_x_num_nonempty_rows = (int)0;
      if ((_6192_nx > (int)0))
      {
        {
          _6216_x_num_nonempty_rows = (int)1;
          if ((_6201_xdim0 > (int)1))
          {
            {
              if ((_6200_xdim1 == (int)1))
              {
                {
                  int32_t _12028_ = (int)1;
                  int32_t _12029_ = _6192_nx;
                  for (int32_t _6217_i = _12028_; _6217_i < _12029_; ++_6217_i)
                  {
                    {
                      if ((_ptr__6213_wi64[safe_add( _6194_sp,_6217_i )] > _ptr__6213_wi64[(safe_add( _6194_sp,_6217_i ) - (int)1)]))
                      {
                        {
                          ++ _6216_x_num_nonempty_rows;
                        }
                      }
                      {}
                    }
                  }
                }
              }
              else
              {
                {
                  int32_t _12030_ = (int)1;
                  int32_t _12031_ = _6192_nx;
                  for (int32_t _6218_i = _12030_; _6218_i < _12031_; ++_6218_i)
                  {
                    {
                      if (((_ptr__6213_wi64[safe_add( _6194_sp,_6218_i )] / _6200_xdim1) > (_ptr__6213_wi64[(safe_add( _6194_sp,_6218_i ) - (int)1)] / _6200_xdim1)))
                      {
                        {
                          ++ _6216_x_num_nonempty_rows;
                        }
                      }
                      {}
                    }
                  }
                }
              }
            }
          }
          {}
        }
      }
      {}
      _6215_nelem = safe_mul( _6216_x_num_nonempty_rows,_6208_mdim1 );
      _6214_nnz = safe_mul( _6192_nx,_6208_mdim1 );
      bool _6219_hassp = (_6216_x_num_nonempty_rows < _6201_xdim0);
      _6186_rs->alloc_expr((int)2,_6215_nelem,_6214_nnz,_6219_hassp);
      int32_t _6220_rptr = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->ptr_base;
      int32_t _6221_rshape = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->shape_base;
      int32_t _6222_rnidx = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->nidxs_base;
      int32_t _12032_;
      bool _12033_ = _6219_hassp;
      if (_12033_)
      {
        _12032_ = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->sp_base;
      }
      else
      {
        _12032_ = _6186_rs->alloci64(_6215_nelem);
      }
      int32_t _6223_rsp = _12032_;
      int32_t _6224_rcof = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->cof_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _6225_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__6225_ri32(_6225_ri32 ? _6225_ri32->raw() : nullptr,_6225_ri32 ? _6225_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _6226_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__6226_ri64(_6226_ri64 ? _6226_ri64->raw() : nullptr,_6226_ri64 ? _6226_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _6227_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->f64;
      _checked_ptr_1<double> _ptr__6227_rf64(_6227_rf64 ? _6227_rf64->raw() : nullptr,_6227_rf64 ? _6227_rf64->size(0) : 0);
      _ptr__6225_ri32[_6221_rshape] = _6201_xdim0;
      _ptr__6225_ri32[safe_add( _6221_rshape,(int)1 )] = _6208_mdim1;
      {
        int32_t _6228_p = (int)0;
        int32_t _6229_relm = (int)0;
        int32_t _6230_rnz = (int)0;
        _ptr__6225_ri32[_6220_rptr] = (int)0;
        while ( (_6228_p < _6192_nx) )
        {
          {
            int32_t _6231_p0 = _6228_p;
            ++ _6228_p;
            while ( ((_6228_p < _6192_nx) && ((_ptr__6213_wi64[safe_add( _6194_sp,_6228_p )] / _6200_xdim1) == (_ptr__6213_wi64[safe_add( _6194_sp,_6231_p0 )] / _6200_xdim1))) )
            {
              {
                ++ _6228_p;
              }
            }
            int64_t _6232_i = (_ptr__6213_wi64[safe_add( _6194_sp,_6231_p0 )] / _6200_xdim1);
            int32_t _12034_ = (int)0;
            int32_t _12035_ = _6208_mdim1;
            for (int32_t _6233_j = _12034_; _6233_j < _12035_; ++_6233_j)
            {
              {
                int32_t _12036_ = _6231_p0;
                int32_t _12037_ = _6228_p;
                for (int32_t _6234_k = _12036_; _6234_k < _12037_; ++_6234_k)
                {
                  {
                    int64_t _6235_jj = (_ptr__6213_wi64[safe_add( _6194_sp,_6234_k )] % _6200_xdim1);
                    _ptr__6226_ri64[safe_add( _6222_rnidx,_6230_rnz )] = _ptr__6213_wi64[safe_add( _6193_nidxs,_6234_k )];
                    _ptr__6227_rf64[safe_add( _6224_rcof,_6230_rnz )] = _ptr__6206_mcof[safe_add( safe_mul( _6235_jj,_6208_mdim1 ),_6233_j )];
                    ++ _6230_rnz;
                  }
                }
                _ptr__6225_ri32[safe_add( safe_add( _6220_rptr,_6229_relm ),(int)1 )] = _6230_rnz;
                _ptr__6226_ri64[safe_add( _6223_rsp,_6229_relm )] = safe_add( safe_mul( _6232_i,_6208_mdim1 ),_6233_j );
                ++ _6229_relm;
              }
            }
          }
        }
      }
      if ((!_6219_hassp))
      {
        {
          _6186_rs->popi64(_6215_nelem);
        }
      }
      {}
    }
  }
  else
  {
    {
      {
        if ((_6208_mdim1 == (int)1))
        {
          {
            int32_t _12038_ = (int)0;
            int32_t _12039_ = _6203_numm;
            for (int32_t _6236_i = _12038_; _6236_i < _12039_; ++_6236_i)
            {
              {
                _ptr__6212_wi32[safe_add( _6210_perm,_6236_i )] = _6236_i;
              }
            }
            _ptr__6212_wi32[_6211_mptr] = (int)0;
            _ptr__6212_wi32[safe_add( _6211_mptr,(int)1 )] = _6203_numm;
          }
        }
        else
        {
          {
            _ptr__6212_wi32[_6211_mptr] = (int)0;
            int32_t _12040_ = (int)0;
            int32_t _12041_ = safe_add( _6208_mdim1,(int)1 );
            for (int32_t _6237_i = _12040_; _6237_i < _12041_; ++_6237_i)
            {
              {
                _ptr__6212_wi32[safe_add( _6211_mptr,_6237_i )] = (int)0;
              }
            }
            int32_t _12042_ = (int)0;
            int32_t _12043_ = _6203_numm;
            for (int32_t _6238_i = _12042_; _6238_i < _12043_; ++_6238_i)
            {
              {
                ++ _ptr__6212_wi32[safe_add( safe_add( _6211_mptr,_ptr__6205_msubj[_6238_i] ),(int)1 )];
              }
            }
            int32_t _12044_ = (int)0;
            int32_t _12045_ = mdimj;
            for (int32_t _6239_i = _12044_; _6239_i < _12045_; ++_6239_i)
            {
              {
                _ptr__6212_wi32[safe_add( safe_add( _6211_mptr,_6239_i ),(int)1 )] += _ptr__6212_wi32[safe_add( _6211_mptr,_6239_i )];
              }
            }
            int32_t _12046_ = (int)0;
            int32_t _12047_ = _6203_numm;
            for (int32_t _6240_i = _12046_; _6240_i < _12047_; ++_6240_i)
            {
              {
                _ptr__6212_wi32[safe_add( _6210_perm,_ptr__6212_wi32[safe_add( _6211_mptr,_ptr__6205_msubj[_6240_i] )] )] = _6240_i;
                ++ _ptr__6212_wi32[safe_add( _6211_mptr,_ptr__6205_msubj[_6240_i] )];
              }
            }
            int32_t _12048_ = (int)0;
            int32_t _12049_ = _6208_mdim1;
            for (int32_t _6241_i = _12048_; _6241_i < _12049_; ++_6241_i)
            {
              {
                _ptr__6212_wi32[(safe_add( _6211_mptr,_6208_mdim1 ) - _6241_i)] = _ptr__6212_wi32[((safe_add( _6211_mptr,_6208_mdim1 ) - _6241_i) - (int)1)];
              }
            }
            _ptr__6212_wi32[_6211_mptr] = (int)0;
          }
        }
      }
      if (((_6192_nx / _6201_xdim0) == _6200_xdim1))
      {
        {
          int32_t _6242_num_nz_cols = (int)0;
          {
            int32_t _6243_p = (int)0;
            while ( (_6243_p < _6203_numm) )
            {
              {
                ++ _6243_p;
                while ( ((_6243_p < _6203_numm) && (_ptr__6205_msubj[_ptr__6212_wi32[(safe_add( _6210_perm,_6243_p ) - (int)1)]] == _ptr__6205_msubj[_ptr__6212_wi32[safe_add( _6210_perm,_6243_p )]])) )
                {
                  {
                    ++ _6243_p;
                  }
                }
                ++ _6242_num_nz_cols;
              }
            }
          }
          _6215_nelem = safe_mul( _6242_num_nz_cols,_6201_xdim0 );
          _6214_nnz = safe_mul( _6203_numm,_6201_xdim0 );
          bool _6244_rhassp = (_6242_num_nz_cols < _6208_mdim1);
          _6186_rs->alloc_expr((int)2,_6215_nelem,_6214_nnz,_6244_rhassp);
          int32_t _6245_rptr = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->ptr_base;
          int32_t _6246_rshape = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->shape_base;
          int32_t _6247_rnidx = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->nidxs_base;
          int32_t _12050_;
          bool _12051_ = _6244_rhassp;
          if (_12051_)
          {
            _12050_ = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->sp_base;
          }
          else
          {
            _12050_ = _6186_rs->alloci64(_6215_nelem);
          }
          int32_t _6248_rsp = _12050_;
          int32_t _6249_rcof = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->cof_base;
          ((*mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->i32)(_6246_rshape)) = _6201_xdim0;
          ((*mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->i32)(safe_add( _6246_rshape,(int)1 ))) = _6208_mdim1;
          std::shared_ptr< monty::ndarray< int32_t,1 > > _6250_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->i32;
          _checked_ptr_1<int32_t> _ptr__6250_ri32(_6250_ri32 ? _6250_ri32->raw() : nullptr,_6250_ri32 ? _6250_ri32->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _6251_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->i64;
          _checked_ptr_1<int64_t> _ptr__6251_ri64(_6251_ri64 ? _6251_ri64->raw() : nullptr,_6251_ri64 ? _6251_ri64->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _6252_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->f64;
          _checked_ptr_1<double> _ptr__6252_rf64(_6252_rf64 ? _6252_rf64->raw() : nullptr,_6252_rf64 ? _6252_rf64->size(0) : 0);
          _ptr__6250_ri32[_6245_rptr] = (int)0;
          int32_t _6253_kelm = (int)0;
          int32_t _6254_knz = (int)0;
          int32_t _12052_ = (int)0;
          int32_t _12053_ = _6201_xdim0;
          for (int32_t _6255_i = _12052_; _6255_i < _12053_; ++_6255_i)
          {
            {
              int32_t _6256_p = (int)0;
              while ( (_6256_p < _6203_numm) )
              {
                {
                  int32_t _6257_p0 = _6256_p;
                  ++ _6256_p;
                  while ( ((_6256_p < _6203_numm) && (_ptr__6205_msubj[_ptr__6212_wi32[safe_add( _6210_perm,_6257_p0 )]] == _ptr__6205_msubj[_ptr__6212_wi32[safe_add( _6210_perm,_6256_p )]])) )
                  {
                    {
                      ++ _6256_p;
                    }
                  }
                  int32_t _6258_j = _ptr__6205_msubj[_ptr__6212_wi32[safe_add( _6210_perm,_6257_p0 )]];
                  int32_t _12054_ = _6257_p0;
                  int32_t _12055_ = _6256_p;
                  for (int32_t _6259_k = _12054_; _6259_k < _12055_; ++_6259_k)
                  {
                    {
                      int32_t _6260_ii = _ptr__6204_msubi[_ptr__6212_wi32[safe_add( _6210_perm,_6259_k )]];
                      _ptr__6251_ri64[safe_add( _6247_rnidx,_6254_knz )] = _ptr__6213_wi64[safe_add( safe_add( _6193_nidxs,safe_mul( _6255_i,_6200_xdim1 ) ),_6260_ii )];
                      _ptr__6252_rf64[safe_add( _6249_rcof,_6254_knz )] = _ptr__6206_mcof[_ptr__6212_wi32[safe_add( _6210_perm,_6259_k )]];
                      ++ _6254_knz;
                    }
                  }
                  _ptr__6251_ri64[safe_add( _6248_rsp,_6253_kelm )] = safe_add( safe_mul( _6255_i,_6208_mdim1 ),_6258_j );
                  _ptr__6250_ri32[safe_add( safe_add( _6245_rptr,_6253_kelm ),(int)1 )] = _6254_knz;
                  ++ _6253_kelm;
                }
              }
            }
          }
          if ((!_6244_rhassp))
          {
            {
              _6186_rs->popi64(_6215_nelem);
            }
          }
          {}
        }
      }
      else
      {
        {
          int32_t _12056_ = (int)0;
          int32_t _12057_ = safe_add( _6201_xdim0,(int)1 );
          for (int32_t _6261_i = _12056_; _6261_i < _12057_; ++_6261_i)
          {
            {
              _ptr__6212_wi32[safe_add( _6202_ptr,_6261_i )] = (int)0;
            }
          }
          if ((_6198_nd == (int)1))
          {
            {
              int32_t _12058_ = (int)0;
              int32_t _12059_ = _6192_nx;
              for (int32_t _6262_i = _12058_; _6262_i < _12059_; ++_6262_i)
              {
                {
                  _ptr__6212_wi32[safe_add( _6195_xsubi,_6262_i )] = (int)0;
                }
              }
              int32_t _12060_ = (int)0;
              int32_t _12061_ = _6192_nx;
              for (int32_t _6263_i = _12060_; _6263_i < _12061_; ++_6263_i)
              {
                {
                  _ptr__6212_wi32[safe_add( _6196_xsubj,_6263_i )] = (int32_t)_ptr__6213_wi64[safe_add( _6194_sp,_6263_i )];
                }
              }
              _ptr__6212_wi32[_6202_ptr] = (int)0;
              _ptr__6212_wi32[safe_add( _6202_ptr,(int)1 )] = _6192_nx;
            }
          }
          else
          {
            {
              int32_t _12062_ = (int)0;
              int32_t _12063_ = _6192_nx;
              for (int32_t _6264_i = _12062_; _6264_i < _12063_; ++_6264_i)
              {
                {
                  _ptr__6212_wi32[safe_add( _6195_xsubi,_6264_i )] = (int32_t)(_ptr__6213_wi64[safe_add( _6194_sp,_6264_i )] / _ptr__6197_xshape[(int)1]);
                }
              }
              int32_t _12064_ = (int)0;
              int32_t _12065_ = _6192_nx;
              for (int32_t _6265_i = _12064_; _6265_i < _12065_; ++_6265_i)
              {
                {
                  _ptr__6212_wi32[safe_add( _6196_xsubj,_6265_i )] = (int32_t)(_ptr__6213_wi64[safe_add( _6194_sp,_6265_i )] % _ptr__6197_xshape[(int)1]);
                }
              }
              _ptr__6212_wi32[_6202_ptr] = (int)0;
              int32_t _12066_ = (int)0;
              int32_t _12067_ = _6192_nx;
              for (int32_t _6266_i = _12066_; _6266_i < _12067_; ++_6266_i)
              {
                {
                  ++ _ptr__6212_wi32[safe_add( safe_add( _6202_ptr,_ptr__6212_wi32[safe_add( _6195_xsubi,_6266_i )] ),(int)1 )];
                }
              }
              int32_t _12068_ = (int)0;
              int32_t _12069_ = _6201_xdim0;
              for (int32_t _6267_i = _12068_; _6267_i < _12069_; ++_6267_i)
              {
                {
                  _ptr__6212_wi32[safe_add( safe_add( _6202_ptr,_6267_i ),(int)1 )] += _ptr__6212_wi32[safe_add( _6202_ptr,_6267_i )];
                }
              }
            }
          }
          int32_t _12070_ = (int)0;
          int32_t _12071_ = _6201_xdim0;
          for (int32_t _6268_i = _12070_; _6268_i < _12071_; ++_6268_i)
          {
            {
              int32_t _12072_ = (int)0;
              int32_t _12073_ = mdimj;
              for (int32_t _6269_j = _12072_; _6269_j < _12073_; ++_6269_j)
              {
                {
                  int32_t _6270_nz = (int)0;
                  int32_t _6271_e1 = _ptr__6212_wi32[safe_add( safe_add( _6202_ptr,_6268_i ),(int)1 )];
                  int32_t _6272_e0 = _ptr__6212_wi32[safe_add( safe_add( _6211_mptr,_6269_j ),(int)1 )];
                  int32_t _6273_i1 = _ptr__6212_wi32[safe_add( _6202_ptr,_6268_i )];
                  int32_t _6274_i0 = _ptr__6212_wi32[safe_add( _6211_mptr,_6269_j )];
                  while ( ((_6274_i0 < _6272_e0) && (_6273_i1 < _6271_e1)) )
                  {
                    {
                      if ((_ptr__6204_msubi[_ptr__6212_wi32[safe_add( _6210_perm,_6274_i0 )]] < _ptr__6212_wi32[safe_add( _6196_xsubj,_6273_i1 )]))
                      {
                        {
                          ++ _6274_i0;
                        }
                      }
                      else if((_ptr__6204_msubi[_ptr__6212_wi32[safe_add( _6210_perm,_6274_i0 )]] > _ptr__6212_wi32[safe_add( _6196_xsubj,_6273_i1 )]))
                      {
                        {
                          ++ _6273_i1;
                        }
                      }
                      else
                      {
                        {
                          ++ _6270_nz;
                          ++ _6274_i0;
                          ++ _6273_i1;
                        }
                      }
                    }
                  }
                  if ((_6270_nz > (int)0))
                  {
                    {
                      _6214_nnz += _6270_nz;
                      ++ _6215_nelem;
                    }
                  }
                  {}
                }
              }
            }
          }
          bool _6275_rhassp = (_6215_nelem < safe_mul( _6200_xdim1,mdimi ));
          _6186_rs->alloc_expr((int)2,_6215_nelem,_6214_nnz,_6275_rhassp);
          int32_t _6276_rptr = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->ptr_base;
          int32_t _6277_rshape = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->shape_base;
          int32_t _6278_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->nidxs_base;
          int32_t _6279_rsp = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->sp_base;
          int32_t _6280_rcof = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->cof_base;
          ((*mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->i32)(_6277_rshape)) = _6201_xdim0;
          ((*mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->i32)(safe_add( _6277_rshape,(int)1 ))) = mdimj;
          std::shared_ptr< monty::ndarray< int32_t,1 > > _6281_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->i32;
          _checked_ptr_1<int32_t> _ptr__6281_ri32(_6281_ri32 ? _6281_ri32->raw() : nullptr,_6281_ri32 ? _6281_ri32->size(0) : 0);
          std::shared_ptr< monty::ndarray< int64_t,1 > > _6282_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->i64;
          _checked_ptr_1<int64_t> _ptr__6282_ri64(_6282_ri64 ? _6282_ri64->raw() : nullptr,_6282_ri64 ? _6282_ri64->size(0) : 0);
          std::shared_ptr< monty::ndarray< double,1 > > _6283_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6186_rs)->f64;
          _checked_ptr_1<double> _ptr__6283_rf64(_6283_rf64 ? _6283_rf64->raw() : nullptr,_6283_rf64 ? _6283_rf64->size(0) : 0);
          {
            int32_t _6284_pi = (int)0;
            int32_t _6285_pe = (int)0;
            int32_t _6286_p = (int)0;
            _ptr__6281_ri32[_6276_rptr] = (int)0;
            int32_t _12074_ = (int)0;
            int32_t _12075_ = _6201_xdim0;
            for (int32_t _6287_i = _12074_; _6287_i < _12075_; ++_6287_i)
            {
              {
                int32_t _12076_ = (int)0;
                int32_t _12077_ = mdimj;
                for (int32_t _6288_j = _12076_; _6288_j < _12077_; ++_6288_j)
                {
                  {
                    int32_t _6289_nz = (int)0;
                    int32_t _6290_e1 = _ptr__6212_wi32[safe_add( safe_add( _6202_ptr,_6287_i ),(int)1 )];
                    int32_t _6291_e0 = _ptr__6212_wi32[safe_add( safe_add( _6211_mptr,_6288_j ),(int)1 )];
                    int32_t _6292_i1 = _ptr__6212_wi32[safe_add( _6202_ptr,_6287_i )];
                    int32_t _6293_i0 = _ptr__6212_wi32[safe_add( _6211_mptr,_6288_j )];
                    while ( ((_6293_i0 < _6291_e0) && (_6292_i1 < _6290_e1)) )
                    {
                      {
                        if ((_ptr__6204_msubi[_ptr__6212_wi32[safe_add( _6210_perm,_6293_i0 )]] < _ptr__6212_wi32[safe_add( _6196_xsubj,_6292_i1 )]))
                        {
                          {
                            ++ _6293_i0;
                          }
                        }
                        else if((_ptr__6204_msubi[_ptr__6212_wi32[safe_add( _6210_perm,_6293_i0 )]] > _ptr__6212_wi32[safe_add( _6196_xsubj,_6292_i1 )]))
                        {
                          {
                            ++ _6292_i1;
                          }
                        }
                        else
                        {
                          {
                            _ptr__6282_ri64[safe_add( _6278_rnidxs,_6286_p )] = _ptr__6213_wi64[safe_add( _6193_nidxs,_6292_i1 )];
                            _ptr__6283_rf64[safe_add( _6280_rcof,_6286_p )] = _ptr__6206_mcof[_ptr__6212_wi32[safe_add( _6210_perm,_6293_i0 )]];
                            ++ _6289_nz;
                            ++ _6286_p;
                            ++ _6293_i0;
                            ++ _6292_i1;
                          }
                        }
                      }
                    }
                    if ((_6289_nz > (int)0))
                    {
                      {
                        _ptr__6281_ri32[safe_add( safe_add( _6276_rptr,_6285_pe ),(int)1 )] = _6286_p;
                        if (_6275_rhassp)
                        {
                          {
                            _ptr__6282_ri64[safe_add( _6279_rsp,_6285_pe )] = _6284_pi;
                          }
                        }
                        {}
                        ++ _6285_pe;
                      }
                    }
                    {}
                    ++ _6284_pi;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  mosek::fusion::p_WorkStack::_get_impl(_6187_ws)->pi32 = _6190_base_pi32;
  mosek::fusion::p_WorkStack::_get_impl(_6187_ws)->pi64 = _6191_base_pi64;
}
// End mosek.fusion.ExprMulVar.eval_right

// Begin mosek.fusion.ExprMulVar.eval_left
// Method mosek.fusion.ExprMulVar.eval_left @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:230:6-409:7
void mosek::fusion::ExprMulVar :: eval_left(monty::rc_ptr< ::mosek::fusion::WorkStack > _6294_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6295_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6296_xs,bool _6297_cache_eval) { mosek::fusion::p_ExprMulVar::_get_impl(this)->eval_left(_6294_rs,_6295_ws,_6296_xs,_6297_cache_eval); }
void mosek::fusion::p_ExprMulVar::eval_left(monty::rc_ptr< ::mosek::fusion::WorkStack > _6294_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6295_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6296_xs,bool _6297_cache_eval)
{
  int32_t _6298_nx = x->numInst();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6299_xshape = x->getShape();
  _checked_ptr_1<int32_t> _ptr__6299_xshape(_6299_xshape ? _6299_xshape->raw() : nullptr,_6299_xshape ? _6299_xshape->size(0) : 0);
  int32_t _6300_nd = (int)((_6299_xshape)->size(0));
  int32_t _6301_nidxs = _6296_xs->alloci64(_6298_nx);
  int32_t _6302_sp = _6296_xs->alloci64(_6298_nx);
  int32_t _6303_xsubi = _6296_xs->alloci32(_6298_nx);
  int32_t _6304_xsubj = _6296_xs->alloci32(_6298_nx);
  int32_t _6305_perm = _6296_xs->alloci32(_6298_nx);
  int32_t _6306_mptr = _6296_xs->alloci32(safe_add( mdimi,(int)1 ));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6307_xshape = x->getShape();
  _checked_ptr_1<int32_t> _ptr__6307_xshape(_6307_xshape ? _6307_xshape->raw() : nullptr,_6307_xshape ? _6307_xshape->size(0) : 0);
  int32_t _6308_nd = (int)((_6307_xshape)->size(0));
  int32_t _12078_;
  bool _12079_ = (_6308_nd == (int)1);
  if (_12079_)
  {
    _12078_ = (int)1;
  }
  else
  {
    _12078_ = _ptr__6307_xshape[(int)1];
  }
  int32_t _6309_xdim1 = _12078_;
  int32_t _6310_xdim0 = _ptr__6307_xshape[(int)0];
  int32_t _6311_ptr = _6296_xs->alloci32(safe_add( _6309_xdim1,(int)1 ));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6312_msubi = mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->msubi;
  _checked_ptr_1<int32_t> _ptr__6312_msubi(_6312_msubi ? _6312_msubi->raw() : nullptr,_6312_msubi ? _6312_msubi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6313_msubj = mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->msubj;
  _checked_ptr_1<int32_t> _ptr__6313_msubj(_6313_msubj ? _6313_msubj->raw() : nullptr,_6313_msubj ? _6313_msubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6314_mcof = mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->mcof;
  _checked_ptr_1<double> _ptr__6314_mcof(_6314_mcof ? _6314_mcof->raw() : nullptr,_6314_mcof ? _6314_mcof->size(0) : 0);
  int32_t _6315_mdimi = mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->mdimi;
  int32_t _6316_mdimj = mosek::fusion::p_ExprMulVar::_get_impl(::mosek::fusion::ExprMulVar::t(_pubthis))->mdimj;
  int32_t _6317_rnnz = (int)0;
  int32_t _6318_rnelem = (int)0;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6319_xi32 = mosek::fusion::p_WorkStack::_get_impl(_6296_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__6319_xi32(_6319_xi32 ? _6319_xi32->raw() : nullptr,_6319_xi32 ? _6319_xi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6320_xi64 = mosek::fusion::p_WorkStack::_get_impl(_6296_xs)->i64;
  _checked_ptr_1<int64_t> _ptr__6320_xi64(_6320_xi64 ? _6320_xi64->raw() : nullptr,_6320_xi64 ? _6320_xi64->size(0) : 0);
  int32_t _6321_mnnz = (int)((_6314_mcof)->size(0));
  x->inst(_6302_sp,_6320_xi64,_6301_nidxs,_6320_xi64);
  if ((x->numInst() < x->getSize()))
  {
    {
      {
        int32_t _12080_ = (int)0;
        int32_t _12081_ = safe_add( _6315_mdimi,(int)1 );
        for (int32_t _6322_i = _12080_; _6322_i < _12081_; ++_6322_i)
        {
          {
            _ptr__6319_xi32[safe_add( _6306_mptr,_6322_i )] = (int)0;
          }
        }
        int32_t _12082_ = (int)0;
        int32_t _12083_ = (int)((_6312_msubi)->size(0));
        for (int32_t _6323_i = _12082_; _6323_i < _12083_; ++_6323_i)
        {
          {
            ++ _ptr__6319_xi32[safe_add( safe_add( _6306_mptr,_ptr__6312_msubi[_6323_i] ),(int)1 )];
          }
        }
        int32_t _12084_ = (int)0;
        int32_t _12085_ = _6315_mdimi;
        for (int32_t _6324_i = _12084_; _6324_i < _12085_; ++_6324_i)
        {
          {
            _ptr__6319_xi32[safe_add( safe_add( _6306_mptr,_6324_i ),(int)1 )] += _ptr__6319_xi32[safe_add( _6306_mptr,_6324_i )];
          }
        }
        if ((_6308_nd == (int)1))
        {
          {
            int32_t _12086_ = (int)0;
            int32_t _12087_ = _6298_nx;
            for (int32_t _6325_i = _12086_; _6325_i < _12087_; ++_6325_i)
            {
              {
                _ptr__6319_xi32[safe_add( _6303_xsubi,_6325_i )] = (int32_t)_ptr__6320_xi64[safe_add( _6302_sp,_6325_i )];
              }
            }
            int32_t _12088_ = (int)0;
            int32_t _12089_ = _6298_nx;
            for (int32_t _6326_i = _12088_; _6326_i < _12089_; ++_6326_i)
            {
              {
                _ptr__6319_xi32[safe_add( _6304_xsubj,_6326_i )] = (int)0;
              }
            }
          }
        }
        else
        {
          {
            int32_t _12090_ = (int)0;
            int32_t _12091_ = _6298_nx;
            for (int32_t _6327_i = _12090_; _6327_i < _12091_; ++_6327_i)
            {
              {
                _ptr__6319_xi32[safe_add( _6303_xsubi,_6327_i )] = (int32_t)(_ptr__6320_xi64[safe_add( _6302_sp,_6327_i )] / _6309_xdim1);
              }
            }
            int32_t _12092_ = (int)0;
            int32_t _12093_ = _6298_nx;
            for (int32_t _6328_i = _12092_; _6328_i < _12093_; ++_6328_i)
            {
              {
                _ptr__6319_xi32[safe_add( _6304_xsubj,_6328_i )] = (int32_t)(_ptr__6320_xi64[safe_add( _6302_sp,_6328_i )] % _6309_xdim1);
              }
            }
          }
        }
        if ((_6308_nd > (int)1))
        {
          {
            int32_t _12094_ = (int)0;
            int32_t _12095_ = safe_add( _6309_xdim1,(int)1 );
            for (int32_t _6329_i = _12094_; _6329_i < _12095_; ++_6329_i)
            {
              {
                _ptr__6319_xi32[safe_add( _6311_ptr,_6329_i )] = (int)0;
              }
            }
            int32_t _12096_ = (int)0;
            int32_t _12097_ = _6298_nx;
            for (int32_t _6330_i = _12096_; _6330_i < _12097_; ++_6330_i)
            {
              {
                ++ _ptr__6319_xi32[safe_add( safe_add( _6311_ptr,_ptr__6319_xi32[safe_add( _6304_xsubj,_6330_i )] ),(int)1 )];
              }
            }
            int32_t _12098_ = (int)0;
            int32_t _12099_ = _6309_xdim1;
            for (int32_t _6331_i = _12098_; _6331_i < _12099_; ++_6331_i)
            {
              {
                _ptr__6319_xi32[safe_add( safe_add( _6311_ptr,_6331_i ),(int)1 )] += _ptr__6319_xi32[safe_add( _6311_ptr,_6331_i )];
              }
            }
            int32_t _12100_ = (int)0;
            int32_t _12101_ = _6298_nx;
            for (int32_t _6332_i = _12100_; _6332_i < _12101_; ++_6332_i)
            {
              {
                _ptr__6319_xi32[safe_add( _6305_perm,_ptr__6319_xi32[safe_add( _6311_ptr,_ptr__6319_xi32[safe_add( _6304_xsubj,_6332_i )] )] )] = _6332_i;
                ++ _ptr__6319_xi32[safe_add( _6311_ptr,_ptr__6319_xi32[safe_add( _6304_xsubj,_6332_i )] )];
              }
            }
            int32_t _12102_ = (int)0;
            int32_t _12103_ = _6309_xdim1;
            for (int32_t _6333_i = _12102_; _6333_i < _12103_; ++_6333_i)
            {
              {
                _ptr__6319_xi32[(safe_add( _6311_ptr,_6309_xdim1 ) - _6333_i)] = _ptr__6319_xi32[((safe_add( _6311_ptr,_6309_xdim1 ) - _6333_i) - (int)1)];
              }
            }
            _ptr__6319_xi32[_6311_ptr] = (int)0;
          }
        }
        else
        {
          {
            _ptr__6319_xi32[_6311_ptr] = (int)0;
            _ptr__6319_xi32[safe_add( _6311_ptr,(int)1 )] = _6298_nx;
            int32_t _12104_ = (int)0;
            int32_t _12105_ = _6298_nx;
            for (int32_t _6334_i = _12104_; _6334_i < _12105_; ++_6334_i)
            {
              {
                _ptr__6319_xi32[safe_add( _6305_perm,_6334_i )] = _6334_i;
              }
            }
          }
        }
        int32_t _12106_ = (int)0;
        int32_t _12107_ = _6315_mdimi;
        for (int32_t _6335_i = _12106_; _6335_i < _12107_; ++_6335_i)
        {
          {
            int32_t _12108_ = (int)0;
            int32_t _12109_ = _6309_xdim1;
            for (int32_t _6336_j = _12108_; _6336_j < _12109_; ++_6336_j)
            {
              {
                int32_t _6337_nz = (int)0;
                int32_t _6338_e1 = _ptr__6319_xi32[safe_add( safe_add( _6311_ptr,_6336_j ),(int)1 )];
                int32_t _6339_e0 = _ptr__6319_xi32[safe_add( safe_add( _6306_mptr,_6335_i ),(int)1 )];
                int32_t _6340_i1 = _ptr__6319_xi32[safe_add( _6311_ptr,_6336_j )];
                int32_t _6341_i0 = _ptr__6319_xi32[safe_add( _6306_mptr,_6335_i )];
                while ( ((_6341_i0 < _6339_e0) && (_6340_i1 < _6338_e1)) )
                {
                  {
                    if ((_ptr__6313_msubj[_6341_i0] < _ptr__6319_xi32[safe_add( _6303_xsubi,_ptr__6319_xi32[safe_add( _6305_perm,_6340_i1 )] )]))
                    {
                      {
                        ++ _6341_i0;
                      }
                    }
                    else if((_ptr__6313_msubj[_6341_i0] > _ptr__6319_xi32[safe_add( _6303_xsubi,_ptr__6319_xi32[safe_add( _6305_perm,_6340_i1 )] )]))
                    {
                      {
                        ++ _6340_i1;
                      }
                    }
                    else
                    {
                      {
                        ++ _6337_nz;
                        ++ _6341_i0;
                        ++ _6340_i1;
                      }
                    }
                  }
                }
                if ((_6337_nz > (int)0))
                {
                  {
                    _6317_rnnz += _6337_nz;
                    ++ _6318_rnelem;
                  }
                }
                {}
              }
            }
          }
        }
      }
    }
  }
  else
  {
    {
      _6317_rnnz = safe_mul( _6321_mnnz,_6309_xdim1 );
      int32_t _6342_i0 = (int)0;
      while ( (_6342_i0 < _6321_mnnz) )
      {
        {
          int32_t _6343_e0 = safe_add( _6342_i0,(int)1 );
          while ( ((_6343_e0 < _6321_mnnz) && (_ptr__6312_msubi[_6342_i0] == _ptr__6312_msubi[_6343_e0])) )
          {
            {
              ++ _6343_e0;
            }
          }
          ++ _6318_rnelem;
          _6342_i0 = _6343_e0;
        }
      }
      _6318_rnelem *= _6309_xdim1;
    }
  }
  bool _12110_;
  bool _12111_ = (_6318_rnelem < safe_mul( _6309_xdim1,_6315_mdimi ));
  if (_12111_)
  {
    _12110_ = true;
  }
  else
  {
    _12110_ = false;
  }
  bool _6344_rhassp = _12110_;
  int32_t _6345_rnd = _6308_nd;
  _6294_rs->alloc_expr(_6345_rnd,_6318_rnelem,_6317_rnnz,_6344_rhassp);
  int32_t _6346_rptr = mosek::fusion::p_WorkStack::_get_impl(_6294_rs)->ptr_base;
  int32_t _6347_rshape = mosek::fusion::p_WorkStack::_get_impl(_6294_rs)->shape_base;
  int32_t _6348_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_6294_rs)->nidxs_base;
  int32_t _12112_;
  bool _12113_ = _6344_rhassp;
  if (_12113_)
  {
    _12112_ = mosek::fusion::p_WorkStack::_get_impl(_6294_rs)->sp_base;
  }
  else
  {
    _12112_ = _6294_rs->alloci64(_6318_rnelem);
  }
  int32_t _6349_rsp = _12112_;
  int32_t _6350_rcof = mosek::fusion::p_WorkStack::_get_impl(_6294_rs)->cof_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6351_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6294_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__6351_ri32(_6351_ri32 ? _6351_ri32->raw() : nullptr,_6351_ri32 ? _6351_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6352_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6294_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__6352_ri64(_6352_ri64 ? _6352_ri64->raw() : nullptr,_6352_ri64 ? _6352_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6353_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6294_rs)->f64;
  _checked_ptr_1<double> _ptr__6353_rf64(_6353_rf64 ? _6353_rf64->raw() : nullptr,_6353_rf64 ? _6353_rf64->size(0) : 0);
  _ptr__6351_ri32[_6347_rshape] = _6315_mdimi;
  if ((_6308_nd > (int)1))
  {
    {
      _ptr__6351_ri32[safe_add( _6347_rshape,(int)1 )] = _6309_xdim1;
    }
  }
  {}
  if ((x->numInst() < x->getSize()))
  {
    {
      int32_t _6354_pi = (int)0;
      int32_t _6355_pe = (int)0;
      int32_t _6356_p = (int)0;
      _ptr__6351_ri32[_6346_rptr] = (int)0;
      int32_t _12114_ = (int)0;
      int32_t _12115_ = _6315_mdimi;
      for (int32_t _6357_i = _12114_; _6357_i < _12115_; ++_6357_i)
      {
        {
          int32_t _12116_ = (int)0;
          int32_t _12117_ = _6309_xdim1;
          for (int32_t _6358_j = _12116_; _6358_j < _12117_; ++_6358_j)
          {
            {
              int32_t _6359_nz = (int)0;
              int32_t _6360_e1 = _ptr__6319_xi32[safe_add( safe_add( _6311_ptr,_6358_j ),(int)1 )];
              int32_t _6361_e0 = _ptr__6319_xi32[safe_add( safe_add( _6306_mptr,_6357_i ),(int)1 )];
              int32_t _6362_i1 = _ptr__6319_xi32[safe_add( _6311_ptr,_6358_j )];
              int32_t _6363_i0 = _ptr__6319_xi32[safe_add( _6306_mptr,_6357_i )];
              while ( ((_6363_i0 < _6361_e0) && (_6362_i1 < _6360_e1)) )
              {
                {
                  if ((_ptr__6313_msubj[_6363_i0] < _ptr__6319_xi32[safe_add( _6303_xsubi,_ptr__6319_xi32[safe_add( _6305_perm,_6362_i1 )] )]))
                  {
                    {
                      ++ _6363_i0;
                    }
                  }
                  else if((_ptr__6313_msubj[_6363_i0] > _ptr__6319_xi32[safe_add( _6303_xsubi,_ptr__6319_xi32[safe_add( _6305_perm,_6362_i1 )] )]))
                  {
                    {
                      ++ _6362_i1;
                    }
                  }
                  else
                  {
                    {
                      _ptr__6352_ri64[safe_add( _6348_rnidxs,_6356_p )] = _ptr__6320_xi64[safe_add( _6301_nidxs,_ptr__6319_xi32[safe_add( _6305_perm,_6362_i1 )] )];
                      _ptr__6353_rf64[safe_add( _6350_rcof,_6356_p )] = _ptr__6314_mcof[_6363_i0];
                      ++ _6359_nz;
                      ++ _6356_p;
                      ++ _6363_i0;
                      ++ _6362_i1;
                    }
                  }
                }
              }
              if ((_6359_nz > (int)0))
              {
                {
                  _ptr__6351_ri32[safe_add( safe_add( _6346_rptr,_6355_pe ),(int)1 )] = _6356_p;
                  _ptr__6352_ri64[safe_add( _6349_rsp,_6355_pe )] = _6354_pi;
                  ++ _6355_pe;
                }
              }
              {}
              ++ _6354_pi;
            }
          }
        }
      }
    }
  }
  else
  {
    {
      int32_t _6364_rnzi = (int)0;
      int32_t _6365_relmi = (int)0;
      _ptr__6351_ri32[_6346_rptr] = (int)0;
      int32_t _6366_i0 = (int)0;
      while ( (_6366_i0 < _6321_mnnz) )
      {
        {
          int32_t _6367_e0 = safe_add( _6366_i0,(int)1 );
          while ( ((_6367_e0 < _6321_mnnz) && (_ptr__6312_msubi[_6367_e0] == _ptr__6312_msubi[_6366_i0])) )
          {
            {
              ++ _6367_e0;
            }
          }
          int32_t _12118_ = (int)0;
          int32_t _12119_ = _6309_xdim1;
          for (int32_t _6368_j = _12118_; _6368_j < _12119_; ++_6368_j)
          {
            {
              int32_t _12120_ = _6366_i0;
              int32_t _12121_ = _6367_e0;
              for (int32_t _6369_k = _12120_; _6369_k < _12121_; ++_6369_k)
              {
                {
                  _ptr__6352_ri64[safe_add( _6348_rnidxs,_6364_rnzi )] = _ptr__6320_xi64[safe_add( safe_add( _6301_nidxs,safe_mul( _ptr__6313_msubj[_6369_k],_6309_xdim1 ) ),_6368_j )];
                  _ptr__6353_rf64[safe_add( _6350_rcof,_6364_rnzi )] = _ptr__6314_mcof[_6369_k];
                  ++ _6364_rnzi;
                }
              }
              _ptr__6351_ri32[safe_add( safe_add( _6346_rptr,_6365_relmi ),(int)1 )] = _6364_rnzi;
              _ptr__6352_ri64[safe_add( _6349_rsp,_6365_relmi )] = safe_add( safe_mul( _ptr__6312_msubi[_6366_i0],_6309_xdim1 ),_6368_j );
              ++ _6365_relmi;
            }
          }
          _6366_i0 = _6367_e0;
        }
      }
    }
  }
  if ((!_6344_rhassp))
  {
    {
      _6294_rs->popi64(_6318_rnelem);
    }
  }
  {}
  _6296_xs->clear();
}
// End mosek.fusion.ExprMulVar.eval_left

// Begin mosek.fusion.ExprMulVar.validate
// Method mosek.fusion.ExprMulVar.validate @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:173:6-195:7
void mosek::fusion::p_ExprMulVar::validate(int32_t _6370_mdimi,int32_t _6371_mdimj,std::shared_ptr< monty::ndarray< int32_t,1 > > _6372_msubi,std::shared_ptr< monty::ndarray< int32_t,1 > > _6373_msubj,std::shared_ptr< monty::ndarray< double,1 > > _6374_mcof)
{
  _checked_ptr_1<int32_t> _ptr__6372_msubi(_6372_msubi ? _6372_msubi->raw() : nullptr, _6372_msubi ? _6372_msubi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__6373_msubj(_6373_msubj ? _6373_msubj->raw() : nullptr, _6373_msubj ? _6373_msubj->size(0) : 0);
  _checked_ptr_1<double> _ptr__6374_mcof(_6374_mcof ? _6374_mcof->raw() : nullptr, _6374_mcof ? _6374_mcof->size(0) : 0);
  bool _6375_ok = true;
  {
    int32_t _12122_ = (int)0;
    int32_t _12123_ = (int)((_6372_msubi)->size(0));
    for (int32_t _6376_i = _12122_; _6376_i < _12123_; ++_6376_i)
    {
      {
        if (((_ptr__6372_msubi[_6376_i] < (int)0) || ((_ptr__6372_msubi[_6376_i] >= _6370_mdimi) || ((_ptr__6373_msubj[_6376_i] < (int)0) || (_ptr__6373_msubj[_6376_i] >= _6371_mdimj)))))
        {
          {
            _6375_ok = false;
          }
        }
        {}
      }
    }
    int32_t _12124_ = (int)1;
    int32_t _12125_ = (int)((_6372_msubi)->size(0));
    for (int32_t _6377_i = _12124_; _6377_i < _12125_; ++_6377_i)
    {
      {
        if (((_ptr__6372_msubi[(_6377_i - (int)1)] > _ptr__6372_msubi[_6377_i]) || ((_ptr__6372_msubi[(_6377_i - (int)1)] == _ptr__6372_msubi[_6377_i]) && (_ptr__6373_msubj[(_6377_i - (int)1)] >= _ptr__6373_msubj[_6377_i]))))
        {
          {
            _6375_ok = false;
          }
        }
        {}
      }
    }
  }
  if ((!_6375_ok))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Invalid matrix data"));
    }
  }
  {}
}
// End mosek.fusion.ExprMulVar.validate

// Begin mosek.fusion.ExprMulVar.resshape
// Method mosek.fusion.ExprMulVar.resshape @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:140:6-145:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_ExprMulVar::resshape(int32_t _6378_mdimi,int32_t _6379_mdimj,std::shared_ptr< monty::ndarray< int32_t,1 > > _6380_xshape,bool _6381_left)
{
  _checked_ptr_1<int32_t> _ptr__6380_xshape(_6380_xshape ? _6380_xshape->raw() : nullptr, _6380_xshape ? _6380_xshape->size(0) : 0);
  if (_6381_left)
  {
    {
      return std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_6378_mdimi),(int32_t)(_ptr__6380_xshape[(int)1])});
    }
  }
  else
  {
    {
      return std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_ptr__6380_xshape[(int)0]),(int32_t)(_6379_mdimj)});
    }
  }
}
// End mosek.fusion.ExprMulVar.resshape

// Begin mosek.fusion.ExprMulVar.toString
// Method mosek.fusion.ExprMulVar.toString @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:133:6-138:7
std::string mosek::fusion::ExprMulVar :: toString() { return mosek::fusion::p_ExprMulVar::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulVar::toString()
{
  if (left)
  {
    {
      return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulVar(M,"))->__mosek_2fusion_2Utils_2StringBuffer__a(x->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
    }
  }
  else
  {
    {
      return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulVar("))->__mosek_2fusion_2Utils_2StringBuffer__a(x->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",M)"))->toString();
    }
  }
}
// End mosek.fusion.ExprMulVar.toString

void mosek::fusion::p_ExprMulVar::destroy()
{
  x.reset();
  mcof.reset();
  msubj.reset();
  msubi.reset();
}
void mosek::fusion::ExprMulVar::destroy() { mosek::fusion::p_ExprMulVar::_get_impl(this)->destroy(); }
// } class ExprMulVar
// class ExprMulScalarVar { // @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:4:4-118:5
mosek::fusion::ExprMulScalarVar::ExprMulScalarVar(mosek::fusion::p_ExprMulScalarVar *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprMulScalarVar()" << this << std::endl; */ }
mosek::fusion::ExprMulScalarVar::~ExprMulScalarVar() {  /* std::cout << "~ExprMulScalarVar()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprMulScalarVar::p_ExprMulScalarVar
  (::mosek::fusion::ExprMulScalarVar * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprMulScalarVar.ctor @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:40:6-77:7
mosek::fusion::ExprMulScalarVar::t mosek::fusion::p_ExprMulScalarVar::_new_ExprMulScalarVar
  (int32_t _6382_mdimi,
    int32_t _6383_mdimj,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6384_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6385_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _6386_mcof,
    monty::rc_ptr< ::mosek::fusion::Variable > _6387_x)
{ return new mosek::fusion::ExprMulScalarVar(_6382_mdimi,_6383_mdimj,_6384_msubi,_6385_msubj,_6386_mcof,_6387_x); }
mosek::fusion::ExprMulScalarVar::ExprMulScalarVar
  (int32_t _6382_mdimi,
    int32_t _6383_mdimj,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6384_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6385_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _6386_mcof,
    monty::rc_ptr< ::mosek::fusion::Variable > _6387_x) : 
   ExprMulScalarVar(new mosek::fusion::p_ExprMulScalarVar(this))
{ mosek::fusion::p_ExprMulScalarVar::_get_impl(this)->_initialize(_6382_mdimi,_6383_mdimj,_6384_msubi,_6385_msubj,_6386_mcof,_6387_x); }
void mosek::fusion::p_ExprMulScalarVar::_initialize  (int32_t _6382_mdimi,
    int32_t _6383_mdimj,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6384_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6385_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _6386_mcof,
    monty::rc_ptr< ::mosek::fusion::Variable > _6387_x)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__6384_msubi(_6384_msubi ? _6384_msubi->raw() : nullptr, _6384_msubi ? _6384_msubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__6385_msubj(_6385_msubj ? _6385_msubj->raw() : nullptr, _6385_msubj ? _6385_msubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__6386_mcof(_6386_mcof ? _6386_mcof->raw() : nullptr, _6386_mcof ? _6386_mcof->size(0) : 0);
    mosek::fusion::p_ExprMulScalarVar::_initialize(_6382_mdimi,_6383_mdimj,::mosek::fusion::Utils::Tools::arraycopy(_6384_msubi),::mosek::fusion::Utils::Tools::arraycopy(_6385_msubj),::mosek::fusion::Utils::Tools::arraycopy(_6386_mcof),_6387_x,(int)1);
    if ((_6387_x->getND() != (int)0))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid Variable size"));
      }
    }
    {}
    if (((_6382_mdimi < (int)0) || ((_6383_mdimj < (int)0) || (((int)((_6384_msubi)->size(0)) != (int)((_6385_msubj)->size(0))) || ((int)((_6384_msubi)->size(0)) != (int)((_6386_mcof)->size(0)))))))
    {
      {
        throw ::mosek::fusion::LengthError(std::string ("Invalid Matrix data"));
      }
    }
    {}
    bool _6388_err_data = false;
    int32_t _12126_ = (int)0;
    int32_t _12127_ = (int)((_6384_msubi)->size(0));
    for (int32_t _6389_i = _12126_; _6389_i < _12127_; ++_6389_i)
    {
      {
        if (((_ptr__6384_msubi[_6389_i] < (int)0) || ((_ptr__6384_msubi[_6389_i] >= _6382_mdimi) || ((_ptr__6385_msubj[_6389_i] < (int)0) || (_ptr__6385_msubj[_6389_i] >= _6383_mdimj)))))
        {
          {
            _6388_err_data = true;
          }
        }
        {}
      }
    }
    if (_6388_err_data)
    {
      {
        throw ::mosek::fusion::IndexError(std::string ("Invalid Matrix data"));
      }
    }
    {}
    bool _6390_err_sorted = false;
    int32_t _12128_ = (int)1;
    int32_t _12129_ = (int)((_6384_msubi)->size(0));
    for (int32_t _6391_i = _12128_; _6391_i < _12129_; ++_6391_i)
    {
      {
        if (((_ptr__6384_msubi[_6391_i] < _ptr__6384_msubi[(_6391_i - (int)1)]) || ((_ptr__6384_msubi[_6391_i] == _ptr__6384_msubi[(_6391_i - (int)1)]) && (_ptr__6385_msubj[_6391_i] <= _ptr__6385_msubj[(_6391_i - (int)1)]))))
        {
          {
            _6390_err_sorted = true;
          }
        }
        {}
      }
    }
    if (_6390_err_sorted)
    {
      {
        throw ::mosek::fusion::IndexError(std::string ("Matrix data not correctly sorted"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprMulScalarVar.ctor

// mosek.fusion.ExprMulScalarVar.ctor @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:19:6-38:7
mosek::fusion::ExprMulScalarVar::t mosek::fusion::p_ExprMulScalarVar::_new_ExprMulScalarVar
  (int32_t _6392_mdimi,
    int32_t _6393_mdimj,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6394_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6395_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _6396_mcof,
    monty::rc_ptr< ::mosek::fusion::Variable > _6397_x,
    int32_t _6398_unchecked_)
{ return new mosek::fusion::ExprMulScalarVar(_6392_mdimi,_6393_mdimj,_6394_msubi,_6395_msubj,_6396_mcof,_6397_x,_6398_unchecked_); }
mosek::fusion::ExprMulScalarVar::ExprMulScalarVar
  (int32_t _6392_mdimi,
    int32_t _6393_mdimj,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6394_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6395_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _6396_mcof,
    monty::rc_ptr< ::mosek::fusion::Variable > _6397_x,
    int32_t _6398_unchecked_) : 
   ExprMulScalarVar(new mosek::fusion::p_ExprMulScalarVar(this))
{ mosek::fusion::p_ExprMulScalarVar::_get_impl(this)->_initialize(_6392_mdimi,_6393_mdimj,_6394_msubi,_6395_msubj,_6396_mcof,_6397_x,_6398_unchecked_); }
void mosek::fusion::p_ExprMulScalarVar::_initialize  (int32_t _6392_mdimi,
    int32_t _6393_mdimj,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6394_msubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6395_msubj,
    std::shared_ptr< monty::ndarray< double,1 > > _6396_mcof,
    monty::rc_ptr< ::mosek::fusion::Variable > _6397_x,
    int32_t _6398_unchecked_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__6394_msubi(_6394_msubi ? _6394_msubi->raw() : nullptr, _6394_msubi ? _6394_msubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__6395_msubj(_6395_msubj ? _6395_msubj->raw() : nullptr, _6395_msubj ? _6395_msubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__6396_mcof(_6396_mcof ? _6396_mcof->raw() : nullptr, _6396_mcof ? _6396_mcof->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(_6397_x->__mosek_2fusion_2Expression__getModel(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_6392_mdimi),(int32_t)(_6393_mdimj)}));
    mosek::fusion::p_ExprMulScalarVar::_get_impl(::mosek::fusion::ExprMulScalarVar::t(_pubthis))->mdimi = _6392_mdimi;
    mosek::fusion::p_ExprMulScalarVar::_get_impl(::mosek::fusion::ExprMulScalarVar::t(_pubthis))->mdimj = _6393_mdimj;
    mosek::fusion::p_ExprMulScalarVar::_get_impl(::mosek::fusion::ExprMulScalarVar::t(_pubthis))->msubi = _6394_msubi;
    mosek::fusion::p_ExprMulScalarVar::_get_impl(::mosek::fusion::ExprMulScalarVar::t(_pubthis))->msubj = _6395_msubj;
    mosek::fusion::p_ExprMulScalarVar::_get_impl(::mosek::fusion::ExprMulScalarVar::t(_pubthis))->mcof = _6396_mcof;
    mosek::fusion::p_ExprMulScalarVar::_get_impl(::mosek::fusion::ExprMulScalarVar::t(_pubthis))->x = _6397_x;
  }
}
// mosek.fusion.ExprMulScalarVar.ctor

// Begin mosek.fusion.ExprMulScalarVar.eval
// Method mosek.fusion.ExprMulScalarVar.eval @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:79:6-117:7
void mosek::fusion::ExprMulScalarVar :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6399_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6400_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6401_xs,bool _6402_cache_eval) { mosek::fusion::p_ExprMulScalarVar::_get_impl(this)->eval(_6399_rs,_6400_ws,_6401_xs,_6402_cache_eval); }
void mosek::fusion::p_ExprMulScalarVar::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6399_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6400_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6401_xs,bool _6402_cache_eval)
{
  if ((x->numInst() == (int)0))
  {
    {
      _6399_rs->alloc_expr((int)2,(int)0,(int)0,false);
      ((*mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->i32)(mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->shape_base)) = mdimi;
      ((*mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->i32)(safe_add( mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->shape_base,(int)1 ))) = mdimj;
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int64_t,1 > > _6403_xidxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)1)));
      _checked_ptr_1<int64_t> _ptr__6403_xidxs(_6403_xidxs ? _6403_xidxs->raw() : nullptr,_6403_xidxs ? _6403_xidxs->size(0) : 0);
      x->inst((int)0,_6403_xidxs);
      int64_t _6404_xi = _ptr__6403_xidxs[(int)0];
      int32_t _6405_nelem = (int)((msubi)->size(0));
      int32_t _6406_nnz = _6405_nelem;
      bool _6407_hassp = (_6405_nelem < safe_mul( mdimi,mdimj ));
      _6399_rs->alloc_expr((int)2,_6405_nelem,_6406_nnz,_6407_hassp);
      int32_t _6408_ptr_base = mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->ptr_base;
      ((*mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->i32)(mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->shape_base)) = mdimi;
      ((*mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->i32)(safe_add( mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->shape_base,(int)1 ))) = mdimj;
      int32_t _6409_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->nidxs_base;
      int32_t _6410_sp_base = mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->sp_base;
      int32_t _6411_cof_base = mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->cof_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _6412_i32 = mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__6412_i32(_6412_i32 ? _6412_i32->raw() : nullptr,_6412_i32 ? _6412_i32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _6413_i64 = mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__6413_i64(_6413_i64 ? _6413_i64->raw() : nullptr,_6413_i64 ? _6413_i64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _6414_f64 = mosek::fusion::p_WorkStack::_get_impl(_6399_rs)->f64;
      _checked_ptr_1<double> _ptr__6414_f64(_6414_f64 ? _6414_f64->raw() : nullptr,_6414_f64 ? _6414_f64->size(0) : 0);
      {
        int32_t _12130_ = (int)0;
        int32_t _12131_ = _6406_nnz;
        for (int32_t _6415_i = _12130_; _6415_i < _12131_; ++_6415_i)
        {
          {
            _ptr__6414_f64[safe_add( _6411_cof_base,_6415_i )] = ((*mcof)(_6415_i));
          }
        }
        int32_t _12132_ = (int)0;
        int32_t _12133_ = _6406_nnz;
        for (int32_t _6416_i = _12132_; _6416_i < _12133_; ++_6416_i)
        {
          {
            _ptr__6413_i64[safe_add( _6409_nidxs_base,_6416_i )] = _6404_xi;
          }
        }
        if (_6407_hassp)
        {
          {
            int32_t _12134_ = (int)0;
            int32_t _12135_ = _6405_nelem;
            for (int32_t _6417_i = _12134_; _6417_i < _12135_; ++_6417_i)
            {
              {
                _ptr__6413_i64[safe_add( _6410_sp_base,_6417_i )] = safe_add( safe_mul( ((*msubi)(_6417_i)),mdimj ),((*msubj)(_6417_i)) );
              }
            }
          }
        }
        {}
        int32_t _12136_ = (int)0;
        int32_t _12137_ = safe_add( _6405_nelem,(int)1 );
        for (int32_t _6418_i = _12136_; _6418_i < _12137_; ++_6418_i)
        {
          {
            _ptr__6412_i32[safe_add( _6408_ptr_base,_6418_i )] = _6418_i;
          }
        }
      }
    }
  }
}
// End mosek.fusion.ExprMulScalarVar.eval

// Begin mosek.fusion.ExprMulScalarVar.toString
// Method mosek.fusion.ExprMulScalarVar.toString @ bld/grindsted/final/default/src/fusion/ExprMulVar.monty:14:6-17:7
std::string mosek::fusion::ExprMulScalarVar :: toString() { return mosek::fusion::p_ExprMulScalarVar::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprMulScalarVar::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprMulScalarVar(M("))->__mosek_2fusion_2Utils_2StringBuffer__a(mdimi)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(mdimj)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("), "))->__mosek_2fusion_2Utils_2StringBuffer__a(x->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprMulScalarVar.toString

void mosek::fusion::p_ExprMulScalarVar::destroy()
{
  x.reset();
  mcof.reset();
  msubj.reset();
  msubi.reset();
}
void mosek::fusion::ExprMulScalarVar::destroy() { mosek::fusion::p_ExprMulScalarVar::_get_impl(this)->destroy(); }
// } class ExprMulScalarVar
// class ExprSumReduceEnd { // @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:1761:4-2029:5
mosek::fusion::ExprSumReduceEnd::ExprSumReduceEnd(mosek::fusion::p_ExprSumReduceEnd *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprSumReduceEnd()" << this << std::endl; */ }
mosek::fusion::ExprSumReduceEnd::~ExprSumReduceEnd() {  /* std::cout << "~ExprSumReduceEnd()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprSumReduceEnd::p_ExprSumReduceEnd
  (::mosek::fusion::ExprSumReduceEnd * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprSumReduceEnd.ctor @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:1778:6-1782:7
mosek::fusion::ExprSumReduceEnd::t mosek::fusion::p_ExprSumReduceEnd::_new_ExprSumReduceEnd
  (int32_t _6419_ndim,
    monty::rc_ptr< ::mosek::fusion::Expression > _6420_expr)
{ return new mosek::fusion::ExprSumReduceEnd(_6419_ndim,_6420_expr); }
mosek::fusion::ExprSumReduceEnd::ExprSumReduceEnd
  (int32_t _6419_ndim,
    monty::rc_ptr< ::mosek::fusion::Expression > _6420_expr) : 
   ExprSumReduceEnd(new mosek::fusion::p_ExprSumReduceEnd(this))
{ mosek::fusion::p_ExprSumReduceEnd::_get_impl(this)->_initialize(_6419_ndim,_6420_expr); }
void mosek::fusion::p_ExprSumReduceEnd::_initialize  (int32_t _6419_ndim,
    monty::rc_ptr< ::mosek::fusion::Expression > _6420_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_6420_expr->__mosek_2fusion_2Expression__getModel(),::mosek::fusion::p_ExprSumReduceEnd::computeShape(_6419_ndim,_6420_expr->getShape()));
    mosek::fusion::p_ExprSumReduceEnd::_get_impl(::mosek::fusion::ExprSumReduceEnd::t(_pubthis))->expr = _6420_expr;
    mosek::fusion::p_ExprSumReduceEnd::_get_impl(::mosek::fusion::ExprSumReduceEnd::t(_pubthis))->ndim = _6419_ndim;
  }
}
// mosek.fusion.ExprSumReduceEnd.ctor

// Begin mosek.fusion.ExprSumReduceEnd.eval
// Method mosek.fusion.ExprSumReduceEnd.eval @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:1784:6-1913:7
void mosek::fusion::ExprSumReduceEnd :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6421_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6422_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6423_xs,bool _6424_cache_eval) { mosek::fusion::p_ExprSumReduceEnd::_get_impl(this)->eval(_6421_rs,_6422_ws,_6423_xs,_6424_cache_eval); }
void mosek::fusion::p_ExprSumReduceEnd::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6421_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6422_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6423_xs,bool _6424_cache_eval)
{
  expr->recursive_eval(_6422_ws,_6421_rs,_6423_xs,_6424_cache_eval);
  _6422_ws->pop_expr();
  int32_t _6425_nd = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->nd;
  int32_t _6426_shape = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->shape_base;
  int32_t _6427_nelem = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->nelem;
  int32_t _6428_nnz = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->nnz;
  int32_t _6429_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->ncodeatom;
  bool _6430_hassp = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->hassp;
  int32_t _6431_ptr = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->ptr_base;
  int32_t _6432_sp = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->sp_base;
  int32_t _6433_nidxs = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->nidxs_base;
  int32_t _6434_cof = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->cof_base;
  int32_t _6435_code = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->code_base;
  int32_t _6436_codeptr = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->codeptr_base;
  int32_t _6437_cconst = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6438_wi32 = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__6438_wi32(_6438_wi32 ? _6438_wi32->raw() : nullptr,_6438_wi32 ? _6438_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6439_wi64 = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__6439_wi64(_6439_wi64 ? _6439_wi64->raw() : nullptr,_6439_wi64 ? _6439_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6440_wf64 = mosek::fusion::p_WorkStack::_get_impl(_6422_ws)->f64;
  _checked_ptr_1<double> _ptr__6440_wf64(_6440_wf64 ? _6440_wf64->raw() : nullptr,_6440_wf64 ? _6440_wf64->size(0) : 0);
  int64_t _6441_dim1 = (int)1;
  int32_t _12138_ = (int)0;
  int32_t _12139_ = (_6425_nd - ndim);
  for (int32_t _6442_i = _12138_; _6442_i < _12139_; ++_6442_i)
  {
    {
      _6441_dim1 *= _ptr__6438_wi32[safe_add( _6426_shape,_6442_i )];
    }
  }
  int64_t _6443_dim2 = (int)1;
  int32_t _12140_ = (_6425_nd - ndim);
  int32_t _12141_ = _6425_nd;
  for (int32_t _6444_i = _12140_; _6444_i < _12141_; ++_6444_i)
  {
    {
      _6443_dim2 *= _ptr__6438_wi32[safe_add( _6426_shape,_6444_i )];
    }
  }
  if (_6430_hassp)
  {
    {
      int32_t _6445_rnelem = (int)0;
      if ((_6427_nelem > (int)0))
      {
        {
          int32_t _6446_si = (int)0;
          int64_t _6447_snext = (-(int)1);
          while ( (_6446_si < _6427_nelem) )
          {
            {
              ++ _6445_rnelem;
              _6447_snext = safe_mul( safe_add( (_ptr__6439_wi64[safe_add( _6432_sp,_6446_si )] / _6443_dim2),(int)1 ),_6443_dim2 );
              while ( ((_6446_si < _6427_nelem) && (_ptr__6439_wi64[safe_add( _6432_sp,_6446_si )] < _6447_snext)) )
              {
                {
                  ++ _6446_si;
                }
              }
            }
          }
        }
      }
      {}
      int32_t _6448_rnnz = _6428_nnz;
      int32_t _6449_rnd = (_6425_nd - ndim);
      int32_t _6450_rncodeatom = _6429_ncodeatom;
      int64_t _6451_rshapesize = (int)1;
      int32_t _12142_ = (int)0;
      int32_t _12143_ = (_6425_nd - ndim);
      for (int32_t _6452_i = _12142_; _6452_i < _12143_; ++_6452_i)
      {
        {
          _6451_rshapesize *= _ptr__6438_wi32[safe_add( _6426_shape,_6452_i )];
        }
      }
      bool _6453_rhassp = (_6445_rnelem < _6451_rshapesize);
      _6421_rs->alloc_expr(_6449_rnd,_6445_rnelem,_6448_rnnz,_6453_rhassp,_6450_rncodeatom);
      int32_t _6454_rptr = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->ptr_base;
      int32_t _6455_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->nidxs_base;
      int32_t _12144_;
      bool _12145_ = _6453_rhassp;
      if (_12145_)
      {
        _12144_ = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->sp_base;
      }
      else
      {
        _12144_ = _6421_rs->alloci64(_6445_rnelem);
      }
      int32_t _6456_rsp = _12144_;
      int32_t _6457_rcof = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->cof_base;
      int32_t _6458_rshape = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->shape_base;
      int32_t _6459_rcode = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->code_base;
      int32_t _6460_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->codeptr_base;
      int32_t _6461_rcconst = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _6462_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__6462_ri32(_6462_ri32 ? _6462_ri32->raw() : nullptr,_6462_ri32 ? _6462_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _6463_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__6463_ri64(_6463_ri64 ? _6463_ri64->raw() : nullptr,_6463_ri64 ? _6463_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _6464_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->f64;
      _checked_ptr_1<double> _ptr__6464_rf64(_6464_rf64 ? _6464_rf64->raw() : nullptr,_6464_rf64 ? _6464_rf64->size(0) : 0);
      int32_t _6465_nzi = (int)0;
      int32_t _6466_codei = (int)0;
      int64_t _6467_wi = (int)0;
      _ptr__6462_ri32[_6454_rptr] = (int)0;
      {
        int32_t _12146_ = (int)0;
        int32_t _12147_ = _6449_rnd;
        for (int32_t _6468_i = _12146_; _6468_i < _12147_; ++_6468_i)
        {
          {
            _ptr__6462_ri32[safe_add( _6458_rshape,_6468_i )] = _ptr__6438_wi32[safe_add( _6426_shape,_6468_i )];
          }
        }
        ::mosek::fusion::Utils::Tools::arraycopy(_6439_wi64,_6433_nidxs,_6463_ri64,_6455_rnidxs,_6428_nnz);
        ::mosek::fusion::Utils::Tools::arraycopy(_6440_wf64,_6434_cof,_6464_rf64,_6457_rcof,_6428_nnz);
        if ((_6450_rncodeatom > (int)0))
        {
          {
            ::mosek::fusion::Utils::Tools::arraycopy(_6438_wi32,_6435_code,_6462_ri32,_6459_rcode,_6450_rncodeatom);
            ::mosek::fusion::Utils::Tools::arraycopy(_6440_wf64,_6437_cconst,_6464_rf64,_6461_rcconst,_6450_rncodeatom);
            ::mosek::fusion::Utils::Tools::arraycopy(_6438_wi32,_6436_codeptr,_6462_ri32,_6460_rcodeptr,safe_add( _6428_nnz,(int)1 ));
          }
        }
        {}
        int32_t _6469_si = (int)0;
        int32_t _12148_ = (int)0;
        int32_t _12149_ = _6445_rnelem;
        for (int32_t _6470_ri = _12148_; _6470_ri < _12149_; ++_6470_ri)
        {
          {
            int64_t _6471_rspi = (_ptr__6439_wi64[safe_add( _6432_sp,_6469_si )] / _6443_dim2);
            if (_6453_rhassp)
            {
              {
                _ptr__6463_ri64[safe_add( _6456_rsp,_6470_ri )] = _6471_rspi;
              }
            }
            {}
            ++ _6469_si;
            int64_t _6472_winext = safe_mul( safe_add( _6471_rspi,(int)1 ),_6443_dim2 );
            while ( ((_6469_si < _6427_nelem) && (_ptr__6439_wi64[safe_add( _6432_sp,_6469_si )] < _6472_winext)) )
            {
              {
                ++ _6469_si;
              }
            }
            _ptr__6462_ri32[safe_add( safe_add( _6454_rptr,_6470_ri ),(int)1 )] = _ptr__6438_wi32[safe_add( _6431_ptr,_6469_si )];
          }
        }
      }
    }
  }
  else
  {
    {
      int32_t _6473_rnelem = (int32_t)_6441_dim1;
      int32_t _6474_rnnz = _6428_nnz;
      int32_t _6475_rncodeatom = _6429_ncodeatom;
      int32_t _6476_rnd = (_6425_nd - ndim);
      _6421_rs->alloc_expr(_6476_rnd,_6473_rnelem,_6474_rnnz,false,_6475_rncodeatom);
      int32_t _6477_rptr = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->ptr_base;
      int32_t _6478_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->nidxs_base;
      int32_t _6479_rcof = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->cof_base;
      int32_t _6480_rshape = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->shape_base;
      int32_t _6481_rcode = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->code_base;
      int32_t _6482_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->codeptr_base;
      int32_t _6483_rcconst = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _6484_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__6484_ri32(_6484_ri32 ? _6484_ri32->raw() : nullptr,_6484_ri32 ? _6484_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _6485_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__6485_ri64(_6485_ri64 ? _6485_ri64->raw() : nullptr,_6485_ri64 ? _6485_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _6486_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6421_rs)->f64;
      _checked_ptr_1<double> _ptr__6486_rf64(_6486_rf64 ? _6486_rf64->raw() : nullptr,_6486_rf64 ? _6486_rf64->size(0) : 0);
      int64_t _6487_wi = (int)0;
      {
        int32_t _12150_ = (int)0;
        int32_t _12151_ = _6476_rnd;
        for (int32_t _6488_i = _12150_; _6488_i < _12151_; ++_6488_i)
        {
          {
            _ptr__6484_ri32[safe_add( _6480_rshape,_6488_i )] = _ptr__6438_wi32[safe_add( _6426_shape,_6488_i )];
          }
        }
        ::mosek::fusion::Utils::Tools::arraycopy(_6439_wi64,_6433_nidxs,_6485_ri64,_6478_rnidxs,_6428_nnz);
        ::mosek::fusion::Utils::Tools::arraycopy(_6440_wf64,_6434_cof,_6486_rf64,_6479_rcof,_6428_nnz);
        if ((_6475_rncodeatom > (int)0))
        {
          {
            ::mosek::fusion::Utils::Tools::arraycopy(_6438_wi32,_6435_code,_6484_ri32,_6481_rcode,_6475_rncodeatom);
            ::mosek::fusion::Utils::Tools::arraycopy(_6440_wf64,_6437_cconst,_6486_rf64,_6483_rcconst,_6475_rncodeatom);
            ::mosek::fusion::Utils::Tools::arraycopy(_6438_wi32,_6436_codeptr,_6484_ri32,_6482_rcodeptr,safe_add( _6428_nnz,(int)1 ));
          }
        }
        {}
        _ptr__6484_ri32[_6477_rptr] = (int)0;
        int32_t _12152_ = (int)0;
        int32_t _12153_ = _6473_rnelem;
        for (int32_t _6489_ri = _12152_; _6489_ri < _12153_; ++_6489_ri)
        {
          {
            _ptr__6484_ri32[safe_add( safe_add( _6477_rptr,_6489_ri ),(int)1 )] = (int32_t)safe_mul( _6443_dim2,safe_add( _6489_ri,(int)1 ) );
          }
        }
      }
    }
  }
}
// End mosek.fusion.ExprSumReduceEnd.eval

// Begin mosek.fusion.ExprSumReduceEnd.computeShape
// Method mosek.fusion.ExprSumReduceEnd.computeShape @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:1769:6-1776:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_ExprSumReduceEnd::computeShape(int32_t _6490_ndim,std::shared_ptr< monty::ndarray< int32_t,1 > > _6491_shape)
{
  _checked_ptr_1<int32_t> _ptr__6491_shape(_6491_shape ? _6491_shape->raw() : nullptr, _6491_shape ? _6491_shape->size(0) : 0);
  if (((int)((_6491_shape)->size(0)) <= _6490_ndim))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid summing dimension"));
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6492_rshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(((int)((_6491_shape)->size(0)) - _6490_ndim))));
  _checked_ptr_1<int32_t> _ptr__6492_rshape(_6492_rshape ? _6492_rshape->raw() : nullptr,_6492_rshape ? _6492_rshape->size(0) : 0);
  int32_t _12154_ = (int)0;
  int32_t _12155_ = (int)((_6492_rshape)->size(0));
  for (int32_t _6493_i = _12154_; _6493_i < _12155_; ++_6493_i)
  {
    {
      _ptr__6492_rshape[_6493_i] = _ptr__6491_shape[_6493_i];
    }
  }
  return _6492_rshape;
}
// End mosek.fusion.ExprSumReduceEnd.computeShape

// Begin mosek.fusion.ExprSumReduceEnd.compress_when_caching
// Method mosek.fusion.ExprSumReduceEnd.compress_when_caching @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:1767:6-65
bool mosek::fusion::ExprSumReduceEnd :: compress_when_caching() { return mosek::fusion::p_ExprSumReduceEnd::_get_impl(this)->compress_when_caching(); }
bool mosek::fusion::p_ExprSumReduceEnd::compress_when_caching()
{
  return true;
}
// End mosek.fusion.ExprSumReduceEnd.compress_when_caching

// Begin mosek.fusion.ExprSumReduceEnd.toString
// Method mosek.fusion.ExprSumReduceEnd.toString @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:1765:6-150
std::string mosek::fusion::ExprSumReduceEnd :: toString() { return mosek::fusion::p_ExprSumReduceEnd::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprSumReduceEnd::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprSumReduceEnd("))->__mosek_2fusion_2Utils_2StringBuffer__a(ndim)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprSumReduceEnd.toString

void mosek::fusion::p_ExprSumReduceEnd::destroy()
{
  expr.reset();
}
void mosek::fusion::ExprSumReduceEnd::destroy() { mosek::fusion::p_ExprSumReduceEnd::_get_impl(this)->destroy(); }
// } class ExprSumReduceEnd
// class ExprAdd { // @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:836:4-1749:5
mosek::fusion::ExprAdd::ExprAdd(mosek::fusion::p_ExprAdd *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprAdd()" << this << std::endl; */ }
mosek::fusion::ExprAdd::~ExprAdd() {  /* std::cout << "~ExprAdd()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprAdd::p_ExprAdd
  (::mosek::fusion::ExprAdd * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprAdd.ctor @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:848:6-860:7
mosek::fusion::ExprAdd::t mosek::fusion::p_ExprAdd::_new_ExprAdd
  (monty::rc_ptr< ::mosek::fusion::Expression > _6494_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _6495_e2,
    double _6496_m1,
    double _6497_m2)
{ return new mosek::fusion::ExprAdd(_6494_e1,_6495_e2,_6496_m1,_6497_m2); }
mosek::fusion::ExprAdd::ExprAdd
  (monty::rc_ptr< ::mosek::fusion::Expression > _6494_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _6495_e2,
    double _6496_m1,
    double _6497_m2) : 
   ExprAdd(new mosek::fusion::p_ExprAdd(this))
{ mosek::fusion::p_ExprAdd::_get_impl(this)->_initialize(_6494_e1,_6495_e2,_6496_m1,_6497_m2); }
void mosek::fusion::p_ExprAdd::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _6494_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _6495_e2,
    double _6496_m1,
    double _6497_m2)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(::mosek::fusion::p_BaseExpression::modelFrom(_6494_e1,_6495_e2),_6494_e1->getShape());
    mosek::fusion::p_ExprAdd::_get_impl(::mosek::fusion::ExprAdd::t(_pubthis))->e1 = _6494_e1;
    mosek::fusion::p_ExprAdd::_get_impl(::mosek::fusion::ExprAdd::t(_pubthis))->e2 = _6495_e2;
    mosek::fusion::p_ExprAdd::_get_impl(::mosek::fusion::ExprAdd::t(_pubthis))->m1 = _6496_m1;
    mosek::fusion::p_ExprAdd::_get_impl(::mosek::fusion::ExprAdd::t(_pubthis))->m2 = _6497_m2;
    if ((_6494_e1->getND() != _6495_e2->getND()))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
      }
    }
    {}
    int32_t _12156_ = (int)0;
    int32_t _12157_ = _6494_e1->getND();
    for (int32_t _6498_i = _12156_; _6498_i < _12157_; ++_6498_i)
    {
      {
        if ((_6494_e1->getDim(_6498_i) != _6495_e2->getDim(_6498_i)))
        {
          {
            throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
          }
        }
        {}
      }
    }
  }
}
// mosek.fusion.ExprAdd.ctor

// Begin mosek.fusion.ExprAdd.eval
// Method mosek.fusion.ExprAdd.eval @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:862:6-1561:7
void mosek::fusion::ExprAdd :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6499_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6500_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6501_xs,bool _6502_cache_eval) { mosek::fusion::p_ExprAdd::_get_impl(this)->eval(_6499_rs,_6500_ws,_6501_xs,_6502_cache_eval); }
void mosek::fusion::p_ExprAdd::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6499_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6500_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6501_xs,bool _6502_cache_eval)
{
  e1->recursive_eval(_6500_ws,_6499_rs,_6501_xs,_6502_cache_eval);
  e2->recursive_eval(_6500_ws,_6499_rs,_6501_xs,_6502_cache_eval);
  _6500_ws->pop_expr();
  int32_t _6503_nd2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->nd;
  int32_t _6504_shape2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->shape_base;
  int32_t _6505_nelem2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->nelem;
  int32_t _6506_nnz2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->nnz;
  int32_t _6507_ncodeatom2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->ncodeatom;
  bool _6508_hassp2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->hassp;
  int32_t _6509_ptr2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->ptr_base;
  int32_t _6510_sp2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->sp_base;
  int32_t _6511_nidxs2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->nidxs_base;
  int32_t _6512_cof2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->cof_base;
  int32_t _6513_code2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->code_base;
  int32_t _6514_codeptr2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->codeptr_base;
  int32_t _6515_cconst2 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->cconst_base;
  _6500_ws->pop_expr();
  int32_t _6516_nd1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->nd;
  int32_t _6517_shape1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->shape_base;
  int32_t _6518_nelem1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->nelem;
  int32_t _6519_nnz1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->nnz;
  int32_t _6520_ncodeatom1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->ncodeatom;
  bool _6521_hassp1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->hassp;
  int32_t _6522_ptr1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->ptr_base;
  int32_t _6523_sp1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->sp_base;
  int32_t _6524_nidxs1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->nidxs_base;
  int32_t _6525_cof1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->cof_base;
  int32_t _6526_code1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->code_base;
  int32_t _6527_codeptr1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->codeptr_base;
  int32_t _6528_cconst1 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6529_wi32 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__6529_wi32(_6529_wi32 ? _6529_wi32->raw() : nullptr,_6529_wi32 ? _6529_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6530_wi64 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__6530_wi64(_6530_wi64 ? _6530_wi64->raw() : nullptr,_6530_wi64 ? _6530_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6531_wf64 = mosek::fusion::p_WorkStack::_get_impl(_6500_ws)->f64;
  _checked_ptr_1<double> _ptr__6531_wf64(_6531_wf64 ? _6531_wf64->raw() : nullptr,_6531_wf64 ? _6531_wf64->size(0) : 0);
  bool _6532_parameterized = ((_6520_ncodeatom1 > (int)0) || (_6507_ncodeatom2 > (int)0));
  if ((_6516_nd1 != _6503_nd2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
    }
  }
  {}
  int32_t _12158_ = (int)0;
  int32_t _12159_ = _6516_nd1;
  for (int32_t _6533_i = _12158_; _6533_i < _12159_; ++_6533_i)
  {
    {
      if ((_ptr__6529_wi32[safe_add( _6517_shape1,_6533_i )] != _ptr__6529_wi32[safe_add( _6504_shape2,_6533_i )]))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
        }
      }
      {}
    }
  }
  if (((!_6521_hassp1) && (!_6508_hassp2)))
  {
    {
      int32_t _6534_rnelem = _6518_nelem1;
      int32_t _6535_rnnz = safe_add( _6519_nnz1,_6506_nnz2 );
      int32_t _6536_rncodeatom = (int)0;
      if (_6532_parameterized)
      {
        {
          int32_t _12160_;
          bool _12161_ = (_6520_ncodeatom1 > (int)0);
          if (_12161_)
          {
            _12160_ = safe_add( _6520_ncodeatom1,safe_mul( _6519_nnz1,(int)2 ) );
          }
          else
          {
            _12160_ = _6519_nnz1;
          }
          _6536_rncodeatom += _12160_;
          int32_t _12162_;
          bool _12163_ = (_6507_ncodeatom2 > (int)0);
          if (_12163_)
          {
            _12162_ = safe_add( _6507_ncodeatom2,safe_mul( _6506_nnz2,(int)2 ) );
          }
          else
          {
            _12162_ = _6506_nnz2;
          }
          _6536_rncodeatom += _12162_;
        }
      }
      {}
      int32_t _6537_rnd = _6516_nd1;
      _6499_rs->alloc_expr(_6537_rnd,_6534_rnelem,_6535_rnnz,false,_6536_rncodeatom);
      int32_t _6538_rshape = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->shape_base;
      int32_t _6539_rptr = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->ptr_base;
      int32_t _6540_rsp = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->sp_base;
      int32_t _6541_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->nidxs_base;
      int32_t _6542_rcof = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->cof_base;
      int32_t _6543_rcode = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->code_base;
      int32_t _6544_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->codeptr_base;
      int32_t _6545_rcconst = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _6546_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__6546_ri32(_6546_ri32 ? _6546_ri32->raw() : nullptr,_6546_ri32 ? _6546_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _6547_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__6547_ri64(_6547_ri64 ? _6547_ri64->raw() : nullptr,_6547_ri64 ? _6547_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _6548_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->f64;
      _checked_ptr_1<double> _ptr__6548_rf64(_6548_rf64 ? _6548_rf64->raw() : nullptr,_6548_rf64 ? _6548_rf64->size(0) : 0);
      int32_t _12164_ = (int)0;
      int32_t _12165_ = _6537_rnd;
      for (int32_t _6549_i = _12164_; _6549_i < _12165_; ++_6549_i)
      {
        {
          _ptr__6546_ri32[safe_add( _6538_rshape,_6549_i )] = _ptr__6529_wi32[safe_add( _6517_shape1,_6549_i )];
        }
      }
      int32_t _6550_codei = (int)0;
      int32_t _6551_knz = (int)0;
      if ((_6536_rncodeatom > (int)0))
      {
        {
          _ptr__6546_ri32[_6544_rcodeptr] = (int)0;
        }
      }
      {}
      _ptr__6546_ri32[_6539_rptr] = (int)0;
      int32_t _12166_ = (int)0;
      int32_t _12167_ = _6534_rnelem;
      for (int32_t _6552_i = _12166_; _6552_i < _12167_; ++_6552_i)
      {
        {
          int32_t _12168_ = _ptr__6529_wi32[safe_add( _6522_ptr1,_6552_i )];
          int32_t _12169_ = _ptr__6529_wi32[safe_add( safe_add( _6522_ptr1,_6552_i ),(int)1 )];
          for (int32_t _6553_k = _12168_; _6553_k < _12169_; ++_6553_k)
          {
            {
              _ptr__6547_ri64[safe_add( _6541_rnidxs,_6551_knz )] = _ptr__6530_wi64[safe_add( _6524_nidxs1,_6553_k )];
              _ptr__6548_rf64[safe_add( _6542_rcof,_6551_knz )] = (_ptr__6531_wf64[safe_add( _6525_cof1,_6553_k )] * m1);
              if ((_6520_ncodeatom1 > (int)0))
              {
                {
                  int32_t _12170_ = _ptr__6529_wi32[safe_add( _6527_codeptr1,_6553_k )];
                  int32_t _12171_ = _ptr__6529_wi32[safe_add( safe_add( _6527_codeptr1,_6553_k ),(int)1 )];
                  for (int32_t _6554_l = _12170_; _6554_l < _12171_; ++_6554_l)
                  {
                    {
                      _ptr__6546_ri32[safe_add( _6543_rcode,_6550_codei )] = _ptr__6529_wi32[safe_add( _6526_code1,_6554_l )];
                      _ptr__6548_rf64[safe_add( _6545_rcconst,_6550_codei )] = _ptr__6531_wf64[safe_add( _6528_cconst1,_6554_l )];
                      ++ _6550_codei;
                    }
                  }
                  _ptr__6546_ri32[safe_add( _6543_rcode,_6550_codei )] = 2;
                  _ptr__6548_rf64[safe_add( _6545_rcconst,_6550_codei )] = m1;
                  ++ _6550_codei;
                  _ptr__6546_ri32[safe_add( _6543_rcode,_6550_codei )] = 5;
                  ++ _6550_codei;
                  _ptr__6546_ri32[safe_add( safe_add( _6544_rcodeptr,_6551_knz ),(int)1 )] = _6550_codei;
                }
              }
              else
              {
                {
                  if ((_6536_rncodeatom > (int)0))
                  {
                    {
                      _ptr__6546_ri32[safe_add( _6543_rcode,_6550_codei )] = 2;
                      _ptr__6548_rf64[safe_add( _6545_rcconst,_6550_codei )] = 0.0;
                      ++ _6550_codei;
                      _ptr__6546_ri32[safe_add( safe_add( _6544_rcodeptr,_6551_knz ),(int)1 )] = _6550_codei;
                    }
                  }
                  {}
                }
              }
              ++ _6551_knz;
            }
          }
          int32_t _12172_ = _ptr__6529_wi32[safe_add( _6509_ptr2,_6552_i )];
          int32_t _12173_ = _ptr__6529_wi32[safe_add( safe_add( _6509_ptr2,_6552_i ),(int)1 )];
          for (int32_t _6555_k = _12172_; _6555_k < _12173_; ++_6555_k)
          {
            {
              _ptr__6547_ri64[safe_add( _6541_rnidxs,_6551_knz )] = _ptr__6530_wi64[safe_add( _6511_nidxs2,_6555_k )];
              _ptr__6548_rf64[safe_add( _6542_rcof,_6551_knz )] = (_ptr__6531_wf64[safe_add( _6512_cof2,_6555_k )] * m2);
              if ((_6507_ncodeatom2 > (int)0))
              {
                {
                  int32_t _12174_ = _ptr__6529_wi32[safe_add( _6514_codeptr2,_6555_k )];
                  int32_t _12175_ = _ptr__6529_wi32[safe_add( safe_add( _6514_codeptr2,_6555_k ),(int)1 )];
                  for (int32_t _6556_l = _12174_; _6556_l < _12175_; ++_6556_l)
                  {
                    {
                      _ptr__6546_ri32[safe_add( _6543_rcode,_6550_codei )] = _ptr__6529_wi32[safe_add( _6513_code2,_6556_l )];
                      _ptr__6548_rf64[safe_add( _6545_rcconst,_6550_codei )] = _ptr__6531_wf64[safe_add( _6515_cconst2,_6556_l )];
                      ++ _6550_codei;
                    }
                  }
                  _ptr__6546_ri32[safe_add( _6543_rcode,_6550_codei )] = 2;
                  _ptr__6548_rf64[safe_add( _6545_rcconst,_6550_codei )] = m2;
                  ++ _6550_codei;
                  _ptr__6546_ri32[safe_add( _6543_rcode,_6550_codei )] = 5;
                  ++ _6550_codei;
                  _ptr__6546_ri32[safe_add( safe_add( _6544_rcodeptr,_6551_knz ),(int)1 )] = _6550_codei;
                }
              }
              else
              {
                {
                  if ((_6536_rncodeatom > (int)0))
                  {
                    {
                      _ptr__6546_ri32[safe_add( _6543_rcode,_6550_codei )] = 2;
                      _ptr__6548_rf64[safe_add( _6545_rcconst,_6550_codei )] = 0.0;
                      ++ _6550_codei;
                      _ptr__6546_ri32[safe_add( safe_add( _6544_rcodeptr,_6551_knz ),(int)1 )] = _6550_codei;
                    }
                  }
                  {}
                }
              }
              ++ _6551_knz;
            }
          }
          _ptr__6546_ri32[safe_add( safe_add( _6539_rptr,_6552_i ),(int)1 )] = _6551_knz;
        }
      }
    }
  }
  else if(((!_6521_hassp1) || (!_6508_hassp2)))
  {
    {
      if ((!_6508_hassp2))
      {
        {
          int32_t _6557_tnelem = _6505_nelem2;
          int32_t _6558_tnnz = _6506_nnz2;
          int32_t _6559_tptr = _6509_ptr2;
          int32_t _6560_tsp = _6510_sp2;
          int32_t _6561_tnidxs = _6511_nidxs2;
          int32_t _6562_tncodeatom = _6507_ncodeatom2;
          int32_t _6563_tcodeptr = _6514_codeptr2;
          int32_t _6564_tcode = _6513_code2;
          int32_t _6565_tcconst = _6515_cconst2;
          int32_t _6566_tcof = _6512_cof2;
          _6505_nelem2 = _6518_nelem1;
          _6506_nnz2 = _6519_nnz1;
          _6509_ptr2 = _6522_ptr1;
          _6510_sp2 = _6523_sp1;
          _6511_nidxs2 = _6524_nidxs1;
          _6507_ncodeatom2 = _6520_ncodeatom1;
          _6514_codeptr2 = _6527_codeptr1;
          _6513_code2 = _6526_code1;
          _6515_cconst2 = _6528_cconst1;
          _6512_cof2 = _6525_cof1;
          _6518_nelem1 = _6557_tnelem;
          _6519_nnz1 = _6558_tnnz;
          _6522_ptr1 = _6559_tptr;
          _6523_sp1 = _6560_tsp;
          _6524_nidxs1 = _6561_tnidxs;
          _6520_ncodeatom1 = _6562_tncodeatom;
          _6527_codeptr1 = _6563_tcodeptr;
          _6526_code1 = _6564_tcode;
          _6528_cconst1 = _6565_tcconst;
          _6525_cof1 = _6566_tcof;
        }
      }
      {}
      double _12176_;
      bool _12177_ = (!_6521_hassp1);
      if (_12177_)
      {
        _12176_ = mosek::fusion::p_ExprAdd::_get_impl(::mosek::fusion::ExprAdd::t(_pubthis))->m1;
      }
      else
      {
        _12176_ = mosek::fusion::p_ExprAdd::_get_impl(::mosek::fusion::ExprAdd::t(_pubthis))->m2;
      }
      double _6567_m1 = _12176_;
      double _12178_;
      bool _12179_ = (!_6521_hassp1);
      if (_12179_)
      {
        _12178_ = mosek::fusion::p_ExprAdd::_get_impl(::mosek::fusion::ExprAdd::t(_pubthis))->m2;
      }
      else
      {
        _12178_ = mosek::fusion::p_ExprAdd::_get_impl(::mosek::fusion::ExprAdd::t(_pubthis))->m1;
      }
      double _6568_m2 = _12178_;
      int32_t _6569_rnelem = _6518_nelem1;
      int32_t _6570_rnnz = safe_add( _6519_nnz1,_6506_nnz2 );
      int32_t _6571_rnd = _6516_nd1;
      int32_t _6572_rncodeatom = safe_add( _6520_ncodeatom1,_6507_ncodeatom2 );
      if (_6532_parameterized)
      {
        {
          int32_t _12180_;
          bool _12181_ = (_6520_ncodeatom1 > (int)0);
          if (_12181_)
          {
            _12180_ = safe_mul( (int)2,_6519_nnz1 );
          }
          else
          {
            _12180_ = _6519_nnz1;
          }
          _6572_rncodeatom += _12180_;
          int32_t _12182_;
          bool _12183_ = (_6507_ncodeatom2 > (int)0);
          if (_12183_)
          {
            _12182_ = safe_mul( (int)2,_6506_nnz2 );
          }
          else
          {
            _12182_ = _6506_nnz2;
          }
          _6572_rncodeatom += _12182_;
        }
      }
      {}
      _6499_rs->alloc_expr(_6571_rnd,_6569_rnelem,_6570_rnnz,false,_6572_rncodeatom);
      int32_t _6573_rshape = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->shape_base;
      int32_t _6574_rptr = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->ptr_base;
      int32_t _6575_rsp = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->sp_base;
      int32_t _6576_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->nidxs_base;
      int32_t _6577_rcof = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->cof_base;
      int32_t _6578_rcode = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->code_base;
      int32_t _6579_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->codeptr_base;
      int32_t _6580_rcconst = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _6581_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__6581_ri32(_6581_ri32 ? _6581_ri32->raw() : nullptr,_6581_ri32 ? _6581_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _6582_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__6582_ri64(_6582_ri64 ? _6582_ri64->raw() : nullptr,_6582_ri64 ? _6582_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _6583_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->f64;
      _checked_ptr_1<double> _ptr__6583_rf64(_6583_rf64 ? _6583_rf64->raw() : nullptr,_6583_rf64 ? _6583_rf64->size(0) : 0);
      {
        int32_t _6584_codei = (int)0;
        int32_t _6585_elmi = (int)0;
        int32_t _6586_nzi = (int)0;
        int32_t _12184_ = (int)0;
        int32_t _12185_ = _6571_rnd;
        for (int32_t _6587_i = _12184_; _6587_i < _12185_; ++_6587_i)
        {
          {
            _ptr__6581_ri32[safe_add( _6573_rshape,_6587_i )] = _ptr__6529_wi32[safe_add( _6517_shape1,_6587_i )];
          }
        }
        _ptr__6581_ri32[_6574_rptr] = (int)0;
        if ((_6572_rncodeatom > (int)0))
        {
          {
            _ptr__6581_ri32[_6579_rcodeptr] = (int)0;
          }
        }
        {}
        int32_t _6588_ii2 = (int)0;
        int32_t _12186_ = (int)0;
        int32_t _12187_ = _6518_nelem1;
        for (int32_t _6589_i1 = _12186_; _6589_i1 < _12187_; ++_6589_i1)
        {
          {
            int32_t _12188_ = _ptr__6529_wi32[safe_add( _6522_ptr1,_6589_i1 )];
            int32_t _12189_ = _ptr__6529_wi32[safe_add( safe_add( _6522_ptr1,_6589_i1 ),(int)1 )];
            for (int32_t _6590_j = _12188_; _6590_j < _12189_; ++_6590_j)
            {
              {
                _ptr__6582_ri64[safe_add( _6576_rnidxs,_6586_nzi )] = _ptr__6530_wi64[safe_add( _6524_nidxs1,_6590_j )];
                _ptr__6583_rf64[safe_add( _6577_rcof,_6586_nzi )] = (_ptr__6531_wf64[safe_add( _6525_cof1,_6590_j )] * _6567_m1);
                if ((_6520_ncodeatom1 > (int)0))
                {
                  {
                    int32_t _12190_ = _ptr__6529_wi32[safe_add( _6527_codeptr1,_6590_j )];
                    int32_t _12191_ = _ptr__6529_wi32[safe_add( safe_add( _6527_codeptr1,_6590_j ),(int)1 )];
                    for (int32_t _6591_k = _12190_; _6591_k < _12191_; ++_6591_k)
                    {
                      {
                        _ptr__6581_ri32[safe_add( _6578_rcode,_6584_codei )] = _ptr__6529_wi32[safe_add( _6526_code1,_6591_k )];
                        _ptr__6583_rf64[safe_add( _6580_rcconst,_6584_codei )] = _ptr__6531_wf64[safe_add( _6528_cconst1,_6591_k )];
                        ++ _6584_codei;
                      }
                    }
                    _ptr__6581_ri32[safe_add( _6578_rcode,_6584_codei )] = 2;
                    _ptr__6583_rf64[safe_add( _6580_rcconst,_6584_codei )] = _6567_m1;
                    ++ _6584_codei;
                    _ptr__6581_ri32[safe_add( _6578_rcode,_6584_codei )] = 5;
                    ++ _6584_codei;
                    _ptr__6581_ri32[safe_add( safe_add( _6579_rcodeptr,_6586_nzi ),(int)1 )] = _6584_codei;
                  }
                }
                else
                {
                  {
                    if ((_6572_rncodeatom > (int)0))
                    {
                      {
                        _ptr__6581_ri32[safe_add( _6578_rcode,_6584_codei )] = 2;
                        _ptr__6583_rf64[safe_add( _6580_rcconst,_6584_codei )] = 0.0;
                        ++ _6584_codei;
                        _ptr__6581_ri32[safe_add( safe_add( _6579_rcodeptr,_6586_nzi ),(int)1 )] = _6584_codei;
                      }
                    }
                    {}
                  }
                }
                ++ _6586_nzi;
              }
            }
            if (((_6588_ii2 < _6505_nelem2) && (_6589_i1 == _ptr__6530_wi64[safe_add( _6510_sp2,_6588_ii2 )])))
            {
              {
                int32_t _12192_ = _ptr__6529_wi32[safe_add( _6509_ptr2,_6588_ii2 )];
                int32_t _12193_ = _ptr__6529_wi32[safe_add( safe_add( _6509_ptr2,_6588_ii2 ),(int)1 )];
                for (int32_t _6592_j = _12192_; _6592_j < _12193_; ++_6592_j)
                {
                  {
                    _ptr__6582_ri64[safe_add( _6576_rnidxs,_6586_nzi )] = _ptr__6530_wi64[safe_add( _6511_nidxs2,_6592_j )];
                    _ptr__6583_rf64[safe_add( _6577_rcof,_6586_nzi )] = (_ptr__6531_wf64[safe_add( _6512_cof2,_6592_j )] * _6568_m2);
                    if ((_6507_ncodeatom2 > (int)0))
                    {
                      {
                        int32_t _12194_ = _ptr__6529_wi32[safe_add( _6514_codeptr2,_6592_j )];
                        int32_t _12195_ = _ptr__6529_wi32[safe_add( safe_add( _6514_codeptr2,_6592_j ),(int)1 )];
                        for (int32_t _6593_k = _12194_; _6593_k < _12195_; ++_6593_k)
                        {
                          {
                            _ptr__6581_ri32[safe_add( _6578_rcode,_6584_codei )] = _ptr__6529_wi32[safe_add( _6513_code2,_6593_k )];
                            _ptr__6583_rf64[safe_add( _6580_rcconst,_6584_codei )] = _ptr__6531_wf64[safe_add( _6515_cconst2,_6593_k )];
                            ++ _6584_codei;
                          }
                        }
                        _ptr__6581_ri32[safe_add( _6578_rcode,_6584_codei )] = 2;
                        _ptr__6583_rf64[safe_add( _6580_rcconst,_6584_codei )] = _6568_m2;
                        ++ _6584_codei;
                        _ptr__6581_ri32[safe_add( _6578_rcode,_6584_codei )] = 5;
                        ++ _6584_codei;
                        _ptr__6581_ri32[safe_add( safe_add( _6579_rcodeptr,_6586_nzi ),(int)1 )] = _6584_codei;
                      }
                    }
                    else
                    {
                      {
                        if ((_6572_rncodeatom > (int)0))
                        {
                          {
                            _ptr__6581_ri32[safe_add( _6578_rcode,_6584_codei )] = 2;
                            _ptr__6583_rf64[safe_add( _6580_rcconst,_6584_codei )] = 0.0;
                            ++ _6584_codei;
                            _ptr__6581_ri32[safe_add( safe_add( _6579_rcodeptr,_6586_nzi ),(int)1 )] = _6584_codei;
                          }
                        }
                        {}
                      }
                    }
                    ++ _6586_nzi;
                  }
                }
                ++ _6588_ii2;
              }
            }
            {}
            _ptr__6581_ri32[safe_add( safe_add( _6574_rptr,_6585_elmi ),(int)1 )] = _6586_nzi;
            ++ _6585_elmi;
          }
        }
        if ((_6585_elmi != _6569_rnelem))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal: invalid nelem"));
          }
        }
        {}
        if ((_6586_nzi != _6570_rnnz))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal: invalid nnz"));
          }
        }
        {}
        if ((_6584_codei != _6572_rncodeatom))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal: invalid codei"));
          }
        }
        {}
      }
    }
  }
  else
  {
    {
      int32_t _6594_rnnz = safe_add( _6519_nnz1,_6506_nnz2 );
      int32_t _6595_rnelem = (int)0;
      int32_t _6596_rnd = _6516_nd1;
      int32_t _6597_rncodeatom = safe_add( _6520_ncodeatom1,_6507_ncodeatom2 );
      if (_6532_parameterized)
      {
        {
          int32_t _12196_;
          bool _12197_ = (_6520_ncodeatom1 > (int)0);
          if (_12197_)
          {
            _12196_ = safe_mul( (int)2,_6519_nnz1 );
          }
          else
          {
            _12196_ = _6519_nnz1;
          }
          _6597_rncodeatom += _12196_;
          int32_t _12198_;
          bool _12199_ = (_6507_ncodeatom2 > (int)0);
          if (_12199_)
          {
            _12198_ = safe_mul( (int)2,_6506_nnz2 );
          }
          else
          {
            _12198_ = _6506_nnz2;
          }
          _6597_rncodeatom += _12198_;
        }
      }
      {}
      int64_t _6598_size = (int64_t)1;
      int32_t _12200_ = (int)0;
      int32_t _12201_ = _6596_rnd;
      for (int32_t _6599_i = _12200_; _6599_i < _12201_; ++_6599_i)
      {
        {
          _6598_size *= _ptr__6529_wi32[safe_add( _6517_shape1,_6599_i )];
        }
      }
      {
        int32_t _6600_i2 = (int)0;
        int32_t _6601_i1 = (int)0;
        while ( ((_6601_i1 < _6518_nelem1) && (_6600_i2 < _6505_nelem2)) )
        {
          {
            if ((_ptr__6530_wi64[safe_add( _6523_sp1,_6601_i1 )] < _ptr__6530_wi64[safe_add( _6510_sp2,_6600_i2 )]))
            {
              {
                ++ _6595_rnelem;
                ++ _6601_i1;
              }
            }
            else if((_ptr__6530_wi64[safe_add( _6523_sp1,_6601_i1 )] > _ptr__6530_wi64[safe_add( _6510_sp2,_6600_i2 )]))
            {
              {
                ++ _6595_rnelem;
                ++ _6600_i2;
              }
            }
            else
            {
              {
                ++ _6595_rnelem;
                ++ _6601_i1;
                ++ _6600_i2;
              }
            }
          }
        }
        _6595_rnelem += (safe_add( (_6518_nelem1 - _6601_i1),_6505_nelem2 ) - _6600_i2);
      }
      bool _6602_rhassp = (_6595_rnelem < _6598_size);
      _6499_rs->alloc_expr(_6596_rnd,_6595_rnelem,_6594_rnnz,_6602_rhassp,_6597_rncodeatom);
      int32_t _6603_rshape = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->shape_base;
      int32_t _6604_rptr = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->ptr_base;
      int32_t _12202_;
      bool _12203_ = _6602_rhassp;
      if (_12203_)
      {
        _12202_ = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->sp_base;
      }
      else
      {
        _12202_ = _6499_rs->alloci64(_6595_rnelem);
      }
      int32_t _6605_rsp = _12202_;
      int32_t _6606_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->nidxs_base;
      int32_t _6607_rcof = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->cof_base;
      int32_t _6608_rcode = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->code_base;
      int32_t _6609_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->codeptr_base;
      int32_t _6610_rcconst = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _6611_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__6611_ri32(_6611_ri32 ? _6611_ri32->raw() : nullptr,_6611_ri32 ? _6611_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _6612_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__6612_ri64(_6612_ri64 ? _6612_ri64->raw() : nullptr,_6612_ri64 ? _6612_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _6613_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6499_rs)->f64;
      _checked_ptr_1<double> _ptr__6613_rf64(_6613_rf64 ? _6613_rf64->raw() : nullptr,_6613_rf64 ? _6613_rf64->size(0) : 0);
      int32_t _12204_ = (int)0;
      int32_t _12205_ = _6596_rnd;
      for (int32_t _6614_i = _12204_; _6614_i < _12205_; ++_6614_i)
      {
        {
          _ptr__6611_ri32[safe_add( _6603_rshape,_6614_i )] = _ptr__6529_wi32[safe_add( _6517_shape1,_6614_i )];
        }
      }
      {
        _ptr__6611_ri32[_6604_rptr] = (int)0;
        if ((_6597_rncodeatom > (int)0))
        {
          {
            _ptr__6611_ri32[_6609_rcodeptr] = (int)0;
          }
        }
        {}
        int32_t _6615_codei = (int)0;
        int32_t _6616_pe = (int)0;
        int32_t _6617_p = (int)0;
        int32_t _6618_i2 = (int)0;
        int32_t _6619_i1 = (int)0;
        while ( ((_6619_i1 < _6518_nelem1) && (_6618_i2 < _6505_nelem2)) )
        {
          {
            if ((_ptr__6530_wi64[safe_add( _6523_sp1,_6619_i1 )] < _ptr__6530_wi64[safe_add( _6510_sp2,_6618_i2 )]))
            {
              {
                int32_t _12206_ = _ptr__6529_wi32[safe_add( _6522_ptr1,_6619_i1 )];
                int32_t _12207_ = _ptr__6529_wi32[safe_add( safe_add( _6522_ptr1,_6619_i1 ),(int)1 )];
                for (int32_t _6620_j = _12206_; _6620_j < _12207_; ++_6620_j)
                {
                  {
                    _ptr__6612_ri64[safe_add( _6606_rnidxs,_6617_p )] = _ptr__6530_wi64[safe_add( _6524_nidxs1,_6620_j )];
                    _ptr__6613_rf64[safe_add( _6607_rcof,_6617_p )] = (m1 * _ptr__6531_wf64[safe_add( _6525_cof1,_6620_j )]);
                    if ((_6520_ncodeatom1 > (int)0))
                    {
                      {
                        int32_t _12208_ = _ptr__6529_wi32[safe_add( _6527_codeptr1,_6620_j )];
                        int32_t _12209_ = _ptr__6529_wi32[safe_add( safe_add( _6527_codeptr1,_6620_j ),(int)1 )];
                        for (int32_t _6621_k = _12208_; _6621_k < _12209_; ++_6621_k)
                        {
                          {
                            _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = _ptr__6529_wi32[safe_add( _6526_code1,_6621_k )];
                            _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = _ptr__6531_wf64[safe_add( _6528_cconst1,_6621_k )];
                            ++ _6615_codei;
                          }
                        }
                        _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 2;
                        _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = m1;
                        ++ _6615_codei;
                        _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 5;
                        ++ _6615_codei;
                        _ptr__6611_ri32[safe_add( safe_add( _6609_rcodeptr,_6617_p ),(int)1 )] = _6615_codei;
                      }
                    }
                    else
                    {
                      {
                        if ((_6597_rncodeatom > (int)0))
                        {
                          {
                            _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 2;
                            _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = (int)0;
                            ++ _6615_codei;
                            _ptr__6611_ri32[safe_add( safe_add( _6609_rcodeptr,_6617_p ),(int)1 )] = _6615_codei;
                          }
                        }
                        {}
                      }
                    }
                    ++ _6617_p;
                  }
                }
                _ptr__6612_ri64[safe_add( _6605_rsp,_6616_pe )] = _ptr__6530_wi64[safe_add( _6523_sp1,_6619_i1 )];
                _ptr__6611_ri32[safe_add( safe_add( _6604_rptr,_6616_pe ),(int)1 )] = _6617_p;
                ++ _6616_pe;
                ++ _6619_i1;
              }
            }
            else if((_ptr__6530_wi64[safe_add( _6510_sp2,_6618_i2 )] < _ptr__6530_wi64[safe_add( _6523_sp1,_6619_i1 )]))
            {
              {
                int32_t _12210_ = _ptr__6529_wi32[safe_add( _6509_ptr2,_6618_i2 )];
                int32_t _12211_ = _ptr__6529_wi32[safe_add( safe_add( _6509_ptr2,_6618_i2 ),(int)1 )];
                for (int32_t _6622_j = _12210_; _6622_j < _12211_; ++_6622_j)
                {
                  {
                    _ptr__6612_ri64[safe_add( _6606_rnidxs,_6617_p )] = _ptr__6530_wi64[safe_add( _6511_nidxs2,_6622_j )];
                    _ptr__6613_rf64[safe_add( _6607_rcof,_6617_p )] = (m2 * _ptr__6531_wf64[safe_add( _6512_cof2,_6622_j )]);
                    if ((_6507_ncodeatom2 > (int)0))
                    {
                      {
                        int32_t _12212_ = _ptr__6529_wi32[safe_add( _6514_codeptr2,_6622_j )];
                        int32_t _12213_ = _ptr__6529_wi32[safe_add( safe_add( _6514_codeptr2,_6622_j ),(int)1 )];
                        for (int32_t _6623_k = _12212_; _6623_k < _12213_; ++_6623_k)
                        {
                          {
                            _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = _ptr__6529_wi32[safe_add( _6513_code2,_6623_k )];
                            _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = _ptr__6531_wf64[safe_add( _6515_cconst2,_6623_k )];
                            ++ _6615_codei;
                          }
                        }
                        _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 2;
                        _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = m2;
                        ++ _6615_codei;
                        _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 5;
                        ++ _6615_codei;
                        _ptr__6611_ri32[safe_add( safe_add( _6609_rcodeptr,_6617_p ),(int)1 )] = _6615_codei;
                      }
                    }
                    else
                    {
                      {
                        if ((_6597_rncodeatom > (int)0))
                        {
                          {
                            _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 2;
                            _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = (int)0;
                            ++ _6615_codei;
                            _ptr__6611_ri32[safe_add( safe_add( _6609_rcodeptr,_6617_p ),(int)1 )] = _6615_codei;
                          }
                        }
                        {}
                      }
                    }
                    ++ _6617_p;
                  }
                }
                _ptr__6612_ri64[safe_add( _6605_rsp,_6616_pe )] = _ptr__6530_wi64[safe_add( _6510_sp2,_6618_i2 )];
                _ptr__6611_ri32[safe_add( safe_add( _6604_rptr,_6616_pe ),(int)1 )] = _6617_p;
                ++ _6616_pe;
                ++ _6618_i2;
              }
            }
            else
            {
              {
                int32_t _12214_ = _ptr__6529_wi32[safe_add( _6522_ptr1,_6619_i1 )];
                int32_t _12215_ = _ptr__6529_wi32[safe_add( safe_add( _6522_ptr1,_6619_i1 ),(int)1 )];
                for (int32_t _6624_j = _12214_; _6624_j < _12215_; ++_6624_j)
                {
                  {
                    _ptr__6612_ri64[safe_add( _6606_rnidxs,_6617_p )] = _ptr__6530_wi64[safe_add( _6524_nidxs1,_6624_j )];
                    _ptr__6613_rf64[safe_add( _6607_rcof,_6617_p )] = (m1 * _ptr__6531_wf64[safe_add( _6525_cof1,_6624_j )]);
                    if ((_6520_ncodeatom1 > (int)0))
                    {
                      {
                        int32_t _12216_ = _ptr__6529_wi32[safe_add( _6527_codeptr1,_6624_j )];
                        int32_t _12217_ = _ptr__6529_wi32[safe_add( safe_add( _6527_codeptr1,_6624_j ),(int)1 )];
                        for (int32_t _6625_k = _12216_; _6625_k < _12217_; ++_6625_k)
                        {
                          {
                            _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = _ptr__6529_wi32[safe_add( _6526_code1,_6625_k )];
                            _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = _ptr__6531_wf64[safe_add( _6528_cconst1,_6625_k )];
                            ++ _6615_codei;
                          }
                        }
                        _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 2;
                        _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = m1;
                        ++ _6615_codei;
                        _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 5;
                        ++ _6615_codei;
                        _ptr__6611_ri32[safe_add( safe_add( _6609_rcodeptr,_6617_p ),(int)1 )] = _6615_codei;
                      }
                    }
                    else
                    {
                      {
                        if ((_6597_rncodeatom > (int)0))
                        {
                          {
                            _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 2;
                            _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = (int)0;
                            ++ _6615_codei;
                            _ptr__6611_ri32[safe_add( safe_add( _6609_rcodeptr,_6617_p ),(int)1 )] = _6615_codei;
                          }
                        }
                        {}
                      }
                    }
                    ++ _6617_p;
                  }
                }
                int32_t _12218_ = _ptr__6529_wi32[safe_add( _6509_ptr2,_6618_i2 )];
                int32_t _12219_ = _ptr__6529_wi32[safe_add( safe_add( _6509_ptr2,_6618_i2 ),(int)1 )];
                for (int32_t _6626_j = _12218_; _6626_j < _12219_; ++_6626_j)
                {
                  {
                    _ptr__6612_ri64[safe_add( _6606_rnidxs,_6617_p )] = _ptr__6530_wi64[safe_add( _6511_nidxs2,_6626_j )];
                    _ptr__6613_rf64[safe_add( _6607_rcof,_6617_p )] = (m2 * _ptr__6531_wf64[safe_add( _6512_cof2,_6626_j )]);
                    if ((_6507_ncodeatom2 > (int)0))
                    {
                      {
                        int32_t _12220_ = _ptr__6529_wi32[safe_add( _6514_codeptr2,_6626_j )];
                        int32_t _12221_ = _ptr__6529_wi32[safe_add( safe_add( _6514_codeptr2,_6626_j ),(int)1 )];
                        for (int32_t _6627_k = _12220_; _6627_k < _12221_; ++_6627_k)
                        {
                          {
                            _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = _ptr__6529_wi32[safe_add( _6513_code2,_6627_k )];
                            _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = _ptr__6531_wf64[safe_add( _6515_cconst2,_6627_k )];
                            ++ _6615_codei;
                          }
                        }
                        _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 2;
                        _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = m2;
                        ++ _6615_codei;
                        _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 5;
                        ++ _6615_codei;
                        _ptr__6611_ri32[safe_add( safe_add( _6609_rcodeptr,_6617_p ),(int)1 )] = _6615_codei;
                      }
                    }
                    else
                    {
                      {
                        if ((_6597_rncodeatom > (int)0))
                        {
                          {
                            _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 2;
                            _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = (int)0;
                            ++ _6615_codei;
                            _ptr__6611_ri32[safe_add( safe_add( _6609_rcodeptr,_6617_p ),(int)1 )] = _6615_codei;
                          }
                        }
                        {}
                      }
                    }
                    ++ _6617_p;
                  }
                }
                _ptr__6612_ri64[safe_add( _6605_rsp,_6616_pe )] = _ptr__6530_wi64[safe_add( _6523_sp1,_6619_i1 )];
                _ptr__6611_ri32[safe_add( safe_add( _6604_rptr,_6616_pe ),(int)1 )] = _6617_p;
                ++ _6616_pe;
                ++ _6619_i1;
                ++ _6618_i2;
              }
            }
          }
        }
        while ( (_6619_i1 < _6518_nelem1) )
        {
          {
            int32_t _12222_ = _ptr__6529_wi32[safe_add( _6522_ptr1,_6619_i1 )];
            int32_t _12223_ = _ptr__6529_wi32[safe_add( safe_add( _6522_ptr1,_6619_i1 ),(int)1 )];
            for (int32_t _6628_j = _12222_; _6628_j < _12223_; ++_6628_j)
            {
              {
                _ptr__6612_ri64[safe_add( _6606_rnidxs,_6617_p )] = _ptr__6530_wi64[safe_add( _6524_nidxs1,_6628_j )];
                _ptr__6613_rf64[safe_add( _6607_rcof,_6617_p )] = (m1 * _ptr__6531_wf64[safe_add( _6525_cof1,_6628_j )]);
                if ((_6520_ncodeatom1 > (int)0))
                {
                  {
                    int32_t _12224_ = _ptr__6529_wi32[safe_add( _6527_codeptr1,_6628_j )];
                    int32_t _12225_ = _ptr__6529_wi32[safe_add( safe_add( _6527_codeptr1,_6628_j ),(int)1 )];
                    for (int32_t _6629_k = _12224_; _6629_k < _12225_; ++_6629_k)
                    {
                      {
                        _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = _ptr__6529_wi32[safe_add( _6526_code1,_6629_k )];
                        _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = _ptr__6531_wf64[safe_add( _6528_cconst1,_6629_k )];
                        ++ _6615_codei;
                      }
                    }
                    _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 2;
                    _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = m1;
                    ++ _6615_codei;
                    _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 5;
                    ++ _6615_codei;
                    _ptr__6611_ri32[safe_add( safe_add( _6609_rcodeptr,_6617_p ),(int)1 )] = _6615_codei;
                  }
                }
                else
                {
                  {
                    if ((_6597_rncodeatom > (int)0))
                    {
                      {
                        _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 2;
                        _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = (int)0;
                        ++ _6615_codei;
                        _ptr__6611_ri32[safe_add( safe_add( _6609_rcodeptr,_6617_p ),(int)1 )] = _6615_codei;
                      }
                    }
                    {}
                  }
                }
                ++ _6617_p;
              }
            }
            _ptr__6612_ri64[safe_add( _6605_rsp,_6616_pe )] = _ptr__6530_wi64[safe_add( _6523_sp1,_6619_i1 )];
            _ptr__6611_ri32[safe_add( safe_add( _6604_rptr,_6616_pe ),(int)1 )] = _6617_p;
            ++ _6616_pe;
            ++ _6619_i1;
          }
        }
        while ( (_6618_i2 < _6505_nelem2) )
        {
          {
            int32_t _12226_ = _ptr__6529_wi32[safe_add( _6509_ptr2,_6618_i2 )];
            int32_t _12227_ = _ptr__6529_wi32[safe_add( safe_add( _6509_ptr2,_6618_i2 ),(int)1 )];
            for (int32_t _6630_j = _12226_; _6630_j < _12227_; ++_6630_j)
            {
              {
                _ptr__6612_ri64[safe_add( _6606_rnidxs,_6617_p )] = _ptr__6530_wi64[safe_add( _6511_nidxs2,_6630_j )];
                _ptr__6613_rf64[safe_add( _6607_rcof,_6617_p )] = (m2 * _ptr__6531_wf64[safe_add( _6512_cof2,_6630_j )]);
                if ((_6507_ncodeatom2 > (int)0))
                {
                  {
                    int32_t _12228_ = _ptr__6529_wi32[safe_add( _6514_codeptr2,_6630_j )];
                    int32_t _12229_ = _ptr__6529_wi32[safe_add( safe_add( _6514_codeptr2,_6630_j ),(int)1 )];
                    for (int32_t _6631_k = _12228_; _6631_k < _12229_; ++_6631_k)
                    {
                      {
                        _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = _ptr__6529_wi32[safe_add( _6513_code2,_6631_k )];
                        _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = _ptr__6531_wf64[safe_add( _6515_cconst2,_6631_k )];
                        ++ _6615_codei;
                      }
                    }
                    _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 2;
                    _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = m2;
                    ++ _6615_codei;
                    _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 5;
                    ++ _6615_codei;
                    _ptr__6611_ri32[safe_add( safe_add( _6609_rcodeptr,_6617_p ),(int)1 )] = _6615_codei;
                  }
                }
                else
                {
                  {
                    if ((_6597_rncodeatom > (int)0))
                    {
                      {
                        _ptr__6611_ri32[safe_add( _6608_rcode,_6615_codei )] = 2;
                        _ptr__6613_rf64[safe_add( _6610_rcconst,_6615_codei )] = (int)0;
                        ++ _6615_codei;
                        _ptr__6611_ri32[safe_add( safe_add( _6609_rcodeptr,_6617_p ),(int)1 )] = _6615_codei;
                      }
                    }
                    {}
                  }
                }
                ++ _6617_p;
              }
            }
            _ptr__6612_ri64[safe_add( _6605_rsp,_6616_pe )] = _ptr__6530_wi64[safe_add( _6510_sp2,_6618_i2 )];
            _ptr__6611_ri32[safe_add( safe_add( _6604_rptr,_6616_pe ),(int)1 )] = _6617_p;
            ++ _6616_pe;
            ++ _6618_i2;
          }
        }
      }
      if ((!_6602_rhassp))
      {
        {
          _6499_rs->popi64(_6595_rnelem);
        }
      }
      {}
    }
  }
}
// End mosek.fusion.ExprAdd.eval

// Begin mosek.fusion.ExprAdd.compress_when_caching
// Method mosek.fusion.ExprAdd.compress_when_caching @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:846:6-65
bool mosek::fusion::ExprAdd :: compress_when_caching() { return mosek::fusion::p_ExprAdd::_get_impl(this)->compress_when_caching(); }
bool mosek::fusion::p_ExprAdd::compress_when_caching()
{
  return true;
}
// End mosek.fusion.ExprAdd.compress_when_caching

// Begin mosek.fusion.ExprAdd.toString
// Method mosek.fusion.ExprAdd.toString @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:842:6-844:7
std::string mosek::fusion::ExprAdd :: toString() { return mosek::fusion::p_ExprAdd::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprAdd::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprAdd("))->__mosek_2fusion_2Utils_2StringBuffer__a(e1->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(e2->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("; "))->__mosek_2fusion_2Utils_2StringBuffer__a(m1)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(m2)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprAdd.toString

void mosek::fusion::p_ExprAdd::destroy()
{
  e2.reset();
  e1.reset();
}
void mosek::fusion::ExprAdd::destroy() { mosek::fusion::p_ExprAdd::_get_impl(this)->destroy(); }
// } class ExprAdd
// class ExprWSum { // @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:369:4-833:5
mosek::fusion::ExprWSum::ExprWSum(mosek::fusion::p_ExprWSum *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprWSum()" << this << std::endl; */ }
mosek::fusion::ExprWSum::~ExprWSum() {  /* std::cout << "~ExprWSum()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprWSum::p_ExprWSum
  (::mosek::fusion::ExprWSum * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprWSum.ctor @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:386:6-407:7
mosek::fusion::ExprWSum::t mosek::fusion::p_ExprWSum::_new_ExprWSum
  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _6632_es,
    std::shared_ptr< monty::ndarray< double,1 > > _6633_w)
{ return new mosek::fusion::ExprWSum(_6632_es,_6633_w); }
mosek::fusion::ExprWSum::ExprWSum
  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _6632_es,
    std::shared_ptr< monty::ndarray< double,1 > > _6633_w) : 
   ExprWSum(new mosek::fusion::p_ExprWSum(this))
{ mosek::fusion::p_ExprWSum::_get_impl(this)->_initialize(_6632_es,_6633_w); }
void mosek::fusion::p_ExprWSum::_initialize  (std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _6632_es,
    std::shared_ptr< monty::ndarray< double,1 > > _6633_w)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__6633_w(_6633_w ? _6633_w->raw() : nullptr, _6633_w ? _6633_w->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(::mosek::fusion::p_BaseExpression::modelFrom(_6632_es),((*_6632_es)((int)0))->getShape());
    if (((int)((_6633_w)->size(0)) != (int)((_6632_es)->size(0))))
    {
      {
        throw ::mosek::fusion::LengthError(std::string ("Mismatching weights and expressions array lengths"));
      }
    }
    {}
    mosek::fusion::p_ExprWSum::_get_impl(::mosek::fusion::ExprWSum::t(_pubthis))->w = ::mosek::fusion::Utils::Tools::arraycopy(_6633_w);
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6634_shape = ((*_6632_es)((int)0))->getShape();
    _checked_ptr_1<int32_t> _ptr__6634_shape(_6634_shape ? _6634_shape->raw() : nullptr,_6634_shape ? _6634_shape->size(0) : 0);
    int32_t _6635_nd = (int)((_6634_shape)->size(0));
    int32_t _12230_ = (int)1;
    int32_t _12231_ = (int)((_6632_es)->size(0));
    for (int32_t _6636_i = _12230_; _6636_i < _12231_; ++_6636_i)
    {
      {
        std::shared_ptr< monty::ndarray< int32_t,1 > > _6637_eshape = ((*_6632_es)(_6636_i))->getShape();
        _checked_ptr_1<int32_t> _ptr__6637_eshape(_6637_eshape ? _6637_eshape->raw() : nullptr,_6637_eshape ? _6637_eshape->size(0) : 0);
        if ((_6635_nd != (int)((_6637_eshape)->size(0))))
        {
          {
            throw ::mosek::fusion::DimensionError(std::string ("Mismatching expression shapes"));
          }
        }
        else
        {
          {
            int32_t _12232_ = (int)0;
            int32_t _12233_ = _6635_nd;
            for (int32_t _6638_j = _12232_; _6638_j < _12233_; ++_6638_j)
            {
              {
                if ((_ptr__6634_shape[_6638_j] != _ptr__6637_eshape[_6638_j]))
                {
                  {
                    throw ::mosek::fusion::DimensionError(std::string ("Mismatching expression shapes"));
                  }
                }
                {}
              }
            }
          }
        }
      }
    }
    std::vector<monty::rc_ptr< ::mosek::fusion::Expression >> _12234_;
    for (int32_t _6639_i = (int)0, _12235_ = (int)((_6632_es)->size(0)); _6639_i < _12235_ ; ++_6639_i)
    {
      _12234_.push_back(((*_6632_es)(_6639_i)));
    }
    auto _12236_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >(monty::shape(_12234_.size()),_12234_.begin(),_12234_.end()));
    mosek::fusion::p_ExprWSum::_get_impl(::mosek::fusion::ExprWSum::t(_pubthis))->es = _12236_;
  }
}
// mosek.fusion.ExprWSum.ctor

// Begin mosek.fusion.ExprWSum.eval
// Method mosek.fusion.ExprWSum.eval @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:409:6-706:7
void mosek::fusion::ExprWSum :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6640_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6641_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6642_xs,bool _6643_cache_eval) { mosek::fusion::p_ExprWSum::_get_impl(this)->eval(_6640_rs,_6641_ws,_6642_xs,_6643_cache_eval); }
void mosek::fusion::p_ExprWSum::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6640_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6641_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6642_xs,bool _6643_cache_eval)
{
  int32_t _6644_n = (int)((es)->size(0));
  int32_t _12237_ = (int)0;
  int32_t _12238_ = _6644_n;
  for (int32_t _6645_i = _12237_; _6645_i < _12238_; ++_6645_i)
  {
    {
      ((*es)(_6645_i))->recursive_eval(_6641_ws,_6640_rs,_6642_xs,_6643_cache_eval);
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6646_nd = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
  _checked_ptr_1<int32_t> _ptr__6646_nd(_6646_nd ? _6646_nd->raw() : nullptr,_6646_nd ? _6646_nd->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6647_nelem = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
  _checked_ptr_1<int32_t> _ptr__6647_nelem(_6647_nelem ? _6647_nelem->raw() : nullptr,_6647_nelem ? _6647_nelem->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6648_nnz = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
  _checked_ptr_1<int32_t> _ptr__6648_nnz(_6648_nnz ? _6648_nnz->raw() : nullptr,_6648_nnz ? _6648_nnz->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6649_ncodeatom = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
  _checked_ptr_1<int32_t> _ptr__6649_ncodeatom(_6649_ncodeatom ? _6649_ncodeatom->raw() : nullptr,_6649_ncodeatom ? _6649_ncodeatom->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6650_ptr_base = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
  _checked_ptr_1<int32_t> _ptr__6650_ptr_base(_6650_ptr_base ? _6650_ptr_base->raw() : nullptr,_6650_ptr_base ? _6650_ptr_base->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6651_nidxs_base = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
  _checked_ptr_1<int32_t> _ptr__6651_nidxs_base(_6651_nidxs_base ? _6651_nidxs_base->raw() : nullptr,_6651_nidxs_base ? _6651_nidxs_base->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6652_sp_base = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
  _checked_ptr_1<int32_t> _ptr__6652_sp_base(_6652_sp_base ? _6652_sp_base->raw() : nullptr,_6652_sp_base ? _6652_sp_base->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6653_cof_base = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
  _checked_ptr_1<int32_t> _ptr__6653_cof_base(_6653_cof_base ? _6653_cof_base->raw() : nullptr,_6653_cof_base ? _6653_cof_base->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6654_shape_base = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
  _checked_ptr_1<int32_t> _ptr__6654_shape_base(_6654_shape_base ? _6654_shape_base->raw() : nullptr,_6654_shape_base ? _6654_shape_base->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6655_code = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
  _checked_ptr_1<int32_t> _ptr__6655_code(_6655_code ? _6655_code->raw() : nullptr,_6655_code ? _6655_code->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6656_codeptr = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
  _checked_ptr_1<int32_t> _ptr__6656_codeptr(_6656_codeptr ? _6656_codeptr->raw() : nullptr,_6656_codeptr ? _6656_codeptr->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6657_cconst = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
  _checked_ptr_1<int32_t> _ptr__6657_cconst(_6657_cconst ? _6657_cconst->raw() : nullptr,_6657_cconst ? _6657_cconst->size(0) : 0);
  std::shared_ptr< monty::ndarray< bool,1 > > _6658_hassp = std::shared_ptr< monty::ndarray< bool,1 > >(new monty::ndarray< bool,1 >(monty::shape(_6644_n)));
  int32_t _12239_ = (int)0;
  int32_t _12240_ = _6644_n;
  for (int32_t _6659_i = _12239_; _6659_i < _12240_; ++_6659_i)
  {
    {
      _6641_ws->pop_expr();
      _ptr__6646_nd[((_6644_n - (int)1) - _6659_i)] = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->nd;
      _ptr__6647_nelem[((_6644_n - (int)1) - _6659_i)] = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->nelem;
      _ptr__6648_nnz[((_6644_n - (int)1) - _6659_i)] = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->nnz;
      _ptr__6649_ncodeatom[((_6644_n - (int)1) - _6659_i)] = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->ncodeatom;
      _ptr__6650_ptr_base[((_6644_n - (int)1) - _6659_i)] = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->ptr_base;
      _ptr__6652_sp_base[((_6644_n - (int)1) - _6659_i)] = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->sp_base;
      _ptr__6651_nidxs_base[((_6644_n - (int)1) - _6659_i)] = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->nidxs_base;
      _ptr__6653_cof_base[((_6644_n - (int)1) - _6659_i)] = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->cof_base;
      _ptr__6654_shape_base[((_6644_n - (int)1) - _6659_i)] = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->shape_base;
      _ptr__6655_code[((_6644_n - (int)1) - _6659_i)] = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->code_base;
      _ptr__6656_codeptr[((_6644_n - (int)1) - _6659_i)] = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->codeptr_base;
      _ptr__6657_cconst[((_6644_n - (int)1) - _6659_i)] = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->cconst_base;
      ((*_6658_hassp)(((_6644_n - (int)1) - _6659_i))) = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->hassp;
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6660_wi32 = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__6660_wi32(_6660_wi32 ? _6660_wi32->raw() : nullptr,_6660_wi32 ? _6660_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6661_wi64 = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__6661_wi64(_6661_wi64 ? _6661_wi64->raw() : nullptr,_6661_wi64 ? _6661_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6662_wf64 = mosek::fusion::p_WorkStack::_get_impl(_6641_ws)->f64;
  _checked_ptr_1<double> _ptr__6662_wf64(_6662_wf64 ? _6662_wf64->raw() : nullptr,_6662_wf64 ? _6662_wf64->size(0) : 0);
  {
    bool _6663_ok = true;
    int32_t _12241_ = (int)1;
    int32_t _12242_ = _6644_n;
    for (int32_t _6664_i = _12241_; _6664_i < _12242_; ++_6664_i)
    {
      {
        _6663_ok = (_6663_ok && (_ptr__6646_nd[(int)0] == _ptr__6646_nd[_6664_i]));
        int32_t _12243_ = (int)0;
        int32_t _12244_ = _ptr__6646_nd[(int)0];
        for (int32_t _6665_j = _12243_; _6665_j < _12244_; ++_6665_j)
        {
          {
            _6663_ok = (_6663_ok && (_ptr__6660_wi32[safe_add( _ptr__6654_shape_base[(int)0],_6665_j )] == _ptr__6660_wi32[safe_add( _ptr__6654_shape_base[_6664_i],_6665_j )]));
          }
        }
      }
    }
    if ((!_6663_ok))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
      }
    }
    {}
  }
  std::vector<int32_t> _12245_;
  for (int32_t _6667_j = (int)0, _12246_ = _ptr__6646_nd[(int)0]; _6667_j < _12246_ ; ++_6667_j)
  {
    _12245_.push_back(_ptr__6660_wi32[safe_add( _ptr__6654_shape_base[(int)0],_6667_j )]);
  }
  auto _12247_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12245_.size()),_12245_.begin(),_12245_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6666_wshape = _12247_;
  _checked_ptr_1<int32_t> _ptr__6666_wshape(_6666_wshape ? _6666_wshape->raw() : nullptr,_6666_wshape ? _6666_wshape->size(0) : 0);
  bool _6668_anydense = false;
  int32_t _12248_ = (int)0;
  int32_t _12249_ = _6644_n;
  for (int32_t _6669_i = _12248_; _6669_i < _12249_; ++_6669_i)
  {
    {
      if ((!((*_6658_hassp)(_6669_i))))
      {
        {
          _6668_anydense = true;
        }
      }
      {}
    }
  }
  bool _6670_anycodeatom = false;
  int32_t _12250_ = (int)0;
  int32_t _12251_ = _6644_n;
  for (int32_t _6671_i = _12250_; _6671_i < _12251_; ++_6671_i)
  {
    {
      if ((_ptr__6649_ncodeatom[_6671_i] > (int)0))
      {
        {
          _6670_anycodeatom = true;
        }
      }
      {}
    }
  }
  int32_t _6672_rncodeatom = (int)0;
  int32_t _6673_rnelem = (int)0;
  int32_t _6674_rnnz = (int)0;
  if (_6668_anydense)
  {
    {
      _6673_rnelem = (int32_t)::mosek::fusion::p_Set::size(_6666_wshape);
      int32_t _12252_ = (int)0;
      int32_t _12253_ = _6644_n;
      for (int32_t _6675_i = _12252_; _6675_i < _12253_; ++_6675_i)
      {
        {
          _6674_rnnz += _ptr__6648_nnz[_6675_i];
          if (_6670_anycodeatom)
          {
            {
              int32_t _12254_;
              bool _12255_ = (_ptr__6649_ncodeatom[_6675_i] > (int)0);
              if (_12255_)
              {
                _12254_ = safe_add( _ptr__6649_ncodeatom[_6675_i],safe_mul( (int)2,_ptr__6648_nnz[_6675_i] ) );
              }
              else
              {
                _12254_ = _ptr__6648_nnz[_6675_i];
              }
              _6672_rncodeatom += _12254_;
            }
          }
          {}
        }
      }
    }
  }
  else
  {
    {
      bool _6676_done = false;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _6677_ii = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
      _checked_ptr_1<int32_t> _ptr__6677_ii(_6677_ii ? _6677_ii->raw() : nullptr,_6677_ii ? _6677_ii->size(0) : 0);
      int32_t _12256_ = (int)0;
      int32_t _12257_ = _6644_n;
      for (int32_t _6678_i = _12256_; _6678_i < _12257_; ++_6678_i)
      {
        {
          _6674_rnnz += _ptr__6648_nnz[_6678_i];
          if (_6670_anycodeatom)
          {
            {
              int32_t _12258_;
              bool _12259_ = (_ptr__6649_ncodeatom[_6678_i] > (int)0);
              if (_12259_)
              {
                _12258_ = safe_add( _ptr__6649_ncodeatom[_6678_i],safe_mul( (int)2,_ptr__6648_nnz[_6678_i] ) );
              }
              else
              {
                _12258_ = _ptr__6648_nnz[_6678_i];
              }
              _6672_rncodeatom += _12258_;
            }
          }
          {}
        }
      }
      while ( (!_6676_done) )
      {
        {
          int64_t _6679_min_i = (-(int)1);
          int32_t _12260_ = (int)0;
          int32_t _12261_ = _6644_n;
          for (int32_t _6680_j = _12260_; _6680_j < _12261_; ++_6680_j)
          {
            {
              if (((_ptr__6677_ii[_6680_j] < _ptr__6647_nelem[_6680_j]) && ((_6679_min_i < (int)0) || (_ptr__6661_wi64[safe_add( _ptr__6652_sp_base[_6680_j],_ptr__6677_ii[_6680_j] )] < _6679_min_i))))
              {
                {
                  _6679_min_i = _ptr__6661_wi64[safe_add( _ptr__6652_sp_base[_6680_j],_ptr__6677_ii[_6680_j] )];
                }
              }
              {}
            }
          }
          if ((_6679_min_i < (int)0))
          {
            {
              _6676_done = true;
            }
          }
          else
          {
            {
              int32_t _12262_ = (int)0;
              int32_t _12263_ = _6644_n;
              for (int32_t _6681_j = _12262_; _6681_j < _12263_; ++_6681_j)
              {
                {
                  if (((_ptr__6677_ii[_6681_j] < _ptr__6647_nelem[_6681_j]) && (_6679_min_i == _ptr__6661_wi64[safe_add( _ptr__6652_sp_base[_6681_j],_ptr__6677_ii[_6681_j] )])))
                  {
                    {
                      ++ _ptr__6677_ii[_6681_j];
                    }
                  }
                  {}
                }
              }
              ++ _6673_rnelem;
            }
          }
        }
      }
    }
  }
  _6640_rs->alloc_expr(_ptr__6646_nd[(int)0],_6673_rnelem,_6674_rnnz,(!_6668_anydense),_6672_rncodeatom);
  int32_t _6682_rptr_base = mosek::fusion::p_WorkStack::_get_impl(_6640_rs)->ptr_base;
  int32_t _6683_rnidxs_base = mosek::fusion::p_WorkStack::_get_impl(_6640_rs)->nidxs_base;
  int32_t _6684_rsp_base = mosek::fusion::p_WorkStack::_get_impl(_6640_rs)->sp_base;
  int32_t _6685_rshape = mosek::fusion::p_WorkStack::_get_impl(_6640_rs)->shape_base;
  int32_t _6686_rcof_base = mosek::fusion::p_WorkStack::_get_impl(_6640_rs)->cof_base;
  int32_t _6687_rcode = mosek::fusion::p_WorkStack::_get_impl(_6640_rs)->code_base;
  int32_t _6688_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_6640_rs)->codeptr_base;
  int32_t _6689_rcconst = mosek::fusion::p_WorkStack::_get_impl(_6640_rs)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6690_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6640_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__6690_ri32(_6690_ri32 ? _6690_ri32->raw() : nullptr,_6690_ri32 ? _6690_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6691_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6640_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__6691_ri64(_6691_ri64 ? _6691_ri64->raw() : nullptr,_6691_ri64 ? _6691_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6692_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6640_rs)->f64;
  _checked_ptr_1<double> _ptr__6692_rf64(_6692_rf64 ? _6692_rf64->raw() : nullptr,_6692_rf64 ? _6692_rf64->size(0) : 0);
  int32_t _12264_ = (int)0;
  int32_t _12265_ = _ptr__6646_nd[(int)0];
  for (int32_t _6693_i = _12264_; _6693_i < _12265_; ++_6693_i)
  {
    {
      _ptr__6690_ri32[safe_add( _6685_rshape,_6693_i )] = _ptr__6660_wi32[safe_add( _ptr__6654_shape_base[(int)0],_6693_i )];
    }
  }
  if ((_6672_rncodeatom > (int)0))
  {
    {
      _ptr__6690_ri32[_6688_rcodeptr] = (int)0;
    }
  }
  {}
  int32_t _12266_ = (int)0;
  int32_t _12267_ = safe_add( _6673_rnelem,(int)1 );
  for (int32_t _6694_i = _12266_; _6694_i < _12267_; ++_6694_i)
  {
    {
      _ptr__6690_ri32[safe_add( _6682_rptr_base,_6694_i )] = (int)0;
    }
  }
  if (_6668_anydense)
  {
    {
      int32_t _6695_xcodeptr = (-(int)9999);
      if ((_6672_rncodeatom > (int)0))
      {
        {
          _6695_xcodeptr = _6642_xs->alloci32(safe_add( _6673_rnelem,(int)1 ));
        }
      }
      {}
      std::shared_ptr< monty::ndarray< int32_t,1 > > _6696_xi32 = mosek::fusion::p_WorkStack::_get_impl(_6642_xs)->i32;
      _checked_ptr_1<int32_t> _ptr__6696_xi32(_6696_xi32 ? _6696_xi32->raw() : nullptr,_6696_xi32 ? _6696_xi32->size(0) : 0);
      if ((_6672_rncodeatom > (int)0))
      {
        {
          int32_t _12268_ = (int)0;
          int32_t _12269_ = safe_add( _6673_rnelem,(int)1 );
          for (int32_t _6697_i = _12268_; _6697_i < _12269_; ++_6697_i)
          {
            {
              _ptr__6696_xi32[safe_add( _6695_xcodeptr,_6697_i )] = (int)0;
            }
          }
        }
      }
      {}
      int32_t _12270_ = (int)0;
      int32_t _12271_ = _6644_n;
      for (int32_t _6698_i = _12270_; _6698_i < _12271_; ++_6698_i)
      {
        {
          if (((*_6658_hassp)(_6698_i)))
          {
            {
              int32_t _12272_ = (int)0;
              int32_t _12273_ = _ptr__6647_nelem[_6698_i];
              for (int32_t _6699_j = _12272_; _6699_j < _12273_; ++_6699_j)
              {
                {
                  _ptr__6690_ri32[safe_add( safe_add( _6682_rptr_base,_ptr__6661_wi64[safe_add( _ptr__6652_sp_base[_6698_i],_6699_j )] ),(int)1 )] += (_ptr__6660_wi32[safe_add( safe_add( _ptr__6650_ptr_base[_6698_i],_6699_j ),(int)1 )] - _ptr__6660_wi32[safe_add( _ptr__6650_ptr_base[_6698_i],_6699_j )]);
                }
              }
              if ((_ptr__6649_ncodeatom[_6698_i] > (int)0))
              {
                {
                  int32_t _12274_ = (int)0;
                  int32_t _12275_ = _ptr__6647_nelem[_6698_i];
                  for (int32_t _6700_j = _12274_; _6700_j < _12275_; ++_6700_j)
                  {
                    {
                      _ptr__6696_xi32[safe_add( safe_add( _6695_xcodeptr,_ptr__6661_wi64[safe_add( _ptr__6652_sp_base[_6698_i],_6700_j )] ),(int)1 )] += safe_add( (_ptr__6660_wi32[safe_add( _ptr__6656_codeptr[_6698_i],_ptr__6660_wi32[safe_add( safe_add( _ptr__6650_ptr_base[_6698_i],_6700_j ),(int)1 )] )] - _ptr__6660_wi32[safe_add( _ptr__6656_codeptr[_6698_i],_ptr__6660_wi32[safe_add( _ptr__6650_ptr_base[_6698_i],_6700_j )] )]),safe_mul( (int)2,(_ptr__6660_wi32[safe_add( safe_add( _ptr__6650_ptr_base[_6698_i],_6700_j ),(int)1 )] - _ptr__6660_wi32[safe_add( _ptr__6650_ptr_base[_6698_i],_6700_j )]) ) );
                    }
                  }
                }
              }
              else if(_6670_anycodeatom)
              {
                {
                  int32_t _12276_ = (int)0;
                  int32_t _12277_ = _ptr__6647_nelem[_6698_i];
                  for (int32_t _6701_j = _12276_; _6701_j < _12277_; ++_6701_j)
                  {
                    {
                      _ptr__6696_xi32[safe_add( safe_add( _6695_xcodeptr,_ptr__6661_wi64[safe_add( _ptr__6652_sp_base[_6698_i],_6701_j )] ),(int)1 )] += (int)1;
                    }
                  }
                }
              }
              {}
            }
          }
          else
          {
            {
              int32_t _12278_ = (int)0;
              int32_t _12279_ = _ptr__6647_nelem[_6698_i];
              for (int32_t _6702_j = _12278_; _6702_j < _12279_; ++_6702_j)
              {
                {
                  _ptr__6690_ri32[safe_add( safe_add( _6682_rptr_base,_6702_j ),(int)1 )] += (_ptr__6660_wi32[safe_add( safe_add( _ptr__6650_ptr_base[_6698_i],_6702_j ),(int)1 )] - _ptr__6660_wi32[safe_add( _ptr__6650_ptr_base[_6698_i],_6702_j )]);
                }
              }
              if ((_ptr__6649_ncodeatom[_6698_i] > (int)0))
              {
                {
                  int32_t _12280_ = (int)0;
                  int32_t _12281_ = _ptr__6647_nelem[_6698_i];
                  for (int32_t _6703_j = _12280_; _6703_j < _12281_; ++_6703_j)
                  {
                    {
                      _ptr__6696_xi32[safe_add( safe_add( _6695_xcodeptr,_6703_j ),(int)1 )] += safe_add( (_ptr__6660_wi32[safe_add( _ptr__6656_codeptr[_6698_i],_ptr__6660_wi32[safe_add( safe_add( _ptr__6650_ptr_base[_6698_i],_6703_j ),(int)1 )] )] - _ptr__6660_wi32[safe_add( _ptr__6656_codeptr[_6698_i],_ptr__6660_wi32[safe_add( _ptr__6650_ptr_base[_6698_i],_6703_j )] )]),safe_mul( (int)2,(_ptr__6660_wi32[safe_add( safe_add( _ptr__6650_ptr_base[_6698_i],_6703_j ),(int)1 )] - _ptr__6660_wi32[safe_add( _ptr__6650_ptr_base[_6698_i],_6703_j )]) ) );
                    }
                  }
                }
              }
              else if(_6670_anycodeatom)
              {
                {
                  int32_t _12282_ = (int)0;
                  int32_t _12283_ = _ptr__6647_nelem[_6698_i];
                  for (int32_t _6704_j = _12282_; _6704_j < _12283_; ++_6704_j)
                  {
                    {
                      _ptr__6696_xi32[safe_add( safe_add( _6695_xcodeptr,_6704_j ),(int)1 )] += (_ptr__6660_wi32[safe_add( safe_add( _ptr__6650_ptr_base[_6698_i],_6704_j ),(int)1 )] - _ptr__6660_wi32[safe_add( _ptr__6650_ptr_base[_6698_i],_6704_j )]);
                    }
                  }
                }
              }
              {}
            }
          }
        }
      }
      int32_t _12284_ = (int)0;
      int32_t _12285_ = _6673_rnelem;
      for (int32_t _6705_i = _12284_; _6705_i < _12285_; ++_6705_i)
      {
        {
          _ptr__6690_ri32[safe_add( safe_add( _6682_rptr_base,_6705_i ),(int)1 )] += _ptr__6690_ri32[safe_add( _6682_rptr_base,_6705_i )];
        }
      }
      if ((_6672_rncodeatom > (int)0))
      {
        {
          int32_t _12286_ = (int)0;
          int32_t _12287_ = _6673_rnelem;
          for (int32_t _6706_i = _12286_; _6706_i < _12287_; ++_6706_i)
          {
            {
              _ptr__6696_xi32[safe_add( safe_add( _6695_xcodeptr,_6706_i ),(int)1 )] += _ptr__6696_xi32[safe_add( _6695_xcodeptr,_6706_i )];
            }
          }
        }
      }
      {}
      int32_t _12288_ = (int)0;
      int32_t _12289_ = _6644_n;
      for (int32_t _6707_i = _12288_; _6707_i < _12289_; ++_6707_i)
      {
        {
          if (((*_6658_hassp)(_6707_i)))
          {
            {
              int32_t _12290_ = (int)0;
              int32_t _12291_ = _ptr__6647_nelem[_6707_i];
              for (int32_t _6708_j = _12290_; _6708_j < _12291_; ++_6708_j)
              {
                {
                  int32_t _6709_p0 = _ptr__6660_wi32[safe_add( _ptr__6650_ptr_base[_6707_i],_6708_j )];
                  int32_t _6710_p1 = _ptr__6660_wi32[safe_add( safe_add( _ptr__6650_ptr_base[_6707_i],_6708_j ),(int)1 )];
                  int64_t _6711_rii = _ptr__6661_wi64[safe_add( _ptr__6652_sp_base[_6707_i],_6708_j )];
                  int32_t _6712_b = _ptr__6690_ri32[safe_add( _6682_rptr_base,_6711_rii )];
                  int32_t _12292_;
                  bool _12293_ = _6670_anycodeatom;
                  if (_12293_)
                  {
                    _12292_ = _ptr__6696_xi32[safe_add( _6695_xcodeptr,_6711_rii )];
                  }
                  else
                  {
                    _12292_ = (-(int)10000);
                  }
                  int32_t _6713_codei = _12292_;
                  int32_t _12294_ = _6709_p0;
                  int32_t _12295_ = _6710_p1;
                  for (int32_t _6714_k = _12294_; _6714_k < _12295_; ++_6714_k)
                  {
                    {
                      _ptr__6691_ri64[safe_add( _6683_rnidxs_base,_6712_b )] = _ptr__6661_wi64[safe_add( _ptr__6651_nidxs_base[_6707_i],_6714_k )];
                      _ptr__6692_rf64[safe_add( _6686_rcof_base,_6712_b )] = (((*w)(_6707_i)) * _ptr__6662_wf64[safe_add( _ptr__6653_cof_base[_6707_i],_6714_k )]);
                      if (_6670_anycodeatom)
                      {
                        {
                          if ((_ptr__6649_ncodeatom[_6707_i] > (int)0))
                          {
                            {
                              int32_t _12296_ = _ptr__6660_wi32[safe_add( _ptr__6656_codeptr[_6707_i],_6714_k )];
                              int32_t _12297_ = _ptr__6660_wi32[safe_add( safe_add( _ptr__6656_codeptr[_6707_i],_6714_k ),(int)1 )];
                              for (int32_t _6715_l = _12296_; _6715_l < _12297_; ++_6715_l)
                              {
                                {
                                  _ptr__6690_ri32[safe_add( _6687_rcode,_6713_codei )] = _ptr__6660_wi32[safe_add( _ptr__6655_code[_6707_i],_6715_l )];
                                  _ptr__6692_rf64[safe_add( _6689_rcconst,_6713_codei )] = _ptr__6662_wf64[safe_add( _ptr__6657_cconst[_6707_i],_6715_l )];
                                  ++ _6713_codei;
                                }
                              }
                              _ptr__6690_ri32[safe_add( _6687_rcode,_6713_codei )] = 2;
                              _ptr__6692_rf64[safe_add( _6689_rcconst,_6713_codei )] = ((*w)(_6707_i));
                              ++ _6713_codei;
                              _ptr__6690_ri32[safe_add( _6687_rcode,_6713_codei )] = 5;
                              ++ _6713_codei;
                            }
                          }
                          else
                          {
                            {
                              _ptr__6690_ri32[safe_add( _6687_rcode,_6713_codei )] = 2;
                              _ptr__6692_rf64[safe_add( _6689_rcconst,_6713_codei )] = 0.0;
                              ++ _6713_codei;
                            }
                          }
                          _ptr__6690_ri32[safe_add( safe_add( _6688_rcodeptr,_6712_b ),(int)1 )] = _6713_codei;
                        }
                      }
                      {}
                      ++ _6712_b;
                    }
                  }
                  if (_6670_anycodeatom)
                  {
                    {
                      _ptr__6696_xi32[safe_add( _6695_xcodeptr,_6711_rii )] = _6713_codei;
                    }
                  }
                  {}
                  _ptr__6690_ri32[safe_add( _6682_rptr_base,_6711_rii )] += (_6710_p1 - _6709_p0);
                }
              }
            }
          }
          else
          {
            {
              int32_t _12298_ = (int)0;
              int32_t _12299_ = _ptr__6647_nelem[_6707_i];
              for (int32_t _6716_j = _12298_; _6716_j < _12299_; ++_6716_j)
              {
                {
                  int32_t _6717_p0 = _ptr__6660_wi32[safe_add( _ptr__6650_ptr_base[_6707_i],_6716_j )];
                  int32_t _6718_p1 = _ptr__6660_wi32[safe_add( safe_add( _ptr__6650_ptr_base[_6707_i],_6716_j ),(int)1 )];
                  int32_t _6719_rii = _6716_j;
                  int32_t _6720_b = _ptr__6690_ri32[safe_add( _6682_rptr_base,_6719_rii )];
                  int32_t _12300_;
                  bool _12301_ = _6670_anycodeatom;
                  if (_12301_)
                  {
                    _12300_ = _ptr__6696_xi32[safe_add( _6695_xcodeptr,_6719_rii )];
                  }
                  else
                  {
                    _12300_ = (-(int)10000);
                  }
                  int32_t _6721_codei = _12300_;
                  int32_t _12302_ = _6717_p0;
                  int32_t _12303_ = _6718_p1;
                  for (int32_t _6722_k = _12302_; _6722_k < _12303_; ++_6722_k)
                  {
                    {
                      _ptr__6691_ri64[safe_add( _6683_rnidxs_base,_6720_b )] = _ptr__6661_wi64[safe_add( _ptr__6651_nidxs_base[_6707_i],_6722_k )];
                      _ptr__6692_rf64[safe_add( _6686_rcof_base,_6720_b )] = (((*w)(_6707_i)) * _ptr__6662_wf64[safe_add( _ptr__6653_cof_base[_6707_i],_6722_k )]);
                      if (_6670_anycodeatom)
                      {
                        {
                          if ((_ptr__6649_ncodeatom[_6707_i] > (int)0))
                          {
                            {
                              int32_t _12304_ = _ptr__6660_wi32[safe_add( _ptr__6656_codeptr[_6707_i],_6722_k )];
                              int32_t _12305_ = _ptr__6660_wi32[safe_add( safe_add( _ptr__6656_codeptr[_6707_i],_6722_k ),(int)1 )];
                              for (int32_t _6723_l = _12304_; _6723_l < _12305_; ++_6723_l)
                              {
                                {
                                  _ptr__6690_ri32[safe_add( _6687_rcode,_6721_codei )] = _ptr__6660_wi32[safe_add( _ptr__6655_code[_6707_i],_6723_l )];
                                  _ptr__6692_rf64[safe_add( _6689_rcconst,_6721_codei )] = _ptr__6662_wf64[safe_add( _ptr__6657_cconst[_6707_i],_6723_l )];
                                  ++ _6721_codei;
                                }
                              }
                              _ptr__6690_ri32[safe_add( _6687_rcode,_6721_codei )] = 2;
                              _ptr__6692_rf64[safe_add( _6689_rcconst,_6721_codei )] = ((*w)(_6707_i));
                              ++ _6721_codei;
                              _ptr__6690_ri32[safe_add( _6687_rcode,_6721_codei )] = 5;
                              ++ _6721_codei;
                            }
                          }
                          else
                          {
                            {
                              _ptr__6690_ri32[safe_add( _6687_rcode,_6721_codei )] = 2;
                              _ptr__6692_rf64[safe_add( _6689_rcconst,_6721_codei )] = 0.0;
                              ++ _6721_codei;
                            }
                          }
                          _ptr__6690_ri32[safe_add( safe_add( _6688_rcodeptr,_6720_b ),(int)1 )] = _6721_codei;
                        }
                      }
                      {}
                      ++ _6720_b;
                    }
                  }
                  if (_6670_anycodeatom)
                  {
                    {
                      _ptr__6696_xi32[safe_add( _6695_xcodeptr,_6719_rii )] = _6721_codei;
                    }
                  }
                  {}
                  _ptr__6690_ri32[safe_add( _6682_rptr_base,_6719_rii )] += (_6718_p1 - _6717_p0);
                }
              }
            }
          }
        }
      }
      int32_t _12306_ = (int)0;
      int32_t _12307_ = _6673_rnelem;
      for (int32_t _6724_i = _12306_; _6724_i < _12307_; ++_6724_i)
      {
        {
          _ptr__6690_ri32[(safe_add( _6682_rptr_base,_6673_rnelem ) - _6724_i)] = _ptr__6690_ri32[((safe_add( _6682_rptr_base,_6673_rnelem ) - _6724_i) - (int)1)];
        }
      }
      _ptr__6690_ri32[_6682_rptr_base] = (int)0;
    }
  }
  else
  {
    {
      bool _6725_done = false;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _6726_ii = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_6644_n)));
      _checked_ptr_1<int32_t> _ptr__6726_ii(_6726_ii ? _6726_ii->raw() : nullptr,_6726_ii ? _6726_ii->size(0) : 0);
      int32_t _6727_codei = (int)0;
      int32_t _6728_kelm = (int)0;
      int32_t _6729_knz = (int)0;
      while ( (!_6725_done) )
      {
        {
          int64_t _6730_idx = (-(int)1);
          int32_t _12308_ = (int)0;
          int32_t _12309_ = _6644_n;
          for (int32_t _6731_j = _12308_; _6731_j < _12309_; ++_6731_j)
          {
            {
              if (((_ptr__6726_ii[_6731_j] < _ptr__6647_nelem[_6731_j]) && ((_6730_idx < (int)0) || (_ptr__6661_wi64[safe_add( _ptr__6652_sp_base[_6731_j],_ptr__6726_ii[_6731_j] )] < _6730_idx))))
              {
                {
                  _6730_idx = _ptr__6661_wi64[safe_add( _ptr__6652_sp_base[_6731_j],_ptr__6726_ii[_6731_j] )];
                }
              }
              {}
            }
          }
          if ((_6730_idx < (int)0))
          {
            {
              _6725_done = true;
            }
          }
          else
          {
            {
              int32_t _12310_ = (int)0;
              int32_t _12311_ = _6644_n;
              for (int32_t _6732_j = _12310_; _6732_j < _12311_; ++_6732_j)
              {
                {
                  if (((_ptr__6726_ii[_6732_j] < _ptr__6647_nelem[_6732_j]) && (_6730_idx == _ptr__6661_wi64[safe_add( _ptr__6652_sp_base[_6732_j],_ptr__6726_ii[_6732_j] )])))
                  {
                    {
                      int32_t _12312_ = _ptr__6660_wi32[safe_add( _ptr__6650_ptr_base[_6732_j],_ptr__6726_ii[_6732_j] )];
                      int32_t _12313_ = _ptr__6660_wi32[safe_add( safe_add( _ptr__6650_ptr_base[_6732_j],_ptr__6726_ii[_6732_j] ),(int)1 )];
                      for (int32_t _6733_k = _12312_; _6733_k < _12313_; ++_6733_k)
                      {
                        {
                          _ptr__6691_ri64[safe_add( _6683_rnidxs_base,_6729_knz )] = _ptr__6661_wi64[safe_add( _ptr__6651_nidxs_base[_6732_j],_6733_k )];
                          _ptr__6692_rf64[safe_add( _6686_rcof_base,_6729_knz )] = (((*w)(_6732_j)) * _ptr__6662_wf64[safe_add( _ptr__6653_cof_base[_6732_j],_6733_k )]);
                          if (_6670_anycodeatom)
                          {
                            {
                              if ((_ptr__6649_ncodeatom[_6732_j] > (int)0))
                              {
                                {
                                  int32_t _12314_ = _ptr__6660_wi32[safe_add( _ptr__6656_codeptr[_6732_j],_6733_k )];
                                  int32_t _12315_ = _ptr__6660_wi32[safe_add( safe_add( _ptr__6656_codeptr[_6732_j],_6733_k ),(int)1 )];
                                  for (int32_t _6734_l = _12314_; _6734_l < _12315_; ++_6734_l)
                                  {
                                    {
                                      _ptr__6690_ri32[safe_add( _6687_rcode,_6727_codei )] = _ptr__6660_wi32[safe_add( _ptr__6655_code[_6732_j],_6734_l )];
                                      _ptr__6692_rf64[safe_add( _6689_rcconst,_6727_codei )] = _ptr__6662_wf64[safe_add( _ptr__6657_cconst[_6732_j],_6734_l )];
                                      ++ _6727_codei;
                                    }
                                  }
                                  _ptr__6690_ri32[safe_add( _6687_rcode,_6727_codei )] = 2;
                                  _ptr__6692_rf64[safe_add( _6689_rcconst,_6727_codei )] = ((*w)(_6732_j));
                                  ++ _6727_codei;
                                  _ptr__6690_ri32[safe_add( _6687_rcode,_6727_codei )] = 5;
                                  ++ _6727_codei;
                                }
                              }
                              else
                              {
                                {
                                  _ptr__6690_ri32[safe_add( _6687_rcode,_6727_codei )] = 2;
                                  _ptr__6692_rf64[safe_add( _6689_rcconst,_6727_codei )] = 0.0;
                                  ++ _6727_codei;
                                }
                              }
                              _ptr__6690_ri32[safe_add( safe_add( _6688_rcodeptr,_6729_knz ),(int)1 )] = _6727_codei;
                            }
                          }
                          {}
                          ++ _6729_knz;
                        }
                      }
                      ++ _ptr__6726_ii[_6732_j];
                    }
                  }
                  {}
                }
              }
              _ptr__6690_ri32[safe_add( safe_add( _6682_rptr_base,_6728_kelm ),(int)1 )] = _6729_knz;
              _ptr__6691_ri64[safe_add( _6684_rsp_base,_6728_kelm )] = _6730_idx;
            }
          }
          ++ _6728_kelm;
        }
      }
    }
  }
  _6642_xs->clear();
}
// End mosek.fusion.ExprWSum.eval

// Begin mosek.fusion.ExprWSum.compress_when_caching
// Method mosek.fusion.ExprWSum.compress_when_caching @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:384:6-65
bool mosek::fusion::ExprWSum :: compress_when_caching() { return mosek::fusion::p_ExprWSum::_get_impl(this)->compress_when_caching(); }
bool mosek::fusion::p_ExprWSum::compress_when_caching()
{
  return true;
}
// End mosek.fusion.ExprWSum.compress_when_caching

// Begin mosek.fusion.ExprWSum.toString
// Method mosek.fusion.ExprWSum.toString @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:373:6-382:7
std::string mosek::fusion::ExprWSum :: toString() { return mosek::fusion::p_ExprWSum::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprWSum::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _6735_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprWSum(["));
  _6735_sb->__mosek_2fusion_2Utils_2StringBuffer__a(((*es)((int)0))->toString());
  int32_t _12316_ = (int)1;
  int32_t _12317_ = (int)((es)->size(0));
  for (int32_t _6736_i = _12316_; _6736_i < _12317_; ++_6736_i)
  {
    {
      _6735_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*es)(_6736_i))->toString());
    }
  }
  _6735_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("])"));
  return _6735_sb->toString();
}
// End mosek.fusion.ExprWSum.toString

void mosek::fusion::p_ExprWSum::destroy()
{
  w.reset();
  es.reset();
}
void mosek::fusion::ExprWSum::destroy() { mosek::fusion::p_ExprWSum::_get_impl(this)->destroy(); }
// } class ExprWSum
// class ExprSumReduce { // @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:9:4-354:5
mosek::fusion::ExprSumReduce::ExprSumReduce(mosek::fusion::p_ExprSumReduce *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprSumReduce()" << this << std::endl; */ }
mosek::fusion::ExprSumReduce::~ExprSumReduce() {  /* std::cout << "~ExprSumReduce()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprSumReduce::p_ExprSumReduce
  (::mosek::fusion::ExprSumReduce * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprSumReduce.ctor @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:24:6-32:7
mosek::fusion::ExprSumReduce::t mosek::fusion::p_ExprSumReduce::_new_ExprSumReduce
  (int32_t _6737_dim,
    monty::rc_ptr< ::mosek::fusion::Expression > _6738_expr)
{ return new mosek::fusion::ExprSumReduce(_6737_dim,_6738_expr); }
mosek::fusion::ExprSumReduce::ExprSumReduce
  (int32_t _6737_dim,
    monty::rc_ptr< ::mosek::fusion::Expression > _6738_expr) : 
   ExprSumReduce(new mosek::fusion::p_ExprSumReduce(this))
{ mosek::fusion::p_ExprSumReduce::_get_impl(this)->_initialize(_6737_dim,_6738_expr); }
void mosek::fusion::p_ExprSumReduce::_initialize  (int32_t _6737_dim,
    monty::rc_ptr< ::mosek::fusion::Expression > _6738_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_6738_expr->__mosek_2fusion_2Expression__getModel(),::mosek::fusion::p_ExprSumReduce::computeShape(_6737_dim,_6738_expr->getShape()));
    mosek::fusion::p_ExprSumReduce::_get_impl(::mosek::fusion::ExprSumReduce::t(_pubthis))->expr = _6738_expr;
    mosek::fusion::p_ExprSumReduce::_get_impl(::mosek::fusion::ExprSumReduce::t(_pubthis))->dim = _6737_dim;
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6739_shape = _6738_expr->getShape();
    _checked_ptr_1<int32_t> _ptr__6739_shape(_6739_shape ? _6739_shape->raw() : nullptr,_6739_shape ? _6739_shape->size(0) : 0);
    if (((int)((_6739_shape)->size(0)) <= _6737_dim))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid summing dimension"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprSumReduce.ctor

// Begin mosek.fusion.ExprSumReduce.eval
// Method mosek.fusion.ExprSumReduce.eval @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:34:6-237:7
void mosek::fusion::ExprSumReduce :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6740_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6741_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6742_xs,bool _6743_cache_eval) { mosek::fusion::p_ExprSumReduce::_get_impl(this)->eval(_6740_rs,_6741_ws,_6742_xs,_6743_cache_eval); }
void mosek::fusion::p_ExprSumReduce::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6740_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6741_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6742_xs,bool _6743_cache_eval)
{
  expr->recursive_eval(_6741_ws,_6740_rs,_6742_xs,_6743_cache_eval);
  _6741_ws->pop_expr();
  int32_t _6744_nd = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->nd;
  int32_t _6745_shape_base = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->shape_base;
  int32_t _6746_nelem = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->nelem;
  int32_t _6747_nnz = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->nnz;
  int32_t _6748_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->ncodeatom;
  bool _6749_hassp = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->hassp;
  int32_t _6750_ptr_base = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->ptr_base;
  int32_t _6751_sp_base = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->sp_base;
  int32_t _6752_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->nidxs_base;
  int32_t _6753_cof_base = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->cof_base;
  int32_t _6754_code = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->code_base;
  int32_t _6755_codeptr = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->codeptr_base;
  int32_t _6756_cconst = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6757_wi32 = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__6757_wi32(_6757_wi32 ? _6757_wi32->raw() : nullptr,_6757_wi32 ? _6757_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6758_wi64 = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__6758_wi64(_6758_wi64 ? _6758_wi64->raw() : nullptr,_6758_wi64 ? _6758_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6759_wf64 = mosek::fusion::p_WorkStack::_get_impl(_6741_ws)->f64;
  _checked_ptr_1<double> _ptr__6759_wf64(_6759_wf64 ? _6759_wf64->raw() : nullptr,_6759_wf64 ? _6759_wf64->size(0) : 0);
  int32_t _6760_ptr = (int)99999;
  int32_t _6761_perm1 = (int)99999;
  int32_t _6762_perm2 = (int)99999;
  if (_6749_hassp)
  {
    {
      int32_t _6763_dimmax = (int)0;
      int32_t _12318_ = (int)0;
      int32_t _12319_ = _6744_nd;
      for (int32_t _6764_i = _12318_; _6764_i < _12319_; ++_6764_i)
      {
        {
          if ((_6763_dimmax < _ptr__6757_wi32[safe_add( _6745_shape_base,_6764_i )]))
          {
            {
              _6763_dimmax = _ptr__6757_wi32[safe_add( _6745_shape_base,_6764_i )];
            }
          }
          {}
        }
      }
      _6760_ptr = _6742_xs->alloci32(safe_add( _6763_dimmax,(int)1 ));
      _6761_perm1 = _6742_xs->alloci32(_6746_nelem);
      _6762_perm2 = _6742_xs->alloci32(_6746_nelem);
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6765_xi32 = mosek::fusion::p_WorkStack::_get_impl(_6742_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__6765_xi32(_6765_xi32 ? _6765_xi32->raw() : nullptr,_6765_xi32 ? _6765_xi32->size(0) : 0);
  if (_6749_hassp)
  {
    {
      int32_t _6766_curperm = _6761_perm1;
      int32_t _6767_tgtperm = _6762_perm2;
      int32_t _12320_ = (int)0;
      int32_t _12321_ = _6746_nelem;
      for (int32_t _6768_i = _12320_; _6768_i < _12321_; ++_6768_i)
      {
        {
          _ptr__6765_xi32[safe_add( _6766_curperm,_6768_i )] = _6768_i;
        }
      }
      if ((dim < (_6744_nd - (int)1)))
      {
        {
          std::shared_ptr< monty::ndarray< int64_t,1 > > _6769_s = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_6744_nd)));
          _checked_ptr_1<int64_t> _ptr__6769_s(_6769_s ? _6769_s->raw() : nullptr,_6769_s ? _6769_s->size(0) : 0);
          _ptr__6769_s[(_6744_nd - (int)1)] = (int)1;
          int32_t _12322_ = (int)1;
          int32_t _12323_ = _6744_nd;
          for (int32_t _6770_i = _12322_; _6770_i < _12323_; ++_6770_i)
          {
            {
              _ptr__6769_s[((_6744_nd - _6770_i) - (int)1)] = safe_mul( _ptr__6769_s[(_6744_nd - _6770_i)],_ptr__6757_wi32[(safe_add( _6745_shape_base,_6744_nd ) - _6770_i)] );
            }
          }
          std::shared_ptr< monty::ndarray< int32_t,1 > > _6771_sortdims = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((_6744_nd - (int)1))));
          _checked_ptr_1<int32_t> _ptr__6771_sortdims(_6771_sortdims ? _6771_sortdims->raw() : nullptr,_6771_sortdims ? _6771_sortdims->size(0) : 0);
          int32_t _12324_ = (int)0;
          int32_t _12325_ = dim;
          for (int32_t _6772_i = _12324_; _6772_i < _12325_; ++_6772_i)
          {
            {
              _ptr__6771_sortdims[((_6744_nd - _6772_i) - (int)2)] = _6772_i;
            }
          }
          int32_t _12326_ = safe_add( dim,(int)1 );
          int32_t _12327_ = _6744_nd;
          for (int32_t _6773_i = _12326_; _6773_i < _12327_; ++_6773_i)
          {
            {
              _ptr__6771_sortdims[((_6744_nd - _6773_i) - (int)1)] = _6773_i;
            }
          }
          int32_t _12328_ = (int)0;
          int32_t _12329_ = (_6744_nd - (int)1);
          for (int32_t _6774_ii = _12328_; _6774_ii < _12329_; ++_6774_ii)
          {
            {
              int32_t _6775_k = _ptr__6771_sortdims[_6774_ii];
              int32_t _6776_dk = _ptr__6757_wi32[safe_add( _6745_shape_base,_6775_k )];
              int32_t _12330_ = (int)0;
              int32_t _12331_ = safe_add( _6776_dk,(int)1 );
              for (int32_t _6777_i = _12330_; _6777_i < _12331_; ++_6777_i)
              {
                {
                  _ptr__6765_xi32[safe_add( _6760_ptr,_6777_i )] = (int)0;
                }
              }
              int32_t _12332_ = (int)0;
              int32_t _12333_ = _6746_nelem;
              for (int32_t _6778_i = _12332_; _6778_i < _12333_; ++_6778_i)
              {
                {
                  ++ _ptr__6765_xi32[safe_add( safe_add( _6760_ptr,(int)1 ),((_ptr__6758_wi64[safe_add( _6751_sp_base,_6778_i )] / _ptr__6769_s[_6775_k]) % _6776_dk) )];
                }
              }
              int32_t _12334_ = (int)0;
              int32_t _12335_ = _6776_dk;
              for (int32_t _6779_i = _12334_; _6779_i < _12335_; ++_6779_i)
              {
                {
                  _ptr__6765_xi32[safe_add( safe_add( _6760_ptr,_6779_i ),(int)1 )] += _ptr__6765_xi32[safe_add( _6760_ptr,_6779_i )];
                }
              }
              int32_t _12336_ = (int)0;
              int32_t _12337_ = _6746_nelem;
              for (int32_t _6780_ii = _12336_; _6780_ii < _12337_; ++_6780_ii)
              {
                {
                  int32_t _6781_i = _ptr__6765_xi32[safe_add( _6766_curperm,_6780_ii )];
                  int64_t _6782_sub = ((_ptr__6758_wi64[safe_add( _6751_sp_base,_6781_i )] / _ptr__6769_s[_6775_k]) % _6776_dk);
                  _ptr__6765_xi32[safe_add( _6767_tgtperm,_ptr__6765_xi32[safe_add( _6760_ptr,_6782_sub )] )] = _6781_i;
                  ++ _ptr__6765_xi32[safe_add( _6760_ptr,_6782_sub )];
                }
              }
              int32_t _6783_tmp = _6767_tgtperm;
              _6767_tgtperm = _6766_curperm;
              _6766_curperm = _6783_tmp;
            }
          }
        }
      }
      {}
      int32_t _6784_d0 = (int)1;
      int32_t _12338_ = (int)0;
      int32_t _12339_ = dim;
      for (int32_t _6785_i = _12338_; _6785_i < _12339_; ++_6785_i)
      {
        {
          _6784_d0 *= _ptr__6757_wi32[safe_add( _6745_shape_base,_6785_i )];
        }
      }
      int32_t _6786_d1 = _ptr__6757_wi32[safe_add( _6745_shape_base,dim )];
      int32_t _6787_d2 = (int)1;
      int32_t _12340_ = safe_add( dim,(int)1 );
      int32_t _12341_ = _6744_nd;
      for (int32_t _6788_i = _12340_; _6788_i < _12341_; ++_6788_i)
      {
        {
          _6787_d2 *= _ptr__6757_wi32[safe_add( _6745_shape_base,_6788_i )];
        }
      }
      int32_t _6789_s0 = safe_mul( _6787_d2,_6786_d1 );
      int32_t _6790_s1 = _6787_d2;
      int32_t _6791_s2 = (int)1;
      int32_t _6792_rnelem = (int)0;
      int64_t _6793_p2 = (-(int)1);
      int64_t _6794_p0 = (-(int)1);
      int32_t _12342_ = (int)0;
      int32_t _12343_ = _6746_nelem;
      for (int32_t _6795_ii = _12342_; _6795_ii < _12343_; ++_6795_ii)
      {
        {
          int32_t _6796_i = _ptr__6765_xi32[safe_add( _6766_curperm,_6795_ii )];
          int64_t _6797_k0 = ((_ptr__6758_wi64[safe_add( _6751_sp_base,_6796_i )] / _6789_s0) % _6784_d0);
          int64_t _6798_k2 = (_ptr__6758_wi64[safe_add( _6751_sp_base,_6796_i )] % _6787_d2);
          if (((_6794_p0 != _6797_k0) || (_6793_p2 != _6798_k2)))
          {
            {
              _6794_p0 = _6797_k0;
              _6793_p2 = _6798_k2;
              ++ _6792_rnelem;
            }
          }
          {}
        }
      }
      int32_t _6799_rnd = (_6744_nd - (int)1);
      bool _6800_rhassp = (_6792_rnelem < safe_mul( _6784_d0,_6787_d2 ));
      int32_t _6801_rnnz = _6747_nnz;
      int32_t _6802_rncodeatom = _6748_ncodeatom;
      _6740_rs->alloc_expr(_6799_rnd,_6792_rnelem,_6801_rnnz,_6800_rhassp,_6802_rncodeatom);
      int32_t _6803_rptr_base = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->ptr_base;
      int32_t _6804_rnidxs_base = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->nidxs_base;
      int32_t _12344_;
      bool _12345_ = _6800_rhassp;
      if (_12345_)
      {
        _12344_ = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->sp_base;
      }
      else
      {
        _12344_ = _6740_rs->alloci64(_6792_rnelem);
      }
      int32_t _6805_rsp_base = _12344_;
      int32_t _6806_rcof_base = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->cof_base;
      int32_t _6807_rshape_base = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->shape_base;
      int32_t _6808_rcode = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->code_base;
      int32_t _6809_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->codeptr_base;
      int32_t _6810_rcconst = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _6811_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__6811_ri32(_6811_ri32 ? _6811_ri32->raw() : nullptr,_6811_ri32 ? _6811_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _6812_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__6812_ri64(_6812_ri64 ? _6812_ri64->raw() : nullptr,_6812_ri64 ? _6812_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _6813_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->f64;
      _checked_ptr_1<double> _ptr__6813_rf64(_6813_rf64 ? _6813_rf64->raw() : nullptr,_6813_rf64 ? _6813_rf64->size(0) : 0);
      int32_t _12346_ = (int)0;
      int32_t _12347_ = dim;
      for (int32_t _6814_i = _12346_; _6814_i < _12347_; ++_6814_i)
      {
        {
          _ptr__6811_ri32[safe_add( _6807_rshape_base,_6814_i )] = _ptr__6757_wi32[safe_add( _6745_shape_base,_6814_i )];
        }
      }
      int32_t _12348_ = safe_add( dim,(int)1 );
      int32_t _12349_ = _6744_nd;
      for (int32_t _6815_i = _12348_; _6815_i < _12349_; ++_6815_i)
      {
        {
          _ptr__6811_ri32[(safe_add( _6807_rshape_base,_6815_i ) - (int)1)] = _ptr__6757_wi32[safe_add( _6745_shape_base,_6815_i )];
        }
      }
      _ptr__6811_ri32[_6803_rptr_base] = (int)0;
      if ((_6802_rncodeatom > (int)0))
      {
        {
          _ptr__6811_ri32[_6809_rcodeptr] = (int)0;
        }
      }
      {}
      int32_t _6816_codei = (int)0;
      int32_t _6817_kelm = (int)0;
      int32_t _6818_knz = (int)0;
      int32_t _6819_ii = (int)0;
      while ( (_6819_ii < _6746_nelem) )
      {
        {
          int32_t _6820_b = _6819_ii;
          int64_t _6821_p0 = ((_ptr__6758_wi64[safe_add( _6751_sp_base,_ptr__6765_xi32[safe_add( _6766_curperm,_6820_b )] )] / _6789_s0) % _6784_d0);
          int64_t _6822_p2 = (_ptr__6758_wi64[safe_add( _6751_sp_base,_ptr__6765_xi32[safe_add( _6766_curperm,_6820_b )] )] % _6787_d2);
          ++ _6819_ii;
          while ( ((_6819_ii < _6746_nelem) && ((_6821_p0 == ((_ptr__6758_wi64[safe_add( _6751_sp_base,_ptr__6765_xi32[safe_add( _6766_curperm,_6819_ii )] )] / _6789_s0) % _6784_d0)) && (_6822_p2 == (_ptr__6758_wi64[safe_add( _6751_sp_base,_ptr__6765_xi32[safe_add( _6766_curperm,_6819_ii )] )] % _6787_d2)))) )
          {
            {
              ++ _6819_ii;
            }
          }
          int32_t _12350_ = _6820_b;
          int32_t _12351_ = _6819_ii;
          for (int32_t _6823_kk = _12350_; _6823_kk < _12351_; ++_6823_kk)
          {
            {
              int32_t _6824_k = _ptr__6765_xi32[safe_add( _6766_curperm,_6823_kk )];
              int32_t _12352_ = _ptr__6757_wi32[safe_add( _6750_ptr_base,_6824_k )];
              int32_t _12353_ = _ptr__6757_wi32[safe_add( safe_add( _6750_ptr_base,_6824_k ),(int)1 )];
              for (int32_t _6825_j = _12352_; _6825_j < _12353_; ++_6825_j)
              {
                {
                  _ptr__6812_ri64[safe_add( _6804_rnidxs_base,_6818_knz )] = _ptr__6758_wi64[safe_add( _6752_nidxs_base,_6825_j )];
                  _ptr__6813_rf64[safe_add( _6806_rcof_base,_6818_knz )] = _ptr__6759_wf64[safe_add( _6753_cof_base,_6825_j )];
                  if ((_6802_rncodeatom > (int)0))
                  {
                    {
                      int32_t _12354_ = _ptr__6757_wi32[safe_add( _6755_codeptr,_6825_j )];
                      int32_t _12355_ = _ptr__6757_wi32[safe_add( safe_add( _6755_codeptr,_6825_j ),(int)1 )];
                      for (int32_t _6826_l = _12354_; _6826_l < _12355_; ++_6826_l)
                      {
                        {
                          _ptr__6811_ri32[safe_add( _6808_rcode,_6816_codei )] = _ptr__6757_wi32[safe_add( _6754_code,_6826_l )];
                          _ptr__6813_rf64[safe_add( _6810_rcconst,_6816_codei )] = _ptr__6759_wf64[safe_add( _6756_cconst,_6826_l )];
                          ++ _6816_codei;
                        }
                      }
                      _ptr__6811_ri32[safe_add( safe_add( _6809_rcodeptr,_6818_knz ),(int)1 )] = _6816_codei;
                    }
                  }
                  {}
                  ++ _6818_knz;
                }
              }
            }
          }
          _ptr__6812_ri64[safe_add( _6805_rsp_base,_6817_kelm )] = safe_add( safe_mul( _6821_p0,_6787_d2 ),_6822_p2 );
          _ptr__6811_ri32[safe_add( safe_add( _6803_rptr_base,_6817_kelm ),(int)1 )] = _6818_knz;
          ++ _6817_kelm;
        }
      }
      if ((!_6800_rhassp))
      {
        {
          _6740_rs->popi64(_6792_rnelem);
        }
      }
      {}
    }
  }
  else
  {
    {
      int32_t _6827_d0 = (int)1;
      int32_t _12356_ = (int)0;
      int32_t _12357_ = dim;
      for (int32_t _6828_i = _12356_; _6828_i < _12357_; ++_6828_i)
      {
        {
          _6827_d0 *= _ptr__6757_wi32[safe_add( _6745_shape_base,_6828_i )];
        }
      }
      int32_t _6829_d1 = _ptr__6757_wi32[safe_add( _6745_shape_base,dim )];
      int32_t _6830_d2 = (int)1;
      int32_t _12358_ = safe_add( dim,(int)1 );
      int32_t _12359_ = _6744_nd;
      for (int32_t _6831_i = _12358_; _6831_i < _12359_; ++_6831_i)
      {
        {
          _6830_d2 *= _ptr__6757_wi32[safe_add( _6745_shape_base,_6831_i )];
        }
      }
      int32_t _6832_s0 = safe_mul( _6830_d2,_6829_d1 );
      int32_t _6833_s1 = _6830_d2;
      int32_t _6834_s2 = (int)1;
      int32_t _6835_rnelem = safe_mul( _6827_d0,_6830_d2 );
      int32_t _6836_rnnz = _6747_nnz;
      int32_t _6837_rncodeatom = _6748_ncodeatom;
      _6740_rs->alloc_expr((_6744_nd - (int)1),_6835_rnelem,_6836_rnnz,false,_6837_rncodeatom);
      int32_t _6838_rptr_base = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->ptr_base;
      int32_t _6839_rnidxs_base = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->nidxs_base;
      int32_t _6840_rcof_base = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->cof_base;
      int32_t _6841_rshape = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->shape_base;
      int32_t _6842_rcode = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->code_base;
      int32_t _6843_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->codeptr_base;
      int32_t _6844_rcconst = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _6845_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__6845_ri32(_6845_ri32 ? _6845_ri32->raw() : nullptr,_6845_ri32 ? _6845_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _6846_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__6846_ri64(_6846_ri64 ? _6846_ri64->raw() : nullptr,_6846_ri64 ? _6846_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _6847_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6740_rs)->f64;
      _checked_ptr_1<double> _ptr__6847_rf64(_6847_rf64 ? _6847_rf64->raw() : nullptr,_6847_rf64 ? _6847_rf64->size(0) : 0);
      int32_t _12360_ = (int)0;
      int32_t _12361_ = dim;
      for (int32_t _6848_i = _12360_; _6848_i < _12361_; ++_6848_i)
      {
        {
          _ptr__6845_ri32[safe_add( _6841_rshape,_6848_i )] = _ptr__6757_wi32[safe_add( _6745_shape_base,_6848_i )];
        }
      }
      int32_t _12362_ = safe_add( dim,(int)1 );
      int32_t _12363_ = _6744_nd;
      for (int32_t _6849_i = _12362_; _6849_i < _12363_; ++_6849_i)
      {
        {
          _ptr__6845_ri32[(safe_add( _6841_rshape,_6849_i ) - (int)1)] = _ptr__6757_wi32[safe_add( _6745_shape_base,_6849_i )];
        }
      }
      int32_t _6850_kelm = (int)0;
      int32_t _6851_knz = (int)0;
      _ptr__6845_ri32[_6838_rptr_base] = (int)0;
      if ((_6837_rncodeatom > (int)0))
      {
        {
          _ptr__6845_ri32[_6843_rcodeptr] = (int)0;
        }
      }
      {}
      int32_t _6852_codei = (int)0;
      int32_t _12364_ = (int)0;
      int32_t _12365_ = _6827_d0;
      for (int32_t _6853_i0 = _12364_; _6853_i0 < _12365_; ++_6853_i0)
      {
        {
          int32_t _12366_ = (int)0;
          int32_t _12367_ = _6830_d2;
          for (int32_t _6854_i2 = _12366_; _6854_i2 < _12367_; ++_6854_i2)
          {
            {
              int32_t _12368_ = (int)0;
              int32_t _12369_ = _6829_d1;
              for (int32_t _6855_i1 = _12368_; _6855_i1 < _12369_; ++_6855_i1)
              {
                {
                  int32_t _6856_i = safe_add( safe_add( safe_mul( _6853_i0,_6832_s0 ),safe_mul( _6855_i1,_6833_s1 ) ),_6854_i2 );
                  int32_t _12370_ = _ptr__6757_wi32[safe_add( _6750_ptr_base,_6856_i )];
                  int32_t _12371_ = _ptr__6757_wi32[safe_add( safe_add( _6750_ptr_base,_6856_i ),(int)1 )];
                  for (int32_t _6857_k = _12370_; _6857_k < _12371_; ++_6857_k)
                  {
                    {
                      _ptr__6846_ri64[safe_add( _6839_rnidxs_base,_6851_knz )] = _ptr__6758_wi64[safe_add( _6752_nidxs_base,_6857_k )];
                      _ptr__6847_rf64[safe_add( _6840_rcof_base,_6851_knz )] = _ptr__6759_wf64[safe_add( _6753_cof_base,_6857_k )];
                      if ((_6837_rncodeatom > (int)0))
                      {
                        {
                          int32_t _12372_ = _ptr__6757_wi32[safe_add( _6755_codeptr,_6857_k )];
                          int32_t _12373_ = _ptr__6757_wi32[safe_add( safe_add( _6755_codeptr,_6857_k ),(int)1 )];
                          for (int32_t _6858_l = _12372_; _6858_l < _12373_; ++_6858_l)
                          {
                            {
                              _ptr__6845_ri32[safe_add( _6842_rcode,_6852_codei )] = _ptr__6757_wi32[safe_add( _6754_code,_6858_l )];
                              _ptr__6847_rf64[safe_add( _6844_rcconst,_6852_codei )] = _ptr__6759_wf64[safe_add( _6756_cconst,_6858_l )];
                              ++ _6852_codei;
                            }
                          }
                          _ptr__6845_ri32[safe_add( safe_add( _6843_rcodeptr,_6851_knz ),(int)1 )] = _6852_codei;
                        }
                      }
                      {}
                      ++ _6851_knz;
                    }
                  }
                }
              }
              _ptr__6845_ri32[safe_add( safe_add( _6838_rptr_base,_6850_kelm ),(int)1 )] = _6851_knz;
              ++ _6850_kelm;
            }
          }
        }
      }
    }
  }
  _6742_xs->clear();
}
// End mosek.fusion.ExprSumReduce.eval

// Begin mosek.fusion.ExprSumReduce.computeShape
// Method mosek.fusion.ExprSumReduce.computeShape @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:17:6-22:7
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_ExprSumReduce::computeShape(int32_t _6859_dim,std::shared_ptr< monty::ndarray< int32_t,1 > > _6860_shape)
{
  _checked_ptr_1<int32_t> _ptr__6860_shape(_6860_shape ? _6860_shape->raw() : nullptr, _6860_shape ? _6860_shape->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6861_r = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(((int)((_6860_shape)->size(0)) - (int)1))));
  _checked_ptr_1<int32_t> _ptr__6861_r(_6861_r ? _6861_r->raw() : nullptr,_6861_r ? _6861_r->size(0) : 0);
  int32_t _12374_ = (int)0;
  int32_t _12375_ = _6859_dim;
  for (int32_t _6862_i = _12374_; _6862_i < _12375_; ++_6862_i)
  {
    {
      _ptr__6861_r[_6862_i] = _ptr__6860_shape[_6862_i];
    }
  }
  int32_t _12376_ = safe_add( _6859_dim,(int)1 );
  int32_t _12377_ = (int)((_6860_shape)->size(0));
  for (int32_t _6863_i = _12376_; _6863_i < _12377_; ++_6863_i)
  {
    {
      _ptr__6861_r[(_6863_i - (int)1)] = _ptr__6860_shape[_6863_i];
    }
  }
  return _6861_r;
}
// End mosek.fusion.ExprSumReduce.computeShape

// Begin mosek.fusion.ExprSumReduce.compress_when_caching
// Method mosek.fusion.ExprSumReduce.compress_when_caching @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:15:6-65
bool mosek::fusion::ExprSumReduce :: compress_when_caching() { return mosek::fusion::p_ExprSumReduce::_get_impl(this)->compress_when_caching(); }
bool mosek::fusion::p_ExprSumReduce::compress_when_caching()
{
  return true;
}
// End mosek.fusion.ExprSumReduce.compress_when_caching

// Begin mosek.fusion.ExprSumReduce.toString
// Method mosek.fusion.ExprSumReduce.toString @ bld/grindsted/final/default/src/fusion/ExprAdd.monty:13:6-146
std::string mosek::fusion::ExprSumReduce :: toString() { return mosek::fusion::p_ExprSumReduce::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprSumReduce::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprSumReduce("))->__mosek_2fusion_2Utils_2StringBuffer__a(dim)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprSumReduce.toString

void mosek::fusion::p_ExprSumReduce::destroy()
{
  expr.reset();
}
void mosek::fusion::ExprSumReduce::destroy() { mosek::fusion::p_ExprSumReduce::_get_impl(this)->destroy(); }
// } class ExprSumReduce
// class ExprScaleVecPSD { // @ bld/grindsted/final/default/src/fusion/ExprShape.monty:1566:4-1892:5
mosek::fusion::ExprScaleVecPSD::ExprScaleVecPSD(mosek::fusion::p_ExprScaleVecPSD *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprScaleVecPSD()" << this << std::endl; */ }
mosek::fusion::ExprScaleVecPSD::~ExprScaleVecPSD() {  /* std::cout << "~ExprScaleVecPSD()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprScaleVecPSD::p_ExprScaleVecPSD
  (::mosek::fusion::ExprScaleVecPSD * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprScaleVecPSD.ctor @ bld/grindsted/final/default/src/fusion/ExprShape.monty:1571:6-1578:7
mosek::fusion::ExprScaleVecPSD::t mosek::fusion::p_ExprScaleVecPSD::_new_ExprScaleVecPSD
  (int32_t _6864_dim0,
    int32_t _6865_dim1,
    monty::rc_ptr< ::mosek::fusion::Expression > _6866_expr)
{ return new mosek::fusion::ExprScaleVecPSD(_6864_dim0,_6865_dim1,_6866_expr); }
mosek::fusion::ExprScaleVecPSD::ExprScaleVecPSD
  (int32_t _6864_dim0,
    int32_t _6865_dim1,
    monty::rc_ptr< ::mosek::fusion::Expression > _6866_expr) : 
   ExprScaleVecPSD(new mosek::fusion::p_ExprScaleVecPSD(this))
{ mosek::fusion::p_ExprScaleVecPSD::_get_impl(this)->_initialize(_6864_dim0,_6865_dim1,_6866_expr); }
void mosek::fusion::p_ExprScaleVecPSD::_initialize  (int32_t _6864_dim0,
    int32_t _6865_dim1,
    monty::rc_ptr< ::mosek::fusion::Expression > _6866_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_6866_expr->__mosek_2fusion_2Expression__getModel(),_6866_expr->getShape());
    mosek::fusion::p_ExprScaleVecPSD::_get_impl(::mosek::fusion::ExprScaleVecPSD::t(_pubthis))->expr = _6866_expr;
    mosek::fusion::p_ExprScaleVecPSD::_get_impl(::mosek::fusion::ExprScaleVecPSD::t(_pubthis))->dim0 = _6864_dim0;
    mosek::fusion::p_ExprScaleVecPSD::_get_impl(::mosek::fusion::ExprScaleVecPSD::t(_pubthis))->dim1 = _6865_dim1;
    if (((_6864_dim0 < (int)0) || ((_6865_dim1 < (int)0) || (_6864_dim0 == _6865_dim1))))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid symmetry dimensions"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprScaleVecPSD.ctor

// Begin mosek.fusion.ExprScaleVecPSD.eval
// Method mosek.fusion.ExprScaleVecPSD.eval @ bld/grindsted/final/default/src/fusion/ExprShape.monty:1580:6-1771:7
void mosek::fusion::ExprScaleVecPSD :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6867_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6868_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6869_xs,bool _6870_cache_eval) { mosek::fusion::p_ExprScaleVecPSD::_get_impl(this)->eval(_6867_rs,_6868_ws,_6869_xs,_6870_cache_eval); }
void mosek::fusion::p_ExprScaleVecPSD::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6867_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6868_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6869_xs,bool _6870_cache_eval)
{
  expr->recursive_eval(_6868_ws,_6867_rs,_6869_xs,_6870_cache_eval);
  _6868_ws->pop_expr();
  int32_t _6871_nd = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->nd;
  int32_t _6872_nnz = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->nnz;
  int32_t _6873_nelem = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->nelem;
  int32_t _6874_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->ncodeatom;
  bool _6875_hassp = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->hassp;
  int32_t _6876_shape = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->shape_base;
  int32_t _6877_ptr = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->ptr_base;
  int32_t _6878_code = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->code_base;
  int32_t _6879_codeptr = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->codeptr_base;
  int32_t _6880_cconst = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->cconst_base;
  int32_t _6881_nidxs = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->nidxs_base;
  int32_t _6882_sp = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->sp_base;
  int32_t _6883_cof = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->cof_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6884_wi32 = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__6884_wi32(_6884_wi32 ? _6884_wi32->raw() : nullptr,_6884_wi32 ? _6884_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6885_wi64 = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__6885_wi64(_6885_wi64 ? _6885_wi64->raw() : nullptr,_6885_wi64 ? _6885_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6886_wf64 = mosek::fusion::p_WorkStack::_get_impl(_6868_ws)->f64;
  _checked_ptr_1<double> _ptr__6886_wf64(_6886_wf64 ? _6886_wf64->raw() : nullptr,_6886_wf64 ? _6886_wf64->size(0) : 0);
  if (((dim0 >= _6871_nd) || (dim1 >= _6871_nd)))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid symmetry dimensions"));
    }
  }
  else if((_ptr__6884_wi32[safe_add( _6876_shape,dim0 )] != _ptr__6884_wi32[safe_add( _6876_shape,dim1 )]))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Not symmetric in given dimensions"));
    }
  }
  {}
  int64_t _6887_d4 = (int)1;
  int64_t _6888_d3 = (int)1;
  int64_t _6889_d2 = (int)1;
  int64_t _6890_d1 = (int)1;
  int64_t _6891_d0 = (int)1;
  int32_t _12378_;
  bool _12379_ = (dim0 < dim1);
  if (_12379_)
  {
    _12378_ = dim0;
  }
  else
  {
    _12378_ = dim1;
  }
  int32_t _6892_xdim0 = _12378_;
  int32_t _12380_;
  bool _12381_ = (dim0 < dim1);
  if (_12381_)
  {
    _12380_ = dim1;
  }
  else
  {
    _12380_ = dim0;
  }
  int32_t _6893_xdim1 = _12380_;
  int32_t _12382_ = (int)0;
  int32_t _12383_ = _6892_xdim0;
  for (int32_t _6894_i = _12382_; _6894_i < _12383_; ++_6894_i)
  {
    {
      _6891_d0 *= _ptr__6884_wi32[safe_add( _6876_shape,_6894_i )];
    }
  }
  int32_t _12384_ = safe_add( _6892_xdim0,(int)1 );
  int32_t _12385_ = _6893_xdim1;
  for (int32_t _6895_i = _12384_; _6895_i < _12385_; ++_6895_i)
  {
    {
      _6889_d2 *= _ptr__6884_wi32[safe_add( _6876_shape,_6895_i )];
    }
  }
  int32_t _12386_ = safe_add( _6893_xdim1,(int)1 );
  int32_t _12387_ = _6871_nd;
  for (int32_t _6896_i = _12386_; _6896_i < _12387_; ++_6896_i)
  {
    {
      _6887_d4 *= _ptr__6884_wi32[safe_add( _6876_shape,_6896_i )];
    }
  }
  _6890_d1 = _ptr__6884_wi32[safe_add( _6876_shape,dim0 )];
  _6888_d3 = _6890_d1;
  int32_t _12388_;
  bool _12389_ = (_6874_ncodeatom == (int)0);
  if (_12389_)
  {
    _12388_ = (int)0;
  }
  else
  {
    _12388_ = safe_add( _6874_ncodeatom,safe_mul( _6872_nnz,(int)2 ) );
  }
  int32_t _6897_rncodeatom = _12388_;
  _6867_rs->alloc_expr(_6871_nd,_6873_nelem,_6872_nnz,_6875_hassp,_6897_rncodeatom);
  int32_t _6898_rptr = mosek::fusion::p_WorkStack::_get_impl(_6867_rs)->ptr_base;
  int32_t _6899_rshape = mosek::fusion::p_WorkStack::_get_impl(_6867_rs)->shape_base;
  int32_t _6900_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_6867_rs)->nidxs_base;
  int32_t _6901_rsp = mosek::fusion::p_WorkStack::_get_impl(_6867_rs)->sp_base;
  int32_t _6902_rcof = mosek::fusion::p_WorkStack::_get_impl(_6867_rs)->cof_base;
  int32_t _6903_rcode = mosek::fusion::p_WorkStack::_get_impl(_6867_rs)->code_base;
  int32_t _6904_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_6867_rs)->codeptr_base;
  int32_t _6905_rcconst = mosek::fusion::p_WorkStack::_get_impl(_6867_rs)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6906_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6867_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__6906_ri32(_6906_ri32 ? _6906_ri32->raw() : nullptr,_6906_ri32 ? _6906_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6907_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6867_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__6907_ri64(_6907_ri64 ? _6907_ri64->raw() : nullptr,_6907_ri64 ? _6907_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6908_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6867_rs)->f64;
  _checked_ptr_1<double> _ptr__6908_rf64(_6908_rf64 ? _6908_rf64->raw() : nullptr,_6908_rf64 ? _6908_rf64->size(0) : 0);
  {
    ::mosek::fusion::Utils::Tools::arraycopy(_6884_wi32,_6877_ptr,_6906_ri32,_6898_rptr,safe_add( _6873_nelem,(int)1 ));
    ::mosek::fusion::Utils::Tools::arraycopy(_6884_wi32,_6876_shape,_6906_ri32,_6899_rshape,_6871_nd);
    ::mosek::fusion::Utils::Tools::arraycopy(_6885_wi64,_6881_nidxs,_6907_ri64,_6900_rnidxs,_6872_nnz);
    ::mosek::fusion::Utils::Tools::arraycopy(_6886_wf64,_6883_cof,_6908_rf64,_6902_rcof,_6872_nnz);
    if (_6875_hassp)
    {
      {
        ::mosek::fusion::Utils::Tools::arraycopy(_6885_wi64,_6882_sp,_6907_ri64,_6901_rsp,_6873_nelem);
      }
    }
    {}
  }
  double _6909_scale = ::mosek::fusion::Utils::Tools::sqrt((double)((int)2));
  if ((!_6875_hassp))
  {
    {
      int32_t _6910_k = (int)0;
      int32_t _12390_ = (int)0;
      int64_t _12391_ = _6891_d0;
      for (int64_t _6911_i0 = _12390_; _6911_i0 < _12391_; ++_6911_i0)
      {
        {
          int32_t _12392_ = (int)0;
          int64_t _12393_ = _6890_d1;
          for (int64_t _6912_i1 = _12392_; _6912_i1 < _12393_; ++_6912_i1)
          {
            {
              int32_t _12394_ = (int)0;
              int64_t _12395_ = _6889_d2;
              for (int64_t _6913_i2 = _12394_; _6913_i2 < _12395_; ++_6913_i2)
              {
                {
                  int32_t _12396_ = (int)0;
                  int64_t _12397_ = _6888_d3;
                  for (int64_t _6914_i3 = _12396_; _6914_i3 < _12397_; ++_6914_i3)
                  {
                    {
                      int32_t _12398_ = (int)0;
                      int64_t _12399_ = _6887_d4;
                      for (int64_t _6915_i4 = _12398_; _6915_i4 < _12399_; ++_6915_i4)
                      {
                        {
                          if ((_6912_i1 != _6914_i3))
                          {
                            {
                              int32_t _12400_ = _ptr__6906_ri32[safe_add( _6898_rptr,_6910_k )];
                              int32_t _12401_ = _ptr__6906_ri32[safe_add( safe_add( _6898_rptr,_6910_k ),(int)1 )];
                              for (int32_t _6916_j = _12400_; _6916_j < _12401_; ++_6916_j)
                              {
                                {
                                  _ptr__6908_rf64[safe_add( _6902_rcof,_6916_j )] *= _6909_scale;
                                }
                              }
                            }
                          }
                          {}
                          ++ _6910_k;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  else
  {
    {
      int32_t _6917_k = (int)0;
      std::shared_ptr< monty::ndarray< int64_t,1 > > _6918_d = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)5)));
      _checked_ptr_1<int64_t> _ptr__6918_d(_6918_d ? _6918_d->raw() : nullptr,_6918_d ? _6918_d->size(0) : 0);
      _ptr__6918_d[(int)4] = (int)1;
      _ptr__6918_d[(int)3] = safe_mul( _ptr__6918_d[(int)4],_6887_d4 );
      _ptr__6918_d[(int)2] = safe_mul( _ptr__6918_d[(int)3],_6888_d3 );
      _ptr__6918_d[(int)1] = safe_mul( _ptr__6918_d[(int)2],_6889_d2 );
      _ptr__6918_d[(int)0] = safe_mul( _ptr__6918_d[(int)1],_6890_d1 );
      int32_t _12402_ = (int)0;
      int32_t _12403_ = _6873_nelem;
      for (int32_t _6919_k = _12402_; _6919_k < _12403_; ++_6919_k)
      {
        {
          int64_t _6920_idx = _ptr__6885_wi64[safe_add( _6882_sp,_6919_k )];
          int64_t _6921_d3 = ((_6920_idx / _ptr__6918_d[(int)3]) % _6888_d3);
          int64_t _6922_d1 = ((_6920_idx / _ptr__6918_d[(int)1]) % _6890_d1);
          if ((_6922_d1 != _6921_d3))
          {
            {
              int32_t _12404_ = _ptr__6906_ri32[safe_add( _6898_rptr,_6919_k )];
              int32_t _12405_ = _ptr__6906_ri32[safe_add( safe_add( _6898_rptr,_6919_k ),(int)1 )];
              for (int32_t _6923_j = _12404_; _6923_j < _12405_; ++_6923_j)
              {
                {
                  _ptr__6908_rf64[safe_add( _6902_rcof,_6923_j )] *= _6909_scale;
                }
              }
            }
          }
          {}
        }
      }
    }
  }
  if ((_6874_ncodeatom != (int)0))
  {
    {
      int32_t _6924_nzi = (int)0;
      int32_t _6925_codei = (int)0;
      _ptr__6906_ri32[_6904_rcodeptr] = (int)0;
      if ((!_6875_hassp))
      {
        {
          int32_t _6926_k = (int)0;
          int32_t _12406_ = (int)0;
          int64_t _12407_ = _6891_d0;
          for (int64_t _6927_i0 = _12406_; _6927_i0 < _12407_; ++_6927_i0)
          {
            {
              int32_t _12408_ = (int)0;
              int64_t _12409_ = _6890_d1;
              for (int64_t _6928_i1 = _12408_; _6928_i1 < _12409_; ++_6928_i1)
              {
                {
                  int32_t _12410_ = (int)0;
                  int64_t _12411_ = _6889_d2;
                  for (int64_t _6929_i2 = _12410_; _6929_i2 < _12411_; ++_6929_i2)
                  {
                    {
                      int32_t _12412_ = (int)0;
                      int64_t _12413_ = _6888_d3;
                      for (int64_t _6930_i3 = _12412_; _6930_i3 < _12413_; ++_6930_i3)
                      {
                        {
                          int32_t _12414_ = (int)0;
                          int64_t _12415_ = _6887_d4;
                          for (int64_t _6931_i4 = _12414_; _6931_i4 < _12415_; ++_6931_i4)
                          {
                            {
                              double _12416_;
                              bool _12417_ = (_6928_i1 != _6930_i3);
                              if (_12417_)
                              {
                                _12416_ = _6909_scale;
                              }
                              else
                              {
                                _12416_ = 1.0;
                              }
                              double _6932_s = _12416_;
                              int32_t _12418_ = _ptr__6884_wi32[safe_add( _6877_ptr,_6926_k )];
                              int32_t _12419_ = _ptr__6884_wi32[safe_add( safe_add( _6877_ptr,_6926_k ),(int)1 )];
                              for (int32_t _6933_j = _12418_; _6933_j < _12419_; ++_6933_j)
                              {
                                {
                                  int32_t _12420_ = _ptr__6884_wi32[safe_add( _6879_codeptr,_6933_j )];
                                  int32_t _12421_ = _ptr__6884_wi32[safe_add( safe_add( _6879_codeptr,_6933_j ),(int)1 )];
                                  for (int32_t _6934_l = _12420_; _6934_l < _12421_; ++_6934_l)
                                  {
                                    {
                                      _ptr__6906_ri32[safe_add( _6903_rcode,_6925_codei )] = _ptr__6884_wi32[safe_add( _6878_code,_6934_l )];
                                      _ptr__6908_rf64[safe_add( _6905_rcconst,_6925_codei )] = _ptr__6886_wf64[safe_add( _6880_cconst,_6934_l )];
                                      ++ _6925_codei;
                                    }
                                  }
                                  _ptr__6906_ri32[safe_add( _6903_rcode,_6925_codei )] = 2;
                                  _ptr__6908_rf64[safe_add( _6905_rcconst,_6925_codei )] = _6932_s;
                                  ++ _6925_codei;
                                  _ptr__6906_ri32[safe_add( _6903_rcode,_6925_codei )] = 5;
                                  ++ _6925_codei;
                                  _ptr__6906_ri32[safe_add( safe_add( _6904_rcodeptr,_6924_nzi ),(int)1 )] = _6925_codei;
                                  ++ _6924_nzi;
                                }
                              }
                              ++ _6926_k;
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      else
      {
        {
          int32_t _6935_k = (int)0;
          std::shared_ptr< monty::ndarray< int64_t,1 > > _6936_d = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)5)));
          _checked_ptr_1<int64_t> _ptr__6936_d(_6936_d ? _6936_d->raw() : nullptr,_6936_d ? _6936_d->size(0) : 0);
          _ptr__6936_d[(int)4] = (int)1;
          _ptr__6936_d[(int)3] = safe_mul( _ptr__6936_d[(int)4],_6887_d4 );
          _ptr__6936_d[(int)2] = safe_mul( _ptr__6936_d[(int)3],_6888_d3 );
          _ptr__6936_d[(int)1] = safe_mul( _ptr__6936_d[(int)2],_6889_d2 );
          _ptr__6936_d[(int)0] = safe_mul( _ptr__6936_d[(int)1],_6890_d1 );
          int32_t _12422_ = (int)0;
          int32_t _12423_ = _6873_nelem;
          for (int32_t _6937_k = _12422_; _6937_k < _12423_; ++_6937_k)
          {
            {
              int64_t _6938_idx = _ptr__6885_wi64[safe_add( _6882_sp,_6937_k )];
              int64_t _6939_i3 = ((_6938_idx / _ptr__6936_d[(int)3]) % _6888_d3);
              int64_t _6940_i1 = ((_6938_idx / _ptr__6936_d[(int)1]) % _6890_d1);
              double _12424_;
              bool _12425_ = (_6940_i1 != _6939_i3);
              if (_12425_)
              {
                _12424_ = _6909_scale;
              }
              else
              {
                _12424_ = 1.0;
              }
              double _6941_s = _12424_;
              int32_t _12426_ = _ptr__6884_wi32[safe_add( _6877_ptr,_6937_k )];
              int32_t _12427_ = _ptr__6884_wi32[safe_add( safe_add( _6877_ptr,_6937_k ),(int)1 )];
              for (int32_t _6942_j = _12426_; _6942_j < _12427_; ++_6942_j)
              {
                {
                  int32_t _12428_ = _ptr__6884_wi32[safe_add( _6879_codeptr,_6942_j )];
                  int32_t _12429_ = _ptr__6884_wi32[safe_add( safe_add( _6879_codeptr,_6942_j ),(int)1 )];
                  for (int32_t _6943_l = _12428_; _6943_l < _12429_; ++_6943_l)
                  {
                    {
                      _ptr__6906_ri32[safe_add( _6903_rcode,_6925_codei )] = _ptr__6884_wi32[safe_add( _6878_code,_6943_l )];
                      _ptr__6908_rf64[safe_add( _6905_rcconst,_6925_codei )] = _ptr__6886_wf64[safe_add( _6880_cconst,_6943_l )];
                      ++ _6925_codei;
                    }
                  }
                  _ptr__6906_ri32[safe_add( _6903_rcode,_6925_codei )] = 2;
                  _ptr__6908_rf64[safe_add( _6905_rcconst,_6925_codei )] = _6941_s;
                  ++ _6925_codei;
                  _ptr__6906_ri32[safe_add( _6903_rcode,_6925_codei )] = 5;
                  ++ _6925_codei;
                  _ptr__6906_ri32[safe_add( safe_add( _6904_rcodeptr,_6924_nzi ),(int)1 )] = _6925_codei;
                  ++ _6924_nzi;
                }
              }
            }
          }
        }
      }
    }
  }
  {}
}
// End mosek.fusion.ExprScaleVecPSD.eval

void mosek::fusion::p_ExprScaleVecPSD::destroy()
{
  expr.reset();
}
void mosek::fusion::ExprScaleVecPSD::destroy() { mosek::fusion::p_ExprScaleVecPSD::_get_impl(this)->destroy(); }
// } class ExprScaleVecPSD
// class ExprDenseTril { // @ bld/grindsted/final/default/src/fusion/ExprShape.monty:1047:4-1557:5
mosek::fusion::ExprDenseTril::ExprDenseTril(mosek::fusion::p_ExprDenseTril *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprDenseTril()" << this << std::endl; */ }
mosek::fusion::ExprDenseTril::~ExprDenseTril() {  /* std::cout << "~ExprDenseTril()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprDenseTril::p_ExprDenseTril
  (::mosek::fusion::ExprDenseTril * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprDenseTril.ctor @ bld/grindsted/final/default/src/fusion/ExprShape.monty:1067:6-1074:7
mosek::fusion::ExprDenseTril::t mosek::fusion::p_ExprDenseTril::_new_ExprDenseTril
  (int32_t _6944_dim0,
    int32_t _6945_dim1,
    monty::rc_ptr< ::mosek::fusion::Expression > _6946_expr,
    int32_t _6947_unchecked_)
{ return new mosek::fusion::ExprDenseTril(_6944_dim0,_6945_dim1,_6946_expr,_6947_unchecked_); }
mosek::fusion::ExprDenseTril::ExprDenseTril
  (int32_t _6944_dim0,
    int32_t _6945_dim1,
    monty::rc_ptr< ::mosek::fusion::Expression > _6946_expr,
    int32_t _6947_unchecked_) : 
   ExprDenseTril(new mosek::fusion::p_ExprDenseTril(this))
{ mosek::fusion::p_ExprDenseTril::_get_impl(this)->_initialize(_6944_dim0,_6945_dim1,_6946_expr,_6947_unchecked_); }
void mosek::fusion::p_ExprDenseTril::_initialize  (int32_t _6944_dim0,
    int32_t _6945_dim1,
    monty::rc_ptr< ::mosek::fusion::Expression > _6946_expr,
    int32_t _6947_unchecked_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_6946_expr->__mosek_2fusion_2Expression__getModel(),_6946_expr->getShape());
    mosek::fusion::p_ExprDenseTril::_get_impl(::mosek::fusion::ExprDenseTril::t(_pubthis))->expr = _6946_expr;
    mosek::fusion::p_ExprDenseTril::_get_impl(::mosek::fusion::ExprDenseTril::t(_pubthis))->dim0 = _6944_dim0;
    mosek::fusion::p_ExprDenseTril::_get_impl(::mosek::fusion::ExprDenseTril::t(_pubthis))->dim1 = _6945_dim1;
  }
}
// mosek.fusion.ExprDenseTril.ctor

// mosek.fusion.ExprDenseTril.ctor @ bld/grindsted/final/default/src/fusion/ExprShape.monty:1054:6-1065:7
mosek::fusion::ExprDenseTril::t mosek::fusion::p_ExprDenseTril::_new_ExprDenseTril
  (int32_t _6948_dim0_,
    int32_t _6949_dim1_,
    monty::rc_ptr< ::mosek::fusion::Expression > _6950_expr)
{ return new mosek::fusion::ExprDenseTril(_6948_dim0_,_6949_dim1_,_6950_expr); }
mosek::fusion::ExprDenseTril::ExprDenseTril
  (int32_t _6948_dim0_,
    int32_t _6949_dim1_,
    monty::rc_ptr< ::mosek::fusion::Expression > _6950_expr) : 
   ExprDenseTril(new mosek::fusion::p_ExprDenseTril(this))
{ mosek::fusion::p_ExprDenseTril::_get_impl(this)->_initialize(_6948_dim0_,_6949_dim1_,_6950_expr); }
void mosek::fusion::p_ExprDenseTril::_initialize  (int32_t _6948_dim0_,
    int32_t _6949_dim1_,
    monty::rc_ptr< ::mosek::fusion::Expression > _6950_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ExprDenseTril::_initialize(_6948_dim0_,_6949_dim1_,_6950_expr,(int)1);
    std::shared_ptr< monty::ndarray< int32_t,1 > > _6951_shape = _6950_expr->getShape();
    _checked_ptr_1<int32_t> _ptr__6951_shape(_6951_shape ? _6951_shape->raw() : nullptr,_6951_shape ? _6951_shape->size(0) : 0);
    if (((dim0 == dim1) || ((dim0 < (int)0) || ((dim0 >= (int)((_6951_shape)->size(0))) || ((dim1 < (int)0) || ((dim1 >= (int)((_6951_shape)->size(0))) || (_ptr__6951_shape[dim0] != _ptr__6951_shape[dim1])))))))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid dimension definitions"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprDenseTril.ctor

// Begin mosek.fusion.ExprDenseTril.eval
// Method mosek.fusion.ExprDenseTril.eval @ bld/grindsted/final/default/src/fusion/ExprShape.monty:1076:6-1304:7
void mosek::fusion::ExprDenseTril :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6952_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6953_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6954_xs,bool _6955_cache_eval) { mosek::fusion::p_ExprDenseTril::_get_impl(this)->eval(_6952_rs,_6953_ws,_6954_xs,_6955_cache_eval); }
void mosek::fusion::p_ExprDenseTril::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _6952_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _6953_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _6954_xs,bool _6955_cache_eval)
{
  expr->recursive_eval(_6953_ws,_6952_rs,_6954_xs,_6955_cache_eval);
  _6953_ws->pop_expr();
  int32_t _6956_nd = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->nd;
  int32_t _6957_nnz = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->nnz;
  int32_t _6958_nelem = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->nelem;
  int32_t _6959_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->ncodeatom;
  bool _6960_hassp = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->hassp;
  int32_t _6961_shape = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->shape_base;
  int32_t _6962_ptr = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->ptr_base;
  int32_t _6963_code = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->code_base;
  int32_t _6964_codeptr = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->codeptr_base;
  int32_t _6965_cconst = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->cconst_base;
  int32_t _6966_nidxs = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->nidxs_base;
  int32_t _6967_sp = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->sp_base;
  int32_t _6968_cof = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->cof_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6969_wi32 = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__6969_wi32(_6969_wi32 ? _6969_wi32->raw() : nullptr,_6969_wi32 ? _6969_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _6970_wi64 = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__6970_wi64(_6970_wi64 ? _6970_wi64->raw() : nullptr,_6970_wi64 ? _6970_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _6971_wf64 = mosek::fusion::p_WorkStack::_get_impl(_6953_ws)->f64;
  _checked_ptr_1<double> _ptr__6971_wf64(_6971_wf64 ? _6971_wf64->raw() : nullptr,_6971_wf64 ? _6971_wf64->size(0) : 0);
  int32_t _12430_;
  bool _12431_ = (dim0 < dim1);
  if (_12431_)
  {
    _12430_ = dim0;
  }
  else
  {
    _12430_ = dim1;
  }
  int32_t _6972_xdim0 = _12430_;
  int32_t _12432_;
  bool _12433_ = (dim0 > dim1);
  if (_12433_)
  {
    _12432_ = dim0;
  }
  else
  {
    _12432_ = dim1;
  }
  int32_t _6973_xdim1 = _12432_;
  bool _6974_tril = (dim0 < dim1);
  if (((dim0 == dim1) || ((dim0 < (int)0) || ((dim0 >= _6956_nd) || ((dim1 < (int)0) || (dim1 >= _6956_nd))))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid symmetry dimensions"));
    }
  }
  else if((_ptr__6969_wi32[safe_add( _6961_shape,dim0 )] != _ptr__6969_wi32[safe_add( _6961_shape,dim1 )]))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Not symmetric in given dimensions"));
    }
  }
  {}
  std::vector<int32_t> _12434_;
  for (int32_t _6976_i = (int)0, _12435_ = (int)5; _6976_i < _12435_ ; ++_6976_i)
  {
    _12434_.push_back((int)1);
  }
  auto _12436_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12434_.size()),_12434_.begin(),_12434_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6975_dim = _12436_;
  _checked_ptr_1<int32_t> _ptr__6975_dim(_6975_dim ? _6975_dim->raw() : nullptr,_6975_dim ? _6975_dim->size(0) : 0);
  int32_t _12437_ = (int)0;
  int32_t _12438_ = _6972_xdim0;
  for (int32_t _6977_i = _12437_; _6977_i < _12438_; ++_6977_i)
  {
    {
      _ptr__6975_dim[(int)0] *= _ptr__6969_wi32[safe_add( _6961_shape,_6977_i )];
    }
  }
  _ptr__6975_dim[(int)1] = _ptr__6969_wi32[safe_add( _6961_shape,dim0 )];
  int32_t _12439_ = safe_add( _6972_xdim0,(int)1 );
  int32_t _12440_ = _6973_xdim1;
  for (int32_t _6978_i = _12439_; _6978_i < _12440_; ++_6978_i)
  {
    {
      _ptr__6975_dim[(int)2] *= _ptr__6969_wi32[safe_add( _6961_shape,_6978_i )];
    }
  }
  _ptr__6975_dim[(int)3] = _ptr__6969_wi32[safe_add( _6961_shape,dim1 )];
  int32_t _12441_ = safe_add( _6973_xdim1,(int)1 );
  int32_t _12442_ = _6956_nd;
  for (int32_t _6979_i = _12441_; _6979_i < _12442_; ++_6979_i)
  {
    {
      _ptr__6975_dim[(int)4] *= _ptr__6969_wi32[safe_add( _6961_shape,_6979_i )];
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _6980_stride = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)5)));
  _checked_ptr_1<int32_t> _ptr__6980_stride(_6980_stride ? _6980_stride->raw() : nullptr,_6980_stride ? _6980_stride->size(0) : 0);
  _ptr__6980_stride[(int)4] = (int)1;
  int32_t _12443_ = (int)1;
  int32_t _12444_ = (int)5;
  for (int32_t _6981_i = _12443_; _6981_i < _12444_; ++_6981_i)
  {
    {
      _ptr__6980_stride[(((int)5 - _6981_i) - (int)1)] = safe_mul( _ptr__6980_stride[((int)5 - _6981_i)],_ptr__6975_dim[((int)5 - _6981_i)] );
    }
  }
  int32_t _6982_rnnz = (int)0;
  int32_t _6983_rnelem = safe_mul( safe_mul( safe_mul( _ptr__6975_dim[(int)0],_ptr__6975_dim[(int)2] ),_ptr__6975_dim[(int)4] ),(safe_mul( _ptr__6975_dim[(int)1],safe_add( _ptr__6975_dim[(int)1],(int)1 ) ) / (int)2) );
  int32_t _6984_rncodeatom = (int)0;
  {
    if (_6960_hassp)
    {
      {
        int32_t _6985_d = _ptr__6975_dim[(int)1];
        if (_6974_tril)
        {
          {
            int32_t _12445_ = (int)0;
            int32_t _12446_ = _6958_nelem;
            for (int32_t _6986_i = _12445_; _6986_i < _12446_; ++_6986_i)
            {
              {
                int64_t _6987_subi = ((_ptr__6970_wi64[safe_add( _6967_sp,_6986_i )] / _ptr__6980_stride[(int)1]) % _6985_d);
                int64_t _6988_subj = ((_ptr__6970_wi64[safe_add( _6967_sp,_6986_i )] / _ptr__6980_stride[(int)3]) % _6985_d);
                if ((_6987_subi >= _6988_subj))
                {
                  {
                    _6982_rnnz += (_ptr__6969_wi32[safe_add( safe_add( _6962_ptr,_6986_i ),(int)1 )] - _ptr__6969_wi32[safe_add( _6962_ptr,_6986_i )]);
                    if ((_6959_ncodeatom > (int)0))
                    {
                      {
                        _6984_rncodeatom += (_ptr__6969_wi32[safe_add( _6964_codeptr,_ptr__6969_wi32[safe_add( safe_add( _6962_ptr,_6986_i ),(int)1 )] )] - _ptr__6969_wi32[safe_add( _6964_codeptr,_ptr__6969_wi32[safe_add( _6962_ptr,_6986_i )] )]);
                      }
                    }
                    {}
                  }
                }
                {}
              }
            }
          }
        }
        else
        {
          {
            int32_t _12447_ = (int)0;
            int32_t _12448_ = _6958_nelem;
            for (int32_t _6989_i = _12447_; _6989_i < _12448_; ++_6989_i)
            {
              {
                int64_t _6990_subi = ((_ptr__6970_wi64[safe_add( _6967_sp,_6989_i )] / _ptr__6980_stride[(int)1]) % _ptr__6975_dim[(int)1]);
                int64_t _6991_subj = ((_ptr__6970_wi64[safe_add( _6967_sp,_6989_i )] / _ptr__6980_stride[(int)3]) % _ptr__6975_dim[(int)3]);
                if ((_6990_subi <= _6991_subj))
                {
                  {
                    _6982_rnnz += (_ptr__6969_wi32[safe_add( safe_add( _6962_ptr,_6989_i ),(int)1 )] - _ptr__6969_wi32[safe_add( _6962_ptr,_6989_i )]);
                    if ((_6959_ncodeatom > (int)0))
                    {
                      {
                        _6984_rncodeatom += (_ptr__6969_wi32[safe_add( _6964_codeptr,_ptr__6969_wi32[safe_add( safe_add( _6962_ptr,_6989_i ),(int)1 )] )] - _ptr__6969_wi32[safe_add( _6964_codeptr,_ptr__6969_wi32[safe_add( _6962_ptr,_6989_i )] )]);
                      }
                    }
                    {}
                  }
                }
                {}
              }
            }
          }
        }
      }
    }
    else
    {
      {
        if (_6974_tril)
        {
          {
            int32_t _12449_ = (int)0;
            int32_t _12450_ = _ptr__6975_dim[(int)0];
            for (int32_t _6992_i0 = _12449_; _6992_i0 < _12450_; ++_6992_i0)
            {
              {
                int32_t _12451_ = (int)0;
                int32_t _12452_ = _ptr__6975_dim[(int)1];
                for (int32_t _6993_i1 = _12451_; _6993_i1 < _12452_; ++_6993_i1)
                {
                  {
                    int32_t _12453_ = (int)0;
                    int32_t _12454_ = _ptr__6975_dim[(int)2];
                    for (int32_t _6994_i2 = _12453_; _6994_i2 < _12454_; ++_6994_i2)
                    {
                      {
                        int32_t _12455_ = (int)0;
                        int32_t _12456_ = safe_add( _6993_i1,(int)1 );
                        for (int32_t _6995_i3 = _12455_; _6995_i3 < _12456_; ++_6995_i3)
                        {
                          {
                            int32_t _12457_ = (int)0;
                            int32_t _12458_ = _ptr__6975_dim[(int)4];
                            for (int32_t _6996_i4 = _12457_; _6996_i4 < _12458_; ++_6996_i4)
                            {
                              {
                                int32_t _6997_p = safe_add( safe_add( safe_add( safe_add( safe_mul( _6992_i0,_ptr__6980_stride[(int)0] ),safe_mul( _6993_i1,_ptr__6980_stride[(int)1] ) ),safe_mul( _6994_i2,_ptr__6980_stride[(int)2] ) ),safe_mul( _6995_i3,_ptr__6980_stride[(int)3] ) ),safe_mul( _6996_i4,_ptr__6980_stride[(int)4] ) );
                                _6982_rnnz += (_ptr__6969_wi32[safe_add( safe_add( _6962_ptr,_6997_p ),(int)1 )] - _ptr__6969_wi32[safe_add( _6962_ptr,_6997_p )]);
                                if ((_6959_ncodeatom > (int)0))
                                {
                                  {
                                    _6984_rncodeatom += (_ptr__6969_wi32[safe_add( _6964_codeptr,_ptr__6969_wi32[safe_add( safe_add( _6962_ptr,_6997_p ),(int)1 )] )] - _ptr__6969_wi32[safe_add( _6964_codeptr,_ptr__6969_wi32[safe_add( _6962_ptr,_6997_p )] )]);
                                  }
                                }
                                {}
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
        else
        {
          {
            int32_t _12459_ = (int)0;
            int32_t _12460_ = _ptr__6975_dim[(int)0];
            for (int32_t _6998_i0 = _12459_; _6998_i0 < _12460_; ++_6998_i0)
            {
              {
                int32_t _12461_ = (int)0;
                int32_t _12462_ = _ptr__6975_dim[(int)1];
                for (int32_t _6999_i1 = _12461_; _6999_i1 < _12462_; ++_6999_i1)
                {
                  {
                    int32_t _12463_ = (int)0;
                    int32_t _12464_ = _ptr__6975_dim[(int)2];
                    for (int32_t _7000_i2 = _12463_; _7000_i2 < _12464_; ++_7000_i2)
                    {
                      {
                        int32_t _12465_ = _6999_i1;
                        int32_t _12466_ = _ptr__6975_dim[(int)3];
                        for (int32_t _7001_i3 = _12465_; _7001_i3 < _12466_; ++_7001_i3)
                        {
                          {
                            int32_t _12467_ = (int)0;
                            int32_t _12468_ = _ptr__6975_dim[(int)4];
                            for (int32_t _7002_i4 = _12467_; _7002_i4 < _12468_; ++_7002_i4)
                            {
                              {
                                int32_t _7003_p = safe_add( safe_add( safe_add( safe_add( safe_mul( _6998_i0,_ptr__6980_stride[(int)0] ),safe_mul( _6999_i1,_ptr__6980_stride[(int)1] ) ),safe_mul( _7000_i2,_ptr__6980_stride[(int)2] ) ),safe_mul( _7001_i3,_ptr__6980_stride[(int)3] ) ),safe_mul( _7002_i4,_ptr__6980_stride[(int)4] ) );
                                _6982_rnnz += (_ptr__6969_wi32[safe_add( safe_add( _6962_ptr,_7003_p ),(int)1 )] - _ptr__6969_wi32[safe_add( _6962_ptr,_7003_p )]);
                                if ((_6959_ncodeatom > (int)0))
                                {
                                  {
                                    _6984_rncodeatom += (_ptr__6969_wi32[safe_add( _6964_codeptr,_ptr__6969_wi32[safe_add( safe_add( _6962_ptr,_7003_p ),(int)1 )] )] - _ptr__6969_wi32[safe_add( _6964_codeptr,_ptr__6969_wi32[safe_add( _6962_ptr,_7003_p )] )]);
                                  }
                                }
                                {}
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  int32_t _7004_fullnelem = (safe_mul( safe_mul( safe_mul( safe_mul( _ptr__6975_dim[(int)0],_ptr__6975_dim[(int)2] ),_ptr__6975_dim[(int)4] ),_ptr__6975_dim[(int)1] ),safe_add( _ptr__6975_dim[(int)1],(int)1 ) ) / (int)2);
  _6952_rs->alloc_expr(_6956_nd,_6983_rnelem,_6982_rnnz,true,_6984_rncodeatom);
  int32_t _7005_rptr = mosek::fusion::p_WorkStack::_get_impl(_6952_rs)->ptr_base;
  int32_t _7006_rshape = mosek::fusion::p_WorkStack::_get_impl(_6952_rs)->shape_base;
  int32_t _7007_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_6952_rs)->nidxs_base;
  int32_t _7008_rsp = mosek::fusion::p_WorkStack::_get_impl(_6952_rs)->sp_base;
  int32_t _7009_rcof = mosek::fusion::p_WorkStack::_get_impl(_6952_rs)->cof_base;
  int32_t _7010_rcode = mosek::fusion::p_WorkStack::_get_impl(_6952_rs)->code_base;
  int32_t _7011_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_6952_rs)->codeptr_base;
  int32_t _7012_rcconst = mosek::fusion::p_WorkStack::_get_impl(_6952_rs)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7013_ri32 = mosek::fusion::p_WorkStack::_get_impl(_6952_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__7013_ri32(_7013_ri32 ? _7013_ri32->raw() : nullptr,_7013_ri32 ? _7013_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7014_ri64 = mosek::fusion::p_WorkStack::_get_impl(_6952_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__7014_ri64(_7014_ri64 ? _7014_ri64->raw() : nullptr,_7014_ri64 ? _7014_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7015_rf64 = mosek::fusion::p_WorkStack::_get_impl(_6952_rs)->f64;
  _checked_ptr_1<double> _ptr__7015_rf64(_7015_rf64 ? _7015_rf64->raw() : nullptr,_7015_rf64 ? _7015_rf64->size(0) : 0);
  _ptr__7013_ri32[_7005_rptr] = (int)0;
  if ((_6984_rncodeatom > (int)0))
  {
    {
      _ptr__7013_ri32[_7011_rcodeptr] = (int)0;
    }
  }
  {}
  int32_t _12469_ = (int)0;
  int32_t _12470_ = _6956_nd;
  for (int32_t _7016_i = _12469_; _7016_i < _12470_; ++_7016_i)
  {
    {
      _ptr__7013_ri32[safe_add( _7006_rshape,_7016_i )] = _ptr__6969_wi32[safe_add( _6961_shape,_7016_i )];
    }
  }
  if (_6974_tril)
  {
    {
      int32_t _7017_k = (int)0;
      int32_t _12471_ = (int)0;
      int32_t _12472_ = _ptr__6975_dim[(int)0];
      for (int32_t _7018_i0 = _12471_; _7018_i0 < _12472_; ++_7018_i0)
      {
        {
          int32_t _12473_ = (int)0;
          int32_t _12474_ = _ptr__6975_dim[(int)1];
          for (int32_t _7019_i1 = _12473_; _7019_i1 < _12474_; ++_7019_i1)
          {
            {
              int32_t _12475_ = (int)0;
              int32_t _12476_ = _ptr__6975_dim[(int)2];
              for (int32_t _7020_i2 = _12475_; _7020_i2 < _12476_; ++_7020_i2)
              {
                {
                  int32_t _12477_ = (int)0;
                  int32_t _12478_ = safe_add( _7019_i1,(int)1 );
                  for (int32_t _7021_i3 = _12477_; _7021_i3 < _12478_; ++_7021_i3)
                  {
                    {
                      int32_t _12479_ = (int)0;
                      int32_t _12480_ = _ptr__6975_dim[(int)4];
                      for (int32_t _7022_i4 = _12479_; _7022_i4 < _12480_; ++_7022_i4)
                      {
                        {
                          _ptr__7014_ri64[safe_add( _7008_rsp,_7017_k )] = safe_add( safe_add( safe_add( safe_add( safe_mul( _7018_i0,_ptr__6980_stride[(int)0] ),safe_mul( _7019_i1,_ptr__6980_stride[(int)1] ) ),safe_mul( _7020_i2,_ptr__6980_stride[(int)2] ) ),safe_mul( _7021_i3,_ptr__6980_stride[(int)3] ) ),safe_mul( _7022_i4,_ptr__6980_stride[(int)4] ) );
                          ++ _7017_k;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      if ((_7017_k != _6983_rnelem))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid nelem"));
        }
      }
      {}
    }
  }
  else
  {
    {
      int32_t _7023_k = (int)0;
      int32_t _12481_ = (int)0;
      int32_t _12482_ = _ptr__6975_dim[(int)0];
      for (int32_t _7024_i0 = _12481_; _7024_i0 < _12482_; ++_7024_i0)
      {
        {
          int32_t _12483_ = (int)0;
          int32_t _12484_ = _ptr__6975_dim[(int)1];
          for (int32_t _7025_i1 = _12483_; _7025_i1 < _12484_; ++_7025_i1)
          {
            {
              int32_t _12485_ = (int)0;
              int32_t _12486_ = _ptr__6975_dim[(int)2];
              for (int32_t _7026_i2 = _12485_; _7026_i2 < _12486_; ++_7026_i2)
              {
                {
                  int32_t _12487_ = _7025_i1;
                  int32_t _12488_ = _ptr__6975_dim[(int)3];
                  for (int32_t _7027_i3 = _12487_; _7027_i3 < _12488_; ++_7027_i3)
                  {
                    {
                      int32_t _12489_ = (int)0;
                      int32_t _12490_ = _ptr__6975_dim[(int)4];
                      for (int32_t _7028_i4 = _12489_; _7028_i4 < _12490_; ++_7028_i4)
                      {
                        {
                          _ptr__7014_ri64[safe_add( _7008_rsp,_7023_k )] = safe_add( safe_add( safe_add( safe_add( safe_mul( _7024_i0,_ptr__6980_stride[(int)0] ),safe_mul( _7025_i1,_ptr__6980_stride[(int)1] ) ),safe_mul( _7026_i2,_ptr__6980_stride[(int)2] ) ),safe_mul( _7027_i3,_ptr__6980_stride[(int)3] ) ),safe_mul( _7028_i4,_ptr__6980_stride[(int)4] ) );
                          ++ _7023_k;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      if ((_7023_k != _6983_rnelem))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid nelem"));
        }
      }
      {}
    }
  }
  {
    int32_t _7029_nzi = (int)0;
    int32_t _7030_codei = (int)0;
    if (_6960_hassp)
    {
      {
        int32_t _7031_i1 = (int)0;
        int32_t _7032_i0 = (int)0;
        while ( ((_7032_i0 < _6958_nelem) && (_7031_i1 < _7004_fullnelem)) )
        {
          {
            if ((_ptr__6970_wi64[safe_add( _6967_sp,_7032_i0 )] < _ptr__7014_ri64[safe_add( _7008_rsp,_7031_i1 )]))
            {
              {
                ++ _7032_i0;
              }
            }
            else if((_ptr__6970_wi64[safe_add( _6967_sp,_7032_i0 )] > _ptr__7014_ri64[safe_add( _7008_rsp,_7031_i1 )]))
            {
              {
                _ptr__7013_ri32[safe_add( safe_add( _7005_rptr,_7031_i1 ),(int)1 )] = _7029_nzi;
                ++ _7031_i1;
              }
            }
            else
            {
              {
                int32_t _12491_ = _ptr__6969_wi32[safe_add( _6962_ptr,_7032_i0 )];
                int32_t _12492_ = _ptr__6969_wi32[safe_add( safe_add( _6962_ptr,_7032_i0 ),(int)1 )];
                for (int32_t _7033_j = _12491_; _7033_j < _12492_; ++_7033_j)
                {
                  {
                    _ptr__7014_ri64[safe_add( _7007_rnidxs,_7029_nzi )] = _ptr__6970_wi64[safe_add( _6966_nidxs,_7033_j )];
                    _ptr__7015_rf64[safe_add( _7009_rcof,_7029_nzi )] = _ptr__6971_wf64[safe_add( _6968_cof,_7033_j )];
                    if ((_6984_rncodeatom > (int)0))
                    {
                      {
                        int32_t _12493_ = _ptr__6969_wi32[safe_add( _6964_codeptr,_7033_j )];
                        int32_t _12494_ = _ptr__6969_wi32[safe_add( safe_add( _6964_codeptr,_7033_j ),(int)1 )];
                        for (int32_t _7034_k = _12493_; _7034_k < _12494_; ++_7034_k)
                        {
                          {
                            _ptr__7013_ri32[safe_add( _7010_rcode,_7030_codei )] = _ptr__6969_wi32[safe_add( _6963_code,_7034_k )];
                            _ptr__7015_rf64[safe_add( _7012_rcconst,_7030_codei )] = _ptr__6971_wf64[safe_add( _6965_cconst,_7034_k )];
                            ++ _7030_codei;
                          }
                        }
                        _ptr__7013_ri32[safe_add( safe_add( _7011_rcodeptr,_7029_nzi ),(int)1 )] = _7030_codei;
                      }
                    }
                    {}
                    ++ _7029_nzi;
                  }
                }
                _ptr__7013_ri32[safe_add( safe_add( _7005_rptr,_7031_i1 ),(int)1 )] = _7029_nzi;
                ++ _7032_i0;
                ++ _7031_i1;
              }
            }
          }
        }
        while ( (_7031_i1 < _7004_fullnelem) )
        {
          {
            _ptr__7013_ri32[safe_add( safe_add( _7005_rptr,_7031_i1 ),(int)1 )] = _7029_nzi;
            ++ _7031_i1;
          }
        }
      }
    }
    else
    {
      {
        int32_t _12495_ = (int)0;
        int32_t _12496_ = _7004_fullnelem;
        for (int32_t _7035_i = _12495_; _7035_i < _12496_; ++_7035_i)
        {
          {
            int64_t _7036_i0 = _ptr__7014_ri64[safe_add( _7008_rsp,_7035_i )];
            int32_t _12497_ = _ptr__6969_wi32[safe_add( _6962_ptr,_7036_i0 )];
            int32_t _12498_ = _ptr__6969_wi32[safe_add( safe_add( _6962_ptr,_7036_i0 ),(int)1 )];
            for (int32_t _7037_j = _12497_; _7037_j < _12498_; ++_7037_j)
            {
              {
                _ptr__7014_ri64[safe_add( _7007_rnidxs,_7029_nzi )] = _ptr__6970_wi64[safe_add( _6966_nidxs,_7037_j )];
                _ptr__7015_rf64[safe_add( _7009_rcof,_7029_nzi )] = _ptr__6971_wf64[safe_add( _6968_cof,_7037_j )];
                if ((_6984_rncodeatom > (int)0))
                {
                  {
                    int32_t _12499_ = _ptr__6969_wi32[safe_add( _6964_codeptr,_7037_j )];
                    int32_t _12500_ = _ptr__6969_wi32[safe_add( safe_add( _6964_codeptr,_7037_j ),(int)1 )];
                    for (int32_t _7038_k = _12499_; _7038_k < _12500_; ++_7038_k)
                    {
                      {
                        _ptr__7013_ri32[safe_add( _7010_rcode,_7030_codei )] = _ptr__6969_wi32[safe_add( _6963_code,_7038_k )];
                        _ptr__7015_rf64[safe_add( _7012_rcconst,_7030_codei )] = _ptr__6971_wf64[safe_add( _6965_cconst,_7038_k )];
                        ++ _7030_codei;
                      }
                    }
                    _ptr__7013_ri32[safe_add( safe_add( _7011_rcodeptr,_7029_nzi ),(int)1 )] = _7030_codei;
                  }
                }
                {}
                ++ _7029_nzi;
              }
            }
            _ptr__7013_ri32[safe_add( safe_add( _7005_rptr,_7035_i ),(int)1 )] = _7029_nzi;
          }
        }
      }
    }
    if ((_7029_nzi != _6982_rnnz))
    {
      {
        throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid nnz"));
      }
    }
    {}
  }
}
// End mosek.fusion.ExprDenseTril.eval

// Begin mosek.fusion.ExprDenseTril.toString
// Method mosek.fusion.ExprDenseTril.toString @ bld/grindsted/final/default/src/fusion/ExprShape.monty:1051:6-1053:7
std::string mosek::fusion::ExprDenseTril :: toString() { return mosek::fusion::p_ExprDenseTril::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprDenseTril::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprDenseTril(symdim=("))->__mosek_2fusion_2Utils_2StringBuffer__a(dim0)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(dim1)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("),"))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprDenseTril.toString

void mosek::fusion::p_ExprDenseTril::destroy()
{
  expr.reset();
}
void mosek::fusion::ExprDenseTril::destroy() { mosek::fusion::p_ExprDenseTril::_get_impl(this)->destroy(); }
// } class ExprDenseTril
// class ExprDense { // @ bld/grindsted/final/default/src/fusion/ExprShape.monty:958:4-1039:5
mosek::fusion::ExprDense::ExprDense(mosek::fusion::p_ExprDense *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprDense()" << this << std::endl; */ }
mosek::fusion::ExprDense::~ExprDense() {  /* std::cout << "~ExprDense()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprDense::p_ExprDense
  (::mosek::fusion::ExprDense * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprDense.ctor @ bld/grindsted/final/default/src/fusion/ExprShape.monty:961:6-964:7
mosek::fusion::ExprDense::t mosek::fusion::p_ExprDense::_new_ExprDense
  (monty::rc_ptr< ::mosek::fusion::Expression > _7039_expr)
{ return new mosek::fusion::ExprDense(_7039_expr); }
mosek::fusion::ExprDense::ExprDense
  (monty::rc_ptr< ::mosek::fusion::Expression > _7039_expr) : 
   ExprDense(new mosek::fusion::p_ExprDense(this))
{ mosek::fusion::p_ExprDense::_get_impl(this)->_initialize(_7039_expr); }
void mosek::fusion::p_ExprDense::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _7039_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_7039_expr->__mosek_2fusion_2Expression__getModel(),_7039_expr->getShape());
    mosek::fusion::p_ExprDense::_get_impl(::mosek::fusion::ExprDense::t(_pubthis))->expr = _7039_expr;
  }
}
// mosek.fusion.ExprDense.ctor

// Begin mosek.fusion.ExprDense.eval
// Method mosek.fusion.ExprDense.eval @ bld/grindsted/final/default/src/fusion/ExprShape.monty:968:6-1035:7
void mosek::fusion::ExprDense :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7040_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7041_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7042_xs,bool _7043_cache_eval) { mosek::fusion::p_ExprDense::_get_impl(this)->eval(_7040_rs,_7041_ws,_7042_xs,_7043_cache_eval); }
void mosek::fusion::p_ExprDense::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7040_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7041_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7042_xs,bool _7043_cache_eval)
{
  expr->recursive_eval(_7041_ws,_7040_rs,_7042_xs,_7043_cache_eval);
  _7041_ws->pop_expr();
  int32_t _7044_nd = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->nd;
  int32_t _7045_nnz = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->nnz;
  int32_t _7046_nelem = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->nelem;
  int32_t _7047_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->ncodeatom;
  bool _7048_hassp = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->hassp;
  int32_t _7049_shape = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->shape_base;
  int32_t _7050_ptr = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->ptr_base;
  int32_t _7051_nidxs = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->nidxs_base;
  int32_t _7052_cof = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->cof_base;
  int32_t _7053_sp = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->sp_base;
  int32_t _7054_codeptr = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->codeptr_base;
  int32_t _7055_code = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->code_base;
  int32_t _7056_cconst = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7057_wi32 = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__7057_wi32(_7057_wi32 ? _7057_wi32->raw() : nullptr,_7057_wi32 ? _7057_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7058_wi64 = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__7058_wi64(_7058_wi64 ? _7058_wi64->raw() : nullptr,_7058_wi64 ? _7058_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7059_wf64 = mosek::fusion::p_WorkStack::_get_impl(_7041_ws)->f64;
  _checked_ptr_1<double> _ptr__7059_wf64(_7059_wf64 ? _7059_wf64->raw() : nullptr,_7059_wf64 ? _7059_wf64->size(0) : 0);
  int32_t _7060_rnelem = (int)1;
  if (_7048_hassp)
  {
    {
      bool _7061_ok = true;
      int32_t _12501_ = (int)0;
      int32_t _12502_ = _7044_nd;
      for (int32_t _7062_i = _12501_; _7062_i < _12502_; ++_7062_i)
      {
        {
          int32_t _7063_szx = safe_mul( _7060_rnelem,_ptr__7057_wi32[safe_add( _7049_shape,_7062_i )] );
          _7061_ok = (_7061_ok && ((_ptr__7057_wi32[safe_add( _7049_shape,_7062_i )] == (int)0) || ((_7063_szx / _ptr__7057_wi32[safe_add( _7049_shape,_7062_i )]) == _7060_rnelem)));
          _7060_rnelem = _7063_szx;
        }
      }
      if ((!_7061_ok))
      {
        {
          throw ::mosek::fusion::LengthError(std::string ("The domain is too large"));
        }
      }
      {}
    }
  }
  else
  {
    {
      _7060_rnelem = _7046_nelem;
    }
  }
  _7040_rs->alloc_expr(_7044_nd,_7060_rnelem,_7045_nnz,false,_7047_ncodeatom);
  int32_t _7064_rshape = mosek::fusion::p_WorkStack::_get_impl(_7040_rs)->shape_base;
  int32_t _7065_rptr = mosek::fusion::p_WorkStack::_get_impl(_7040_rs)->ptr_base;
  int32_t _7066_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_7040_rs)->nidxs_base;
  int32_t _7067_rcof = mosek::fusion::p_WorkStack::_get_impl(_7040_rs)->cof_base;
  int32_t _7068_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_7040_rs)->codeptr_base;
  int32_t _7069_rcode = mosek::fusion::p_WorkStack::_get_impl(_7040_rs)->code_base;
  int32_t _7070_rcconst = mosek::fusion::p_WorkStack::_get_impl(_7040_rs)->cconst_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7071_ri32 = mosek::fusion::p_WorkStack::_get_impl(_7040_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__7071_ri32(_7071_ri32 ? _7071_ri32->raw() : nullptr,_7071_ri32 ? _7071_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7072_ri64 = mosek::fusion::p_WorkStack::_get_impl(_7040_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__7072_ri64(_7072_ri64 ? _7072_ri64->raw() : nullptr,_7072_ri64 ? _7072_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7073_rf64 = mosek::fusion::p_WorkStack::_get_impl(_7040_rs)->f64;
  _checked_ptr_1<double> _ptr__7073_rf64(_7073_rf64 ? _7073_rf64->raw() : nullptr,_7073_rf64 ? _7073_rf64->size(0) : 0);
  {
    int32_t _12503_ = (int)0;
    int32_t _12504_ = _7044_nd;
    for (int32_t _7074_i = _12503_; _7074_i < _12504_; ++_7074_i)
    {
      {
        _ptr__7071_ri32[safe_add( _7064_rshape,_7074_i )] = _ptr__7057_wi32[safe_add( _7049_shape,_7074_i )];
      }
    }
    int32_t _12505_ = (int)0;
    int32_t _12506_ = _7045_nnz;
    for (int32_t _7075_i = _12505_; _7075_i < _12506_; ++_7075_i)
    {
      {
        _ptr__7072_ri64[safe_add( _7066_rnidxs,_7075_i )] = _ptr__7058_wi64[safe_add( _7051_nidxs,_7075_i )];
      }
    }
    int32_t _12507_ = (int)0;
    int32_t _12508_ = _7045_nnz;
    for (int32_t _7076_i = _12507_; _7076_i < _12508_; ++_7076_i)
    {
      {
        _ptr__7073_rf64[safe_add( _7067_rcof,_7076_i )] = _ptr__7059_wf64[safe_add( _7052_cof,_7076_i )];
      }
    }
    if ((_7047_ncodeatom > (int)0))
    {
      {
        int32_t _12509_ = (int)0;
        int32_t _12510_ = safe_add( _7045_nnz,(int)1 );
        for (int32_t _7077_i = _12509_; _7077_i < _12510_; ++_7077_i)
        {
          {
            _ptr__7071_ri32[safe_add( _7068_rcodeptr,_7077_i )] = _ptr__7057_wi32[safe_add( _7054_codeptr,_7077_i )];
          }
        }
        int32_t _12511_ = (int)0;
        int32_t _12512_ = _7047_ncodeatom;
        for (int32_t _7078_i = _12511_; _7078_i < _12512_; ++_7078_i)
        {
          {
            _ptr__7071_ri32[safe_add( _7069_rcode,_7078_i )] = _ptr__7057_wi32[safe_add( _7055_code,_7078_i )];
          }
        }
        int32_t _12513_ = (int)0;
        int32_t _12514_ = _7047_ncodeatom;
        for (int32_t _7079_i = _12513_; _7079_i < _12514_; ++_7079_i)
        {
          {
            _ptr__7073_rf64[safe_add( _7070_rcconst,_7079_i )] = _ptr__7059_wf64[safe_add( _7056_cconst,_7079_i )];
          }
        }
      }
    }
    {}
    if ((!_7048_hassp))
    {
      {
        int32_t _12515_ = (int)0;
        int32_t _12516_ = safe_add( _7060_rnelem,(int)1 );
        for (int32_t _7080_i = _12515_; _7080_i < _12516_; ++_7080_i)
        {
          {
            _ptr__7071_ri32[safe_add( _7065_rptr,_7080_i )] = _ptr__7057_wi32[safe_add( _7050_ptr,_7080_i )];
          }
        }
      }
    }
    else
    {
      {
        int32_t _12517_ = (int)0;
        int32_t _12518_ = safe_add( _7060_rnelem,(int)1 );
        for (int32_t _7081_i = _12517_; _7081_i < _12518_; ++_7081_i)
        {
          {
            _ptr__7071_ri32[safe_add( _7065_rptr,_7081_i )] = (int)0;
          }
        }
        int32_t _12519_ = (int)0;
        int32_t _12520_ = _7046_nelem;
        for (int32_t _7082_i = _12519_; _7082_i < _12520_; ++_7082_i)
        {
          {
            _ptr__7071_ri32[safe_add( safe_add( _7065_rptr,_ptr__7058_wi64[safe_add( _7053_sp,_7082_i )] ),(int)1 )] = (_ptr__7057_wi32[safe_add( safe_add( _7050_ptr,_7082_i ),(int)1 )] - _ptr__7057_wi32[safe_add( _7050_ptr,_7082_i )]);
          }
        }
        int32_t _12521_ = (int)0;
        int32_t _12522_ = _7060_rnelem;
        for (int32_t _7083_i = _12521_; _7083_i < _12522_; ++_7083_i)
        {
          {
            _ptr__7071_ri32[safe_add( safe_add( _7065_rptr,_7083_i ),(int)1 )] += _ptr__7071_ri32[safe_add( _7065_rptr,_7083_i )];
          }
        }
      }
    }
  }
}
// End mosek.fusion.ExprDense.eval

// Begin mosek.fusion.ExprDense.toString
// Method mosek.fusion.ExprDense.toString @ bld/grindsted/final/default/src/fusion/ExprShape.monty:966:6-127
std::string mosek::fusion::ExprDense :: toString() { return mosek::fusion::p_ExprDense::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprDense::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprDense("))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprDense.toString

void mosek::fusion::p_ExprDense::destroy()
{
  expr.reset();
}
void mosek::fusion::ExprDense::destroy() { mosek::fusion::p_ExprDense::_get_impl(this)->destroy(); }
// } class ExprDense
// class ExprSymmetrize { // @ bld/grindsted/final/default/src/fusion/ExprShape.monty:227:4-951:5
mosek::fusion::ExprSymmetrize::ExprSymmetrize(mosek::fusion::p_ExprSymmetrize *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprSymmetrize()" << this << std::endl; */ }
mosek::fusion::ExprSymmetrize::~ExprSymmetrize() {  /* std::cout << "~ExprSymmetrize()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprSymmetrize::p_ExprSymmetrize
  (::mosek::fusion::ExprSymmetrize * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprSymmetrize.ctor @ bld/grindsted/final/default/src/fusion/ExprShape.monty:244:6-257:7
mosek::fusion::ExprSymmetrize::t mosek::fusion::p_ExprSymmetrize::_new_ExprSymmetrize
  (int32_t _7084_dim0,
    int32_t _7085_dim1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7086_expr,
    int32_t _7087_unchecked_)
{ return new mosek::fusion::ExprSymmetrize(_7084_dim0,_7085_dim1,_7086_expr,_7087_unchecked_); }
mosek::fusion::ExprSymmetrize::ExprSymmetrize
  (int32_t _7084_dim0,
    int32_t _7085_dim1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7086_expr,
    int32_t _7087_unchecked_) : 
   ExprSymmetrize(new mosek::fusion::p_ExprSymmetrize(this))
{ mosek::fusion::p_ExprSymmetrize::_get_impl(this)->_initialize(_7084_dim0,_7085_dim1,_7086_expr,_7087_unchecked_); }
void mosek::fusion::p_ExprSymmetrize::_initialize  (int32_t _7084_dim0,
    int32_t _7085_dim1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7086_expr,
    int32_t _7087_unchecked_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_7086_expr->__mosek_2fusion_2Expression__getModel(),_7086_expr->getShape());
    mosek::fusion::p_ExprSymmetrize::_get_impl(::mosek::fusion::ExprSymmetrize::t(_pubthis))->expr = _7086_expr;
    if ((_7084_dim0 < _7085_dim1))
    {
      {
        mosek::fusion::p_ExprSymmetrize::_get_impl(::mosek::fusion::ExprSymmetrize::t(_pubthis))->dim0 = _7084_dim0;
        mosek::fusion::p_ExprSymmetrize::_get_impl(::mosek::fusion::ExprSymmetrize::t(_pubthis))->dim1 = _7085_dim1;
      }
    }
    else
    {
      {
        mosek::fusion::p_ExprSymmetrize::_get_impl(::mosek::fusion::ExprSymmetrize::t(_pubthis))->dim0 = _7085_dim1;
        mosek::fusion::p_ExprSymmetrize::_get_impl(::mosek::fusion::ExprSymmetrize::t(_pubthis))->dim1 = _7084_dim0;
      }
    }
  }
}
// mosek.fusion.ExprSymmetrize.ctor

// mosek.fusion.ExprSymmetrize.ctor @ bld/grindsted/final/default/src/fusion/ExprShape.monty:236:6-242:7
mosek::fusion::ExprSymmetrize::t mosek::fusion::p_ExprSymmetrize::_new_ExprSymmetrize
  (int32_t _7088_dim0_,
    int32_t _7089_dim1_,
    monty::rc_ptr< ::mosek::fusion::Expression > _7090_expr)
{ return new mosek::fusion::ExprSymmetrize(_7088_dim0_,_7089_dim1_,_7090_expr); }
mosek::fusion::ExprSymmetrize::ExprSymmetrize
  (int32_t _7088_dim0_,
    int32_t _7089_dim1_,
    monty::rc_ptr< ::mosek::fusion::Expression > _7090_expr) : 
   ExprSymmetrize(new mosek::fusion::p_ExprSymmetrize(this))
{ mosek::fusion::p_ExprSymmetrize::_get_impl(this)->_initialize(_7088_dim0_,_7089_dim1_,_7090_expr); }
void mosek::fusion::p_ExprSymmetrize::_initialize  (int32_t _7088_dim0_,
    int32_t _7089_dim1_,
    monty::rc_ptr< ::mosek::fusion::Expression > _7090_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ExprSymmetrize::_initialize(_7088_dim0_,_7089_dim1_,_7090_expr,(int)1);
    std::shared_ptr< monty::ndarray< int32_t,1 > > _7091_shape = _7090_expr->getShape();
    _checked_ptr_1<int32_t> _ptr__7091_shape(_7091_shape ? _7091_shape->raw() : nullptr,_7091_shape ? _7091_shape->size(0) : 0);
    if (((dim0 < (int)0) || ((dim0 == dim1) || ((dim1 >= (int)((_7091_shape)->size(0))) || (_ptr__7091_shape[dim0] != _ptr__7091_shape[dim1])))))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid dimension definitions"));
      }
    }
    {}
  }
}
// mosek.fusion.ExprSymmetrize.ctor

// Begin mosek.fusion.ExprSymmetrize.eval
// Method mosek.fusion.ExprSymmetrize.eval @ bld/grindsted/final/default/src/fusion/ExprShape.monty:259:6-791:7
void mosek::fusion::ExprSymmetrize :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7092_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7093_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7094_xs,bool _7095_cache_eval) { mosek::fusion::p_ExprSymmetrize::_get_impl(this)->eval(_7092_rs,_7093_ws,_7094_xs,_7095_cache_eval); }
void mosek::fusion::p_ExprSymmetrize::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7092_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7093_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7094_xs,bool _7095_cache_eval)
{
  expr->recursive_eval(_7093_ws,_7092_rs,_7094_xs,_7095_cache_eval);
  _7093_ws->pop_expr();
  int32_t _7096_dimmax = (int)0;
  int32_t _7097_nd = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->nd;
  int32_t _7098_nnz = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->nnz;
  int32_t _7099_nelem = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->nelem;
  int32_t _7100_ncodeatom = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->ncodeatom;
  bool _7101_hassp = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->hassp;
  int32_t _7102_shape = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->shape_base;
  int32_t _7103_ptr = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->ptr_base;
  int32_t _7104_code = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->code_base;
  int32_t _7105_codeptr = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->codeptr_base;
  int32_t _7106_cconst = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->cconst_base;
  int32_t _7107_nidxs = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->nidxs_base;
  int32_t _7108_sp = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->sp_base;
  int32_t _7109_cof = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->cof_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7110_wi32 = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->i32;
  _checked_ptr_1<int32_t> _ptr__7110_wi32(_7110_wi32 ? _7110_wi32->raw() : nullptr,_7110_wi32 ? _7110_wi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7111_wi64 = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->i64;
  _checked_ptr_1<int64_t> _ptr__7111_wi64(_7111_wi64 ? _7111_wi64->raw() : nullptr,_7111_wi64 ? _7111_wi64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7112_wf64 = mosek::fusion::p_WorkStack::_get_impl(_7093_ws)->f64;
  _checked_ptr_1<double> _ptr__7112_wf64(_7112_wf64 ? _7112_wf64->raw() : nullptr,_7112_wf64 ? _7112_wf64->size(0) : 0);
  int32_t _12523_ = (int)0;
  int32_t _12524_ = _7097_nd;
  for (int32_t _7113_i = _12523_; _7113_i < _12524_; ++_7113_i)
  {
    {
      int32_t _7114_d = _ptr__7110_wi32[safe_add( _7102_shape,_7113_i )];
      if ((_7114_d > _7096_dimmax))
      {
        {
          _7096_dimmax = _7114_d;
        }
      }
      {}
    }
  }
  int32_t _7115_xperm1 = _7094_xs->alloci32(_7099_nelem);
  int32_t _7116_xperm2 = _7094_xs->alloci32(_7099_nelem);
  int32_t _7117_xptr = _7094_xs->alloci32(safe_add( _7096_dimmax,(int)1 ));
  int32_t _7118_xsp = _7094_xs->alloci64(_7099_nelem);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7119_xi32 = mosek::fusion::p_WorkStack::_get_impl(_7094_xs)->i32;
  _checked_ptr_1<int32_t> _ptr__7119_xi32(_7119_xi32 ? _7119_xi32->raw() : nullptr,_7119_xi32 ? _7119_xi32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7120_xi64 = mosek::fusion::p_WorkStack::_get_impl(_7094_xs)->i64;
  _checked_ptr_1<int64_t> _ptr__7120_xi64(_7120_xi64 ? _7120_xi64->raw() : nullptr,_7120_xi64 ? _7120_xi64->size(0) : 0);
  int32_t _7121_rnelem = (int)0;
  int32_t _7122_rnnz = (int)0;
  int32_t _7123_rncodeatom = (int)0;
  if ((_ptr__7110_wi32[safe_add( _7102_shape,dim0 )] != _ptr__7110_wi32[safe_add( _7102_shape,dim1 )]))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Symmetry dimensions are no the same"));
    }
  }
  {}
  int32_t _7124_d = _ptr__7110_wi32[safe_add( _7102_shape,dim0 )];
  std::vector<int32_t> _12525_;
  for (int32_t _7126_i = (int)0, _12526_ = (int)5; _7126_i < _12526_ ; ++_7126_i)
  {
    _12525_.push_back((int)1);
  }
  auto _12527_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12525_.size()),_12525_.begin(),_12525_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7125_dim = _12527_;
  _checked_ptr_1<int32_t> _ptr__7125_dim(_7125_dim ? _7125_dim->raw() : nullptr,_7125_dim ? _7125_dim->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7127_stride = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)5)));
  _checked_ptr_1<int64_t> _ptr__7127_stride(_7127_stride ? _7127_stride->raw() : nullptr,_7127_stride ? _7127_stride->size(0) : 0);
  int32_t _12528_ = (int)0;
  int32_t _12529_ = dim0;
  for (int32_t _7128_i = _12528_; _7128_i < _12529_; ++_7128_i)
  {
    {
      _ptr__7125_dim[(int)0] *= _ptr__7110_wi32[safe_add( _7102_shape,_7128_i )];
    }
  }
  _ptr__7125_dim[(int)1] = _ptr__7110_wi32[safe_add( _7102_shape,dim0 )];
  int32_t _12530_ = safe_add( dim0,(int)1 );
  int32_t _12531_ = dim1;
  for (int32_t _7129_i = _12530_; _7129_i < _12531_; ++_7129_i)
  {
    {
      _ptr__7125_dim[(int)2] *= _ptr__7110_wi32[safe_add( _7102_shape,_7129_i )];
    }
  }
  _ptr__7125_dim[(int)3] = _ptr__7110_wi32[safe_add( _7102_shape,dim1 )];
  int32_t _12532_ = safe_add( dim1,(int)1 );
  int32_t _12533_ = _7097_nd;
  for (int32_t _7130_i = _12532_; _7130_i < _12533_; ++_7130_i)
  {
    {
      _ptr__7125_dim[(int)4] *= _ptr__7110_wi32[safe_add( _7102_shape,_7130_i )];
    }
  }
  _ptr__7127_stride[(int)4] = (int)1;
  int32_t _12534_ = (int)1;
  int32_t _12535_ = (int)5;
  for (int32_t _7131_i = _12534_; _7131_i < _12535_; ++_7131_i)
  {
    {
      _ptr__7127_stride[(((int)5 - _7131_i) - (int)1)] = safe_mul( _ptr__7127_stride[((int)5 - _7131_i)],_ptr__7125_dim[((int)5 - _7131_i)] );
    }
  }
  if (_7101_hassp)
  {
    {
      int32_t _7132_curperm = _7115_xperm1;
      int32_t _12536_ = (int)0;
      int32_t _12537_ = _7099_nelem;
      for (int32_t _7133_i = _12536_; _7133_i < _12537_; ++_7133_i)
      {
        {
          _ptr__7119_xi32[safe_add( _7132_curperm,_7133_i )] = _7133_i;
        }
      }
      int32_t _7134_tgtperm = _7116_xperm2;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7135_sortidx = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)((int)2),(int32_t)((int)3),(int32_t)((int)0)});
      _checked_ptr_1<int32_t> _ptr__7135_sortidx(_7135_sortidx ? _7135_sortidx->raw() : nullptr,_7135_sortidx ? _7135_sortidx->size(0) : 0);
      int32_t _12538_ = (int)0;
      int32_t _12539_ = (int)4;
      for (int32_t _7136_k = _12538_; _7136_k < _12539_; ++_7136_k)
      {
        {
          int64_t _7137_s = _ptr__7127_stride[_ptr__7135_sortidx[_7136_k]];
          int32_t _7138_d = _ptr__7125_dim[_ptr__7135_sortidx[_7136_k]];
          if ((_7138_d > (int)1))
          {
            {
              int32_t _12540_ = (int)0;
              int32_t _12541_ = safe_add( _7138_d,(int)1 );
              for (int32_t _7139_i = _12540_; _7139_i < _12541_; ++_7139_i)
              {
                {
                  _ptr__7119_xi32[safe_add( _7117_xptr,_7139_i )] = (int)0;
                }
              }
              int32_t _12542_ = (int)0;
              int32_t _12543_ = _7099_nelem;
              for (int32_t _7140_i = _12542_; _7140_i < _12543_; ++_7140_i)
              {
                {
                  ++ _ptr__7119_xi32[safe_add( safe_add( _7117_xptr,((_ptr__7111_wi64[safe_add( _7108_sp,_ptr__7119_xi32[safe_add( _7132_curperm,_7140_i )] )] / _7137_s) % _7138_d) ),(int)1 )];
                }
              }
              int32_t _12544_ = (int)0;
              int32_t _12545_ = _ptr__7125_dim[(int)3];
              for (int32_t _7141_i = _12544_; _7141_i < _12545_; ++_7141_i)
              {
                {
                  _ptr__7119_xi32[safe_add( safe_add( _7117_xptr,_7141_i ),(int)1 )] += _ptr__7119_xi32[safe_add( _7117_xptr,_7141_i )];
                }
              }
              int32_t _12546_ = (int)0;
              int32_t _12547_ = _7099_nelem;
              for (int32_t _7142_i = _12546_; _7142_i < _12547_; ++_7142_i)
              {
                {
                  int32_t _7143_ii = _ptr__7119_xi32[safe_add( _7132_curperm,_7142_i )];
                  int64_t _7144_idx = ((_ptr__7111_wi64[safe_add( _7108_sp,_7143_ii )] / _7137_s) % _7138_d);
                  _ptr__7119_xi32[safe_add( _7134_tgtperm,_ptr__7119_xi32[safe_add( _7117_xptr,_7144_idx )] )] = _7143_ii;
                  ++ _ptr__7119_xi32[safe_add( _7117_xptr,_7144_idx )];
                }
              }
              int32_t _7145_tmpperm = _7132_curperm;
              _7132_curperm = _7134_tgtperm;
              _7134_tgtperm = _7145_tmpperm;
            }
          }
          {}
        }
      }
      int32_t _12548_ = (int)0;
      int32_t _12549_ = _7099_nelem;
      for (int32_t _7146_i = _12548_; _7146_i < _12549_; ++_7146_i)
      {
        {
          int32_t _7147_p0 = _ptr__7110_wi32[safe_add( _7103_ptr,_7146_i )];
          int32_t _7148_p1 = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7146_i ),(int)1 )];
          int64_t _7149_spi0 = _ptr__7111_wi64[safe_add( _7108_sp,_7146_i )];
          if ((((_7149_spi0 % _ptr__7127_stride[(int)0]) / _ptr__7127_stride[(int)1]) == ((_7149_spi0 % _ptr__7127_stride[(int)2]) / _ptr__7127_stride[(int)3])))
          {
            {
              _7122_rnnz += (_7148_p1 - _7147_p0);
              if ((_7100_ncodeatom > (int)0))
              {
                {
                  _7123_rncodeatom += (_ptr__7110_wi32[safe_add( _7105_codeptr,_7148_p1 )] - _ptr__7110_wi32[safe_add( _7105_codeptr,_7147_p0 )]);
                }
              }
              {}
            }
          }
          else
          {
            {
              _7122_rnnz += safe_mul( (_7148_p1 - _7147_p0),(int)2 );
              if ((_7100_ncodeatom > (int)0))
              {
                {
                  _7123_rncodeatom += safe_mul( safe_add( (_ptr__7110_wi32[safe_add( _7105_codeptr,_7148_p1 )] - _ptr__7110_wi32[safe_add( _7105_codeptr,_7147_p0 )]),safe_mul( (int)2,(_7148_p1 - _7147_p0) ) ),(int)2 );
                }
              }
              {}
            }
          }
        }
      }
      int32_t _12550_ = (int)0;
      int32_t _12551_ = _7099_nelem;
      for (int32_t _7150_i = _12550_; _7150_i < _12551_; ++_7150_i)
      {
        {
          int64_t _7151_k = _ptr__7111_wi64[safe_add( _7108_sp,_ptr__7119_xi32[safe_add( _7132_curperm,_7150_i )] )];
          int64_t _7152_i0 = (_7151_k / _ptr__7127_stride[(int)0]);
          _7151_k %= _ptr__7127_stride[(int)0];
          int64_t _7153_i1 = (_7151_k / _ptr__7127_stride[(int)1]);
          _7151_k %= _ptr__7127_stride[(int)1];
          int64_t _7154_i2 = (_7151_k / _ptr__7127_stride[(int)2]);
          _7151_k %= _ptr__7127_stride[(int)2];
          int64_t _7155_i3 = (_7151_k / _ptr__7127_stride[(int)3]);
          _7151_k %= _ptr__7127_stride[(int)3];
          int64_t _7156_i4 = _7151_k;
          _ptr__7120_xi64[safe_add( _7118_xsp,_7150_i )] = safe_add( safe_add( safe_add( safe_add( safe_mul( _7152_i0,_ptr__7127_stride[(int)0] ),safe_mul( _7155_i3,_ptr__7127_stride[(int)1] ) ),safe_mul( _7154_i2,_ptr__7127_stride[(int)2] ) ),safe_mul( _7153_i1,_ptr__7127_stride[(int)3] ) ),_7156_i4 );
        }
      }
      {
        int32_t _7157_i1 = (int)0;
        int32_t _7158_i0 = (int)0;
        while ( ((_7158_i0 < _7099_nelem) || (_7157_i1 < _7099_nelem)) )
        {
          {
            int64_t _12552_;
            bool _12553_ = (_7158_i0 < _7099_nelem);
            if (_12553_)
            {
              _12552_ = _ptr__7111_wi64[safe_add( _7108_sp,_7158_i0 )];
            }
            else
            {
              _12552_ = (-(int)1);
            }
            int64_t _7159_spi0 = _12552_;
            int64_t _12554_;
            bool _12555_ = (_7157_i1 < _7099_nelem);
            if (_12555_)
            {
              _12554_ = _ptr__7120_xi64[safe_add( _7118_xsp,_7157_i1 )];
            }
            else
            {
              _12554_ = (-(int)1);
            }
            int64_t _7160_spi1 = _12554_;
            if (((_7158_i0 < _7099_nelem) && ((_7157_i1 >= _7099_nelem) || (_7159_spi0 < _7160_spi1))))
            {
              {
                ++ _7121_rnelem;
                ++ _7158_i0;
              }
            }
            else if(((_7157_i1 < _7099_nelem) && ((_7158_i0 >= _7099_nelem) || (_7159_spi0 > _7160_spi1))))
            {
              {
                ++ _7121_rnelem;
                ++ _7157_i1;
              }
            }
            else
            {
              {
                int64_t _7161_idx2_0 = ((_ptr__7111_wi64[safe_add( _7108_sp,_7158_i0 )] % _ptr__7127_stride[(int)0]) / _ptr__7127_stride[(int)1]);
                int64_t _7162_idx2_1 = ((_ptr__7111_wi64[safe_add( _7108_sp,_7158_i0 )] % _ptr__7127_stride[(int)2]) / _ptr__7127_stride[(int)3]);
                if ((((_7159_spi0 % _ptr__7127_stride[(int)0]) / _ptr__7127_stride[(int)1]) != ((_7159_spi0 % _ptr__7127_stride[(int)2]) / _ptr__7127_stride[(int)3])))
                {
                  {
                    ++ _7121_rnelem;
                    ++ _7157_i1;
                    ++ _7158_i0;
                  }
                }
                else
                {
                  {
                    ++ _7121_rnelem;
                    ++ _7157_i1;
                    ++ _7158_i0;
                  }
                }
              }
            }
          }
        }
      }
      _7092_rs->alloc_expr(_7097_nd,_7121_rnelem,_7122_rnnz,true,_7123_rncodeatom);
      int32_t _7163_rnd = _7097_nd;
      int32_t _7164_rptr = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->ptr_base;
      int32_t _7165_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->nidxs_base;
      int32_t _7166_rshape = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->shape_base;
      int32_t _7167_rsp = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->sp_base;
      int32_t _7168_rcof = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->cof_base;
      int32_t _7169_rcode = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->code_base;
      int32_t _7170_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->codeptr_base;
      int32_t _7171_rcconst = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7172_ri32 = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__7172_ri32(_7172_ri32 ? _7172_ri32->raw() : nullptr,_7172_ri32 ? _7172_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _7173_ri64 = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__7173_ri64(_7173_ri64 ? _7173_ri64->raw() : nullptr,_7173_ri64 ? _7173_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _7174_rf64 = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->f64;
      _checked_ptr_1<double> _ptr__7174_rf64(_7174_rf64 ? _7174_rf64->raw() : nullptr,_7174_rf64 ? _7174_rf64->size(0) : 0);
      int32_t _12556_ = (int)0;
      int32_t _12557_ = _7097_nd;
      for (int32_t _7175_i = _12556_; _7175_i < _12557_; ++_7175_i)
      {
        {
          _ptr__7172_ri32[safe_add( _7166_rshape,_7175_i )] = _ptr__7110_wi32[safe_add( _7102_shape,_7175_i )];
        }
      }
      _ptr__7172_ri32[_7164_rptr] = (int)0;
      if ((_7123_rncodeatom > (int)0))
      {
        {
          _ptr__7172_ri32[_7170_rcodeptr] = (int)0;
        }
      }
      {}
      {
        int32_t _7176_nzi = (int)0;
        int32_t _7177_codei = (int)0;
        int32_t _7178_elmi = (int)0;
        int32_t _7179_ii1 = (int)0;
        int32_t _7180_i0 = (int)0;
        _ptr__7172_ri32[_7164_rptr] = (int)0;
        while ( ((_7180_i0 < _7099_nelem) || (_7179_ii1 < _7099_nelem)) )
        {
          {
            int32_t _12558_;
            bool _12559_ = (_7179_ii1 < _7099_nelem);
            if (_12559_)
            {
              _12558_ = _ptr__7119_xi32[safe_add( _7132_curperm,_7179_ii1 )];
            }
            else
            {
              _12558_ = (-(int)1);
            }
            int32_t _7181_i1 = _12558_;
            int64_t _12560_;
            bool _12561_ = (_7180_i0 < _7099_nelem);
            if (_12561_)
            {
              _12560_ = _ptr__7111_wi64[safe_add( _7108_sp,_7180_i0 )];
            }
            else
            {
              _12560_ = (-(int)1);
            }
            int64_t _7182_spi0 = _12560_;
            int64_t _12562_;
            bool _12563_ = (_7179_ii1 < _7099_nelem);
            if (_12563_)
            {
              _12562_ = _ptr__7120_xi64[safe_add( _7118_xsp,_7179_ii1 )];
            }
            else
            {
              _12562_ = (-(int)1);
            }
            int64_t _7183_spi1 = _12562_;
            if (((_7180_i0 < _7099_nelem) && ((_7179_ii1 >= _7099_nelem) || (_7182_spi0 < _7183_spi1))))
            {
              {
                if ((_7123_rncodeatom == (int)0))
                {
                  {
                    int32_t _12564_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7180_i0 )];
                    int32_t _12565_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7180_i0 ),(int)1 )];
                    for (int32_t _7184_j = _12564_; _7184_j < _12565_; ++_7184_j)
                    {
                      {
                        _ptr__7173_ri64[safe_add( _7165_rnidxs,_7176_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7184_j )];
                        _ptr__7174_rf64[safe_add( _7168_rcof,_7176_nzi )] = (_ptr__7112_wf64[safe_add( _7109_cof,_7184_j )] * 0.5);
                        ++ _7176_nzi;
                      }
                    }
                  }
                }
                else
                {
                  {
                    int32_t _12566_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7180_i0 )];
                    int32_t _12567_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7180_i0 ),(int)1 )];
                    for (int32_t _7185_j = _12566_; _7185_j < _12567_; ++_7185_j)
                    {
                      {
                        _ptr__7173_ri64[safe_add( _7165_rnidxs,_7176_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7185_j )];
                        _ptr__7174_rf64[safe_add( _7168_rcof,_7176_nzi )] = (_ptr__7112_wf64[safe_add( _7109_cof,_7185_j )] * 0.5);
                        int32_t _12568_ = _ptr__7110_wi32[safe_add( _7105_codeptr,_7185_j )];
                        int32_t _12569_ = _ptr__7110_wi32[safe_add( safe_add( _7105_codeptr,_7185_j ),(int)1 )];
                        for (int32_t _7186_k = _12568_; _7186_k < _12569_; ++_7186_k)
                        {
                          {
                            _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = _ptr__7110_wi32[safe_add( _7104_code,_7186_k )];
                            _ptr__7174_rf64[safe_add( _7171_rcconst,_7177_codei )] = _ptr__7112_wf64[safe_add( _7106_cconst,_7186_k )];
                            ++ _7177_codei;
                          }
                        }
                        _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = 2;
                        _ptr__7174_rf64[safe_add( _7171_rcconst,_7177_codei )] = 0.5;
                        ++ _7177_codei;
                        _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = 5;
                        ++ _7177_codei;
                        _ptr__7172_ri32[safe_add( safe_add( _7170_rcodeptr,_7176_nzi ),(int)1 )] = _7177_codei;
                        ++ _7176_nzi;
                      }
                    }
                  }
                }
                _ptr__7173_ri64[safe_add( _7167_rsp,_7178_elmi )] = _7182_spi0;
                _ptr__7172_ri32[safe_add( safe_add( _7164_rptr,_7178_elmi ),(int)1 )] = _7176_nzi;
                ++ _7178_elmi;
                ++ _7180_i0;
              }
            }
            else if(((_7179_ii1 < _7099_nelem) && ((_7180_i0 >= _7099_nelem) || (_7182_spi0 > _7183_spi1))))
            {
              {
                if ((_7123_rncodeatom == (int)0))
                {
                  {
                    int32_t _12570_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7181_i1 )];
                    int32_t _12571_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7181_i1 ),(int)1 )];
                    for (int32_t _7187_j = _12570_; _7187_j < _12571_; ++_7187_j)
                    {
                      {
                        _ptr__7173_ri64[safe_add( _7165_rnidxs,_7176_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7187_j )];
                        _ptr__7174_rf64[safe_add( _7168_rcof,_7176_nzi )] = (_ptr__7112_wf64[safe_add( _7109_cof,_7187_j )] * 0.5);
                        ++ _7176_nzi;
                      }
                    }
                  }
                }
                else
                {
                  {
                    int32_t _12572_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7181_i1 )];
                    int32_t _12573_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7181_i1 ),(int)1 )];
                    for (int32_t _7188_j = _12572_; _7188_j < _12573_; ++_7188_j)
                    {
                      {
                        _ptr__7173_ri64[safe_add( _7165_rnidxs,_7176_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7188_j )];
                        _ptr__7174_rf64[safe_add( _7168_rcof,_7176_nzi )] = (_ptr__7112_wf64[safe_add( _7109_cof,_7188_j )] * 0.5);
                        int32_t _12574_ = _ptr__7110_wi32[safe_add( _7105_codeptr,_7188_j )];
                        int32_t _12575_ = _ptr__7110_wi32[safe_add( safe_add( _7105_codeptr,_7188_j ),(int)1 )];
                        for (int32_t _7189_k = _12574_; _7189_k < _12575_; ++_7189_k)
                        {
                          {
                            _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = _ptr__7110_wi32[safe_add( _7104_code,_7189_k )];
                            _ptr__7174_rf64[safe_add( _7171_rcconst,_7177_codei )] = _ptr__7112_wf64[safe_add( _7106_cconst,_7189_k )];
                            ++ _7177_codei;
                          }
                        }
                        _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = 2;
                        _ptr__7174_rf64[safe_add( _7171_rcconst,_7177_codei )] = 0.5;
                        ++ _7177_codei;
                        _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = 5;
                        ++ _7177_codei;
                        _ptr__7172_ri32[safe_add( safe_add( _7170_rcodeptr,_7176_nzi ),(int)1 )] = _7177_codei;
                        ++ _7176_nzi;
                      }
                    }
                  }
                }
                _ptr__7173_ri64[safe_add( _7167_rsp,_7178_elmi )] = _7183_spi1;
                _ptr__7172_ri32[safe_add( safe_add( _7164_rptr,_7178_elmi ),(int)1 )] = _7176_nzi;
                ++ _7178_elmi;
                ++ _7179_ii1;
              }
            }
            else if((((_7182_spi0 % _ptr__7127_stride[(int)0]) / _ptr__7127_stride[(int)1]) != ((_7182_spi0 % _ptr__7127_stride[(int)2]) / _ptr__7127_stride[(int)3])))
            {
              {
                int32_t _7190_nzi_ = _7176_nzi;
                int32_t _12576_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7180_i0 )];
                int32_t _12577_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7180_i0 ),(int)1 )];
                for (int32_t _7191_j = _12576_; _7191_j < _12577_; ++_7191_j)
                {
                  {
                    _ptr__7173_ri64[safe_add( _7165_rnidxs,_7176_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7191_j )];
                    _ptr__7174_rf64[safe_add( _7168_rcof,_7176_nzi )] = (_ptr__7112_wf64[safe_add( _7109_cof,_7191_j )] * 0.5);
                    ++ _7176_nzi;
                  }
                }
                int32_t _12578_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7181_i1 )];
                int32_t _12579_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7181_i1 ),(int)1 )];
                for (int32_t _7192_j = _12578_; _7192_j < _12579_; ++_7192_j)
                {
                  {
                    _ptr__7173_ri64[safe_add( _7165_rnidxs,_7176_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7192_j )];
                    _ptr__7174_rf64[safe_add( _7168_rcof,_7176_nzi )] = (_ptr__7112_wf64[safe_add( _7109_cof,_7192_j )] * 0.5);
                    ++ _7176_nzi;
                  }
                }
                if ((_7123_rncodeatom > (int)0))
                {
                  {
                    int32_t _12580_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7180_i0 )];
                    int32_t _12581_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7180_i0 ),(int)1 )];
                    for (int32_t _7193_j = _12580_; _7193_j < _12581_; ++_7193_j)
                    {
                      {
                        int32_t _12582_ = _ptr__7110_wi32[safe_add( _7105_codeptr,_7193_j )];
                        int32_t _12583_ = _ptr__7110_wi32[safe_add( safe_add( _7105_codeptr,_7193_j ),(int)1 )];
                        for (int32_t _7194_k = _12582_; _7194_k < _12583_; ++_7194_k)
                        {
                          {
                            _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = _ptr__7110_wi32[safe_add( _7104_code,_7194_k )];
                            _ptr__7174_rf64[safe_add( _7171_rcconst,_7177_codei )] = _ptr__7112_wf64[safe_add( _7106_cconst,_7194_k )];
                            ++ _7177_codei;
                          }
                        }
                        _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = 2;
                        _ptr__7174_rf64[safe_add( _7171_rcconst,_7177_codei )] = 0.5;
                        ++ _7177_codei;
                        _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = 5;
                        ++ _7177_codei;
                        _ptr__7172_ri32[safe_add( safe_add( _7170_rcodeptr,_7190_nzi_ ),(int)1 )] = _7177_codei;
                        ++ _7190_nzi_;
                      }
                    }
                    int32_t _12584_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7181_i1 )];
                    int32_t _12585_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7181_i1 ),(int)1 )];
                    for (int32_t _7195_j = _12584_; _7195_j < _12585_; ++_7195_j)
                    {
                      {
                        int32_t _12586_ = _ptr__7110_wi32[safe_add( _7105_codeptr,_7195_j )];
                        int32_t _12587_ = _ptr__7110_wi32[safe_add( safe_add( _7105_codeptr,_7195_j ),(int)1 )];
                        for (int32_t _7196_k = _12586_; _7196_k < _12587_; ++_7196_k)
                        {
                          {
                            _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = _ptr__7110_wi32[safe_add( _7104_code,_7196_k )];
                            _ptr__7174_rf64[safe_add( _7171_rcconst,_7177_codei )] = _ptr__7112_wf64[safe_add( _7106_cconst,_7196_k )];
                            ++ _7177_codei;
                          }
                        }
                        _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = 2;
                        _ptr__7174_rf64[safe_add( _7171_rcconst,_7177_codei )] = 0.5;
                        ++ _7177_codei;
                        _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = 5;
                        ++ _7177_codei;
                        _ptr__7172_ri32[safe_add( safe_add( _7170_rcodeptr,_7190_nzi_ ),(int)1 )] = _7177_codei;
                        ++ _7190_nzi_;
                      }
                    }
                  }
                }
                {}
                _ptr__7173_ri64[safe_add( _7167_rsp,_7178_elmi )] = _7182_spi0;
                _ptr__7172_ri32[safe_add( safe_add( _7164_rptr,_7178_elmi ),(int)1 )] = _7176_nzi;
                ++ _7178_elmi;
                ++ _7179_ii1;
                ++ _7180_i0;
              }
            }
            else
            {
              {
                int32_t _7197_nzi_ = _7176_nzi;
                int32_t _12588_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7180_i0 )];
                int32_t _12589_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7180_i0 ),(int)1 )];
                for (int32_t _7198_j = _12588_; _7198_j < _12589_; ++_7198_j)
                {
                  {
                    _ptr__7173_ri64[safe_add( _7165_rnidxs,_7176_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7198_j )];
                    _ptr__7174_rf64[safe_add( _7168_rcof,_7176_nzi )] = _ptr__7112_wf64[safe_add( _7109_cof,_7198_j )];
                    ++ _7176_nzi;
                  }
                }
                if ((_7123_rncodeatom > (int)0))
                {
                  {
                    int32_t _12590_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7180_i0 )];
                    int32_t _12591_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7180_i0 ),(int)1 )];
                    for (int32_t _7199_j = _12590_; _7199_j < _12591_; ++_7199_j)
                    {
                      {
                        int32_t _12592_ = _ptr__7110_wi32[safe_add( _7105_codeptr,_7199_j )];
                        int32_t _12593_ = _ptr__7110_wi32[safe_add( safe_add( _7105_codeptr,_7199_j ),(int)1 )];
                        for (int32_t _7200_k = _12592_; _7200_k < _12593_; ++_7200_k)
                        {
                          {
                            _ptr__7172_ri32[safe_add( _7169_rcode,_7177_codei )] = _ptr__7110_wi32[safe_add( _7104_code,_7200_k )];
                            _ptr__7174_rf64[safe_add( _7171_rcconst,_7177_codei )] = _ptr__7112_wf64[safe_add( _7106_cconst,_7200_k )];
                            ++ _7177_codei;
                          }
                        }
                        _ptr__7172_ri32[safe_add( safe_add( _7170_rcodeptr,_7197_nzi_ ),(int)1 )] = _7177_codei;
                        ++ _7197_nzi_;
                      }
                    }
                  }
                }
                {}
                _ptr__7173_ri64[safe_add( _7167_rsp,_7178_elmi )] = _ptr__7111_wi64[safe_add( _7108_sp,_7180_i0 )];
                _ptr__7172_ri32[safe_add( safe_add( _7164_rptr,_7178_elmi ),(int)1 )] = _7176_nzi;
                ++ _7178_elmi;
                ++ _7179_ii1;
                ++ _7180_i0;
              }
            }
          }
        }
        if ((_7176_nzi != _7122_rnnz))
        {
          {
            throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid nzi"));
          }
        }
        {}
      }
    }
  }
  else
  {
    {
      _7121_rnelem = _7099_nelem;
      _7122_rnnz = safe_mul( _7098_nnz,(int)2 );
      int32_t _12594_;
      bool _12595_ = (_7100_ncodeatom > (int)0);
      if (_12595_)
      {
        _12594_ = safe_add( safe_mul( (int)2,_7100_ncodeatom ),safe_mul( safe_mul( (int)2,(int)2 ),_7098_nnz ) );
      }
      else
      {
        _12594_ = (int)0;
      }
      _7123_rncodeatom = _12594_;
      int32_t _12596_ = (int)0;
      int32_t _12597_ = _ptr__7125_dim[(int)0];
      for (int32_t _7201_i0 = _12596_; _7201_i0 < _12597_; ++_7201_i0)
      {
        {
          int32_t _12598_ = (int)0;
          int32_t _12599_ = _ptr__7125_dim[(int)2];
          for (int32_t _7202_i2 = _12598_; _7202_i2 < _12599_; ++_7202_i2)
          {
            {
              int32_t _12600_ = (int)0;
              int32_t _12601_ = _ptr__7125_dim[(int)4];
              for (int32_t _7203_i4 = _12600_; _7203_i4 < _12601_; ++_7203_i4)
              {
                {
                  int32_t _12602_ = (int)0;
                  int32_t _12603_ = _ptr__7125_dim[(int)1];
                  for (int32_t _7204_i = _12602_; _7204_i < _12603_; ++_7204_i)
                  {
                    {
                      int64_t _7205_p = safe_add( safe_add( safe_add( safe_add( safe_mul( _ptr__7127_stride[(int)0],_7201_i0 ),safe_mul( _ptr__7127_stride[(int)1],_7204_i ) ),safe_mul( _ptr__7127_stride[(int)2],_7202_i2 ) ),safe_mul( _ptr__7127_stride[(int)3],_7204_i ) ),safe_mul( _ptr__7127_stride[(int)4],_7203_i4 ) );
                      _7122_rnnz -= (_ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7205_p ),(int)1 )] - _ptr__7110_wi32[safe_add( _7103_ptr,_7205_p )]);
                      if ((_7100_ncodeatom > (int)0))
                      {
                        {
                          _7123_rncodeatom -= safe_add( (_ptr__7110_wi32[safe_add( _7105_codeptr,_ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7205_p ),(int)1 )] )] - _ptr__7110_wi32[safe_add( _7105_codeptr,_ptr__7110_wi32[safe_add( _7103_ptr,_7205_p )] )]),safe_mul( safe_mul( (int)2,(int)2 ),(_ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7205_p ),(int)1 )] - _ptr__7110_wi32[safe_add( _7103_ptr,_7205_p )]) ) );
                        }
                      }
                      {}
                    }
                  }
                }
              }
            }
          }
        }
      }
      _7092_rs->alloc_expr(_7097_nd,_7121_rnelem,_7122_rnnz,false,_7123_rncodeatom);
      int32_t _7206_rptr = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->ptr_base;
      int32_t _7207_rshape = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->shape_base;
      int32_t _7208_rcode = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->code_base;
      int32_t _7209_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->codeptr_base;
      int32_t _7210_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->nidxs_base;
      int32_t _7211_rsp = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->sp_base;
      int32_t _7212_rcof = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->cof_base;
      int32_t _7213_rcconst = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->cconst_base;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7214_ri32 = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->i32;
      _checked_ptr_1<int32_t> _ptr__7214_ri32(_7214_ri32 ? _7214_ri32->raw() : nullptr,_7214_ri32 ? _7214_ri32->size(0) : 0);
      std::shared_ptr< monty::ndarray< int64_t,1 > > _7215_ri64 = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->i64;
      _checked_ptr_1<int64_t> _ptr__7215_ri64(_7215_ri64 ? _7215_ri64->raw() : nullptr,_7215_ri64 ? _7215_ri64->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _7216_rf64 = mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->f64;
      _checked_ptr_1<double> _ptr__7216_rf64(_7216_rf64 ? _7216_rf64->raw() : nullptr,_7216_rf64 ? _7216_rf64->size(0) : 0);
      int32_t _7217_nzi = (int)0;
      int32_t _7218_relmi = (int)0;
      int32_t _7219_codei = (int)0;
      int32_t _12604_ = (int)0;
      int32_t _12605_ = _7097_nd;
      for (int32_t _7220_i = _12604_; _7220_i < _12605_; ++_7220_i)
      {
        {
          _ptr__7214_ri32[safe_add( _7207_rshape,_7220_i )] = _ptr__7110_wi32[safe_add( _7102_shape,_7220_i )];
        }
      }
      _ptr__7214_ri32[_7206_rptr] = (int)0;
      if ((_7123_rncodeatom > (int)0))
      {
        {
          _ptr__7214_ri32[_7209_rcodeptr] = (int)0;
        }
      }
      {}
      int32_t _7221_k = (int)0;
      int32_t _12606_ = (int)0;
      int32_t _12607_ = _ptr__7125_dim[(int)0];
      for (int32_t _7222_i0 = _12606_; _7222_i0 < _12607_; ++_7222_i0)
      {
        {
          int32_t _12608_ = (int)0;
          int32_t _12609_ = _7124_d;
          for (int32_t _7223_i1 = _12608_; _7223_i1 < _12609_; ++_7223_i1)
          {
            {
              int32_t _12610_ = (int)0;
              int32_t _12611_ = _ptr__7125_dim[(int)2];
              for (int32_t _7224_i2 = _12610_; _7224_i2 < _12611_; ++_7224_i2)
              {
                {
                  int32_t _12612_ = (int)0;
                  int32_t _12613_ = _7124_d;
                  for (int32_t _7225_i3 = _12612_; _7225_i3 < _12613_; ++_7225_i3)
                  {
                    {
                      int32_t _12614_ = (int)0;
                      int32_t _12615_ = _ptr__7125_dim[(int)4];
                      for (int32_t _7226_i4 = _12614_; _7226_i4 < _12615_; ++_7226_i4)
                      {
                        {
                          if ((_7223_i1 == _7225_i3))
                          {
                            {
                              if ((_7123_rncodeatom == (int)0))
                              {
                                {
                                  int32_t _12616_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7221_k )];
                                  int32_t _12617_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7221_k ),(int)1 )];
                                  for (int32_t _7227_j = _12616_; _7227_j < _12617_; ++_7227_j)
                                  {
                                    {
                                      _ptr__7215_ri64[safe_add( _7210_rnidxs,_7217_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7227_j )];
                                      _ptr__7216_rf64[safe_add( _7212_rcof,_7217_nzi )] = _ptr__7112_wf64[safe_add( _7109_cof,_7227_j )];
                                      ++ _7217_nzi;
                                    }
                                  }
                                }
                              }
                              else
                              {
                                {
                                  int32_t _12618_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7221_k )];
                                  int32_t _12619_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7221_k ),(int)1 )];
                                  for (int32_t _7228_j = _12618_; _7228_j < _12619_; ++_7228_j)
                                  {
                                    {
                                      _ptr__7215_ri64[safe_add( _7210_rnidxs,_7217_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7228_j )];
                                      _ptr__7216_rf64[safe_add( _7212_rcof,_7217_nzi )] = _ptr__7112_wf64[safe_add( _7109_cof,_7228_j )];
                                      int32_t _12620_ = _ptr__7110_wi32[safe_add( _7105_codeptr,_7228_j )];
                                      int32_t _12621_ = _ptr__7110_wi32[safe_add( safe_add( _7105_codeptr,_7228_j ),(int)1 )];
                                      for (int32_t _7229_l = _12620_; _7229_l < _12621_; ++_7229_l)
                                      {
                                        {
                                          _ptr__7214_ri32[safe_add( _7208_rcode,_7219_codei )] = _ptr__7110_wi32[safe_add( _7104_code,_7229_l )];
                                          _ptr__7216_rf64[safe_add( _7213_rcconst,_7219_codei )] = _ptr__7112_wf64[safe_add( _7106_cconst,_7229_l )];
                                          ++ _7219_codei;
                                        }
                                      }
                                      _ptr__7214_ri32[safe_add( safe_add( _7209_rcodeptr,_7217_nzi ),(int)1 )] = _7219_codei;
                                      ++ _7217_nzi;
                                    }
                                  }
                                }
                              }
                              _ptr__7214_ri32[safe_add( safe_add( _7206_rptr,_7218_relmi ),(int)1 )] = _7217_nzi;
                              ++ _7221_k;
                            }
                          }
                          else
                          {
                            {
                              int64_t _7230_k2 = safe_add( safe_add( safe_add( safe_add( safe_mul( _7222_i0,_ptr__7127_stride[(int)0] ),safe_mul( _7225_i3,_ptr__7127_stride[(int)1] ) ),safe_mul( _7224_i2,_ptr__7127_stride[(int)2] ) ),safe_mul( _7223_i1,_ptr__7127_stride[(int)3] ) ),_7226_i4 );
                              if ((_7123_rncodeatom == (int)0))
                              {
                                {
                                  int32_t _12622_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7221_k )];
                                  int32_t _12623_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7221_k ),(int)1 )];
                                  for (int32_t _7231_j = _12622_; _7231_j < _12623_; ++_7231_j)
                                  {
                                    {
                                      _ptr__7215_ri64[safe_add( _7210_rnidxs,_7217_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7231_j )];
                                      _ptr__7216_rf64[safe_add( _7212_rcof,_7217_nzi )] = (_ptr__7112_wf64[safe_add( _7109_cof,_7231_j )] * 0.5);
                                      ++ _7217_nzi;
                                    }
                                  }
                                  int32_t _12624_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7230_k2 )];
                                  int32_t _12625_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7230_k2 ),(int)1 )];
                                  for (int32_t _7232_j = _12624_; _7232_j < _12625_; ++_7232_j)
                                  {
                                    {
                                      _ptr__7215_ri64[safe_add( _7210_rnidxs,_7217_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7232_j )];
                                      _ptr__7216_rf64[safe_add( _7212_rcof,_7217_nzi )] = (_ptr__7112_wf64[safe_add( _7109_cof,_7232_j )] * 0.5);
                                      ++ _7217_nzi;
                                    }
                                  }
                                }
                              }
                              else
                              {
                                {
                                  int32_t _12626_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7221_k )];
                                  int32_t _12627_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7221_k ),(int)1 )];
                                  for (int32_t _7233_j = _12626_; _7233_j < _12627_; ++_7233_j)
                                  {
                                    {
                                      _ptr__7215_ri64[safe_add( _7210_rnidxs,_7217_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7233_j )];
                                      _ptr__7216_rf64[safe_add( _7212_rcof,_7217_nzi )] = (_ptr__7112_wf64[safe_add( _7109_cof,_7233_j )] * 0.5);
                                      int32_t _12628_ = _ptr__7110_wi32[safe_add( _7105_codeptr,_7233_j )];
                                      int32_t _12629_ = _ptr__7110_wi32[safe_add( safe_add( _7105_codeptr,_7233_j ),(int)1 )];
                                      for (int32_t _7234_l = _12628_; _7234_l < _12629_; ++_7234_l)
                                      {
                                        {
                                          _ptr__7214_ri32[safe_add( _7208_rcode,_7219_codei )] = _ptr__7110_wi32[safe_add( _7104_code,_7234_l )];
                                          _ptr__7216_rf64[safe_add( _7213_rcconst,_7219_codei )] = _ptr__7112_wf64[safe_add( _7106_cconst,_7234_l )];
                                          ++ _7219_codei;
                                        }
                                      }
                                      _ptr__7214_ri32[safe_add( _7208_rcode,_7219_codei )] = 2;
                                      _ptr__7216_rf64[safe_add( _7213_rcconst,_7219_codei )] = 0.5;
                                      ++ _7219_codei;
                                      _ptr__7214_ri32[safe_add( _7208_rcode,_7219_codei )] = 5;
                                      ++ _7219_codei;
                                      _ptr__7214_ri32[safe_add( safe_add( _7209_rcodeptr,_7217_nzi ),(int)1 )] = _7219_codei;
                                      ++ _7217_nzi;
                                    }
                                  }
                                  int32_t _12630_ = _ptr__7110_wi32[safe_add( _7103_ptr,_7230_k2 )];
                                  int32_t _12631_ = _ptr__7110_wi32[safe_add( safe_add( _7103_ptr,_7230_k2 ),(int)1 )];
                                  for (int32_t _7235_j = _12630_; _7235_j < _12631_; ++_7235_j)
                                  {
                                    {
                                      _ptr__7215_ri64[safe_add( _7210_rnidxs,_7217_nzi )] = _ptr__7111_wi64[safe_add( _7107_nidxs,_7235_j )];
                                      _ptr__7216_rf64[safe_add( _7212_rcof,_7217_nzi )] = (_ptr__7112_wf64[safe_add( _7109_cof,_7235_j )] * 0.5);
                                      int32_t _12632_ = _ptr__7110_wi32[safe_add( _7105_codeptr,_7235_j )];
                                      int32_t _12633_ = _ptr__7110_wi32[safe_add( safe_add( _7105_codeptr,_7235_j ),(int)1 )];
                                      for (int32_t _7236_l = _12632_; _7236_l < _12633_; ++_7236_l)
                                      {
                                        {
                                          _ptr__7214_ri32[safe_add( _7208_rcode,_7219_codei )] = _ptr__7110_wi32[safe_add( _7104_code,_7236_l )];
                                          _ptr__7216_rf64[safe_add( _7213_rcconst,_7219_codei )] = _ptr__7112_wf64[safe_add( _7106_cconst,_7236_l )];
                                          ++ _7219_codei;
                                        }
                                      }
                                      _ptr__7214_ri32[safe_add( _7208_rcode,_7219_codei )] = 2;
                                      _ptr__7216_rf64[safe_add( _7213_rcconst,_7219_codei )] = 0.5;
                                      ++ _7219_codei;
                                      _ptr__7214_ri32[safe_add( _7208_rcode,_7219_codei )] = 5;
                                      ++ _7219_codei;
                                      _ptr__7214_ri32[safe_add( safe_add( _7209_rcodeptr,_7217_nzi ),(int)1 )] = _7219_codei;
                                      ++ _7217_nzi;
                                    }
                                  }
                                }
                              }
                              _ptr__7214_ri32[safe_add( safe_add( _7206_rptr,_7218_relmi ),(int)1 )] = _7217_nzi;
                              ++ _7221_k;
                            }
                          }
                          ++ _7218_relmi;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      if ((_7217_nzi != _7122_rnnz))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid nnz"));
        }
      }
      {}
      if ((_7218_relmi != _7121_rnelem))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid nelem"));
        }
      }
      {}
    }
  }
  _7094_xs->clear();
  _7092_rs->peek_expr();
  if ((mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->nnz != ((*mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->i32)(safe_add( mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->ptr_base,mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->nelem )))))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid ptr"));
    }
  }
  {}
  if ((((*mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->i32)(mosek::fusion::p_WorkStack::_get_impl(_7092_rs)->ptr_base)) != (int)0))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal: Invalid ptr"));
    }
  }
  {}
}
// End mosek.fusion.ExprSymmetrize.eval

// Begin mosek.fusion.ExprSymmetrize.toString
// Method mosek.fusion.ExprSymmetrize.toString @ bld/grindsted/final/default/src/fusion/ExprShape.monty:232:6-234:7
std::string mosek::fusion::ExprSymmetrize :: toString() { return mosek::fusion::p_ExprSymmetrize::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprSymmetrize::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprSymmetrize(symdim=("))->__mosek_2fusion_2Utils_2StringBuffer__a(dim0)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(dim1)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("),"))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprSymmetrize.toString

void mosek::fusion::p_ExprSymmetrize::destroy()
{
  expr.reset();
}
void mosek::fusion::ExprSymmetrize::destroy() { mosek::fusion::p_ExprSymmetrize::_get_impl(this)->destroy(); }
// } class ExprSymmetrize
// class ExprCondense { // @ bld/grindsted/final/default/src/fusion/ExprShape.monty:157:4-214:5
mosek::fusion::ExprCondense::ExprCondense(mosek::fusion::p_ExprCondense *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprCondense()" << this << std::endl; */ }
mosek::fusion::ExprCondense::~ExprCondense() {  /* std::cout << "~ExprCondense()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprCondense::p_ExprCondense
  (::mosek::fusion::ExprCondense * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprCondense.ctor @ bld/grindsted/final/default/src/fusion/ExprShape.monty:159:6-162:7
mosek::fusion::ExprCondense::t mosek::fusion::p_ExprCondense::_new_ExprCondense
  (monty::rc_ptr< ::mosek::fusion::Expression > _7237_expr)
{ return new mosek::fusion::ExprCondense(_7237_expr); }
mosek::fusion::ExprCondense::ExprCondense
  (monty::rc_ptr< ::mosek::fusion::Expression > _7237_expr) : 
   ExprCondense(new mosek::fusion::p_ExprCondense(this))
{ mosek::fusion::p_ExprCondense::_get_impl(this)->_initialize(_7237_expr); }
void mosek::fusion::p_ExprCondense::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _7237_expr)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_7237_expr->__mosek_2fusion_2Expression__getModel(),_7237_expr->getShape());
    mosek::fusion::p_ExprCondense::_get_impl(::mosek::fusion::ExprCondense::t(_pubthis))->expr = _7237_expr;
  }
}
// mosek.fusion.ExprCondense.ctor

// Begin mosek.fusion.ExprCondense.eval
// Method mosek.fusion.ExprCondense.eval @ bld/grindsted/final/default/src/fusion/ExprShape.monty:168:6-188:7
void mosek::fusion::ExprCondense :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7238_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7239_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7240_xs,bool _7241_cache_eval) { mosek::fusion::p_ExprCondense::_get_impl(this)->eval(_7238_rs,_7239_ws,_7240_xs,_7241_cache_eval); }
void mosek::fusion::p_ExprCondense::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7238_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7239_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7240_xs,bool _7241_cache_eval)
{
  expr->recursive_eval(_7238_rs,_7239_ws,_7240_xs,_7241_cache_eval);
  _7238_rs->peek_expr();
  if (mosek::fusion::p_WorkStack::_get_impl(_7238_rs)->hassp)
  {
    {
      int32_t _7242_nd = _7238_rs->popi32();
      _7238_rs->popi32(_7242_nd);
      int32_t _7243_nelem = _7238_rs->popi32();
      int32_t _7244_nnz = _7238_rs->popi32();
      _7238_rs->popi32();
      _7238_rs->popi64(_7243_nelem);
      _7238_rs->pushi32((int)0);
      _7238_rs->pushi32(_7244_nnz);
      _7238_rs->pushi32(_7243_nelem);
      _7238_rs->pushi32(_7243_nelem);
      _7238_rs->pushi32((int)1);
      _7238_rs->peek_expr();
    }
  }
  {}
}
// End mosek.fusion.ExprCondense.eval

// Begin mosek.fusion.ExprCondense.toString
// Method mosek.fusion.ExprCondense.toString @ bld/grindsted/final/default/src/fusion/ExprShape.monty:164:6-166:7
std::string mosek::fusion::ExprCondense :: toString() { return mosek::fusion::p_ExprCondense::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprCondense::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprCondense("))->__mosek_2fusion_2Utils_2StringBuffer__a(expr->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprCondense.toString

void mosek::fusion::p_ExprCondense::destroy()
{
  expr.reset();
}
void mosek::fusion::ExprCondense::destroy() { mosek::fusion::p_ExprCondense::_get_impl(this)->destroy(); }
// } class ExprCondense
// class ExprFromVar { // @ bld/grindsted/final/default/src/fusion/ExprShape.monty:103:4-146:5
mosek::fusion::ExprFromVar::ExprFromVar(mosek::fusion::p_ExprFromVar *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprFromVar()" << this << std::endl; */ }
mosek::fusion::ExprFromVar::~ExprFromVar() {  /* std::cout << "~ExprFromVar()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprFromVar::p_ExprFromVar
  (::mosek::fusion::ExprFromVar * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprFromVar.ctor @ bld/grindsted/final/default/src/fusion/ExprShape.monty:105:6-108:7
mosek::fusion::ExprFromVar::t mosek::fusion::p_ExprFromVar::_new_ExprFromVar
  (monty::rc_ptr< ::mosek::fusion::Variable > _7245_x)
{ return new mosek::fusion::ExprFromVar(_7245_x); }
mosek::fusion::ExprFromVar::ExprFromVar
  (monty::rc_ptr< ::mosek::fusion::Variable > _7245_x) : 
   ExprFromVar(new mosek::fusion::p_ExprFromVar(this))
{ mosek::fusion::p_ExprFromVar::_get_impl(this)->_initialize(_7245_x); }
void mosek::fusion::p_ExprFromVar::_initialize  (monty::rc_ptr< ::mosek::fusion::Variable > _7245_x)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_BaseExpression::_initialize(_7245_x->__mosek_2fusion_2Expression__getModel(),_7245_x->getShape());
    mosek::fusion::p_ExprFromVar::_get_impl(::mosek::fusion::ExprFromVar::t(_pubthis))->x = _7245_x;
  }
}
// mosek.fusion.ExprFromVar.ctor

// Begin mosek.fusion.ExprFromVar.eval
// Method mosek.fusion.ExprFromVar.eval @ bld/grindsted/final/default/src/fusion/ExprShape.monty:117:6-145:7
void mosek::fusion::ExprFromVar :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7246_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7247_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7248_xs,bool _7249_cache_eval) { mosek::fusion::p_ExprFromVar::_get_impl(this)->eval(_7246_rs,_7247_ws,_7248_xs,_7249_cache_eval); }
void mosek::fusion::p_ExprFromVar::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7246_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7247_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7248_xs,bool _7249_cache_eval)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7250_shape = _pubthis->getShape();
  _checked_ptr_1<int32_t> _ptr__7250_shape(_7250_shape ? _7250_shape->raw() : nullptr,_7250_shape ? _7250_shape->size(0) : 0);
  int64_t _7251_size = ::mosek::fusion::p_Set::size(_7250_shape);
  int32_t _7252_nelm = x->numInst();
  int32_t _7253_nnz = _7252_nelm;
  bool _7254_hassp = (_7251_size > _7252_nelm);
  _7246_rs->alloc_expr((int)((_7250_shape)->size(0)),_7252_nelm,_7253_nnz,_7254_hassp);
  int32_t _7255_ptr_base = mosek::fusion::p_WorkStack::_get_impl(_7246_rs)->ptr_base;
  int32_t _7256_nidx_base = mosek::fusion::p_WorkStack::_get_impl(_7246_rs)->nidxs_base;
  int32_t _7257_nsp_base = mosek::fusion::p_WorkStack::_get_impl(_7246_rs)->sp_base;
  int32_t _7258_cof_base = mosek::fusion::p_WorkStack::_get_impl(_7246_rs)->cof_base;
  int32_t _7259_shape_base = mosek::fusion::p_WorkStack::_get_impl(_7246_rs)->shape_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7260_ri32 = mosek::fusion::p_WorkStack::_get_impl(_7246_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__7260_ri32(_7260_ri32 ? _7260_ri32->raw() : nullptr,_7260_ri32 ? _7260_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7261_ri64 = mosek::fusion::p_WorkStack::_get_impl(_7246_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__7261_ri64(_7261_ri64 ? _7261_ri64->raw() : nullptr,_7261_ri64 ? _7261_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7262_rf64 = mosek::fusion::p_WorkStack::_get_impl(_7246_rs)->f64;
  _checked_ptr_1<double> _ptr__7262_rf64(_7262_rf64 ? _7262_rf64->raw() : nullptr,_7262_rf64 ? _7262_rf64->size(0) : 0);
  int32_t _12634_ = (int)0;
  int32_t _12635_ = (int)((_7250_shape)->size(0));
  for (int32_t _7263_i = _12634_; _7263_i < _12635_; ++_7263_i)
  {
    {
      _ptr__7260_ri32[safe_add( _7259_shape_base,_7263_i )] = _ptr__7250_shape[_7263_i];
    }
  }
  {
    int32_t _12636_ = (int)0;
    int32_t _12637_ = safe_add( _7252_nelm,(int)1 );
    for (int32_t _7264_i = _12636_; _7264_i < _12637_; ++_7264_i)
    {
      {
        _ptr__7260_ri32[safe_add( _7255_ptr_base,_7264_i )] = _7264_i;
      }
    }
    int32_t _12638_ = (int)0;
    int32_t _12639_ = _7253_nnz;
    for (int32_t _7265_i = _12638_; _7265_i < _12639_; ++_7265_i)
    {
      {
        _ptr__7262_rf64[safe_add( _7258_cof_base,_7265_i )] = 1.0;
      }
    }
  }
  if (_7254_hassp)
  {
    {
      x->inst(_7257_nsp_base,_7261_ri64,_7256_nidx_base,_7261_ri64);
    }
  }
  else
  {
    {
      x->inst(_7256_nidx_base,_7261_ri64);
    }
  }
}
// End mosek.fusion.ExprFromVar.eval

// Begin mosek.fusion.ExprFromVar.recursive_eval
// Method mosek.fusion.ExprFromVar.recursive_eval @ bld/grindsted/final/default/src/fusion/ExprShape.monty:115:6-124
void mosek::fusion::ExprFromVar :: recursive_eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7266_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7267_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7268_xs,bool _7269_cache_eval) { mosek::fusion::p_ExprFromVar::_get_impl(this)->recursive_eval(_7266_rs,_7267_ws,_7268_xs,_7269_cache_eval); }
void mosek::fusion::p_ExprFromVar::recursive_eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7266_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7267_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7268_xs,bool _7269_cache_eval)
{
  _pubthis->eval(_7266_rs,_7267_ws,_7268_xs,_7269_cache_eval);
}
// End mosek.fusion.ExprFromVar.recursive_eval

// Begin mosek.fusion.ExprFromVar.toString
// Method mosek.fusion.ExprFromVar.toString @ bld/grindsted/final/default/src/fusion/ExprShape.monty:110:6-112:7
std::string mosek::fusion::ExprFromVar :: toString() { return mosek::fusion::p_ExprFromVar::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprFromVar::toString()
{
  return ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("Expr("))->__mosek_2fusion_2Utils_2StringBuffer__a(x->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"))->toString();
}
// End mosek.fusion.ExprFromVar.toString

void mosek::fusion::p_ExprFromVar::destroy()
{
  x.reset();
}
void mosek::fusion::ExprFromVar::destroy() { mosek::fusion::p_ExprFromVar::_get_impl(this)->destroy(); }
// } class ExprFromVar
// class ExprReshape { // @ bld/grindsted/final/default/src/fusion/ExprShape.monty:5:4-95:5
mosek::fusion::ExprReshape::ExprReshape(mosek::fusion::p_ExprReshape *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "ExprReshape()" << this << std::endl; */ }
mosek::fusion::ExprReshape::~ExprReshape() {  /* std::cout << "~ExprReshape()" << this << std::endl << std::flush; */ }
mosek::fusion::p_ExprReshape::p_ExprReshape
  (::mosek::fusion::ExprReshape * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.ExprReshape.ctor @ bld/grindsted/final/default/src/fusion/ExprShape.monty:7:6-14:7
mosek::fusion::ExprReshape::t mosek::fusion::p_ExprReshape::_new_ExprReshape
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _7270_shape,
    monty::rc_ptr< ::mosek::fusion::Expression > _7271_e)
{ return new mosek::fusion::ExprReshape(_7270_shape,_7271_e); }
mosek::fusion::ExprReshape::ExprReshape
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _7270_shape,
    monty::rc_ptr< ::mosek::fusion::Expression > _7271_e) : 
   ExprReshape(new mosek::fusion::p_ExprReshape(this))
{ mosek::fusion::p_ExprReshape::_get_impl(this)->_initialize(_7270_shape,_7271_e); }
void mosek::fusion::p_ExprReshape::_initialize  (std::shared_ptr< monty::ndarray< int32_t,1 > > _7270_shape,
    monty::rc_ptr< ::mosek::fusion::Expression > _7271_e)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__7270_shape(_7270_shape ? _7270_shape->raw() : nullptr, _7270_shape ? _7270_shape->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(_7271_e->__mosek_2fusion_2Expression__getModel(),::mosek::fusion::Utils::Tools::arraycopy(_7270_shape));
    int64_t _7272_esize = _7271_e->getSize();
    if ((::mosek::fusion::p_Set::size(_7270_shape) != _7271_e->getSize()))
    {
      {
        throw ::mosek::fusion::LengthError(std::string ("Cannot reshape to mismatching shape"));
      }
    }
    {}
    mosek::fusion::p_ExprReshape::_get_impl(::mosek::fusion::ExprReshape::t(_pubthis))->e = _7271_e;
  }
}
// mosek.fusion.ExprReshape.ctor

// Begin mosek.fusion.ExprReshape.eval
// Method mosek.fusion.ExprReshape.eval @ bld/grindsted/final/default/src/fusion/ExprShape.monty:27:6-43:7
void mosek::fusion::ExprReshape :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7273_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7274_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7275_xs,bool _7276_cache_eval) { mosek::fusion::p_ExprReshape::_get_impl(this)->eval(_7273_rs,_7274_ws,_7275_xs,_7276_cache_eval); }
void mosek::fusion::p_ExprReshape::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7273_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7274_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7275_xs,bool _7276_cache_eval)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7277_eshape = _pubthis->getShape();
  _checked_ptr_1<int32_t> _ptr__7277_eshape(_7277_eshape ? _7277_eshape->raw() : nullptr,_7277_eshape ? _7277_eshape->size(0) : 0);
  e->recursive_eval(_7273_rs,_7274_ws,_7275_xs,_7276_cache_eval);
  _7273_rs->peek_expr();
  int32_t _7278_nd = _7273_rs->popi32();
  int64_t _7279_sz = (int)1;
  int32_t _12640_ = (int)0;
  int32_t _12641_ = _7278_nd;
  for (int32_t _7280_i = _12640_; _7280_i < _12641_; ++_7280_i)
  {
    {
      _7279_sz *= _7273_rs->popi32();
    }
  }
  if ((_7279_sz != _pubthis->getSize()))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("The two shapes have different sizes"));
    }
  }
  {}
  int32_t _12642_ = (int)0;
  int32_t _12643_ = (int)((_7277_eshape)->size(0));
  for (int32_t _7281_i = _12642_; _7281_i < _12643_; ++_7281_i)
  {
    {
      _7273_rs->pushi32(_ptr__7277_eshape[_7281_i]);
    }
  }
  _7273_rs->pushi32((int)((_7277_eshape)->size(0)));
}
// End mosek.fusion.ExprReshape.eval

// Begin mosek.fusion.ExprReshape.toString
// Method mosek.fusion.ExprReshape.toString @ bld/grindsted/final/default/src/fusion/ExprShape.monty:16:6-25:7
std::string mosek::fusion::ExprReshape :: toString() { return mosek::fusion::p_ExprReshape::_get_impl(this)->toString(); }
std::string mosek::fusion::p_ExprReshape::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _7282_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer()->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("ExprReshape(("));
  if ((_pubthis->getND() > (int)0))
  {
    {
      _7282_sb->__mosek_2fusion_2Utils_2StringBuffer__a(_pubthis->getDim((int)0));
      int32_t _12644_ = (int)1;
      int32_t _12645_ = _pubthis->getND();
      for (int32_t _7283_i = _12644_; _7283_i < _12645_; ++_7283_i)
      {
        {
          _7282_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(_pubthis->getDim(_7283_i));
        }
      }
    }
  }
  {}
  _7282_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("),"))->__mosek_2fusion_2Utils_2StringBuffer__a(e->toString())->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"));
  return _7282_sb->toString();
}
// End mosek.fusion.ExprReshape.toString

void mosek::fusion::p_ExprReshape::destroy()
{
  e.reset();
}
void mosek::fusion::ExprReshape::destroy() { mosek::fusion::p_ExprReshape::_get_impl(this)->destroy(); }
// } class ExprReshape
// class ExprRangeDomain { // @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:700:4-705:5
mosek::fusion::ExprRangeDomain::ExprRangeDomain(mosek::fusion::p_ExprRangeDomain *_impl) : _impl(_impl) { /*std::cout << "ExprRangeDomain() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::ExprRangeDomain::~ExprRangeDomain() { delete _impl; _impl = nullptr; }
mosek::fusion::p_ExprRangeDomain::p_ExprRangeDomain
  (::mosek::fusion::ExprRangeDomain * _pubthis) :     _pubthis(_pubthis)
{}
monty::rc_ptr< ::mosek::fusion::RangeDomain > mosek::fusion::ExprRangeDomain::get_dom() { return _impl->dom; }
void mosek::fusion::ExprRangeDomain::set_dom(monty::rc_ptr< ::mosek::fusion::RangeDomain > _val) { _impl->dom = _val; }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ExprRangeDomain::get_expr() { return _impl->expr; }
void mosek::fusion::ExprRangeDomain::set_expr(monty::rc_ptr< ::mosek::fusion::Expression > _val) { _impl->expr = _val; }
// mosek.fusion.ExprRangeDomain.ctor @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:703:6-89
mosek::fusion::ExprRangeDomain::t mosek::fusion::p_ExprRangeDomain::_new_ExprRangeDomain
  (monty::rc_ptr< ::mosek::fusion::Expression > _7284_expr,
    monty::rc_ptr< ::mosek::fusion::RangeDomain > _7285_dom)
{ return new mosek::fusion::ExprRangeDomain(_7284_expr,_7285_dom); }
mosek::fusion::ExprRangeDomain::ExprRangeDomain
  (monty::rc_ptr< ::mosek::fusion::Expression > _7284_expr,
    monty::rc_ptr< ::mosek::fusion::RangeDomain > _7285_dom) : 
   ExprRangeDomain(new mosek::fusion::p_ExprRangeDomain(this))
{ mosek::fusion::p_ExprRangeDomain::_get_impl(this)->_initialize(_7284_expr,_7285_dom); }
void mosek::fusion::p_ExprRangeDomain::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _7284_expr,
    monty::rc_ptr< ::mosek::fusion::RangeDomain > _7285_dom)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ExprRangeDomain::_get_impl(::mosek::fusion::ExprRangeDomain::t(_pubthis))->expr = _7284_expr;
    mosek::fusion::p_ExprRangeDomain::_get_impl(::mosek::fusion::ExprRangeDomain::t(_pubthis))->dom = _7285_dom;
  }
}
// mosek.fusion.ExprRangeDomain.ctor

// Begin mosek.fusion.ExprRangeDomain.toDJCTerm
// Method mosek.fusion.ExprRangeDomain.toDJCTerm @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:704:6-67
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::ExprRangeDomain :: __mosek_2fusion_2ExprRangeDomain__toDJCTerm() { return mosek::fusion::p_ExprRangeDomain::_get_impl(this)->__mosek_2fusion_2ExprRangeDomain__toDJCTerm(); }
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::ExprRangeDomain::toDJCTerm() { return __mosek_2fusion_2ExprRangeDomain__toDJCTerm(); }
/* override: mosek.fusion.ExprDomain.toDJCTerm*/
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::ExprRangeDomain::__mosek_2fusion_2ExprDomain__toDJCTerm() { return __mosek_2fusion_2ExprRangeDomain__toDJCTerm(); }
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::p_ExprRangeDomain::__mosek_2fusion_2ExprRangeDomain__toDJCTerm()
{
  return (::mosek::fusion::p_DJC::term(expr,dom)).as<::mosek::fusion::Term>();
}
// End mosek.fusion.ExprRangeDomain.toDJCTerm

void mosek::fusion::p_ExprRangeDomain::destroy()
{
  dom.reset();
  expr.reset();
}
void mosek::fusion::ExprRangeDomain::destroy() { mosek::fusion::p_ExprRangeDomain::_get_impl(this)->destroy(); }
// } class ExprRangeDomain
// class ExprPSDDomain { // @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:690:4-694:5
mosek::fusion::ExprPSDDomain::ExprPSDDomain(mosek::fusion::p_ExprPSDDomain *_impl) : _impl(_impl) { /*std::cout << "ExprPSDDomain() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::ExprPSDDomain::~ExprPSDDomain() { delete _impl; _impl = nullptr; }
mosek::fusion::p_ExprPSDDomain::p_ExprPSDDomain
  (::mosek::fusion::ExprPSDDomain * _pubthis) :     _pubthis(_pubthis)
{}
monty::rc_ptr< ::mosek::fusion::PSDDomain > mosek::fusion::ExprPSDDomain::get_dom() { return _impl->dom; }
void mosek::fusion::ExprPSDDomain::set_dom(monty::rc_ptr< ::mosek::fusion::PSDDomain > _val) { _impl->dom = _val; }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ExprPSDDomain::get_expr() { return _impl->expr; }
void mosek::fusion::ExprPSDDomain::set_expr(monty::rc_ptr< ::mosek::fusion::Expression > _val) { _impl->expr = _val; }
// mosek.fusion.ExprPSDDomain.ctor @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:693:6-87
mosek::fusion::ExprPSDDomain::t mosek::fusion::p_ExprPSDDomain::_new_ExprPSDDomain
  (monty::rc_ptr< ::mosek::fusion::Expression > _7286_expr,
    monty::rc_ptr< ::mosek::fusion::PSDDomain > _7287_dom)
{ return new mosek::fusion::ExprPSDDomain(_7286_expr,_7287_dom); }
mosek::fusion::ExprPSDDomain::ExprPSDDomain
  (monty::rc_ptr< ::mosek::fusion::Expression > _7286_expr,
    monty::rc_ptr< ::mosek::fusion::PSDDomain > _7287_dom) : 
   ExprPSDDomain(new mosek::fusion::p_ExprPSDDomain(this))
{ mosek::fusion::p_ExprPSDDomain::_get_impl(this)->_initialize(_7286_expr,_7287_dom); }
void mosek::fusion::p_ExprPSDDomain::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _7286_expr,
    monty::rc_ptr< ::mosek::fusion::PSDDomain > _7287_dom)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ExprPSDDomain::_get_impl(::mosek::fusion::ExprPSDDomain::t(_pubthis))->expr = _7286_expr;
    mosek::fusion::p_ExprPSDDomain::_get_impl(::mosek::fusion::ExprPSDDomain::t(_pubthis))->dom = _7287_dom;
  }
}
// mosek.fusion.ExprPSDDomain.ctor

void mosek::fusion::p_ExprPSDDomain::destroy()
{
  dom.reset();
  expr.reset();
}
void mosek::fusion::ExprPSDDomain::destroy() { mosek::fusion::p_ExprPSDDomain::_get_impl(this)->destroy(); }
// } class ExprPSDDomain
// class ExprConicDomain { // @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:680:4-684:5
mosek::fusion::ExprConicDomain::ExprConicDomain(mosek::fusion::p_ExprConicDomain *_impl) : _impl(_impl) { /*std::cout << "ExprConicDomain() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::ExprConicDomain::~ExprConicDomain() { delete _impl; _impl = nullptr; }
mosek::fusion::p_ExprConicDomain::p_ExprConicDomain
  (::mosek::fusion::ExprConicDomain * _pubthis) :     _pubthis(_pubthis)
{}
monty::rc_ptr< ::mosek::fusion::ConeDomain > mosek::fusion::ExprConicDomain::get_dom() { return _impl->dom; }
void mosek::fusion::ExprConicDomain::set_dom(monty::rc_ptr< ::mosek::fusion::ConeDomain > _val) { _impl->dom = _val; }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ExprConicDomain::get_expr() { return _impl->expr; }
void mosek::fusion::ExprConicDomain::set_expr(monty::rc_ptr< ::mosek::fusion::Expression > _val) { _impl->expr = _val; }
// mosek.fusion.ExprConicDomain.ctor @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:683:6-88
mosek::fusion::ExprConicDomain::t mosek::fusion::p_ExprConicDomain::_new_ExprConicDomain
  (monty::rc_ptr< ::mosek::fusion::Expression > _7288_expr,
    monty::rc_ptr< ::mosek::fusion::ConeDomain > _7289_dom)
{ return new mosek::fusion::ExprConicDomain(_7288_expr,_7289_dom); }
mosek::fusion::ExprConicDomain::ExprConicDomain
  (monty::rc_ptr< ::mosek::fusion::Expression > _7288_expr,
    monty::rc_ptr< ::mosek::fusion::ConeDomain > _7289_dom) : 
   ExprConicDomain(new mosek::fusion::p_ExprConicDomain(this))
{ mosek::fusion::p_ExprConicDomain::_get_impl(this)->_initialize(_7288_expr,_7289_dom); }
void mosek::fusion::p_ExprConicDomain::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _7288_expr,
    monty::rc_ptr< ::mosek::fusion::ConeDomain > _7289_dom)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ExprConicDomain::_get_impl(::mosek::fusion::ExprConicDomain::t(_pubthis))->expr = _7288_expr;
    mosek::fusion::p_ExprConicDomain::_get_impl(::mosek::fusion::ExprConicDomain::t(_pubthis))->dom = _7289_dom;
  }
}
// mosek.fusion.ExprConicDomain.ctor

void mosek::fusion::p_ExprConicDomain::destroy()
{
  dom.reset();
  expr.reset();
}
void mosek::fusion::ExprConicDomain::destroy() { mosek::fusion::p_ExprConicDomain::_get_impl(this)->destroy(); }
// } class ExprConicDomain
// class ExprLinearDomain { // @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:669:4-674:5
mosek::fusion::ExprLinearDomain::ExprLinearDomain(mosek::fusion::p_ExprLinearDomain *_impl) : _impl(_impl) { /*std::cout << "ExprLinearDomain() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::ExprLinearDomain::~ExprLinearDomain() { delete _impl; _impl = nullptr; }
mosek::fusion::p_ExprLinearDomain::p_ExprLinearDomain
  (::mosek::fusion::ExprLinearDomain * _pubthis) :     _pubthis(_pubthis)
{}
monty::rc_ptr< ::mosek::fusion::LinearDomain > mosek::fusion::ExprLinearDomain::get_dom() { return _impl->dom; }
void mosek::fusion::ExprLinearDomain::set_dom(monty::rc_ptr< ::mosek::fusion::LinearDomain > _val) { _impl->dom = _val; }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::ExprLinearDomain::get_expr() { return _impl->expr; }
void mosek::fusion::ExprLinearDomain::set_expr(monty::rc_ptr< ::mosek::fusion::Expression > _val) { _impl->expr = _val; }
// mosek.fusion.ExprLinearDomain.ctor @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:672:6-90
mosek::fusion::ExprLinearDomain::t mosek::fusion::p_ExprLinearDomain::_new_ExprLinearDomain
  (monty::rc_ptr< ::mosek::fusion::Expression > _7290_expr,
    monty::rc_ptr< ::mosek::fusion::LinearDomain > _7291_dom)
{ return new mosek::fusion::ExprLinearDomain(_7290_expr,_7291_dom); }
mosek::fusion::ExprLinearDomain::ExprLinearDomain
  (monty::rc_ptr< ::mosek::fusion::Expression > _7290_expr,
    monty::rc_ptr< ::mosek::fusion::LinearDomain > _7291_dom) : 
   ExprLinearDomain(new mosek::fusion::p_ExprLinearDomain(this))
{ mosek::fusion::p_ExprLinearDomain::_get_impl(this)->_initialize(_7290_expr,_7291_dom); }
void mosek::fusion::p_ExprLinearDomain::_initialize  (monty::rc_ptr< ::mosek::fusion::Expression > _7290_expr,
    monty::rc_ptr< ::mosek::fusion::LinearDomain > _7291_dom)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_ExprLinearDomain::_get_impl(::mosek::fusion::ExprLinearDomain::t(_pubthis))->expr = _7290_expr;
    mosek::fusion::p_ExprLinearDomain::_get_impl(::mosek::fusion::ExprLinearDomain::t(_pubthis))->dom = _7291_dom;
  }
}
// mosek.fusion.ExprLinearDomain.ctor

// Begin mosek.fusion.ExprLinearDomain.toDJCTerm
// Method mosek.fusion.ExprLinearDomain.toDJCTerm @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:673:6-67
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::ExprLinearDomain :: __mosek_2fusion_2ExprLinearDomain__toDJCTerm() { return mosek::fusion::p_ExprLinearDomain::_get_impl(this)->__mosek_2fusion_2ExprLinearDomain__toDJCTerm(); }
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::ExprLinearDomain::toDJCTerm() { return __mosek_2fusion_2ExprLinearDomain__toDJCTerm(); }
/* override: mosek.fusion.ExprDomain.toDJCTerm*/
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::ExprLinearDomain::__mosek_2fusion_2ExprDomain__toDJCTerm() { return __mosek_2fusion_2ExprLinearDomain__toDJCTerm(); }
monty::rc_ptr< ::mosek::fusion::Term > mosek::fusion::p_ExprLinearDomain::__mosek_2fusion_2ExprLinearDomain__toDJCTerm()
{
  return (::mosek::fusion::p_DJC::term(expr,dom)).as<::mosek::fusion::Term>();
}
// End mosek.fusion.ExprLinearDomain.toDJCTerm

void mosek::fusion::p_ExprLinearDomain::destroy()
{
  dom.reset();
  expr.reset();
}
void mosek::fusion::ExprLinearDomain::destroy() { mosek::fusion::p_ExprLinearDomain::_get_impl(this)->destroy(); }
// } class ExprLinearDomain
// class ExprDomain { // @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:659:4-662:5
// Begin mosek.fusion.ExprDomain.toDJCTerm
monty::rc_ptr< mosek::fusion::Term > mosek::fusion::ExprDomain::toDJCTerm() { return __mosek_2fusion_2ExprDomain__toDJCTerm(); }
// End mosek.fusion.ExprDomain.toDJCTerm

// } class ExprDomain
// class BaseExpression { // @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:498:4-652:5
mosek::fusion::BaseExpression::BaseExpression(mosek::fusion::p_BaseExpression *_impl) : _impl(_impl) { /*std::cout << "BaseExpression() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::BaseExpression::~BaseExpression() { delete _impl; _impl = nullptr; }
mosek::fusion::p_BaseExpression::p_BaseExpression
  (::mosek::fusion::BaseExpression * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.BaseExpression.ctor @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:530:6-535:7
void mosek::fusion::p_BaseExpression::_initialize  (monty::rc_ptr< ::mosek::fusion::Model > _7292_owner,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _7293_shape)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__7293_shape(_7293_shape ? _7293_shape->raw() : nullptr, _7293_shape ? _7293_shape->size(0) : 0);
    mosek::fusion::p_BaseExpression::_get_impl(::mosek::fusion::BaseExpression::t(_pubthis))->shape = _7293_shape;
    mosek::fusion::p_BaseExpression::_get_impl(::mosek::fusion::BaseExpression::t(_pubthis))->owner = _7292_owner;
    mosek::fusion::p_BaseExpression::_get_impl(::mosek::fusion::BaseExpression::t(_pubthis))->has_evaluation = false;
    mosek::fusion::p_BaseExpression::_get_impl(::mosek::fusion::BaseExpression::t(_pubthis))->evaluated = nullptr;
  }
}
// mosek.fusion.BaseExpression.ctor

// Begin mosek.fusion.BaseExpression.toString
// Method mosek.fusion.BaseExpression.toString @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:651:6-64
std::string mosek::fusion::BaseExpression :: toString() { return mosek::fusion::p_BaseExpression::_get_impl(this)->toString(); }
std::string mosek::fusion::p_BaseExpression::toString()
{
  return std::string ("Expression()");
}
// End mosek.fusion.BaseExpression.toString

// Begin mosek.fusion.BaseExpression.printStack
// Method mosek.fusion.BaseExpression.printStack @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:604:6-649:7
void mosek::fusion::p_BaseExpression::printStack(monty::rc_ptr< ::mosek::fusion::WorkStack > _7294_rs)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7295_ri32 = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__7295_ri32(_7295_ri32 ? _7295_ri32->raw() : nullptr,_7295_ri32 ? _7295_ri32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7296_ri64 = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__7296_ri64(_7296_ri64 ? _7296_ri64->raw() : nullptr,_7296_ri64 ? _7296_ri64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7297_rf64 = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->f64;
  _checked_ptr_1<double> _ptr__7297_rf64(_7297_rf64 ? _7297_rf64->raw() : nullptr,_7297_rf64 ? _7297_rf64->size(0) : 0);
  int32_t _7298_rptr = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->ptr_base;
  int32_t _7299_rnidxs = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->nidxs_base;
  int32_t _7300_rcof = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->cof_base;
  int32_t _7301_rshape = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->shape_base;
  int32_t _7302_rcodeptr = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->codeptr_base;
  int32_t _7303_rcode = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->code_base;
  int32_t _7304_rcconst = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->cconst_base;
  int32_t _7305_rsp = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->sp_base;
  int32_t _7306_rnelem = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->nelem;
  int32_t _7307_rnnz = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->nnz;
  int32_t _7308_rncodeatom = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->ncodeatom;
  int32_t _7309_rnd = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->nd;
  bool _7310_rhassp = mosek::fusion::p_WorkStack::_get_impl(_7294_rs)->hassp;
}
// End mosek.fusion.BaseExpression.printStack

// Begin mosek.fusion.BaseExpression.recursive_eval
// Method mosek.fusion.BaseExpression.recursive_eval @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:575:6-602:7
void mosek::fusion::BaseExpression :: recursive_eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7311_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7312_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7313_xs,bool _7314_cache_eval) { mosek::fusion::p_BaseExpression::_get_impl(this)->recursive_eval(_7311_rs,_7312_ws,_7313_xs,_7314_cache_eval); }
void mosek::fusion::p_BaseExpression::recursive_eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7311_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7312_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7313_xs,bool _7314_cache_eval)
{
  if (_7314_cache_eval)
  {
    {
      if (has_evaluation)
      {
        {
          evaluated->copy_expr(_7311_rs);
        }
      }
      else
      {
        {
          _pubthis->eval(_7311_rs,_7312_ws,_7313_xs,_7314_cache_eval);
          evaluated = ::mosek::fusion::p_WorkStack::_new_WorkStack();
          if (_pubthis->compress_when_caching())
          {
            {
              ::mosek::fusion::p_ExprCompress::_new_ExprCompress((::mosek::fusion::BaseExpression::t(_pubthis)).as<::mosek::fusion::Expression>())->eval_continue(evaluated,_7311_rs,_7313_xs);
              evaluated->copy_expr(_7311_rs);
            }
          }
          else
          {
            {
              _7311_rs->copy_expr(evaluated);
            }
          }
          has_evaluation = true;
        }
      }
    }
  }
  else
  {
    {
      _pubthis->eval(_7311_rs,_7312_ws,_7313_xs,_7314_cache_eval);
    }
  }
}
// End mosek.fusion.BaseExpression.recursive_eval

// Begin mosek.fusion.BaseExpression.compress_when_caching
// Method mosek.fusion.BaseExpression.compress_when_caching @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:572:6-66
bool mosek::fusion::BaseExpression :: compress_when_caching() { return mosek::fusion::p_BaseExpression::_get_impl(this)->compress_when_caching(); }
bool mosek::fusion::p_BaseExpression::compress_when_caching()
{
  return false;
}
// End mosek.fusion.BaseExpression.compress_when_caching

// Begin mosek.fusion.BaseExpression.eval
// Method mosek.fusion.BaseExpression.eval @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:569:6-105
void mosek::fusion::BaseExpression :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7315_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7316_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7317_xs) { mosek::fusion::p_BaseExpression::_get_impl(this)->eval(_7315_rs,_7316_ws,_7317_xs); }
void mosek::fusion::p_BaseExpression::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _7315_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _7316_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _7317_xs)
{
  _pubthis->recursive_eval(_7315_rs,_7316_ws,_7317_xs,false);
}
// End mosek.fusion.BaseExpression.eval

// Begin mosek.fusion.BaseExpression.eval
// End mosek.fusion.BaseExpression.eval

// Begin mosek.fusion.BaseExpression.pick
// Method mosek.fusion.BaseExpression.pick @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:561:6-563:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression :: __mosek_2fusion_2BaseExpression__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _7322_indexrows) { return mosek::fusion::p_BaseExpression::_get_impl(this)->__mosek_2fusion_2BaseExpression__pick(_7322_indexrows); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression::pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _7322_indexrows) { return __mosek_2fusion_2BaseExpression__pick(_7322_indexrows); }
/* override: mosek.fusion.Expression.pick*/
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression::__mosek_2fusion_2Expression__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _7322_indexrows) { return __mosek_2fusion_2BaseExpression__pick(_7322_indexrows); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_BaseExpression::__mosek_2fusion_2BaseExpression__pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _7322_indexrows)
{
  return (::mosek::fusion::p_ExprPick::_new_ExprPick((::mosek::fusion::BaseExpression::t(_pubthis)).as<::mosek::fusion::Expression>(),_7322_indexrows)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.BaseExpression.pick

// Begin mosek.fusion.BaseExpression.pick
// Method mosek.fusion.BaseExpression.pick @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:557:6-560:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression :: __mosek_2fusion_2BaseExpression__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _7323_indexes) { return mosek::fusion::p_BaseExpression::_get_impl(this)->__mosek_2fusion_2BaseExpression__pick(_7323_indexes); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _7323_indexes) { return __mosek_2fusion_2BaseExpression__pick(_7323_indexes); }
/* override: mosek.fusion.Expression.pick*/
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression::__mosek_2fusion_2Expression__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _7323_indexes) { return __mosek_2fusion_2BaseExpression__pick(_7323_indexes); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_BaseExpression::__mosek_2fusion_2BaseExpression__pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _7323_indexes)
{
  _checked_ptr_1<int32_t> _ptr__7323_indexes(_7323_indexes ? _7323_indexes->raw() : nullptr, _7323_indexes ? _7323_indexes->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,2 > > _7324_idxs = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape((int)((_7323_indexes)->size(0)),(int)1)));
  int32_t _12646_ = (int)0;
  int32_t _12647_ = (int)((_7323_indexes)->size(0));
  for (int32_t _7325_i = _12646_; _7325_i < _12647_; ++_7325_i)
  {
    {
      ((*_7324_idxs)(_7325_i,(int)0)) = _ptr__7323_indexes[_7325_i];
    }
  }
  return (::mosek::fusion::p_ExprPick::_new_ExprPick((::mosek::fusion::BaseExpression::t(_pubthis)).as<::mosek::fusion::Expression>(),_7324_idxs)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.BaseExpression.pick

// Begin mosek.fusion.BaseExpression.index
// Method mosek.fusion.BaseExpression.index @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:553:6-556:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression :: __mosek_2fusion_2BaseExpression__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _7326_indexes) { return mosek::fusion::p_BaseExpression::_get_impl(this)->__mosek_2fusion_2BaseExpression__index(_7326_indexes); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression::index(std::shared_ptr< monty::ndarray< int32_t,1 > > _7326_indexes) { return __mosek_2fusion_2BaseExpression__index(_7326_indexes); }
/* override: mosek.fusion.Expression.index*/
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression::__mosek_2fusion_2Expression__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _7326_indexes) { return __mosek_2fusion_2BaseExpression__index(_7326_indexes); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_BaseExpression::__mosek_2fusion_2BaseExpression__index(std::shared_ptr< monty::ndarray< int32_t,1 > > _7326_indexes)
{
  _checked_ptr_1<int32_t> _ptr__7326_indexes(_7326_indexes ? _7326_indexes->raw() : nullptr, _7326_indexes ? _7326_indexes->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,2 > > _7327_idxs = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape((int)1,(int)((_7326_indexes)->size(0)))));
  int32_t _12648_ = (int)0;
  int32_t _12649_ = (int)((_7326_indexes)->size(0));
  for (int32_t _7328_i = _12648_; _7328_i < _12649_; ++_7328_i)
  {
    {
      ((*_7327_idxs)((int)0,_7328_i)) = _ptr__7326_indexes[_7328_i];
    }
  }
  return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),(::mosek::fusion::p_ExprPick::_new_ExprPick((::mosek::fusion::BaseExpression::t(_pubthis)).as<::mosek::fusion::Expression>(),_7327_idxs)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.BaseExpression.index

// Begin mosek.fusion.BaseExpression.index
// Method mosek.fusion.BaseExpression.index @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:549:6-552:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression :: __mosek_2fusion_2BaseExpression__index(int32_t _7329_i) { return mosek::fusion::p_BaseExpression::_get_impl(this)->__mosek_2fusion_2BaseExpression__index(_7329_i); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression::index(int32_t _7329_i) { return __mosek_2fusion_2BaseExpression__index(_7329_i); }
/* override: mosek.fusion.Expression.index*/
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression::__mosek_2fusion_2Expression__index(int32_t _7329_i) { return __mosek_2fusion_2BaseExpression__index(_7329_i); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_BaseExpression::__mosek_2fusion_2BaseExpression__index(int32_t _7329_i)
{
  std::shared_ptr< monty::ndarray< int32_t,2 > > _7330_idxs = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape((int)1,(int)1)));
  ((*_7330_idxs)((int)0,(int)0)) = _7329_i;
  return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),(::mosek::fusion::p_ExprPick::_new_ExprPick((::mosek::fusion::BaseExpression::t(_pubthis)).as<::mosek::fusion::Expression>(),_7330_idxs)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.BaseExpression.index

// Begin mosek.fusion.BaseExpression.slice
// Method mosek.fusion.BaseExpression.slice @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:546:6-548:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression :: __mosek_2fusion_2BaseExpression__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _7331_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _7332_lasta) { return mosek::fusion::p_BaseExpression::_get_impl(this)->__mosek_2fusion_2BaseExpression__slice(_7331_firsta,_7332_lasta); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression::slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _7331_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _7332_lasta) { return __mosek_2fusion_2BaseExpression__slice(_7331_firsta,_7332_lasta); }
/* override: mosek.fusion.Expression.slice*/
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression::__mosek_2fusion_2Expression__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _7331_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _7332_lasta) { return __mosek_2fusion_2BaseExpression__slice(_7331_firsta,_7332_lasta); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_BaseExpression::__mosek_2fusion_2BaseExpression__slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _7331_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _7332_lasta)
{
  _checked_ptr_1<int32_t> _ptr__7331_firsta(_7331_firsta ? _7331_firsta->raw() : nullptr, _7331_firsta ? _7331_firsta->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__7332_lasta(_7332_lasta ? _7332_lasta->raw() : nullptr, _7332_lasta ? _7332_lasta->size(0) : 0);
  return (::mosek::fusion::p_ExprSlice::_new_ExprSlice((::mosek::fusion::BaseExpression::t(_pubthis)).as<::mosek::fusion::Expression>(),_7331_firsta,_7332_lasta)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.BaseExpression.slice

// Begin mosek.fusion.BaseExpression.slice
// Method mosek.fusion.BaseExpression.slice @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:543:6-545:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression :: __mosek_2fusion_2BaseExpression__slice(int32_t _7333_first,int32_t _7334_last) { return mosek::fusion::p_BaseExpression::_get_impl(this)->__mosek_2fusion_2BaseExpression__slice(_7333_first,_7334_last); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression::slice(int32_t _7333_first,int32_t _7334_last) { return __mosek_2fusion_2BaseExpression__slice(_7333_first,_7334_last); }
/* override: mosek.fusion.Expression.slice*/
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::BaseExpression::__mosek_2fusion_2Expression__slice(int32_t _7333_first,int32_t _7334_last) { return __mosek_2fusion_2BaseExpression__slice(_7333_first,_7334_last); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_BaseExpression::__mosek_2fusion_2BaseExpression__slice(int32_t _7333_first,int32_t _7334_last)
{
  return (::mosek::fusion::p_ExprSlice::_new_ExprSlice((::mosek::fusion::BaseExpression::t(_pubthis)).as<::mosek::fusion::Expression>(),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7333_first)}),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7334_last)}))).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.BaseExpression.slice

// Begin mosek.fusion.BaseExpression.getSize
// Method mosek.fusion.BaseExpression.getSize @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:541:6-64
int64_t mosek::fusion::BaseExpression :: getSize() { return mosek::fusion::p_BaseExpression::_get_impl(this)->getSize(); }
int64_t mosek::fusion::p_BaseExpression::getSize()
{
  return ::mosek::fusion::p_Set::size(shape);
}
// End mosek.fusion.BaseExpression.getSize

// Begin mosek.fusion.BaseExpression.getND
// Method mosek.fusion.BaseExpression.getND @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:540:6-59
int32_t mosek::fusion::BaseExpression :: getND() { return mosek::fusion::p_BaseExpression::_get_impl(this)->getND(); }
int32_t mosek::fusion::p_BaseExpression::getND()
{
  return (int)((shape)->size(0));
}
// End mosek.fusion.BaseExpression.getND

// Begin mosek.fusion.BaseExpression.getDim
// Method mosek.fusion.BaseExpression.getDim @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:539:6-64
int32_t mosek::fusion::BaseExpression :: getDim(int32_t _7335_d) { return mosek::fusion::p_BaseExpression::_get_impl(this)->getDim(_7335_d); }
int32_t mosek::fusion::p_BaseExpression::getDim(int32_t _7335_d)
{
  return ((*shape)(_7335_d));
}
// End mosek.fusion.BaseExpression.getDim

// Begin mosek.fusion.BaseExpression.getShape
// Method mosek.fusion.BaseExpression.getShape @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:538:6-79
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::BaseExpression :: getShape() { return mosek::fusion::p_BaseExpression::_get_impl(this)->getShape(); }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::p_BaseExpression::getShape()
{
  return ::mosek::fusion::Utils::Tools::arraycopy(shape);
}
// End mosek.fusion.BaseExpression.getShape

// Begin mosek.fusion.BaseExpression.getModel
// Method mosek.fusion.BaseExpression.getModel @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:537:6-54
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::BaseExpression :: __mosek_2fusion_2BaseExpression__getModel() { return mosek::fusion::p_BaseExpression::_get_impl(this)->__mosek_2fusion_2BaseExpression__getModel(); }
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::BaseExpression::getModel() { return __mosek_2fusion_2BaseExpression__getModel(); }
/* override: mosek.fusion.Expression.getModel*/
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::BaseExpression::__mosek_2fusion_2Expression__getModel() { return __mosek_2fusion_2BaseExpression__getModel(); }
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::p_BaseExpression::__mosek_2fusion_2BaseExpression__getModel()
{
  return owner;
}
// End mosek.fusion.BaseExpression.getModel

// Begin mosek.fusion.BaseExpression.modelFrom
// Method mosek.fusion.BaseExpression.modelFrom @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:520:6-528:7
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::p_BaseExpression::modelFrom(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7336_es)
{
  if (((int)((_7336_es)->size(0)) == (int)0))
  {
    {
      return nullptr;
    }
  }
  else
  {
    {
      monty::rc_ptr< ::mosek::fusion::Model > _7337_m = ((*_7336_es)((int)0))->__mosek_2fusion_2Expression__getModel();
      int32_t _12650_ = (int)1;
      int32_t _12651_ = (int)((_7336_es)->size(0));
      for (int32_t _7338_i = _12650_; _7338_i < _12651_; ++_7338_i)
      {
        {
          _7337_m = ::mosek::fusion::p_BaseExpression::modelFrom(_7337_m,((*_7336_es)(_7338_i)));
        }
      }
      return _7337_m;
    }
  }
}
// End mosek.fusion.BaseExpression.modelFrom

// Begin mosek.fusion.BaseExpression.modelFrom
// Method mosek.fusion.BaseExpression.modelFrom @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:517:6-519:7
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::p_BaseExpression::modelFrom(monty::rc_ptr< ::mosek::fusion::Model > _7339_m1,monty::rc_ptr< ::mosek::fusion::Expression > _7340_e2)
{
  return ::mosek::fusion::p_BaseExpression::modelFrom(_7339_m1,_7340_e2->__mosek_2fusion_2Expression__getModel());
}
// End mosek.fusion.BaseExpression.modelFrom

// Begin mosek.fusion.BaseExpression.modelFrom
// Method mosek.fusion.BaseExpression.modelFrom @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:514:6-516:7
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::p_BaseExpression::modelFrom(monty::rc_ptr< ::mosek::fusion::Expression > _7341_e1,monty::rc_ptr< ::mosek::fusion::Expression > _7342_e2)
{
  return ::mosek::fusion::p_BaseExpression::modelFrom(_7341_e1->__mosek_2fusion_2Expression__getModel(),_7342_e2->__mosek_2fusion_2Expression__getModel());
}
// End mosek.fusion.BaseExpression.modelFrom

// Begin mosek.fusion.BaseExpression.modelFrom
// Method mosek.fusion.BaseExpression.modelFrom @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:506:6-513:7
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::p_BaseExpression::modelFrom(monty::rc_ptr< ::mosek::fusion::Model > _7343_m1,monty::rc_ptr< ::mosek::fusion::Model > _7344_m2)
{
  if ((NULL == _7343_m1.get()))
  {
    {
      return _7344_m2;
    }
  }
  else if(((NULL != _7344_m2.get()) && (_7343_m1 != _7344_m2)))
  {
    {
      throw ::mosek::fusion::ModelError(std::string ("Mixing different models"));
    }
  }
  else
  {
    {
      return _7343_m1;
    }
  }
}
// End mosek.fusion.BaseExpression.modelFrom

void mosek::fusion::p_BaseExpression::destroy()
{
  evaluated.reset();
  owner.reset();
  shape.reset();
}
void mosek::fusion::BaseExpression::destroy() { mosek::fusion::p_BaseExpression::_get_impl(this)->destroy(); }
// } class BaseExpression
// class WorkStack { // @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:46:4-493:5
mosek::fusion::WorkStack::WorkStack(mosek::fusion::p_WorkStack *_impl) : _impl(_impl) { /*std::cout << "WorkStack() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::WorkStack::~WorkStack() { delete _impl; _impl = nullptr; }
mosek::fusion::p_WorkStack::p_WorkStack
  (::mosek::fusion::WorkStack * _pubthis) :     _pubthis(_pubthis)
{}
int32_t mosek::fusion::WorkStack::get_code_base() { return _impl->code_base; }
void mosek::fusion::WorkStack::set_code_base(int32_t _val) { _impl->code_base = _val; }
int32_t mosek::fusion::WorkStack::get_cconst_base() { return _impl->cconst_base; }
void mosek::fusion::WorkStack::set_cconst_base(int32_t _val) { _impl->cconst_base = _val; }
int32_t mosek::fusion::WorkStack::get_codeptr_base() { return _impl->codeptr_base; }
void mosek::fusion::WorkStack::set_codeptr_base(int32_t _val) { _impl->codeptr_base = _val; }
int32_t mosek::fusion::WorkStack::get_cof_base() { return _impl->cof_base; }
void mosek::fusion::WorkStack::set_cof_base(int32_t _val) { _impl->cof_base = _val; }
int32_t mosek::fusion::WorkStack::get_nidxs_base() { return _impl->nidxs_base; }
void mosek::fusion::WorkStack::set_nidxs_base(int32_t _val) { _impl->nidxs_base = _val; }
int32_t mosek::fusion::WorkStack::get_sp_base() { return _impl->sp_base; }
void mosek::fusion::WorkStack::set_sp_base(int32_t _val) { _impl->sp_base = _val; }
int32_t mosek::fusion::WorkStack::get_shape_base() { return _impl->shape_base; }
void mosek::fusion::WorkStack::set_shape_base(int32_t _val) { _impl->shape_base = _val; }
int32_t mosek::fusion::WorkStack::get_ptr_base() { return _impl->ptr_base; }
void mosek::fusion::WorkStack::set_ptr_base(int32_t _val) { _impl->ptr_base = _val; }
bool mosek::fusion::WorkStack::get_hassp() { return _impl->hassp; }
void mosek::fusion::WorkStack::set_hassp(bool _val) { _impl->hassp = _val; }
int32_t mosek::fusion::WorkStack::get_ncodeatom() { return _impl->ncodeatom; }
void mosek::fusion::WorkStack::set_ncodeatom(int32_t _val) { _impl->ncodeatom = _val; }
int32_t mosek::fusion::WorkStack::get_nelem() { return _impl->nelem; }
void mosek::fusion::WorkStack::set_nelem(int32_t _val) { _impl->nelem = _val; }
int32_t mosek::fusion::WorkStack::get_nnz() { return _impl->nnz; }
void mosek::fusion::WorkStack::set_nnz(int32_t _val) { _impl->nnz = _val; }
int32_t mosek::fusion::WorkStack::get_nd() { return _impl->nd; }
void mosek::fusion::WorkStack::set_nd(int32_t _val) { _impl->nd = _val; }
int32_t mosek::fusion::WorkStack::get_pf64() { return _impl->pf64; }
void mosek::fusion::WorkStack::set_pf64(int32_t _val) { _impl->pf64 = _val; }
int32_t mosek::fusion::WorkStack::get_pi64() { return _impl->pi64; }
void mosek::fusion::WorkStack::set_pi64(int32_t _val) { _impl->pi64 = _val; }
int32_t mosek::fusion::WorkStack::get_pi32() { return _impl->pi32; }
void mosek::fusion::WorkStack::set_pi32(int32_t _val) { _impl->pi32 = _val; }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::WorkStack::get_f64() { return _impl->f64; }
void mosek::fusion::WorkStack::set_f64(std::shared_ptr< monty::ndarray< double,1 > > _val) { _impl->f64 = _val; }
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::WorkStack::get_i64() { return _impl->i64; }
void mosek::fusion::WorkStack::set_i64(std::shared_ptr< monty::ndarray< int64_t,1 > > _val) { _impl->i64 = _val; }
std::shared_ptr< monty::ndarray< int32_t,1 > > mosek::fusion::WorkStack::get_i32() { return _impl->i32; }
void mosek::fusion::WorkStack::set_i32(std::shared_ptr< monty::ndarray< int32_t,1 > > _val) { _impl->i32 = _val; }
// mosek.fusion.WorkStack.ctor @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:212:6-236:7
mosek::fusion::WorkStack::t mosek::fusion::p_WorkStack::_new_WorkStack
  ()
{ return new mosek::fusion::WorkStack(); }
mosek::fusion::WorkStack::WorkStack
  () : 
   WorkStack(new mosek::fusion::p_WorkStack(this))
{ mosek::fusion::p_WorkStack::_get_impl(this)->_initialize(); }
void mosek::fusion::p_WorkStack::_initialize  ()
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    i32 = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)128)));
    i64 = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)128)));
    f64 = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)128)));
    pi32 = (int)0;
    pi64 = (int)0;
    pf64 = (int)0;
    nd = (int)0;
    nnz = (int)0;
    nelem = (int)0;
    hassp = false;
    ncodeatom = (int)0;
    ptr_base = (int)0;
    shape_base = (int)0;
    sp_base = (int)0;
    nidxs_base = (int)0;
    cof_base = (int)0;
    cconst_base = (int)0;
    code_base = (int)0;
    codeptr_base = (int)0;
  }
}
// mosek.fusion.WorkStack.ctor

// Begin mosek.fusion.WorkStack.validate
// Method mosek.fusion.WorkStack.validate @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:492:6-72
void mosek::fusion::WorkStack :: validate() { mosek::fusion::p_WorkStack::_get_impl(this)->validate(); }
void mosek::fusion::p_WorkStack::validate()
{
  validate_from(pi32,pi64,pf64,false);
}
// End mosek.fusion.WorkStack.validate

// Begin mosek.fusion.WorkStack.validate_all
// Method mosek.fusion.WorkStack.validate_all @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:489:6-75
void mosek::fusion::WorkStack :: validate_all() { mosek::fusion::p_WorkStack::_get_impl(this)->validate_all(); }
void mosek::fusion::p_WorkStack::validate_all()
{
  validate_from(pi32,pi64,pf64,true);
}
// End mosek.fusion.WorkStack.validate_all

// Begin mosek.fusion.WorkStack.validate_from
// Method mosek.fusion.WorkStack.validate_from @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:420:6-486:7
void mosek::fusion::p_WorkStack::validate_from(int32_t _7345_fi32,int32_t _7346_fi64,int32_t _7347_ff64,bool _7348_rec)
{
  int32_t _7349_nd = ((*i32)((_7345_fi32 - (int)1)));
  int32_t _7350_nelem = ((*i32)(((_7345_fi32 - _7349_nd) - (int)2)));
  int32_t _7351_nnz = ((*i32)(((_7345_fi32 - _7349_nd) - (int)3)));
  bool _7352_hassp = (((*i32)(((_7345_fi32 - _7349_nd) - (int)4))) != (int)0);
  int32_t _7353_ncodeatom = ((*i32)(((_7345_fi32 - _7349_nd) - (int)5)));
  int32_t _7354_ptr_base = (((_7345_fi32 - _7349_nd) - (int)6) - _7350_nelem);
  int32_t _12652_;
  bool _12653_ = (_7353_ncodeatom > (int)0);
  if (_12653_)
  {
    _12652_ = (_7354_ptr_base - safe_add( _7351_nnz,(int)1 ));
  }
  else
  {
    _12652_ = _7354_ptr_base;
  }
  int32_t _7355_codeptr_base = _12652_;
  int32_t _7356_code_base = (_7355_codeptr_base - _7353_ncodeatom);
  int32_t _12654_;
  bool _12655_ = _7352_hassp;
  if (_12655_)
  {
    _12654_ = (_7346_fi64 - _7350_nelem);
  }
  else
  {
    _12654_ = _7346_fi64;
  }
  int32_t _7357_sp_base = _12654_;
  int32_t _7358_nidxs_base = (_7357_sp_base - _7351_nnz);
  int32_t _7359_cof_base = (_7347_ff64 - _7351_nnz);
  int32_t _7360_cconst_base = (_7359_cof_base - _7353_ncodeatom);
  int64_t _7361_shapesize = (int)1;
  {
    int32_t _7362_i = (int)0;
    for(;(_7362_i < _7349_nd);++ _7362_i)
    {
      {
        _7361_shapesize *= ((*i32)(safe_add( ((_7345_fi32 - _7349_nd) - (int)1),_7362_i )));
      }
    }
  }
  if ((_7361_shapesize < _7350_nelem))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Invalid shape/nelem"));
    }
  }
  {}
  if (((_7361_shapesize > _7350_nelem) && (!_7352_hassp)))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Invalid hassp/nelem/shape"));
    }
  }
  {}
  if ((_7351_nnz < ((*i32)(safe_add( _7354_ptr_base,_7350_nelem )))))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Invalid ptr/nnz"));
    }
  }
  {}
  int32_t _12656_ = (int)0;
  int32_t _12657_ = _7350_nelem;
  for (int32_t _7363_i = _12656_; _7363_i < _12657_; ++_7363_i)
  {
    {
      if ((((*i32)(safe_add( _7354_ptr_base,_7363_i ))) > ((*i32)(safe_add( safe_add( _7354_ptr_base,_7363_i ),(int)1 )))))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("Invalid ptr, not ascending"));
        }
      }
      {}
    }
  }
  if (_7352_hassp)
  {
    {
      int32_t _12658_ = (int)0;
      int32_t _12659_ = (_7350_nelem - (int)1);
      for (int32_t _7364_i = _12658_; _7364_i < _12659_; ++_7364_i)
      {
        {
          if ((((*i64)(safe_add( _7357_sp_base,_7364_i ))) > ((*i64)(safe_add( safe_add( _7357_sp_base,_7364_i ),(int)1 )))))
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Invalid sp - not sorted"));
            }
          }
          {}
        }
      }
    }
  }
  {}
  if ((_7353_ncodeatom > (int)0))
  {
    {
      int32_t _12660_ = (int)0;
      int32_t _12661_ = _7351_nnz;
      for (int32_t _7365_i = _12660_; _7365_i < _12661_; ++_7365_i)
      {
        {
          if ((((*i32)(safe_add( _7355_codeptr_base,_7365_i ))) > ((*i32)(safe_add( safe_add( _7355_codeptr_base,_7365_i ),(int)1 )))))
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Invalid codeptr - not ascending"));
            }
          }
          {}
        }
      }
      int32_t _12662_ = (int)0;
      int32_t _12663_ = _7351_nnz;
      for (int32_t _7366_i = _12662_; _7366_i < _12663_; ++_7366_i)
      {
        {
          int32_t _7367_stackpos = (int)0;
          int32_t _12664_ = ((*i32)(safe_add( _7355_codeptr_base,_7366_i )));
          int32_t _12665_ = ((*i32)(safe_add( safe_add( _7355_codeptr_base,_7366_i ),(int)1 )));
          for (int32_t _7368_j = _12664_; _7368_j < _12665_; ++_7368_j)
          {
            {
              int32_t _7369_op = ((*i32)(safe_add( _7356_code_base,_7368_j )));
              if ((_7369_op == 0))
              {
                {
                }
              }
              else if(((_7369_op == 1) || ((_7369_op == 2) || (_7369_op == 10))))
              {
                {
                  ++ _7367_stackpos;
                }
              }
              else if(((_7369_op == 3) || (_7369_op == 5)))
              {
                {
                  if ((_7367_stackpos < (int)2))
                  {
                    {
                      throw ::mosek::fusion::UnexpectedError(std::string ("Code stack underflow"));
                    }
                  }
                  {}
                  -- _7367_stackpos;
                }
              }
              else if(((_7369_op == 4) || (_7369_op == 6)))
              {
                {
                  if ((_7367_stackpos < (int)1))
                  {
                    {
                      throw ::mosek::fusion::UnexpectedError(std::string ("Code stack underflow"));
                    }
                  }
                  {}
                }
              }
              else if((_7369_op == 8))
              {
                {
                  int32_t _7370_n = (int32_t)((*f64)(safe_add( _7360_cconst_base,_7368_j )));
                  if ((_7370_n > _7367_stackpos))
                  {
                    {
                      throw ::mosek::fusion::UnexpectedError(std::string ("Code stack underflow in SUM"));
                    }
                  }
                  {}
                  _7367_stackpos -= (_7370_n - (int)1);
                }
              }
              else
              {
                {
                  throw ::mosek::fusion::UnexpectedError(std::string ("Invalid code list opcode"));
                }
              }
            }
          }
          if ((_7367_stackpos != (int)1))
          {
            {
              throw ::mosek::fusion::UnexpectedError(std::string ("Invalid code list result"));
            }
          }
          {}
        }
      }
    }
  }
  {}
  if (_7348_rec)
  {
    {
      validate_from(_7356_code_base,_7358_nidxs_base,_7360_cconst_base,_7348_rec);
    }
  }
  {}
}
// End mosek.fusion.WorkStack.validate_from

// Begin mosek.fusion.WorkStack.formatCurrent
// Method mosek.fusion.WorkStack.formatCurrent @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:390:6-418:7
std::string mosek::fusion::WorkStack :: formatCurrent() { return mosek::fusion::p_WorkStack::_get_impl(this)->formatCurrent(); }
std::string mosek::fusion::p_WorkStack::formatCurrent()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _7371_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  std::vector<int32_t> _12666_;
  for (int32_t _7372_i = (int)0, _12667_ = nd; _7372_i < _12667_ ; ++_7372_i)
  {
    _12666_.push_back(((*i32)(safe_add( shape_base,_7372_i ))));
  }
  auto _12668_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12666_.size()),_12666_.begin(),_12666_.end()));
  std::vector<int32_t> _12669_;
  for (int32_t _7373_i = (int)0, _12670_ = safe_add( nelem,(int)1 ); _7373_i < _12670_ ; ++_7373_i)
  {
    _12669_.push_back(((*i32)(safe_add( ptr_base,_7373_i ))));
  }
  auto _12671_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12669_.size()),_12669_.begin(),_12669_.end()));
  _7371_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("  nelem     = "))->__mosek_2fusion_2Utils_2StringBuffer__a(nelem)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("\n"))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("  nnz       = "))->__mosek_2fusion_2Utils_2StringBuffer__a(nnz)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("\n"))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("  hassp     = "))->__mosek_2fusion_2Utils_2StringBuffer__a(hassp)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (" / "))->__mosek_2fusion_2Utils_2StringBuffer__a(hassp)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("\n"))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("  shape     = "))->__mosek_2fusion_2Utils_2StringBuffer__a(_12668_)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("\n"))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("  ptr       = "))->__mosek_2fusion_2Utils_2StringBuffer__a(_12671_)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("\n"));
  if ((ncodeatom > (int)0))
  {
    {
      std::vector<int32_t> _12672_;
      for (int32_t _7374_i = (int)0, _12673_ = safe_add( nnz,(int)1 ); _7374_i < _12673_ ; ++_7374_i)
      {
        _12672_.push_back(((*i32)(safe_add( codeptr_base,_7374_i ))));
      }
      auto _12674_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12672_.size()),_12672_.begin(),_12672_.end()));
      _7371_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("  codeptr   = "))->__mosek_2fusion_2Utils_2StringBuffer__a(_12674_)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("\n"));
    }
  }
  {}
  if (hassp)
  {
    {
      std::vector<int64_t> _12675_;
      for (int32_t _7375_i = (int)0, _12676_ = nelem; _7375_i < _12676_ ; ++_7375_i)
      {
        _12675_.push_back(((*i64)(safe_add( sp_base,_7375_i ))));
      }
      auto _12677_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_12675_.size()),_12675_.begin(),_12675_.end()));
      _7371_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("  sp        = "))->__mosek_2fusion_2Utils_2StringBuffer__a(_12677_)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("\n"));
    }
  }
  {}
  int32_t _12678_ = (int)0;
  int32_t _12679_ = nelem;
  for (int32_t _7376_i = _12678_; _7376_i < _12679_; ++_7376_i)
  {
    {
      std::vector<int64_t> _12680_;
      for (int32_t _7377_j = ((*i32)(safe_add( ptr_base,_7376_i ))), _12681_ = ((*i32)(safe_add( safe_add( ptr_base,_7376_i ),(int)1 ))); _7377_j < _12681_ ; ++_7377_j)
      {
        _12680_.push_back(((*i64)(safe_add( nidxs_base,_7377_j ))));
      }
      auto _12682_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_12680_.size()),_12680_.begin(),_12680_.end()));
      std::vector<double> _12683_;
      for (int32_t _7378_j = ((*i32)(safe_add( ptr_base,_7376_i ))), _12684_ = ((*i32)(safe_add( safe_add( ptr_base,_7376_i ),(int)1 ))); _7378_j < _12684_ ; ++_7378_j)
      {
        _12683_.push_back(((*f64)(safe_add( cof_base,_7378_j ))));
      }
      auto _12685_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_12683_.size()),_12683_.begin(),_12683_.end()));
      _7371_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("  row["))->__mosek_2fusion_2Utils_2StringBuffer__a(_7376_i)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("]"))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("\n"))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("    nidx : "))->__mosek_2fusion_2Utils_2StringBuffer__a(_12682_)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("\n"))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("    cof  : "))->__mosek_2fusion_2Utils_2StringBuffer__a(_12685_)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("\n"));
      if ((ncodeatom > (int)0))
      {
        {
          int32_t _12686_ = ((*i32)(safe_add( ptr_base,_7376_i )));
          int32_t _12687_ = ((*i32)(safe_add( safe_add( ptr_base,_7376_i ),(int)1 )));
          for (int32_t _7379_j = _12686_; _7379_j < _12687_; ++_7379_j)
          {
            {
              std::vector<int32_t> _12688_;
              for (int32_t _7380_k = ((*i32)(safe_add( codeptr_base,_7379_j ))), _12689_ = ((*i32)(safe_add( safe_add( codeptr_base,_7379_j ),(int)1 ))); _7380_k < _12689_ ; ++_7380_k)
              {
                _12688_.push_back(((*i32)(safe_add( code_base,_7380_k ))));
              }
              auto _12690_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12688_.size()),_12688_.begin(),_12688_.end()));
              std::vector<double> _12691_;
              for (int32_t _7381_k = ((*i32)(safe_add( codeptr_base,_7379_j ))), _12692_ = ((*i32)(safe_add( safe_add( codeptr_base,_7379_j ),(int)1 ))); _7381_k < _12692_ ; ++_7381_k)
              {
                _12691_.push_back(((*f64)(safe_add( cconst_base,_7381_k ))));
              }
              auto _12693_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_12691_.size()),_12691_.begin(),_12691_.end()));
              _7371_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("      code["))->__mosek_2fusion_2Utils_2StringBuffer__a(((*i64)(safe_add( nidxs_base,_7379_j ))))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("] "))->__mosek_2fusion_2Utils_2StringBuffer__a(_12690_)->__mosek_2fusion_2Utils_2StringBuffer__a(_12693_)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("\n"));
            }
          }
        }
      }
      {}
    }
  }
  return _7371_sb->toString();
}
// End mosek.fusion.WorkStack.formatCurrent

// Begin mosek.fusion.WorkStack.peek_hassp
// Method mosek.fusion.WorkStack.peek_hassp @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:388:6-77
bool mosek::fusion::WorkStack :: peek_hassp() { return mosek::fusion::p_WorkStack::_get_impl(this)->peek_hassp(); }
bool mosek::fusion::p_WorkStack::peek_hassp()
{
  return (_pubthis->peeki32(safe_add( (int)3,_pubthis->peek_nd() )) != (int)0);
}
// End mosek.fusion.WorkStack.peek_hassp

// Begin mosek.fusion.WorkStack.peek_nnz
// Method mosek.fusion.WorkStack.peek_nnz @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:386:6-72
int32_t mosek::fusion::WorkStack :: peek_nnz() { return mosek::fusion::p_WorkStack::_get_impl(this)->peek_nnz(); }
int32_t mosek::fusion::p_WorkStack::peek_nnz()
{
  return _pubthis->peeki32(safe_add( (int)2,_pubthis->peek_nd() ));
}
// End mosek.fusion.WorkStack.peek_nnz

// Begin mosek.fusion.WorkStack.peek_nelem
// Method mosek.fusion.WorkStack.peek_nelem @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:384:6-72
int32_t mosek::fusion::WorkStack :: peek_nelem() { return mosek::fusion::p_WorkStack::_get_impl(this)->peek_nelem(); }
int32_t mosek::fusion::p_WorkStack::peek_nelem()
{
  return _pubthis->peeki32(safe_add( (int)1,_pubthis->peek_nd() ));
}
// End mosek.fusion.WorkStack.peek_nelem

// Begin mosek.fusion.WorkStack.peek_dim
// Method mosek.fusion.WorkStack.peek_dim @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:382:6-71
int32_t mosek::fusion::WorkStack :: peek_dim(int32_t _7382_i) { return mosek::fusion::p_WorkStack::_get_impl(this)->peek_dim(_7382_i); }
int32_t mosek::fusion::p_WorkStack::peek_dim(int32_t _7382_i)
{
  return _pubthis->peeki32(safe_add( _7382_i,(int)1 ));
}
// End mosek.fusion.WorkStack.peek_dim

// Begin mosek.fusion.WorkStack.peek_nd
// Method mosek.fusion.WorkStack.peek_nd @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:380:6-68
int32_t mosek::fusion::WorkStack :: peek_nd() { return mosek::fusion::p_WorkStack::_get_impl(this)->peek_nd(); }
int32_t mosek::fusion::p_WorkStack::peek_nd()
{
  return _pubthis->peeki32();
}
// End mosek.fusion.WorkStack.peek_nd

// Begin mosek.fusion.WorkStack.alloc_expr
// Method mosek.fusion.WorkStack.alloc_expr @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:375:6-377:7
void mosek::fusion::WorkStack :: alloc_expr(int32_t _7383_nd,int32_t _7384_nelem,int32_t _7385_nnz,bool _7386_hassp) { mosek::fusion::p_WorkStack::_get_impl(this)->alloc_expr(_7383_nd,_7384_nelem,_7385_nnz,_7386_hassp); }
void mosek::fusion::p_WorkStack::alloc_expr(int32_t _7383_nd,int32_t _7384_nelem,int32_t _7385_nnz,bool _7386_hassp)
{
  _pubthis->alloc_expr(_7383_nd,_7384_nelem,_7385_nnz,_7386_hassp,(int)0);
}
// End mosek.fusion.WorkStack.alloc_expr

// Begin mosek.fusion.WorkStack.alloc_expr
// Method mosek.fusion.WorkStack.alloc_expr @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:344:6-372:7
void mosek::fusion::WorkStack :: alloc_expr(int32_t _7387_nd,int32_t _7388_nelem,int32_t _7389_nnz,bool _7390_hassp,int32_t _7391_ncodeatom) { mosek::fusion::p_WorkStack::_get_impl(this)->alloc_expr(_7387_nd,_7388_nelem,_7389_nnz,_7390_hassp,_7391_ncodeatom); }
void mosek::fusion::p_WorkStack::alloc_expr(int32_t _7387_nd,int32_t _7388_nelem,int32_t _7389_nnz,bool _7390_hassp,int32_t _7391_ncodeatom)
{
  if (((_7387_nd < (int)0) || ((_7388_nelem < (int)0) || ((_7389_nnz < (int)0) || (_7391_ncodeatom < (int)0)))))
  {
    {
      throw ::mosek::fusion::ExpressionError(std::string ("Attempted to allocate negative amount on work stack"));
    }
  }
  {}
  cof_base = _pubthis->allocf64(_7389_nnz);
  cconst_base = _pubthis->allocf64(_7391_ncodeatom);
  nidxs_base = _pubthis->alloci64(_7389_nnz);
  int32_t _12694_;
  bool _12695_ = _7390_hassp;
  if (_12695_)
  {
    _12694_ = _pubthis->alloci64(_7388_nelem);
  }
  else
  {
    _12694_ = (-(int)9999);
  }
  sp_base = _12694_;
  code_base = _pubthis->alloci32(_7391_ncodeatom);
  int32_t _12696_;
  bool _12697_ = (_7391_ncodeatom > (int)0);
  if (_12697_)
  {
    _12696_ = _pubthis->alloci32(safe_add( _7389_nnz,(int)1 ));
  }
  else
  {
    _12696_ = (-(int)9999);
  }
  codeptr_base = _12696_;
  ptr_base = _pubthis->alloci32(safe_add( _7388_nelem,(int)1 ));
  _pubthis->pushi32(_7391_ncodeatom);
  int32_t _12698_;
  bool _12699_ = _7390_hassp;
  if (_12699_)
  {
    _12698_ = (int)1;
  }
  else
  {
    _12698_ = (int)0;
  }
  _pubthis->pushi32(_12698_);
  _pubthis->pushi32(_7389_nnz);
  _pubthis->pushi32(_7388_nelem);
  shape_base = _pubthis->alloci32(_7387_nd);
  _pubthis->pushi32(_7387_nd);
  mosek::fusion::p_WorkStack::_get_impl(::mosek::fusion::WorkStack::t(_pubthis))->ncodeatom = _7391_ncodeatom;
  mosek::fusion::p_WorkStack::_get_impl(::mosek::fusion::WorkStack::t(_pubthis))->nd = _7387_nd;
  mosek::fusion::p_WorkStack::_get_impl(::mosek::fusion::WorkStack::t(_pubthis))->nelem = _7388_nelem;
  mosek::fusion::p_WorkStack::_get_impl(::mosek::fusion::WorkStack::t(_pubthis))->nnz = _7389_nnz;
  mosek::fusion::p_WorkStack::_get_impl(::mosek::fusion::WorkStack::t(_pubthis))->hassp = _7390_hassp;
}
// End mosek.fusion.WorkStack.alloc_expr

// Begin mosek.fusion.WorkStack.pop_expr
// Method mosek.fusion.WorkStack.pop_expr @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:322:6-341:7
void mosek::fusion::WorkStack :: pop_expr() { mosek::fusion::p_WorkStack::_get_impl(this)->pop_expr(); }
void mosek::fusion::p_WorkStack::pop_expr()
{
  nd = _pubthis->popi32();
  shape_base = _pubthis->popi32(nd);
  nelem = _pubthis->popi32();
  nnz = _pubthis->popi32();
  hassp = (_pubthis->popi32() != (int)0);
  ncodeatom = _pubthis->popi32();
  ptr_base = _pubthis->popi32(safe_add( nelem,(int)1 ));
  int32_t _12700_;
  bool _12701_ = (ncodeatom > (int)0);
  if (_12701_)
  {
    _12700_ = _pubthis->popi32(safe_add( nnz,(int)1 ));
  }
  else
  {
    _12700_ = (-(int)9999);
  }
  codeptr_base = _12700_;
  code_base = _pubthis->popi32(ncodeatom);
  int32_t _12702_;
  bool _12703_ = hassp;
  if (_12703_)
  {
    _12702_ = _pubthis->popi64(nelem);
  }
  else
  {
    _12702_ = (-(int)9999);
  }
  sp_base = _12702_;
  nidxs_base = _pubthis->popi64(nnz);
  cconst_base = _pubthis->popf64(ncodeatom);
  cof_base = _pubthis->popf64(nnz);
}
// End mosek.fusion.WorkStack.pop_expr

// Begin mosek.fusion.WorkStack.copy_expr
// Method mosek.fusion.WorkStack.copy_expr @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:301:6-319:7
void mosek::fusion::WorkStack :: copy_expr(monty::rc_ptr< ::mosek::fusion::WorkStack > _7392_to) { mosek::fusion::p_WorkStack::_get_impl(this)->copy_expr(_7392_to); }
void mosek::fusion::p_WorkStack::copy_expr(monty::rc_ptr< ::mosek::fusion::WorkStack > _7392_to)
{
  int32_t _7393_tmp_pi32 = pi32;
  int32_t _7394_tmp_pi64 = pi64;
  int32_t _7395_tmp_pf64 = pf64;
  _pubthis->pop_expr();
  int32_t _7396_ti32 = _7392_to->alloci32((_7393_tmp_pi32 - pi32));
  int32_t _7397_ti64 = _7392_to->alloci64((_7394_tmp_pi64 - pi64));
  int32_t _7398_tf64 = _7392_to->allocf64((_7395_tmp_pf64 - pf64));
  ::mosek::fusion::Utils::Tools::arraycopy(i32,pi32,mosek::fusion::p_WorkStack::_get_impl(_7392_to)->i32,_7396_ti32,(_7393_tmp_pi32 - pi32));
  ::mosek::fusion::Utils::Tools::arraycopy(i64,pi64,mosek::fusion::p_WorkStack::_get_impl(_7392_to)->i64,_7397_ti64,(_7394_tmp_pi64 - pi64));
  ::mosek::fusion::Utils::Tools::arraycopy(f64,pf64,mosek::fusion::p_WorkStack::_get_impl(_7392_to)->f64,_7398_tf64,(_7395_tmp_pf64 - pf64));
  pi32 = _7393_tmp_pi32;
  pi64 = _7394_tmp_pi64;
  pf64 = _7395_tmp_pf64;
}
// End mosek.fusion.WorkStack.copy_expr

// Begin mosek.fusion.WorkStack.move_expr
// Method mosek.fusion.WorkStack.move_expr @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:284:6-298:7
void mosek::fusion::WorkStack :: move_expr(monty::rc_ptr< ::mosek::fusion::WorkStack > _7399_to) { mosek::fusion::p_WorkStack::_get_impl(this)->move_expr(_7399_to); }
void mosek::fusion::p_WorkStack::move_expr(monty::rc_ptr< ::mosek::fusion::WorkStack > _7399_to)
{
  int32_t _7400_tmp_pi32 = pi32;
  int32_t _7401_tmp_pi64 = pi64;
  int32_t _7402_tmp_pf64 = pf64;
  _pubthis->pop_expr();
  int32_t _7403_ti32 = _7399_to->alloci32((_7400_tmp_pi32 - pi32));
  int32_t _7404_ti64 = _7399_to->alloci64((_7401_tmp_pi64 - pi64));
  int32_t _7405_tf64 = _7399_to->allocf64((_7402_tmp_pf64 - pf64));
  ::mosek::fusion::Utils::Tools::arraycopy(i32,pi32,mosek::fusion::p_WorkStack::_get_impl(_7399_to)->i32,_7403_ti32,(_7400_tmp_pi32 - pi32));
  ::mosek::fusion::Utils::Tools::arraycopy(i64,pi64,mosek::fusion::p_WorkStack::_get_impl(_7399_to)->i64,_7404_ti64,(_7401_tmp_pi64 - pi64));
  ::mosek::fusion::Utils::Tools::arraycopy(f64,pf64,mosek::fusion::p_WorkStack::_get_impl(_7399_to)->f64,_7405_tf64,(_7402_tmp_pf64 - pf64));
}
// End mosek.fusion.WorkStack.move_expr

// Begin mosek.fusion.WorkStack.peek_expr
// Method mosek.fusion.WorkStack.peek_expr @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:272:6-281:7
void mosek::fusion::WorkStack :: peek_expr() { mosek::fusion::p_WorkStack::_get_impl(this)->peek_expr(); }
void mosek::fusion::p_WorkStack::peek_expr()
{
  int32_t _7406_tmp_pi32 = pi32;
  int32_t _7407_tmp_pi64 = pi64;
  int32_t _7408_tmp_pf64 = pf64;
  _pubthis->pop_expr();
  pi32 = _7406_tmp_pi32;
  pi64 = _7407_tmp_pi64;
  pf64 = _7408_tmp_pf64;
}
// End mosek.fusion.WorkStack.peek_expr

// Begin mosek.fusion.WorkStack.ensure_sparsity
// Method mosek.fusion.WorkStack.ensure_sparsity @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:258:6-268:7
void mosek::fusion::WorkStack :: ensure_sparsity() { mosek::fusion::p_WorkStack::_get_impl(this)->ensure_sparsity(); }
void mosek::fusion::p_WorkStack::ensure_sparsity()
{
  int32_t _7409_nd = ((*i32)((pi32 - (int)1)));
  bool _7410_hassp = (((*i32)(((pi32 - _7409_nd) - (int)3))) != (int)0);
  int32_t _7411_nelem = ((*i32)(((pi32 - _7409_nd) - (int)1)));
  if ((!_7410_hassp))
  {
    {
      ((*i32)(((pi32 - _7409_nd) - (int)3))) = (int)1;
      int32_t _7412_sp = _pubthis->alloci64(_7411_nelem);
      int32_t _12704_ = (int)0;
      int32_t _12705_ = _7411_nelem;
      for (int32_t _7413_i = _12704_; _7413_i < _12705_; ++_7413_i)
      {
        {
          ((*i64)(_7412_sp)) = _7413_i;
        }
      }
    }
  }
  {}
}
// End mosek.fusion.WorkStack.ensure_sparsity

// Begin mosek.fusion.WorkStack.clear
// Method mosek.fusion.WorkStack.clear @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:210:6-61
void mosek::fusion::WorkStack :: clear() { mosek::fusion::p_WorkStack::_get_impl(this)->clear(); }
void mosek::fusion::p_WorkStack::clear()
{
  pi32 = (int)0;
  pi64 = (int)0;
  pf64 = (int)0;
}
// End mosek.fusion.WorkStack.clear

// Begin mosek.fusion.WorkStack.allocf64
// Method mosek.fusion.WorkStack.allocf64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:201:6-207:7
int32_t mosek::fusion::WorkStack :: allocf64(int32_t _7414_n) { return mosek::fusion::p_WorkStack::_get_impl(this)->allocf64(_7414_n); }
int32_t mosek::fusion::p_WorkStack::allocf64(int32_t _7414_n)
{
  _pubthis->ensuref64(_7414_n);
  int32_t _7415_r = pf64;
  pf64 += _7414_n;
  return _7415_r;
}
// End mosek.fusion.WorkStack.allocf64

// Begin mosek.fusion.WorkStack.alloci64
// Method mosek.fusion.WorkStack.alloci64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:191:6-197:7
int32_t mosek::fusion::WorkStack :: alloci64(int32_t _7416_n) { return mosek::fusion::p_WorkStack::_get_impl(this)->alloci64(_7416_n); }
int32_t mosek::fusion::p_WorkStack::alloci64(int32_t _7416_n)
{
  _pubthis->ensurei64(_7416_n);
  int32_t _7417_r = pi64;
  pi64 += _7416_n;
  return _7417_r;
}
// End mosek.fusion.WorkStack.alloci64

// Begin mosek.fusion.WorkStack.alloci32
// Method mosek.fusion.WorkStack.alloci32 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:177:6-187:7
int32_t mosek::fusion::WorkStack :: alloci32(int32_t _7418_n) { return mosek::fusion::p_WorkStack::_get_impl(this)->alloci32(_7418_n); }
int32_t mosek::fusion::p_WorkStack::alloci32(int32_t _7418_n)
{
  if ((_7418_n > (int)0))
  {
    {
      _pubthis->ensurei32(_7418_n);
      int32_t _7419_r = pi32;
      pi32 += _7418_n;
      return _7419_r;
    }
  }
  else
  {
    {
      return (int)0;
    }
  }
}
// End mosek.fusion.WorkStack.alloci32

// Begin mosek.fusion.WorkStack.pushf64
// Method mosek.fusion.WorkStack.pushf64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:168:6-172:7
void mosek::fusion::WorkStack :: pushf64(double _7420_v) { mosek::fusion::p_WorkStack::_get_impl(this)->pushf64(_7420_v); }
void mosek::fusion::p_WorkStack::pushf64(double _7420_v)
{
  _pubthis->ensuref64((int)1);
  ((*f64)(pf64)) = _7420_v;
  ++ pf64;
}
// End mosek.fusion.WorkStack.pushf64

// Begin mosek.fusion.WorkStack.pushi64
// Method mosek.fusion.WorkStack.pushi64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:160:6-164:7
void mosek::fusion::WorkStack :: pushi64(int64_t _7421_v) { mosek::fusion::p_WorkStack::_get_impl(this)->pushi64(_7421_v); }
void mosek::fusion::p_WorkStack::pushi64(int64_t _7421_v)
{
  _pubthis->ensurei64((int)1);
  ((*i64)(pi64)) = _7421_v;
  ++ pi64;
}
// End mosek.fusion.WorkStack.pushi64

// Begin mosek.fusion.WorkStack.pushi32
// Method mosek.fusion.WorkStack.pushi32 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:152:6-156:7
void mosek::fusion::WorkStack :: pushi32(int32_t _7422_v) { mosek::fusion::p_WorkStack::_get_impl(this)->pushi32(_7422_v); }
void mosek::fusion::p_WorkStack::pushi32(int32_t _7422_v)
{
  _pubthis->ensurei32((int)1);
  ((*i32)(pi32)) = _7422_v;
  ++ pi32;
}
// End mosek.fusion.WorkStack.pushi32

// Begin mosek.fusion.WorkStack.ensuref64
// Method mosek.fusion.WorkStack.ensuref64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:141:6-147:7
void mosek::fusion::WorkStack :: ensuref64(int32_t _7423_n) { mosek::fusion::p_WorkStack::_get_impl(this)->ensuref64(_7423_n); }
void mosek::fusion::p_WorkStack::ensuref64(int32_t _7423_n)
{
  if ((safe_add( pf64,_7423_n ) > (int)((f64)->size(0))))
  {
    {
      int32_t _12706_;
      bool _12707_ = ((_7423_n < (int)((f64)->size(0))) && ((int)((f64)->size(0)) < (int)0x3FFFFFFF));
      if (_12707_)
      {
        _12706_ = safe_mul( (int)((f64)->size(0)),(int)2 );
      }
      else
      {
        _12706_ = safe_add( (int)((f64)->size(0)),_7423_n );
      }
      int32_t _7424_newsz = _12706_;
      std::shared_ptr< monty::ndarray< double,1 > > _7425_tmp = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7424_newsz)));
      _checked_ptr_1<double> _ptr__7425_tmp(_7425_tmp ? _7425_tmp->raw() : nullptr,_7425_tmp ? _7425_tmp->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(f64,(int)0,_7425_tmp,(int)0,pf64);
      f64 = _7425_tmp;
    }
  }
  {}
}
// End mosek.fusion.WorkStack.ensuref64

// Begin mosek.fusion.WorkStack.ensurei64
// Method mosek.fusion.WorkStack.ensurei64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:131:6-137:7
void mosek::fusion::WorkStack :: ensurei64(int32_t _7426_n) { mosek::fusion::p_WorkStack::_get_impl(this)->ensurei64(_7426_n); }
void mosek::fusion::p_WorkStack::ensurei64(int32_t _7426_n)
{
  if ((safe_add( pi64,_7426_n ) > (int)((i64)->size(0))))
  {
    {
      int32_t _12708_;
      bool _12709_ = ((_7426_n < (int)((i64)->size(0))) && ((int)((i64)->size(0)) < (int)0x3FFFFFFF));
      if (_12709_)
      {
        _12708_ = (int)((i64)->size(0));
      }
      else
      {
        _12708_ = _7426_n;
      }
      int32_t _7427_newsz = safe_add( (int)((i64)->size(0)),_12708_ );
      std::shared_ptr< monty::ndarray< int64_t,1 > > _7428_tmp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_7427_newsz)));
      _checked_ptr_1<int64_t> _ptr__7428_tmp(_7428_tmp ? _7428_tmp->raw() : nullptr,_7428_tmp ? _7428_tmp->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(i64,(int)0,_7428_tmp,(int)0,pi64);
      i64 = _7428_tmp;
    }
  }
  {}
}
// End mosek.fusion.WorkStack.ensurei64

// Begin mosek.fusion.WorkStack.ensurei32
// Method mosek.fusion.WorkStack.ensurei32 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:121:6-127:7
void mosek::fusion::WorkStack :: ensurei32(int32_t _7429_n) { mosek::fusion::p_WorkStack::_get_impl(this)->ensurei32(_7429_n); }
void mosek::fusion::p_WorkStack::ensurei32(int32_t _7429_n)
{
  if ((safe_add( pi32,_7429_n ) > (int)((i32)->size(0))))
  {
    {
      int32_t _12710_;
      bool _12711_ = ((_7429_n < (int)((i32)->size(0))) && ((int)((i32)->size(0)) < (int)0x3FFFFFFF));
      if (_12711_)
      {
        _12710_ = safe_mul( (int)((i32)->size(0)),(int)2 );
      }
      else
      {
        _12710_ = safe_add( (int)((i32)->size(0)),_7429_n );
      }
      int32_t _7430_newsz = _12710_;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7431_tmp = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7430_newsz)));
      _checked_ptr_1<int32_t> _ptr__7431_tmp(_7431_tmp ? _7431_tmp->raw() : nullptr,_7431_tmp ? _7431_tmp->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(i32,(int)0,_7431_tmp,(int)0,pi32);
      i32 = _7431_tmp;
    }
  }
  {}
}
// End mosek.fusion.WorkStack.ensurei32

// Begin mosek.fusion.WorkStack.popf64
// Method mosek.fusion.WorkStack.popf64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:112:6-116:7
int32_t mosek::fusion::WorkStack :: popf64(int32_t _7432_n) { return mosek::fusion::p_WorkStack::_get_impl(this)->popf64(_7432_n); }
int32_t mosek::fusion::p_WorkStack::popf64(int32_t _7432_n)
{
  pf64 -= _7432_n;
  if ((pf64 < (int)0))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal: stack underflow"));
    }
  }
  {}
  return pf64;
}
// End mosek.fusion.WorkStack.popf64

// Begin mosek.fusion.WorkStack.popi64
// Method mosek.fusion.WorkStack.popi64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:107:6-111:7
int32_t mosek::fusion::WorkStack :: popi64(int32_t _7433_n) { return mosek::fusion::p_WorkStack::_get_impl(this)->popi64(_7433_n); }
int32_t mosek::fusion::p_WorkStack::popi64(int32_t _7433_n)
{
  pi64 -= _7433_n;
  if ((pi64 < (int)0))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal: stack underflow"));
    }
  }
  {}
  return pi64;
}
// End mosek.fusion.WorkStack.popi64

// Begin mosek.fusion.WorkStack.popi32
// Method mosek.fusion.WorkStack.popi32 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:102:6-106:7
int32_t mosek::fusion::WorkStack :: popi32(int32_t _7434_n) { return mosek::fusion::p_WorkStack::_get_impl(this)->popi32(_7434_n); }
int32_t mosek::fusion::p_WorkStack::popi32(int32_t _7434_n)
{
  pi32 -= _7434_n;
  if ((pi32 < (int)0))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal: stack underflow"));
    }
  }
  {}
  return pi32;
}
// End mosek.fusion.WorkStack.popi32

// Begin mosek.fusion.WorkStack.popf64
// Method mosek.fusion.WorkStack.popf64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:97:6-101:7
void mosek::fusion::WorkStack :: popf64(int32_t _7435_n,std::shared_ptr< monty::ndarray< double,1 > > _7436_r,int32_t _7437_ofs) { mosek::fusion::p_WorkStack::_get_impl(this)->popf64(_7435_n,_7436_r,_7437_ofs); }
void mosek::fusion::p_WorkStack::popf64(int32_t _7435_n,std::shared_ptr< monty::ndarray< double,1 > > _7436_r,int32_t _7437_ofs)
{
  _checked_ptr_1<double> _ptr__7436_r(_7436_r ? _7436_r->raw() : nullptr, _7436_r ? _7436_r->size(0) : 0);
  pf64 -= _7435_n;
  if ((pf64 < (int)0))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal: stack underflow"));
    }
  }
  {}
  ::mosek::fusion::Utils::Tools::arraycopy(f64,pf64,_7436_r,_7437_ofs,_7435_n);
}
// End mosek.fusion.WorkStack.popf64

// Begin mosek.fusion.WorkStack.popi64
// Method mosek.fusion.WorkStack.popi64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:92:6-96:7
void mosek::fusion::WorkStack :: popi64(int32_t _7438_n,std::shared_ptr< monty::ndarray< int64_t,1 > > _7439_r,int32_t _7440_ofs) { mosek::fusion::p_WorkStack::_get_impl(this)->popi64(_7438_n,_7439_r,_7440_ofs); }
void mosek::fusion::p_WorkStack::popi64(int32_t _7438_n,std::shared_ptr< monty::ndarray< int64_t,1 > > _7439_r,int32_t _7440_ofs)
{
  _checked_ptr_1<int64_t> _ptr__7439_r(_7439_r ? _7439_r->raw() : nullptr, _7439_r ? _7439_r->size(0) : 0);
  pi64 -= _7438_n;
  if ((pi64 < (int)0))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal: stack underflow"));
    }
  }
  {}
  ::mosek::fusion::Utils::Tools::arraycopy(i64,pi64,_7439_r,_7440_ofs,_7438_n);
}
// End mosek.fusion.WorkStack.popi64

// Begin mosek.fusion.WorkStack.popi32
// Method mosek.fusion.WorkStack.popi32 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:87:6-91:7
void mosek::fusion::WorkStack :: popi32(int32_t _7441_n,std::shared_ptr< monty::ndarray< int32_t,1 > > _7442_r,int32_t _7443_ofs) { mosek::fusion::p_WorkStack::_get_impl(this)->popi32(_7441_n,_7442_r,_7443_ofs); }
void mosek::fusion::p_WorkStack::popi32(int32_t _7441_n,std::shared_ptr< monty::ndarray< int32_t,1 > > _7442_r,int32_t _7443_ofs)
{
  _checked_ptr_1<int32_t> _ptr__7442_r(_7442_r ? _7442_r->raw() : nullptr, _7442_r ? _7442_r->size(0) : 0);
  pi32 -= _7441_n;
  if ((pi32 < (int)0))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal: stack underflow"));
    }
  }
  {}
  ::mosek::fusion::Utils::Tools::arraycopy(i32,pi32,_7442_r,_7443_ofs,_7441_n);
}
// End mosek.fusion.WorkStack.popi32

// Begin mosek.fusion.WorkStack.popf64
// Method mosek.fusion.WorkStack.popf64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:82:6-86:7
double mosek::fusion::WorkStack :: popf64() { return mosek::fusion::p_WorkStack::_get_impl(this)->popf64(); }
double mosek::fusion::p_WorkStack::popf64()
{
  -- pf64;
  if ((pf64 < (int)0))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal: stack underflow"));
    }
  }
  {}
  return ((*f64)(pf64));
}
// End mosek.fusion.WorkStack.popf64

// Begin mosek.fusion.WorkStack.popi64
// Method mosek.fusion.WorkStack.popi64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:77:6-81:7
int64_t mosek::fusion::WorkStack :: popi64() { return mosek::fusion::p_WorkStack::_get_impl(this)->popi64(); }
int64_t mosek::fusion::p_WorkStack::popi64()
{
  if ((pi64 < (int)0))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal: stack underflow"));
    }
  }
  {}
  -- pi64;
  return ((*i64)(pi64));
}
// End mosek.fusion.WorkStack.popi64

// Begin mosek.fusion.WorkStack.popi32
// Method mosek.fusion.WorkStack.popi32 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:72:6-76:7
int32_t mosek::fusion::WorkStack :: popi32() { return mosek::fusion::p_WorkStack::_get_impl(this)->popi32(); }
int32_t mosek::fusion::p_WorkStack::popi32()
{
  -- pi32;
  if ((pi32 < (int)0))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("Internal: stack underflow"));
    }
  }
  {}
  return ((*i32)(pi32));
}
// End mosek.fusion.WorkStack.popi32

// Begin mosek.fusion.WorkStack.peekf64
// Method mosek.fusion.WorkStack.peekf64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:70:6-61
double mosek::fusion::WorkStack :: peekf64() { return mosek::fusion::p_WorkStack::_get_impl(this)->peekf64(); }
double mosek::fusion::p_WorkStack::peekf64()
{
  return ((*f64)((pf64 - (int)1)));
}
// End mosek.fusion.WorkStack.peekf64

// Begin mosek.fusion.WorkStack.peeki64
// Method mosek.fusion.WorkStack.peeki64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:69:6-61
int64_t mosek::fusion::WorkStack :: peeki64() { return mosek::fusion::p_WorkStack::_get_impl(this)->peeki64(); }
int64_t mosek::fusion::p_WorkStack::peeki64()
{
  return ((*i64)((pi64 - (int)1)));
}
// End mosek.fusion.WorkStack.peeki64

// Begin mosek.fusion.WorkStack.peeki32
// Method mosek.fusion.WorkStack.peeki32 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:68:6-61
int32_t mosek::fusion::WorkStack :: peeki32() { return mosek::fusion::p_WorkStack::_get_impl(this)->peeki32(); }
int32_t mosek::fusion::p_WorkStack::peeki32()
{
  return ((*i32)((pi32 - (int)1)));
}
// End mosek.fusion.WorkStack.peeki32

// Begin mosek.fusion.WorkStack.peekf64
// Method mosek.fusion.WorkStack.peekf64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:66:6-70
double mosek::fusion::WorkStack :: peekf64(int32_t _7444_i) { return mosek::fusion::p_WorkStack::_get_impl(this)->peekf64(_7444_i); }
double mosek::fusion::p_WorkStack::peekf64(int32_t _7444_i)
{
  return ((*f64)(((pf64 - _7444_i) - (int)1)));
}
// End mosek.fusion.WorkStack.peekf64

// Begin mosek.fusion.WorkStack.peeki64
// Method mosek.fusion.WorkStack.peeki64 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:65:6-70
int64_t mosek::fusion::WorkStack :: peeki64(int32_t _7445_i) { return mosek::fusion::p_WorkStack::_get_impl(this)->peeki64(_7445_i); }
int64_t mosek::fusion::p_WorkStack::peeki64(int32_t _7445_i)
{
  return ((*i64)(((pi64 - _7445_i) - (int)1)));
}
// End mosek.fusion.WorkStack.peeki64

// Begin mosek.fusion.WorkStack.peeki32
// Method mosek.fusion.WorkStack.peeki32 @ bld/grindsted/final/default/src/fusion/BaseExpression.monty:64:6-70
int32_t mosek::fusion::WorkStack :: peeki32(int32_t _7446_i) { return mosek::fusion::p_WorkStack::_get_impl(this)->peeki32(_7446_i); }
int32_t mosek::fusion::p_WorkStack::peeki32(int32_t _7446_i)
{
  return ((*i32)(((pi32 - _7446_i) - (int)1)));
}
// End mosek.fusion.WorkStack.peeki32

void mosek::fusion::p_WorkStack::destroy()
{
  f64.reset();
  i64.reset();
  i32.reset();
}
void mosek::fusion::WorkStack::destroy() { mosek::fusion::p_WorkStack::_get_impl(this)->destroy(); }
// } class WorkStack
// class Expr { // @ bld/grindsted/final/default/src/fusion/Expr.mbi:351:4-1886:5
mosek::fusion::Expr::Expr(mosek::fusion::p_Expr *_impl) : mosek::fusion::BaseExpression(_impl) { /*std::cout << "Expr()" << this << std::endl; */ }
mosek::fusion::Expr::~Expr() {  /* std::cout << "~Expr()" << this << std::endl << std::flush; */ }
mosek::fusion::p_Expr::p_Expr
  (::mosek::fusion::Expr * _pubthis) :     mosek::fusion::p_BaseExpression(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.Expr.ctor @ bld/grindsted/final/default/src/fusion/Expr.mbi:526:6-569:7
mosek::fusion::Expr::t mosek::fusion::p_Expr::_new_Expr
  (std::shared_ptr< monty::ndarray< int64_t,1 > > _7447_ptrb,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _7448_subj,
    std::shared_ptr< monty::ndarray< double,1 > > _7449_cof,
    std::shared_ptr< monty::ndarray< double,1 > > _7450_bfix,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _7451_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _7452_inst)
{ return new mosek::fusion::Expr(_7447_ptrb,_7448_subj,_7449_cof,_7450_bfix,_7451_shape,_7452_inst); }
mosek::fusion::Expr::Expr
  (std::shared_ptr< monty::ndarray< int64_t,1 > > _7447_ptrb,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _7448_subj,
    std::shared_ptr< monty::ndarray< double,1 > > _7449_cof,
    std::shared_ptr< monty::ndarray< double,1 > > _7450_bfix,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _7451_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _7452_inst) : 
   Expr(new mosek::fusion::p_Expr(this))
{ mosek::fusion::p_Expr::_get_impl(this)->_initialize(_7447_ptrb,_7448_subj,_7449_cof,_7450_bfix,_7451_shape,_7452_inst); }
void mosek::fusion::p_Expr::_initialize  (std::shared_ptr< monty::ndarray< int64_t,1 > > _7447_ptrb,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _7448_subj,
    std::shared_ptr< monty::ndarray< double,1 > > _7449_cof,
    std::shared_ptr< monty::ndarray< double,1 > > _7450_bfix,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _7451_shape,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _7452_inst)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int64_t> _ptr__7447_ptrb(_7447_ptrb ? _7447_ptrb->raw() : nullptr, _7447_ptrb ? _7447_ptrb->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__7448_subj(_7448_subj ? _7448_subj->raw() : nullptr, _7448_subj ? _7448_subj->size(0) : 0);
    _checked_ptr_1<double> _ptr__7449_cof(_7449_cof ? _7449_cof->raw() : nullptr, _7449_cof ? _7449_cof->size(0) : 0);
    _checked_ptr_1<double> _ptr__7450_bfix(_7450_bfix ? _7450_bfix->raw() : nullptr, _7450_bfix ? _7450_bfix->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__7451_shape(_7451_shape ? _7451_shape->raw() : nullptr, _7451_shape ? _7451_shape->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__7452_inst(_7452_inst ? _7452_inst->raw() : nullptr, _7452_inst ? _7452_inst->size(0) : 0);
    std::shared_ptr< monty::ndarray< int32_t,1 > > _12712_;
    bool _12713_ = (NULL != _7451_shape.get());
    if (_12713_)
    {
      _12712_ = ::mosek::fusion::Utils::Tools::arraycopy(_7451_shape);
    }
    else
    {
      _12712_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(((int)((_7447_ptrb)->size(0)) - (int)1))});
    }
    std::shared_ptr< monty::ndarray< int64_t,1 > > _12714_;
    bool _12715_ = (NULL != _7452_inst.get());
    if (_12715_)
    {
      _12714_ = ::mosek::fusion::Utils::Tools::arraycopy(_7452_inst);
    }
    else
    {
      _12714_ = nullptr;
    }
    mosek::fusion::p_Expr::_initialize(::mosek::fusion::Utils::Tools::arraycopy(_7447_ptrb),::mosek::fusion::Utils::Tools::arraycopy(_7448_subj),::mosek::fusion::Utils::Tools::arraycopy(_7449_cof),::mosek::fusion::Utils::Tools::arraycopy(_7450_bfix),_12712_,_12714_,(int)1);
    int32_t _7453_nelem = ((int)((_7447_ptrb)->size(0)) - (int)1);
    if ((_7453_nelem < (int)0))
    {
      {
        throw ::mosek::fusion::ExpressionError(std::string ("Invalid ptrb"));
      }
    }
    {}
    int64_t _7454_nnz = _ptr__7447_ptrb[_7453_nelem];
    if (((_7454_nnz < (int)0) || ((_7454_nnz != (int)((_7449_cof)->size(0))) || (_7454_nnz != (int)((_7448_subj)->size(0))))))
    {
      {
        throw ::mosek::fusion::ExpressionError(std::string ("Invalid ptrb construction"));
      }
    }
    {}
    bool _7455_ptrb_ok = true;
    bool _7456_shape_ok = true;
    bool _7457_inst_ok = true;
    std::shared_ptr< monty::ndarray< int32_t,1 > > _7458_thisshape = mosek::fusion::p_Expr::_get_impl(::mosek::fusion::Expr::t(_pubthis))->shape;
    _checked_ptr_1<int32_t> _ptr__7458_thisshape(_7458_thisshape ? _7458_thisshape->raw() : nullptr,_7458_thisshape ? _7458_thisshape->size(0) : 0);
    int64_t _7459_sz = ::mosek::fusion::p_Set::size(_7458_thisshape);
    {
      int32_t _12716_ = (int)0;
      int32_t _12717_ = (int)((_7458_thisshape)->size(0));
      for (int32_t _7460_i = _12716_; _7460_i < _12717_; ++_7460_i)
      {
        {
          _7456_shape_ok = (_7456_shape_ok && (_ptr__7458_thisshape[_7460_i] >= (int)0));
        }
      }
      int32_t _12718_ = (int)0;
      int32_t _12719_ = _7453_nelem;
      for (int32_t _7461_i = _12718_; _7461_i < _12719_; ++_7461_i)
      {
        {
          _7455_ptrb_ok = (_7455_ptrb_ok && (_ptr__7447_ptrb[_7461_i] <= _ptr__7447_ptrb[safe_add( _7461_i,(int)1 )]));
        }
      }
      if (((NULL != _7452_inst.get()) && ((int)((_7452_inst)->size(0)) > (int)0)))
      {
        {
          _7457_inst_ok = ((_ptr__7452_inst[(int)0] >= (int)0) && (_ptr__7452_inst[(_7453_nelem - (int)1)] < _7459_sz));
          int32_t _12720_ = (int)0;
          int32_t _12721_ = (_7453_nelem - (int)1);
          for (int32_t _7462_i = _12720_; _7462_i < _12721_; ++_7462_i)
          {
            {
              _7457_inst_ok = (_7457_inst_ok && (_ptr__7452_inst[_7462_i] < _ptr__7452_inst[safe_add( _7462_i,(int)1 )]));
            }
          }
        }
      }
      {}
    }
    if ((!_7456_shape_ok))
    {
      {
        throw ::mosek::fusion::ExpressionError(std::string ("Invalid shape"));
      }
    }
    {}
    if ((!_7455_ptrb_ok))
    {
      {
        throw ::mosek::fusion::ExpressionError(std::string ("Invalid ptrb"));
      }
    }
    {}
    if ((!_7457_inst_ok))
    {
      {
        throw ::mosek::fusion::ExpressionError(std::string ("Invalid sparsity pattern"));
      }
    }
    {}
  }
}
// mosek.fusion.Expr.ctor

// mosek.fusion.Expr.ctor @ bld/grindsted/final/default/src/fusion/Expr.mbi:462:6-482:7
mosek::fusion::Expr::t mosek::fusion::p_Expr::_new_Expr
  (std::shared_ptr< monty::ndarray< int64_t,1 > > _7463_ptrb,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _7464_subj,
    std::shared_ptr< monty::ndarray< double,1 > > _7465_cof,
    std::shared_ptr< monty::ndarray< double,1 > > _7466_bfix,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _7467_shp,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _7468_inst,
    int32_t _7469_unchecked_)
{ return new mosek::fusion::Expr(_7463_ptrb,_7464_subj,_7465_cof,_7466_bfix,_7467_shp,_7468_inst,_7469_unchecked_); }
mosek::fusion::Expr::Expr
  (std::shared_ptr< monty::ndarray< int64_t,1 > > _7463_ptrb,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _7464_subj,
    std::shared_ptr< monty::ndarray< double,1 > > _7465_cof,
    std::shared_ptr< monty::ndarray< double,1 > > _7466_bfix,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _7467_shp,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _7468_inst,
    int32_t _7469_unchecked_) : 
   Expr(new mosek::fusion::p_Expr(this))
{ mosek::fusion::p_Expr::_get_impl(this)->_initialize(_7463_ptrb,_7464_subj,_7465_cof,_7466_bfix,_7467_shp,_7468_inst,_7469_unchecked_); }
void mosek::fusion::p_Expr::_initialize  (std::shared_ptr< monty::ndarray< int64_t,1 > > _7463_ptrb,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _7464_subj,
    std::shared_ptr< monty::ndarray< double,1 > > _7465_cof,
    std::shared_ptr< monty::ndarray< double,1 > > _7466_bfix,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _7467_shp,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _7468_inst,
    int32_t _7469_unchecked_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int64_t> _ptr__7463_ptrb(_7463_ptrb ? _7463_ptrb->raw() : nullptr, _7463_ptrb ? _7463_ptrb->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__7464_subj(_7464_subj ? _7464_subj->raw() : nullptr, _7464_subj ? _7464_subj->size(0) : 0);
    _checked_ptr_1<double> _ptr__7465_cof(_7465_cof ? _7465_cof->raw() : nullptr, _7465_cof ? _7465_cof->size(0) : 0);
    _checked_ptr_1<double> _ptr__7466_bfix(_7466_bfix ? _7466_bfix->raw() : nullptr, _7466_bfix ? _7466_bfix->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__7467_shp(_7467_shp ? _7467_shp->raw() : nullptr, _7467_shp ? _7467_shp->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__7468_inst(_7468_inst ? _7468_inst->raw() : nullptr, _7468_inst ? _7468_inst->size(0) : 0);
    mosek::fusion::p_BaseExpression::_initialize(nullptr,_7467_shp);
    mosek::fusion::p_Expr::_get_impl(::mosek::fusion::Expr::t(_pubthis))->shape = _7467_shp;
    mosek::fusion::p_Expr::_get_impl(::mosek::fusion::Expr::t(_pubthis))->ptrb = _7463_ptrb;
    mosek::fusion::p_Expr::_get_impl(::mosek::fusion::Expr::t(_pubthis))->subj = _7464_subj;
    mosek::fusion::p_Expr::_get_impl(::mosek::fusion::Expr::t(_pubthis))->cof_v = _7465_cof;
    mosek::fusion::p_Expr::_get_impl(::mosek::fusion::Expr::t(_pubthis))->bfix = _7466_bfix;
    mosek::fusion::p_Expr::_get_impl(::mosek::fusion::Expr::t(_pubthis))->inst = _7468_inst;
    if ((NULL == mosek::fusion::p_Expr::_get_impl(::mosek::fusion::Expr::t(_pubthis))->shape.get()))
    {
      {
        throw ::mosek::fusion::UnexpectedError(std::string ("Internal: NULL shape"));
      }
    }
    {}
  }
}
// mosek.fusion.Expr.ctor

// Begin mosek.fusion.Expr.prod
// Method mosek.fusion.Expr.prod @ bld/grindsted/final/default/src/fusion/Expr.mbi:1885:6-110
int64_t mosek::fusion::p_Expr::prod(std::shared_ptr< monty::ndarray< int32_t,1 > > _7470_vals)
{
  _checked_ptr_1<int32_t> _ptr__7470_vals(_7470_vals ? _7470_vals->raw() : nullptr, _7470_vals ? _7470_vals->size(0) : 0);
  int32_t _7471_r = (int)1;
  int32_t _12722_ = (int)0;
  int32_t _12723_ = (int)((_7470_vals)->size(0));
  for (int32_t _7472_i = _12722_; _7472_i < _12723_; ++_7472_i)
  {
    {
      _7471_r *= _ptr__7470_vals[_7472_i];
    }
  }
  return _7471_r;
}
// End mosek.fusion.Expr.prod

// Begin mosek.fusion.Expr.varstack
// Method mosek.fusion.Expr.varstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:1880:6-1883:7
std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > mosek::fusion::p_Expr::varstack(std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >,1 > > _7473_vs)
{
  std::vector<monty::rc_ptr< ::mosek::fusion::Variable >> _12724_;
  for (int32_t _7474_i = (int)0, _12725_ = (int)((_7473_vs)->size(0)); _7474_i < _12725_ ; ++_7474_i)
  {
    for (int32_t _7475_j = (int)0, _12726_ = (int)((((*_7473_vs)(_7474_i)))->size(0)); _7475_j < _12726_ ; ++_7475_j)
    {
      _12724_.push_back(((*((*_7473_vs)(_7474_i)))(_7475_j)));
    }
  }
  auto _12727_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 >(monty::shape(_12724_.size()),_12724_.begin(),_12724_.end()));
  return _12727_;
}
// End mosek.fusion.Expr.varstack

// Begin mosek.fusion.Expr.varstack
// Method mosek.fusion.Expr.varstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:1867:6-1878:7
std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > mosek::fusion::p_Expr::varstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _7476_v1,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _7477_v2)
{
  if ((NULL == _7476_v1.get()))
  {
    {
      return _7477_v2;
    }
  }
  else if((NULL == _7477_v2.get()))
  {
    {
      return _7476_v1;
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _7478_r = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 >(monty::shape(safe_add( (int)((_7476_v1)->size(0)),(int)((_7477_v2)->size(0)) ))));
      int32_t _12728_ = (int)0;
      int32_t _12729_ = (int)((_7476_v1)->size(0));
      for (int32_t _7479_i = _12728_; _7479_i < _12729_; ++_7479_i)
      {
        {
          ((*_7478_r)(_7479_i)) = ((*_7476_v1)(_7479_i));
        }
      }
      int32_t _12730_ = (int)0;
      int32_t _12731_ = (int)((_7477_v2)->size(0));
      for (int32_t _7480_i = _12730_; _7480_i < _12731_; ++_7480_i)
      {
        {
          ((*_7478_r)(safe_add( _7480_i,(int)((_7476_v1)->size(0)) ))) = ((*_7477_v2)(_7480_i));
        }
      }
      return _7478_r;
    }
  }
}
// End mosek.fusion.Expr.varstack

// Begin mosek.fusion.Expr.condense
// Method mosek.fusion.Expr.condense @ bld/grindsted/final/default/src/fusion/Expr.mbi:1864:6-93
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::condense
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7481_e) { return mosek::fusion::p_Expr::condense(_7481_e); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::condense(monty::rc_ptr< ::mosek::fusion::Expression > _7481_e)
{
  return (::mosek::fusion::p_ExprCondense::_new_ExprCondense(_7481_e)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.condense

// Begin mosek.fusion.Expr.flatten
// Method mosek.fusion.Expr.flatten @ bld/grindsted/final/default/src/fusion/Expr.mbi:1851:6-1859:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::flatten
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7482_e) { return mosek::fusion::p_Expr::flatten(_7482_e); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::flatten(monty::rc_ptr< ::mosek::fusion::Expression > _7482_e)
{
  if ((NULL == _7482_e.get()))
  {
    {
      throw monty::NullPointerException(std::string ("Arguments for flatten may not be null"));
    }
  }
  {}
  int64_t _7483_sz = _7482_e->getSize();
  if ((!(_7483_sz <= (int)0x7fffffff)))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Maximum dimension size exceeded"));
    }
  }
  {}
  return ::mosek::fusion::p_Expr::reshape(_7482_e,(int32_t)_7483_sz);
}
// End mosek.fusion.Expr.flatten

// Begin mosek.fusion.Expr.reshape
// Method mosek.fusion.Expr.reshape @ bld/grindsted/final/default/src/fusion/Expr.mbi:1842:6-1846:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::reshape
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7484_e,
    int32_t _7485_dimi,
    int32_t _7486_dimj) { return mosek::fusion::p_Expr::reshape(_7484_e,_7485_dimi,_7486_dimj); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::reshape(monty::rc_ptr< ::mosek::fusion::Expression > _7484_e,int32_t _7485_dimi,int32_t _7486_dimj)
{
  if ((NULL == _7484_e.get()))
  {
    {
      throw monty::NullPointerException(std::string ("Arguments for reshape may not be null"));
    }
  }
  {}
  return ::mosek::fusion::p_Expr::reshape(_7484_e,::mosek::fusion::p_Set::make(_7485_dimi,_7486_dimj));
}
// End mosek.fusion.Expr.reshape

// Begin mosek.fusion.Expr.reshape
// Method mosek.fusion.Expr.reshape @ bld/grindsted/final/default/src/fusion/Expr.mbi:1832:6-1836:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::reshape
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7487_e,
    int32_t _7488_size) { return mosek::fusion::p_Expr::reshape(_7487_e,_7488_size); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::reshape(monty::rc_ptr< ::mosek::fusion::Expression > _7487_e,int32_t _7488_size)
{
  if ((NULL == _7487_e.get()))
  {
    {
      throw monty::NullPointerException(std::string ("Arguments for reshape may not be null"));
    }
  }
  {}
  return ::mosek::fusion::p_Expr::reshape(_7487_e,::mosek::fusion::p_Set::make(_7488_size));
}
// End mosek.fusion.Expr.reshape

// Begin mosek.fusion.Expr.reshape
// Method mosek.fusion.Expr.reshape @ bld/grindsted/final/default/src/fusion/Expr.mbi:1831:6-118
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::reshape
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7489_e,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _7490_newshape) { return mosek::fusion::p_Expr::reshape(_7489_e,_7490_newshape); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::reshape(monty::rc_ptr< ::mosek::fusion::Expression > _7489_e,std::shared_ptr< monty::ndarray< int32_t,1 > > _7490_newshape)
{
  _checked_ptr_1<int32_t> _ptr__7490_newshape(_7490_newshape ? _7490_newshape->raw() : nullptr, _7490_newshape ? _7490_newshape->size(0) : 0);
  return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(_7490_newshape,_7489_e)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.reshape

// Begin mosek.fusion.Expr.zeros
// Method mosek.fusion.Expr.zeros @ bld/grindsted/final/default/src/fusion/Expr.mbi:1817:6-87
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::zeros
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _7491_shp) { return mosek::fusion::p_Expr::zeros(_7491_shp); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::zeros(std::shared_ptr< monty::ndarray< int32_t,1 > > _7491_shp)
{
  _checked_ptr_1<int32_t> _ptr__7491_shp(_7491_shp ? _7491_shp->raw() : nullptr, _7491_shp ? _7491_shp->size(0) : 0);
  return ::mosek::fusion::p_Expr::constTerm(_7491_shp,(double)((int)0));
}
// End mosek.fusion.Expr.zeros

// Begin mosek.fusion.Expr.zeros
// Method mosek.fusion.Expr.zeros @ bld/grindsted/final/default/src/fusion/Expr.mbi:1816:6-87
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::zeros
  ( int32_t _7492_size) { return mosek::fusion::p_Expr::zeros(_7492_size); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::zeros(int32_t _7492_size)
{
  return ::mosek::fusion::p_Expr::constTerm(_7492_size,(double)((int)0));
}
// End mosek.fusion.Expr.zeros

// Begin mosek.fusion.Expr.ones
// Method mosek.fusion.Expr.ones @ bld/grindsted/final/default/src/fusion/Expr.mbi:1814:6-70
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::ones
  ( ) { return mosek::fusion::p_Expr::ones(); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::ones()
{
  return ::mosek::fusion::p_Expr::constTerm((double)((int)1));
}
// End mosek.fusion.Expr.ones

// Begin mosek.fusion.Expr.ones
// Method mosek.fusion.Expr.ones @ bld/grindsted/final/default/src/fusion/Expr.mbi:1813:6-113
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::ones
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _7493_shp,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _7494_sparsity) { return mosek::fusion::p_Expr::ones(_7493_shp,_7494_sparsity); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::ones(std::shared_ptr< monty::ndarray< int32_t,1 > > _7493_shp,std::shared_ptr< monty::ndarray< int32_t,2 > > _7494_sparsity)
{
  _checked_ptr_1<int32_t> _ptr__7493_shp(_7493_shp ? _7493_shp->raw() : nullptr, _7493_shp ? _7493_shp->size(0) : 0);
  return ::mosek::fusion::p_Expr::constTerm(_7493_shp,_7494_sparsity,(double)((int)1));
}
// End mosek.fusion.Expr.ones

// Begin mosek.fusion.Expr.ones
// Method mosek.fusion.Expr.ones @ bld/grindsted/final/default/src/fusion/Expr.mbi:1812:6-87
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::ones
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _7495_shp) { return mosek::fusion::p_Expr::ones(_7495_shp); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::ones(std::shared_ptr< monty::ndarray< int32_t,1 > > _7495_shp)
{
  _checked_ptr_1<int32_t> _ptr__7495_shp(_7495_shp ? _7495_shp->raw() : nullptr, _7495_shp ? _7495_shp->size(0) : 0);
  return ::mosek::fusion::p_Expr::constTerm(_7495_shp,(double)((int)1));
}
// End mosek.fusion.Expr.ones

// Begin mosek.fusion.Expr.ones
// Method mosek.fusion.Expr.ones @ bld/grindsted/final/default/src/fusion/Expr.mbi:1811:6-87
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::ones
  ( int32_t _7496_size) { return mosek::fusion::p_Expr::ones(_7496_size); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::ones(int32_t _7496_size)
{
  return ::mosek::fusion::p_Expr::constTerm(_7496_size,(double)((int)1));
}
// End mosek.fusion.Expr.ones

// Begin mosek.fusion.Expr.constTerm
// Method mosek.fusion.Expr.constTerm @ bld/grindsted/final/default/src/fusion/Expr.mbi:1805:6-1808:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::constTerm
  ( monty::rc_ptr< ::mosek::fusion::NDSparseArray > _7497_nda) { return mosek::fusion::p_Expr::constTerm(_7497_nda); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::constTerm(monty::rc_ptr< ::mosek::fusion::NDSparseArray > _7497_nda)
{
  return (::mosek::fusion::p_ExprConst::_new_ExprConst(mosek::fusion::p_NDSparseArray::_get_impl(_7497_nda)->dims,mosek::fusion::p_NDSparseArray::_get_impl(_7497_nda)->inst,mosek::fusion::p_NDSparseArray::_get_impl(_7497_nda)->cof)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.constTerm

// Begin mosek.fusion.Expr.constTerm
// Method mosek.fusion.Expr.constTerm @ bld/grindsted/final/default/src/fusion/Expr.mbi:1784:6-1803:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::constTerm
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _7498_m) { return mosek::fusion::p_Expr::constTerm(_7498_m); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::constTerm(monty::rc_ptr< ::mosek::fusion::Matrix > _7498_m)
{
  int32_t _7499_dim0 = _7498_m->numRows();
  int32_t _7500_dim1 = _7498_m->numColumns();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7501_shape = ::mosek::fusion::p_Set::make(_7499_dim0,_7500_dim1);
  _checked_ptr_1<int32_t> _ptr__7501_shape(_7501_shape ? _7501_shape->raw() : nullptr,_7501_shape ? _7501_shape->size(0) : 0);
  if (_7498_m->isSparse())
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _7502_mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7498_m->numNonzeros())));
      _checked_ptr_1<double> _ptr__7502_mval(_7502_mval ? _7502_mval->raw() : nullptr,_7502_mval ? _7502_mval->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7503_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7498_m->numNonzeros())));
      _checked_ptr_1<int32_t> _ptr__7503_msubj(_7503_msubj ? _7503_msubj->raw() : nullptr,_7503_msubj ? _7503_msubj->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7504_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7498_m->numNonzeros())));
      _checked_ptr_1<int32_t> _ptr__7504_msubi(_7504_msubi ? _7504_msubi->raw() : nullptr,_7504_msubi ? _7504_msubi->size(0) : 0);
      _7498_m->getDataAsTriplets(_7504_msubi,_7503_msubj,_7502_mval);
      std::vector<int64_t> _12732_;
      for (int32_t _7506_i = (int)0, _12733_ = (int)((_7503_msubj)->size(0)); _7506_i < _12733_ ; ++_7506_i)
      {
        _12732_.push_back(safe_add( safe_mul( _ptr__7504_msubi[_7506_i],_7500_dim1 ),_ptr__7503_msubj[_7506_i] ));
      }
      auto _12734_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_12732_.size()),_12732_.begin(),_12732_.end()));
      std::shared_ptr< monty::ndarray< int64_t,1 > > _7505_sp = _12734_;
      _checked_ptr_1<int64_t> _ptr__7505_sp(_7505_sp ? _7505_sp->raw() : nullptr,_7505_sp ? _7505_sp->size(0) : 0);
      return (::mosek::fusion::p_ExprConst::_new_ExprConst(_7501_shape,_7505_sp,_7502_mval)).as<::mosek::fusion::Expression>();
    }
  }
  else
  {
    {
      return (::mosek::fusion::p_ExprConst::_new_ExprConst(_7501_shape,nullptr,_7498_m->getDataAsArray())).as<::mosek::fusion::Expression>();
    }
  }
}
// End mosek.fusion.Expr.constTerm

// Begin mosek.fusion.Expr.constTerm
// Method mosek.fusion.Expr.constTerm @ bld/grindsted/final/default/src/fusion/Expr.mbi:1779:6-1782:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::constTerm
  ( double _7507_val) { return mosek::fusion::p_Expr::constTerm(_7507_val); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::constTerm(double _7507_val)
{
  return (::mosek::fusion::p_ExprConst::_new_ExprConst(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),nullptr,_7507_val)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.constTerm

// Begin mosek.fusion.Expr.constTerm
// Method mosek.fusion.Expr.constTerm @ bld/grindsted/final/default/src/fusion/Expr.mbi:1768:6-1777:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::constTerm
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _7508_shp,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _7509_sparsity,
    double _7510_val) { return mosek::fusion::p_Expr::constTerm(_7508_shp,_7509_sparsity,_7510_val); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::constTerm(std::shared_ptr< monty::ndarray< int32_t,1 > > _7508_shp,std::shared_ptr< monty::ndarray< int32_t,2 > > _7509_sparsity,double _7510_val)
{
  _checked_ptr_1<int32_t> _ptr__7508_shp(_7508_shp ? _7508_shp->raw() : nullptr, _7508_shp ? _7508_shp->size(0) : 0);
  int32_t _7511_n = (int)((_7509_sparsity)->size(0));
  int32_t _7512_nd = (int)((_7508_shp)->size(0));
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7513_sp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_7511_n)));
  _checked_ptr_1<int64_t> _ptr__7513_sp(_7513_sp ? _7513_sp->raw() : nullptr,_7513_sp ? _7513_sp->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7514_s = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_7512_nd)));
  _checked_ptr_1<int64_t> _ptr__7514_s(_7514_s ? _7514_s->raw() : nullptr,_7514_s ? _7514_s->size(0) : 0);
  _ptr__7514_s[(_7512_nd - (int)1)] = (int)1;
  int32_t _12735_ = (int)1;
  int32_t _12736_ = _7512_nd;
  for (int32_t _7515_i = _12735_; _7515_i < _12736_; ++_7515_i)
  {
    {
      _ptr__7514_s[((_7512_nd - _7515_i) - (int)1)] = safe_mul( _ptr__7514_s[(_7512_nd - _7515_i)],_ptr__7508_shp[(_7512_nd - _7515_i)] );
    }
  }
  int32_t _12737_ = (int)0;
  int32_t _12738_ = _7511_n;
  for (int32_t _7516_i = _12737_; _7516_i < _12738_; ++_7516_i)
  {
    {
      int32_t _12739_ = (int)0;
      int32_t _12740_ = _7512_nd;
      for (int32_t _7517_j = _12739_; _7517_j < _12740_; ++_7517_j)
      {
        {
          _ptr__7513_sp[_7516_i] += safe_mul( _ptr__7514_s[_7517_j],((*_7509_sparsity)(_7516_i,_7517_j)) );
        }
      }
    }
  }
  return (::mosek::fusion::p_ExprConst::_new_ExprConst(_7508_shp,_7513_sp,_7510_val)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.constTerm

// Begin mosek.fusion.Expr.constTerm
// Method mosek.fusion.Expr.constTerm @ bld/grindsted/final/default/src/fusion/Expr.mbi:1757:6-1767:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::constTerm
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _7518_shp,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _7519_sparsity,
    std::shared_ptr< monty::ndarray< double,1 > > _7520_vals1) { return mosek::fusion::p_Expr::constTerm(_7518_shp,_7519_sparsity,_7520_vals1); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::constTerm(std::shared_ptr< monty::ndarray< int32_t,1 > > _7518_shp,std::shared_ptr< monty::ndarray< int32_t,2 > > _7519_sparsity,std::shared_ptr< monty::ndarray< double,1 > > _7520_vals1)
{
  _checked_ptr_1<int32_t> _ptr__7518_shp(_7518_shp ? _7518_shp->raw() : nullptr, _7518_shp ? _7518_shp->size(0) : 0);
  _checked_ptr_1<double> _ptr__7520_vals1(_7520_vals1 ? _7520_vals1->raw() : nullptr, _7520_vals1 ? _7520_vals1->size(0) : 0);
  int32_t _7521_n = (int)((_7519_sparsity)->size(0));
  int32_t _7522_nd = (int)((_7518_shp)->size(0));
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7523_sp = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_7521_n)));
  _checked_ptr_1<int64_t> _ptr__7523_sp(_7523_sp ? _7523_sp->raw() : nullptr,_7523_sp ? _7523_sp->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7524_s = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_7522_nd)));
  _checked_ptr_1<int64_t> _ptr__7524_s(_7524_s ? _7524_s->raw() : nullptr,_7524_s ? _7524_s->size(0) : 0);
  _ptr__7524_s[(_7522_nd - (int)1)] = (int)1;
  int32_t _12741_ = (int)1;
  int32_t _12742_ = _7522_nd;
  for (int32_t _7525_i = _12741_; _7525_i < _12742_; ++_7525_i)
  {
    {
      _ptr__7524_s[((_7522_nd - _7525_i) - (int)1)] = safe_mul( _ptr__7524_s[(_7522_nd - _7525_i)],_ptr__7518_shp[(_7522_nd - _7525_i)] );
    }
  }
  int32_t _12743_ = (int)0;
  int32_t _12744_ = _7521_n;
  for (int32_t _7526_i = _12743_; _7526_i < _12744_; ++_7526_i)
  {
    {
      int32_t _12745_ = (int)0;
      int32_t _12746_ = _7522_nd;
      for (int32_t _7527_j = _12745_; _7527_j < _12746_; ++_7527_j)
      {
        {
          _ptr__7523_sp[_7526_i] += safe_mul( _ptr__7524_s[_7527_j],((*_7519_sparsity)(_7526_i,_7527_j)) );
        }
      }
    }
  }
  return (::mosek::fusion::p_ExprConst::_new_ExprConst(_7518_shp,_7523_sp,_7520_vals1)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.constTerm

// Begin mosek.fusion.Expr.constTerm
// Method mosek.fusion.Expr.constTerm @ bld/grindsted/final/default/src/fusion/Expr.mbi:1752:6-1755:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::constTerm
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _7528_shp,
    double _7529_val) { return mosek::fusion::p_Expr::constTerm(_7528_shp,_7529_val); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::constTerm(std::shared_ptr< monty::ndarray< int32_t,1 > > _7528_shp,double _7529_val)
{
  _checked_ptr_1<int32_t> _ptr__7528_shp(_7528_shp ? _7528_shp->raw() : nullptr, _7528_shp ? _7528_shp->size(0) : 0);
  return (::mosek::fusion::p_ExprConst::_new_ExprConst(_7528_shp,nullptr,_7529_val)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.constTerm

// Begin mosek.fusion.Expr.constTerm
// Method mosek.fusion.Expr.constTerm @ bld/grindsted/final/default/src/fusion/Expr.mbi:1748:6-1750:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::constTerm
  ( int32_t _7530_size,
    double _7531_val) { return mosek::fusion::p_Expr::constTerm(_7530_size,_7531_val); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::constTerm(int32_t _7530_size,double _7531_val)
{
  std::vector<double> _12747_;
  for (int32_t _7532_i = (int)0, _12748_ = _7530_size; _7532_i < _12748_ ; ++_7532_i)
  {
    _12747_.push_back(_7531_val);
  }
  auto _12749_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_12747_.size()),_12747_.begin(),_12747_.end()));
  return (::mosek::fusion::p_ExprConst::_new_ExprConst(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7530_size)}),nullptr,_12749_)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.constTerm

// Begin mosek.fusion.Expr.constTerm
// Method mosek.fusion.Expr.constTerm @ bld/grindsted/final/default/src/fusion/Expr.mbi:1741:6-1743:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::constTerm
  ( std::shared_ptr< monty::ndarray< double,2 > > _7533_vals2) { return mosek::fusion::p_Expr::constTerm(_7533_vals2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::constTerm(std::shared_ptr< monty::ndarray< double,2 > > _7533_vals2)
{
  std::vector<double> _12750_;
  for (int32_t _7534_i = (int)0, _12751_ = (int)((_7533_vals2)->size(0)); _7534_i < _12751_ ; ++_7534_i)
  {
    for (int32_t _7535_j = (int)0, _12752_ = (int)((_7533_vals2)->size(1)); _7535_j < _12752_ ; ++_7535_j)
    {
      _12750_.push_back(((*_7533_vals2)(_7534_i,_7535_j)));
    }
  }
  auto _12753_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_12750_.size()),_12750_.begin(),_12750_.end()));
  return (::mosek::fusion::p_ExprConst::_new_ExprConst(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_7533_vals2)->size(0))),(int32_t)((int)((_7533_vals2)->size(1)))}),nullptr,_12753_)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.constTerm

// Begin mosek.fusion.Expr.constTerm
// Method mosek.fusion.Expr.constTerm @ bld/grindsted/final/default/src/fusion/Expr.mbi:1734:6-1736:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::constTerm
  ( std::shared_ptr< monty::ndarray< double,1 > > _7536_vals1) { return mosek::fusion::p_Expr::constTerm(_7536_vals1); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::constTerm(std::shared_ptr< monty::ndarray< double,1 > > _7536_vals1)
{
  _checked_ptr_1<double> _ptr__7536_vals1(_7536_vals1 ? _7536_vals1->raw() : nullptr, _7536_vals1 ? _7536_vals1->size(0) : 0);
  return (::mosek::fusion::p_ExprConst::_new_ExprConst(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)((_7536_vals1)->size(0)))}),nullptr,_7536_vals1)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.constTerm

// Begin mosek.fusion.Expr.sum
// Method mosek.fusion.Expr.sum @ bld/grindsted/final/default/src/fusion/Expr.mbi:1699:6-1721:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sum
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7537_expr,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _7538_dims) { return mosek::fusion::p_Expr::sum(_7537_expr,_7538_dims); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sum(monty::rc_ptr< ::mosek::fusion::Expression > _7537_expr,std::shared_ptr< monty::ndarray< int32_t,1 > > _7538_dims)
{
  _checked_ptr_1<int32_t> _ptr__7538_dims(_7538_dims ? _7538_dims->raw() : nullptr, _7538_dims ? _7538_dims->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7539_eshape = _7537_expr->getShape();
  _checked_ptr_1<int32_t> _ptr__7539_eshape(_7539_eshape ? _7539_eshape->raw() : nullptr,_7539_eshape ? _7539_eshape->size(0) : 0);
  if ((((int)((_7538_dims)->size(0)) == (int)0) || (_ptr__7538_dims[(int)0] < (int)0)))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid index dimension"));
    }
  }
  {}
  int32_t _12754_ = (int)1;
  int32_t _12755_ = (int)((_7538_dims)->size(0));
  for (int32_t _7540_i = _12754_; _7540_i < _12755_; ++_7540_i)
  {
    {
      if ((_ptr__7538_dims[(_7540_i - (int)1)] >= _ptr__7538_dims[_7540_i]))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Unordered dimension indexes"));
        }
      }
      {}
    }
  }
  if ((_ptr__7538_dims[((int)((_7538_dims)->size(0)) - (int)1)] >= (int)((_7539_eshape)->size(0))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Unordered dimension indexes"));
    }
  }
  {}
  int32_t _7541_nd = (int)((_7539_eshape)->size(0));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7542_perm = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7541_nd)));
  _checked_ptr_1<int32_t> _ptr__7542_perm(_7542_perm ? _7542_perm->raw() : nullptr,_7542_perm ? _7542_perm->size(0) : 0);
  int32_t _7543_i = (int)0;
  int32_t _7544_j = (int)0;
  int32_t _12756_ = (int)0;
  int32_t _12757_ = (int)((_7538_dims)->size(0));
  for (int32_t _7545_k = _12756_; _7545_k < _12757_; ++_7545_k)
  {
    {
      {
        for(;(_7543_i < _ptr__7538_dims[_7545_k]);++ _7543_i,++ _7544_j)
        {
          {
            _ptr__7542_perm[_7544_j] = _7543_i;
          }
        }
      }
      ++ _7543_i;
    }
  }
  {
    for(;(_7543_i < _7541_nd);++ _7543_i,++ _7544_j)
    {
      {
        _ptr__7542_perm[_7544_j] = _7543_i;
      }
    }
  }
  int32_t _12758_ = (int)0;
  int32_t _12759_ = (int)((_7538_dims)->size(0));
  for (int32_t _7546_k = _12758_; _7546_k < _12759_; ++_7546_k)
  {
    {
      _ptr__7542_perm[_7544_j] = _ptr__7538_dims[_7546_k];
      ++ _7544_j;
    }
  }
  return (::mosek::fusion::p_ExprSumReduceEnd::_new_ExprSumReduceEnd((int)((_7538_dims)->size(0)),(::mosek::fusion::p_ExprPermuteDims::_new_ExprPermuteDims(_7542_perm,_7537_expr)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.sum

// Begin mosek.fusion.Expr.sum
// Method mosek.fusion.Expr.sum @ bld/grindsted/final/default/src/fusion/Expr.mbi:1697:6-110
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sum
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7547_expr,
    int32_t _7548_dim) { return mosek::fusion::p_Expr::sum(_7547_expr,_7548_dim); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sum(monty::rc_ptr< ::mosek::fusion::Expression > _7547_expr,int32_t _7548_dim)
{
  return (::mosek::fusion::p_ExprSumReduce::_new_ExprSumReduce(_7548_dim,_7547_expr)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.sum

// Begin mosek.fusion.Expr.sum
// Method mosek.fusion.Expr.sum @ bld/grindsted/final/default/src/fusion/Expr.mbi:1696:6-117
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sum
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7549_expr) { return mosek::fusion::p_Expr::sum(_7549_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sum(monty::rc_ptr< ::mosek::fusion::Expression > _7549_expr)
{
  return (::mosek::fusion::p_ExprSumReduce::_new_ExprSumReduce((int)0,::mosek::fusion::p_Expr::flatten(_7549_expr))).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.sum

// Begin mosek.fusion.Expr.neg
// Method mosek.fusion.Expr.neg @ bld/grindsted/final/default/src/fusion/Expr.mbi:1695:6-98
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::neg
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7550_e) { return mosek::fusion::p_Expr::neg(_7550_e); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::neg(monty::rc_ptr< ::mosek::fusion::Expression > _7550_e)
{
  return (::mosek::fusion::p_ExprMulScalarConst::_new_ExprMulScalarConst((double)((-(int)1)),_7550_e)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.neg

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1680:6-1693:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(bool _7551_left,monty::rc_ptr< ::mosek::fusion::Matrix > _7552_mx,monty::rc_ptr< ::mosek::fusion::Expression > _7553_expr)
{
  int64_t _7554_nnz = _7552_mx->numNonzeros();
  int32_t _7555_dimi = _7552_mx->numRows();
  int32_t _7556_dimj = _7552_mx->numColumns();
  std::shared_ptr< monty::ndarray< double,1 > > _7557_mcof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7554_nnz)));
  _checked_ptr_1<double> _ptr__7557_mcof(_7557_mcof ? _7557_mcof->raw() : nullptr,_7557_mcof ? _7557_mcof->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7558_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7554_nnz)));
  _checked_ptr_1<int32_t> _ptr__7558_msubj(_7558_msubj ? _7558_msubj->raw() : nullptr,_7558_msubj ? _7558_msubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7559_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7554_nnz)));
  _checked_ptr_1<int32_t> _ptr__7559_msubi(_7559_msubi ? _7559_msubi->raw() : nullptr,_7559_msubi ? _7559_msubi->size(0) : 0);
  _7552_mx->getDataAsTriplets(_7559_msubi,_7558_msubj,_7557_mcof);
  if (_7551_left)
  {
    {
      return (::mosek::fusion::p_ExprMulDiagLeft::_new_ExprMulDiagLeft(_7555_dimi,_7556_dimj,_7559_msubi,_7558_msubj,_7557_mcof,_7553_expr)).as<::mosek::fusion::Expression>();
    }
  }
  else
  {
    {
      return (::mosek::fusion::p_ExprMulDiagRight::_new_ExprMulDiagRight(_7555_dimi,_7556_dimj,_7559_msubi,_7558_msubj,_7557_mcof,_7553_expr)).as<::mosek::fusion::Expression>();
    }
  }
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1677:6-140
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulDiag
  ( monty::rc_ptr< ::mosek::fusion::Variable > _7560_v,
    monty::rc_ptr< ::mosek::fusion::Parameter > _7561_p) { return mosek::fusion::p_Expr::mulDiag(_7560_v,_7561_p); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(monty::rc_ptr< ::mosek::fusion::Variable > _7560_v,monty::rc_ptr< ::mosek::fusion::Parameter > _7561_p)
{
  return (::mosek::fusion::p_ExprMulParamDiagRight::_new_ExprMulParamDiagRight(_7560_v->__mosek_2fusion_2Variable__asExpr(),_7561_p)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1676:6-139
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulDiag
  ( monty::rc_ptr< ::mosek::fusion::Parameter > _7562_p,
    monty::rc_ptr< ::mosek::fusion::Variable > _7563_v) { return mosek::fusion::p_Expr::mulDiag(_7562_p,_7563_v); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(monty::rc_ptr< ::mosek::fusion::Parameter > _7562_p,monty::rc_ptr< ::mosek::fusion::Variable > _7563_v)
{
  return (::mosek::fusion::p_ExprMulParamDiagLeft::_new_ExprMulParamDiagLeft(_7562_p,_7563_v->__mosek_2fusion_2Variable__asExpr())).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1675:6-134
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulDiag
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7564_expr,
    monty::rc_ptr< ::mosek::fusion::Parameter > _7565_p) { return mosek::fusion::p_Expr::mulDiag(_7564_expr,_7565_p); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(monty::rc_ptr< ::mosek::fusion::Expression > _7564_expr,monty::rc_ptr< ::mosek::fusion::Parameter > _7565_p)
{
  return (::mosek::fusion::p_ExprMulParamDiagRight::_new_ExprMulParamDiagRight(_7564_expr,_7565_p)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1674:6-133
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulDiag
  ( monty::rc_ptr< ::mosek::fusion::Parameter > _7566_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _7567_expr) { return mosek::fusion::p_Expr::mulDiag(_7566_p,_7567_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(monty::rc_ptr< ::mosek::fusion::Parameter > _7566_p,monty::rc_ptr< ::mosek::fusion::Expression > _7567_expr)
{
  return (::mosek::fusion::p_ExprMulParamDiagLeft::_new_ExprMulParamDiagLeft(_7566_p,_7567_expr)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1672:6-129
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulDiag
  ( monty::rc_ptr< ::mosek::fusion::Variable > _7568_v,
    monty::rc_ptr< ::mosek::fusion::Matrix > _7569_mx) { return mosek::fusion::p_Expr::mulDiag(_7568_v,_7569_mx); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(monty::rc_ptr< ::mosek::fusion::Variable > _7568_v,monty::rc_ptr< ::mosek::fusion::Matrix > _7569_mx)
{
  return ::mosek::fusion::p_Expr::mulDiag(false,_7569_mx,_7568_v->__mosek_2fusion_2Variable__asExpr());
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1671:6-128
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulDiag
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _7570_mx,
    monty::rc_ptr< ::mosek::fusion::Variable > _7571_v) { return mosek::fusion::p_Expr::mulDiag(_7570_mx,_7571_v); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(monty::rc_ptr< ::mosek::fusion::Matrix > _7570_mx,monty::rc_ptr< ::mosek::fusion::Variable > _7571_v)
{
  return ::mosek::fusion::p_Expr::mulDiag(true,_7570_mx,_7571_v->__mosek_2fusion_2Variable__asExpr());
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1670:6-123
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulDiag
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7572_expr,
    monty::rc_ptr< ::mosek::fusion::Matrix > _7573_mx) { return mosek::fusion::p_Expr::mulDiag(_7572_expr,_7573_mx); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(monty::rc_ptr< ::mosek::fusion::Expression > _7572_expr,monty::rc_ptr< ::mosek::fusion::Matrix > _7573_mx)
{
  return ::mosek::fusion::p_Expr::mulDiag(false,_7573_mx,_7572_expr);
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1669:6-122
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulDiag
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _7574_mx,
    monty::rc_ptr< ::mosek::fusion::Expression > _7575_expr) { return mosek::fusion::p_Expr::mulDiag(_7574_mx,_7575_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(monty::rc_ptr< ::mosek::fusion::Matrix > _7574_mx,monty::rc_ptr< ::mosek::fusion::Expression > _7575_expr)
{
  return ::mosek::fusion::p_Expr::mulDiag(true,_7574_mx,_7575_expr);
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1668:6-306
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulDiag
  ( monty::rc_ptr< ::mosek::fusion::Variable > _7576_v,
    std::shared_ptr< monty::ndarray< double,2 > > _7577_a) { return mosek::fusion::p_Expr::mulDiag(_7576_v,_7577_a); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(monty::rc_ptr< ::mosek::fusion::Variable > _7576_v,std::shared_ptr< monty::ndarray< double,2 > > _7577_a)
{
  std::vector<int32_t> _12760_;
  for (int32_t _7578_i = (int)0, _12761_ = (int)((_7577_a)->size(0)); _7578_i < _12761_ ; ++_7578_i)
  {
    for (int32_t _7579_j = (int)0, _12762_ = (int)((_7577_a)->size(1)); _7579_j < _12762_ ; ++_7579_j)
    {
      _12760_.push_back(_7578_i);
    }
  }
  auto _12763_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12760_.size()),_12760_.begin(),_12760_.end()));
  std::vector<int32_t> _12764_;
  for (int32_t _7580_i = (int)0, _12765_ = (int)((_7577_a)->size(0)); _7580_i < _12765_ ; ++_7580_i)
  {
    for (int32_t _7581_j = (int)0, _12766_ = (int)((_7577_a)->size(1)); _7581_j < _12766_ ; ++_7581_j)
    {
      _12764_.push_back(_7581_j);
    }
  }
  auto _12767_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12764_.size()),_12764_.begin(),_12764_.end()));
  std::vector<double> _12768_;
  for (int32_t _7582_i = (int)0, _12769_ = (int)((_7577_a)->size(0)); _7582_i < _12769_ ; ++_7582_i)
  {
    for (int32_t _7583_j = (int)0, _12770_ = (int)((_7577_a)->size(1)); _7583_j < _12770_ ; ++_7583_j)
    {
      _12768_.push_back(((*_7577_a)(_7582_i,_7583_j)));
    }
  }
  auto _12771_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_12768_.size()),_12768_.begin(),_12768_.end()));
  return (::mosek::fusion::p_ExprMulDiagRight::_new_ExprMulDiagRight((int)((_7577_a)->size(0)),(int)((_7577_a)->size(1)),_12763_,_12767_,_12771_,_7576_v->__mosek_2fusion_2Variable__asExpr())).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1667:6-300
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulDiag
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7584_expr,
    std::shared_ptr< monty::ndarray< double,2 > > _7585_a) { return mosek::fusion::p_Expr::mulDiag(_7584_expr,_7585_a); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(monty::rc_ptr< ::mosek::fusion::Expression > _7584_expr,std::shared_ptr< monty::ndarray< double,2 > > _7585_a)
{
  std::vector<int32_t> _12772_;
  for (int32_t _7586_i = (int)0, _12773_ = (int)((_7585_a)->size(0)); _7586_i < _12773_ ; ++_7586_i)
  {
    for (int32_t _7587_j = (int)0, _12774_ = (int)((_7585_a)->size(1)); _7587_j < _12774_ ; ++_7587_j)
    {
      _12772_.push_back(_7586_i);
    }
  }
  auto _12775_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12772_.size()),_12772_.begin(),_12772_.end()));
  std::vector<int32_t> _12776_;
  for (int32_t _7588_i = (int)0, _12777_ = (int)((_7585_a)->size(0)); _7588_i < _12777_ ; ++_7588_i)
  {
    for (int32_t _7589_j = (int)0, _12778_ = (int)((_7585_a)->size(1)); _7589_j < _12778_ ; ++_7589_j)
    {
      _12776_.push_back(_7589_j);
    }
  }
  auto _12779_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12776_.size()),_12776_.begin(),_12776_.end()));
  std::vector<double> _12780_;
  for (int32_t _7590_i = (int)0, _12781_ = (int)((_7585_a)->size(0)); _7590_i < _12781_ ; ++_7590_i)
  {
    for (int32_t _7591_j = (int)0, _12782_ = (int)((_7585_a)->size(1)); _7591_j < _12782_ ; ++_7591_j)
    {
      _12780_.push_back(((*_7585_a)(_7590_i,_7591_j)));
    }
  }
  auto _12783_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_12780_.size()),_12780_.begin(),_12780_.end()));
  return (::mosek::fusion::p_ExprMulDiagRight::_new_ExprMulDiagRight((int)((_7585_a)->size(0)),(int)((_7585_a)->size(1)),_12775_,_12779_,_12783_,_7584_expr)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1666:6-306
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulDiag
  ( std::shared_ptr< monty::ndarray< double,2 > > _7592_a,
    monty::rc_ptr< ::mosek::fusion::Variable > _7593_v) { return mosek::fusion::p_Expr::mulDiag(_7592_a,_7593_v); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(std::shared_ptr< monty::ndarray< double,2 > > _7592_a,monty::rc_ptr< ::mosek::fusion::Variable > _7593_v)
{
  std::vector<int32_t> _12784_;
  for (int32_t _7594_i = (int)0, _12785_ = (int)((_7592_a)->size(0)); _7594_i < _12785_ ; ++_7594_i)
  {
    for (int32_t _7595_j = (int)0, _12786_ = (int)((_7592_a)->size(1)); _7595_j < _12786_ ; ++_7595_j)
    {
      _12784_.push_back(_7594_i);
    }
  }
  auto _12787_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12784_.size()),_12784_.begin(),_12784_.end()));
  std::vector<int32_t> _12788_;
  for (int32_t _7596_i = (int)0, _12789_ = (int)((_7592_a)->size(0)); _7596_i < _12789_ ; ++_7596_i)
  {
    for (int32_t _7597_j = (int)0, _12790_ = (int)((_7592_a)->size(1)); _7597_j < _12790_ ; ++_7597_j)
    {
      _12788_.push_back(_7597_j);
    }
  }
  auto _12791_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12788_.size()),_12788_.begin(),_12788_.end()));
  std::vector<double> _12792_;
  for (int32_t _7598_i = (int)0, _12793_ = (int)((_7592_a)->size(0)); _7598_i < _12793_ ; ++_7598_i)
  {
    for (int32_t _7599_j = (int)0, _12794_ = (int)((_7592_a)->size(1)); _7599_j < _12794_ ; ++_7599_j)
    {
      _12792_.push_back(((*_7592_a)(_7598_i,_7599_j)));
    }
  }
  auto _12795_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_12792_.size()),_12792_.begin(),_12792_.end()));
  return (::mosek::fusion::p_ExprMulDiagLeft::_new_ExprMulDiagLeft((int)((_7592_a)->size(0)),(int)((_7592_a)->size(1)),_12787_,_12791_,_12795_,_7593_v->__mosek_2fusion_2Variable__asExpr())).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulDiag
// Method mosek.fusion.Expr.mulDiag @ bld/grindsted/final/default/src/fusion/Expr.mbi:1665:6-300
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulDiag
  ( std::shared_ptr< monty::ndarray< double,2 > > _7600_a,
    monty::rc_ptr< ::mosek::fusion::Expression > _7601_expr) { return mosek::fusion::p_Expr::mulDiag(_7600_a,_7601_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulDiag(std::shared_ptr< monty::ndarray< double,2 > > _7600_a,monty::rc_ptr< ::mosek::fusion::Expression > _7601_expr)
{
  std::vector<int32_t> _12796_;
  for (int32_t _7602_i = (int)0, _12797_ = (int)((_7600_a)->size(0)); _7602_i < _12797_ ; ++_7602_i)
  {
    for (int32_t _7603_j = (int)0, _12798_ = (int)((_7600_a)->size(1)); _7603_j < _12798_ ; ++_7603_j)
    {
      _12796_.push_back(_7602_i);
    }
  }
  auto _12799_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12796_.size()),_12796_.begin(),_12796_.end()));
  std::vector<int32_t> _12800_;
  for (int32_t _7604_i = (int)0, _12801_ = (int)((_7600_a)->size(0)); _7604_i < _12801_ ; ++_7604_i)
  {
    for (int32_t _7605_j = (int)0, _12802_ = (int)((_7600_a)->size(1)); _7605_j < _12802_ ; ++_7605_j)
    {
      _12800_.push_back(_7605_j);
    }
  }
  auto _12803_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12800_.size()),_12800_.begin(),_12800_.end()));
  std::vector<double> _12804_;
  for (int32_t _7606_i = (int)0, _12805_ = (int)((_7600_a)->size(0)); _7606_i < _12805_ ; ++_7606_i)
  {
    for (int32_t _7607_j = (int)0, _12806_ = (int)((_7600_a)->size(1)); _7607_j < _12806_ ; ++_7607_j)
    {
      _12804_.push_back(((*_7600_a)(_7606_i,_7607_j)));
    }
  }
  auto _12807_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_12804_.size()),_12804_.begin(),_12804_.end()));
  return (::mosek::fusion::p_ExprMulDiagLeft::_new_ExprMulDiagLeft((int)((_7600_a)->size(0)),(int)((_7600_a)->size(1)),_12799_,_12803_,_12807_,_7601_expr)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mulDiag

// Begin mosek.fusion.Expr.mulElm_
// Method mosek.fusion.Expr.mulElm_ @ bld/grindsted/final/default/src/fusion/Expr.mbi:1642:6-1663:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm_(monty::rc_ptr< ::mosek::fusion::Matrix > _7608_m,monty::rc_ptr< ::mosek::fusion::Expression > _7609_e)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7610_eshape = _7609_e->getShape();
  _checked_ptr_1<int32_t> _ptr__7610_eshape(_7610_eshape ? _7610_eshape->raw() : nullptr,_7610_eshape ? _7610_eshape->size(0) : 0);
  monty::rc_ptr< ::mosek::fusion::Expression > _7611_expr = _7609_e;
  if (((int)((_7610_eshape)->size(0)) == (int)1))
  {
    {
      _7610_eshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_ptr__7610_eshape[(int)0]),(int32_t)((int)1)});
      _ptr__7610_eshape.update(_7610_eshape ? _7610_eshape->raw() : nullptr, _7610_eshape ? _7610_eshape->size(0) : 0);
      _7611_expr = (::mosek::fusion::p_ExprReshape::_new_ExprReshape(_7610_eshape,_7609_e)).as<::mosek::fusion::Expression>();
    }
  }
  {}
  if ((((int)((_7610_eshape)->size(0)) != (int)2) || ((_7608_m->numRows() != _ptr__7610_eshape[(int)0]) || (_7608_m->numColumns() != _ptr__7610_eshape[(int)1]))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Dimensions of operands do not match"));
    }
  }
  {}
  int32_t _7612_mdim1 = _7608_m->numColumns();
  int64_t _7613_mnnz = _7608_m->numNonzeros();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7614_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7613_mnnz)));
  _checked_ptr_1<int32_t> _ptr__7614_msubi(_7614_msubi ? _7614_msubi->raw() : nullptr,_7614_msubi ? _7614_msubi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7615_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7613_mnnz)));
  _checked_ptr_1<int32_t> _ptr__7615_msubj(_7615_msubj ? _7615_msubj->raw() : nullptr,_7615_msubj ? _7615_msubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7616_mcof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7613_mnnz)));
  _checked_ptr_1<double> _ptr__7616_mcof(_7616_mcof ? _7616_mcof->raw() : nullptr,_7616_mcof ? _7616_mcof->size(0) : 0);
  _7608_m->getDataAsTriplets(_7614_msubi,_7615_msubj,_7616_mcof);
  std::vector<int64_t> _12808_;
  for (int64_t _7617_i = (int)0, _12809_ = _7613_mnnz; _7617_i < _12809_ ; ++_7617_i)
  {
    _12808_.push_back(safe_add( safe_mul( _ptr__7614_msubi[_7617_i],_7612_mdim1 ),_ptr__7615_msubj[_7617_i] ));
  }
  auto _12810_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_12808_.size()),_12808_.begin(),_12808_.end()));
  return (::mosek::fusion::p_ExprMulElement::_new_ExprMulElement(_7616_mcof,_12810_,_7611_expr,(int)1)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mulElm_

// Begin mosek.fusion.Expr.mulElm_
// Method mosek.fusion.Expr.mulElm_ @ bld/grindsted/final/default/src/fusion/Expr.mbi:1628:6-1639:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm_(std::shared_ptr< monty::ndarray< double,1 > > _7618_a,monty::rc_ptr< ::mosek::fusion::Expression > _7619_expr)
{
  _checked_ptr_1<double> _ptr__7618_a(_7618_a ? _7618_a->raw() : nullptr, _7618_a ? _7618_a->size(0) : 0);
  if (((NULL == _7618_a.get()) || (NULL == _7619_expr.get())))
  {
    {
      throw monty::NullPointerException(std::string ("Arguments for mulElm may not be null"));
    }
  }
  {}
  if (((_7619_expr->getND() == (int)0) && ((int)((_7618_a)->size(0)) == (int)1)))
  {
    {
      return (::mosek::fusion::p_ExprMulScalarConst::_new_ExprMulScalarConst(_ptr__7618_a[(int)0],_7619_expr)).as<::mosek::fusion::Expression>();
    }
  }
  else if(((_7619_expr->getND() != (int)1) || (_7619_expr->getDim((int)0) != (int)((_7618_a)->size(0)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Dimensions of operands do not match"));
    }
  }
  else
  {
    {
      std::vector<int64_t> _12811_;
      for (int32_t _7620_i = (int)0, _12812_ = (int)((_7618_a)->size(0)); _7620_i < _12812_ ; ++_7620_i)
      {
        _12811_.push_back(_7620_i);
      }
      auto _12813_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_12811_.size()),_12811_.begin(),_12811_.end()));
      return (::mosek::fusion::p_ExprMulElement::_new_ExprMulElement(_7618_a,_12813_,_7619_expr)).as<::mosek::fusion::Expression>();
    }
  }
}
// End mosek.fusion.Expr.mulElm_

// Begin mosek.fusion.Expr.mulElm_
// Method mosek.fusion.Expr.mulElm_ @ bld/grindsted/final/default/src/fusion/Expr.mbi:1616:6-1626:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm_(monty::rc_ptr< ::mosek::fusion::NDSparseArray > _7621_spm,monty::rc_ptr< ::mosek::fusion::Expression > _7622_expr)
{
  if (((NULL == _7621_spm.get()) || (NULL == _7622_expr.get())))
  {
    {
      throw monty::NullPointerException(std::string ("Arguments for mulElm may not be null"));
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7623_eshape = _7622_expr->getShape();
  _checked_ptr_1<int32_t> _ptr__7623_eshape(_7623_eshape ? _7623_eshape->raw() : nullptr,_7623_eshape ? _7623_eshape->size(0) : 0);
  if (((int)((_7623_eshape)->size(0)) != (int)((mosek::fusion::p_NDSparseArray::_get_impl(_7621_spm)->dims)->size(0))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Dimension mismatch"));
    }
  }
  {}
  int32_t _12814_ = (int)0;
  int32_t _12815_ = (int)((mosek::fusion::p_NDSparseArray::_get_impl(_7621_spm)->dims)->size(0));
  for (int32_t _7624_i = _12814_; _7624_i < _12815_; ++_7624_i)
  {
    {
      if ((((*mosek::fusion::p_NDSparseArray::_get_impl(_7621_spm)->dims)(_7624_i)) != _ptr__7623_eshape[_7624_i]))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Dimensions of operands do not match"));
        }
      }
      {}
    }
  }
  return (::mosek::fusion::p_ExprMulElement::_new_ExprMulElement(mosek::fusion::p_NDSparseArray::_get_impl(_7621_spm)->cof,mosek::fusion::p_NDSparseArray::_get_impl(_7621_spm)->inst,_7622_expr)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mulElm_

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1614:6-118
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7625_expr,
    double _7626_c) { return mosek::fusion::p_Expr::mul(_7625_expr,_7626_c); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(monty::rc_ptr< ::mosek::fusion::Expression > _7625_expr,double _7626_c)
{
  return (::mosek::fusion::p_ExprMulScalarConst::_new_ExprMulScalarConst(_7626_c,_7625_expr)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1613:6-121
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( double _7627_c,
    monty::rc_ptr< ::mosek::fusion::Expression > _7628_expr) { return mosek::fusion::p_Expr::mul(_7627_c,_7628_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(double _7627_c,monty::rc_ptr< ::mosek::fusion::Expression > _7628_expr)
{
  return (::mosek::fusion::p_ExprMulScalarConst::_new_ExprMulScalarConst(_7627_c,_7628_expr)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1612:6-105
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7629_expr,
    std::shared_ptr< monty::ndarray< double,1 > > _7630_a) { return mosek::fusion::p_Expr::mul(_7629_expr,_7630_a); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(monty::rc_ptr< ::mosek::fusion::Expression > _7629_expr,std::shared_ptr< monty::ndarray< double,1 > > _7630_a)
{
  _checked_ptr_1<double> _ptr__7630_a(_7630_a ? _7630_a->raw() : nullptr, _7630_a ? _7630_a->size(0) : 0);
  return ::mosek::fusion::p_Expr::mul(false,_7630_a,_7629_expr);
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1611:6-107
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( std::shared_ptr< monty::ndarray< double,1 > > _7631_a,
    monty::rc_ptr< ::mosek::fusion::Expression > _7632_expr) { return mosek::fusion::p_Expr::mul(_7631_a,_7632_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(std::shared_ptr< monty::ndarray< double,1 > > _7631_a,monty::rc_ptr< ::mosek::fusion::Expression > _7632_expr)
{
  _checked_ptr_1<double> _ptr__7631_a(_7631_a ? _7631_a->raw() : nullptr, _7631_a ? _7631_a->size(0) : 0);
  return ::mosek::fusion::p_Expr::mul(true,_7631_a,_7632_expr);
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1610:6-105
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7633_expr,
    std::shared_ptr< monty::ndarray< double,2 > > _7634_a) { return mosek::fusion::p_Expr::mul(_7633_expr,_7634_a); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(monty::rc_ptr< ::mosek::fusion::Expression > _7633_expr,std::shared_ptr< monty::ndarray< double,2 > > _7634_a)
{
  return ::mosek::fusion::p_Expr::mul(false,_7634_a,_7633_expr);
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1609:6-107
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( std::shared_ptr< monty::ndarray< double,2 > > _7635_a,
    monty::rc_ptr< ::mosek::fusion::Expression > _7636_expr) { return mosek::fusion::p_Expr::mul(_7635_a,_7636_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(std::shared_ptr< monty::ndarray< double,2 > > _7635_a,monty::rc_ptr< ::mosek::fusion::Expression > _7636_expr)
{
  return ::mosek::fusion::p_Expr::mul(true,_7635_a,_7636_expr);
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1608:6-106
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7637_expr,
    monty::rc_ptr< ::mosek::fusion::Matrix > _7638_mx) { return mosek::fusion::p_Expr::mul(_7637_expr,_7638_mx); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(monty::rc_ptr< ::mosek::fusion::Expression > _7637_expr,monty::rc_ptr< ::mosek::fusion::Matrix > _7638_mx)
{
  return ::mosek::fusion::p_Expr::mul(false,_7638_mx,_7637_expr);
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1607:6-108
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _7639_mx,
    monty::rc_ptr< ::mosek::fusion::Expression > _7640_expr) { return mosek::fusion::p_Expr::mul(_7639_mx,_7640_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(monty::rc_ptr< ::mosek::fusion::Matrix > _7639_mx,monty::rc_ptr< ::mosek::fusion::Expression > _7640_expr)
{
  return ::mosek::fusion::p_Expr::mul(true,_7639_mx,_7640_expr);
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1576:6-1605:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(bool _7641_left,std::shared_ptr< monty::ndarray< double,1 > > _7642_mx,monty::rc_ptr< ::mosek::fusion::Expression > _7643_e)
{
  _checked_ptr_1<double> _ptr__7642_mx(_7642_mx ? _7642_mx->raw() : nullptr, _7642_mx ? _7642_mx->size(0) : 0);
  int32_t _7644_mdim0 = (int)((_7642_mx)->size(0));
  int32_t _7645_nnz = _7644_mdim0;
  std::shared_ptr< monty::ndarray< double,1 > > _7646_mval = ::mosek::fusion::Utils::Tools::arraycopy(_7642_mx);
  _checked_ptr_1<double> _ptr__7646_mval(_7646_mval ? _7646_mval->raw() : nullptr,_7646_mval ? _7646_mval->size(0) : 0);
  int32_t _7647_nd = _7643_e->getND();
  if ((_7647_nd == (int)0))
  {
    {
      std::vector<int32_t> _12816_;
      for (int32_t _7648_i = (int)0, _12817_ = _7644_mdim0; _7648_i < _12817_ ; ++_7648_i)
      {
        _12816_.push_back(_7648_i);
      }
      auto _12818_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12816_.size()),_12816_.begin(),_12816_.end()));
      std::vector<int32_t> _12819_;
      for (int32_t _7649_i = (int)0, _12820_ = _7644_mdim0; _7649_i < _12820_ ; ++_7649_i)
      {
        _12819_.push_back((int)0);
      }
      auto _12821_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12819_.size()),_12819_.begin(),_12819_.end()));
      return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7644_mdim0)}),(::mosek::fusion::p_ExprScalarMul::_new_ExprScalarMul(_7644_mdim0,(int)1,_12818_,_12821_,_7646_mval,_7643_e,(int)1)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
    }
  }
  else if((_7647_nd != (int)2))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions"));
    }
  }
  else if((_7641_left && (_7643_e->getDim((int)0) == (int)((_7642_mx)->size(0)))))
  {
    {
      return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7643_e->getDim((int)1))}),(::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7644_mdim0,(int)1,_7646_mval,_7643_e)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
    }
  }
  else if((_7641_left && (_7643_e->getDim((int)0) == (int)1)))
  {
    {
      return (::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7644_mdim0,(int)1,_7646_mval,_7643_e)).as<::mosek::fusion::Expression>();
    }
  }
  else if(((!_7641_left) && (_7643_e->getDim((int)1) == _7644_mdim0)))
  {
    {
      return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7643_e->getDim((int)0))}),(::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot((int)1,_7644_mdim0,_7646_mval,_7643_e)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
    }
  }
  else if(((!_7641_left) && (_7643_e->getDim((int)1) == (int)1)))
  {
    {
      return (::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7644_mdim0,(int)1,_7646_mval,(::mosek::fusion::p_ExprTranspose::_new_ExprTranspose(_7643_e)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
    }
  }
  else
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
    }
  }
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1516:6-1574:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(bool _7650_left,std::shared_ptr< monty::ndarray< double,2 > > _7651_mx,monty::rc_ptr< ::mosek::fusion::Expression > _7652_e)
{
  int32_t _7653_mdim0 = (int)((_7651_mx)->size(0));
  int32_t _7654_mdim1 = (int)((_7651_mx)->size(1));
  int32_t _7655_nnz = safe_mul( _7653_mdim0,_7654_mdim1 );
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7656_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7655_nnz)));
  _checked_ptr_1<int32_t> _ptr__7656_msubi(_7656_msubi ? _7656_msubi->raw() : nullptr,_7656_msubi ? _7656_msubi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7657_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7655_nnz)));
  _checked_ptr_1<int32_t> _ptr__7657_msubj(_7657_msubj ? _7657_msubj->raw() : nullptr,_7657_msubj ? _7657_msubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7658_mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7655_nnz)));
  _checked_ptr_1<double> _ptr__7658_mval(_7658_mval ? _7658_mval->raw() : nullptr,_7658_mval ? _7658_mval->size(0) : 0);
  {
    int32_t _7659_k = (int)0;
    int32_t _12822_ = (int)0;
    int32_t _12823_ = _7653_mdim0;
    for (int32_t _7660_i = _12822_; _7660_i < _12823_; ++_7660_i)
    {
      {
        int32_t _12824_ = (int)0;
        int32_t _12825_ = _7654_mdim1;
        for (int32_t _7661_j = _12824_; _7661_j < _12825_; ++_7661_j)
        {
          {
            _ptr__7656_msubi[_7659_k] = _7660_i;
            _ptr__7657_msubj[_7659_k] = _7661_j;
            _ptr__7658_mval[_7659_k] = ((*_7651_mx)(_7660_i,_7661_j));
            _7659_k += (int)1;
          }
        }
      }
    }
  }
  int64_t _7662_esize = _7652_e->getSize();
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7663_eshape = _7652_e->getShape();
  _checked_ptr_1<int32_t> _ptr__7663_eshape(_7663_eshape ? _7663_eshape->raw() : nullptr,_7663_eshape ? _7663_eshape->size(0) : 0);
  if (((int)((_7663_eshape)->size(0)) == (int)0))
  {
    {
      return (::mosek::fusion::p_ExprScalarMul::_new_ExprScalarMul(_7653_mdim0,_7654_mdim1,_7656_msubi,_7657_msubj,_7658_mval,_7652_e,(int)1)).as<::mosek::fusion::Expression>();
    }
  }
  else if(_7650_left)
  {
    {
      if (((int)((_7663_eshape)->size(0)) == (int)1))
      {
        {
          return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7653_mdim0)}),(::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7653_mdim0,_7654_mdim1,_7658_mval,(::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)(_ptr__7663_eshape[(int)0])}),_7652_e)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
        }
      }
      else if(((int)((_7663_eshape)->size(0)) == (int)2))
      {
        {
          return (::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7653_mdim0,_7654_mdim1,_7658_mval,(::mosek::fusion::p_ExprTranspose::_new_ExprTranspose(_7652_e)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
        }
      }
      else
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
        }
      }
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< double,1 > > _7664_mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7655_nnz)));
      _checked_ptr_1<double> _ptr__7664_mval(_7664_mval ? _7664_mval->raw() : nullptr,_7664_mval ? _7664_mval->size(0) : 0);
      {
        int32_t _7665_k = (int)0;
        int32_t _12826_ = (int)0;
        int32_t _12827_ = _7654_mdim1;
        for (int32_t _7666_j = _12826_; _7666_j < _12827_; ++_7666_j)
        {
          {
            int32_t _12828_ = (int)0;
            int32_t _12829_ = _7653_mdim0;
            for (int32_t _7667_i = _12828_; _7667_i < _12829_; ++_7667_i)
            {
              {
                _ptr__7664_mval[_7665_k] = ((*_7651_mx)(_7667_i,_7666_j));
                _7665_k += (int)1;
              }
            }
          }
        }
      }
      if (((int)((_7663_eshape)->size(0)) == (int)1))
      {
        {
          return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7654_mdim1)}),(::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7654_mdim1,_7653_mdim0,_7664_mval,(::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)(_ptr__7663_eshape[(int)0])}),_7652_e)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
        }
      }
      else if(((int)((_7663_eshape)->size(0)) == (int)2))
      {
        {
          return (::mosek::fusion::p_ExprTranspose::_new_ExprTranspose((::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7654_mdim1,_7653_mdim0,_7664_mval,_7652_e)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
        }
      }
      else
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
        }
      }
    }
  }
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1420:6-1514:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(bool _7668_left,monty::rc_ptr< ::mosek::fusion::Matrix > _7669_mx,monty::rc_ptr< ::mosek::fusion::Expression > _7670_e)
{
  int64_t _7671_nnz = _7669_mx->numNonzeros();
  int32_t _7672_mdim0 = _7669_mx->numRows();
  int32_t _7673_mdim1 = _7669_mx->numColumns();
  int32_t _7674_nd = _7670_e->getND();
  if ((_7674_nd == (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7675_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7671_nnz)));
      _checked_ptr_1<int32_t> _ptr__7675_msubi(_7675_msubi ? _7675_msubi->raw() : nullptr,_7675_msubi ? _7675_msubi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7676_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7671_nnz)));
      _checked_ptr_1<int32_t> _ptr__7676_msubj(_7676_msubj ? _7676_msubj->raw() : nullptr,_7676_msubj ? _7676_msubj->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _7677_mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7671_nnz)));
      _checked_ptr_1<double> _ptr__7677_mval(_7677_mval ? _7677_mval->raw() : nullptr,_7677_mval ? _7677_mval->size(0) : 0);
      _7669_mx->getDataAsTriplets(_7675_msubi,_7676_msubj,_7677_mval);
      return (::mosek::fusion::p_ExprScalarMul::_new_ExprScalarMul(_7672_mdim0,_7673_mdim1,_7675_msubi,_7676_msubj,_7677_mval,_7670_e)).as<::mosek::fusion::Expression>();
    }
  }
  {}
  if (_7669_mx->isSparse())
  {
    {
      if ((_7674_nd == (int)1))
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _7678_eshape = _7670_e->getShape();
          _checked_ptr_1<int32_t> _ptr__7678_eshape(_7678_eshape ? _7678_eshape->raw() : nullptr,_7678_eshape ? _7678_eshape->size(0) : 0);
          if (_7668_left)
          {
            {
              std::shared_ptr< monty::ndarray< int32_t,1 > > _7679_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7671_nnz)));
              _checked_ptr_1<int32_t> _ptr__7679_msubi(_7679_msubi ? _7679_msubi->raw() : nullptr,_7679_msubi ? _7679_msubi->size(0) : 0);
              std::shared_ptr< monty::ndarray< int32_t,1 > > _7680_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7671_nnz)));
              _checked_ptr_1<int32_t> _ptr__7680_msubj(_7680_msubj ? _7680_msubj->raw() : nullptr,_7680_msubj ? _7680_msubj->size(0) : 0);
              std::shared_ptr< monty::ndarray< double,1 > > _7681_mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7671_nnz)));
              _checked_ptr_1<double> _ptr__7681_mval(_7681_mval ? _7681_mval->raw() : nullptr,_7681_mval ? _7681_mval->size(0) : 0);
              _7669_mx->getDataAsTriplets(_7679_msubi,_7680_msubj,_7681_mval);
              return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7672_mdim0)}),(::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7672_mdim0,_7673_mdim1,_7679_msubi,_7680_msubj,_7681_mval,::mosek::fusion::p_Expr::transpose(_7670_e))).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
            }
          }
          else
          {
            {
              std::shared_ptr< monty::ndarray< int32_t,1 > > _7682_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7671_nnz)));
              _checked_ptr_1<int32_t> _ptr__7682_msubi(_7682_msubi ? _7682_msubi->raw() : nullptr,_7682_msubi ? _7682_msubi->size(0) : 0);
              std::shared_ptr< monty::ndarray< int32_t,1 > > _7683_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7671_nnz)));
              _checked_ptr_1<int32_t> _ptr__7683_msubj(_7683_msubj ? _7683_msubj->raw() : nullptr,_7683_msubj ? _7683_msubj->size(0) : 0);
              std::shared_ptr< monty::ndarray< double,1 > > _7684_mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7671_nnz)));
              _checked_ptr_1<double> _ptr__7684_mval(_7684_mval ? _7684_mval->raw() : nullptr,_7684_mval ? _7684_mval->size(0) : 0);
              _7669_mx->__mosek_2fusion_2Matrix__transpose()->getDataAsTriplets(_7682_msubi,_7683_msubj,_7684_mval);
              return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7673_mdim1)}),(::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7673_mdim1,_7672_mdim0,_7682_msubi,_7683_msubj,_7684_mval,::mosek::fusion::p_Expr::transpose(_7670_e))).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
            }
          }
        }
      }
      else if((_7674_nd == (int)2))
      {
        {
          if (_7668_left)
          {
            {
              std::shared_ptr< monty::ndarray< int32_t,1 > > _7685_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7671_nnz)));
              _checked_ptr_1<int32_t> _ptr__7685_msubi(_7685_msubi ? _7685_msubi->raw() : nullptr,_7685_msubi ? _7685_msubi->size(0) : 0);
              std::shared_ptr< monty::ndarray< int32_t,1 > > _7686_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7671_nnz)));
              _checked_ptr_1<int32_t> _ptr__7686_msubj(_7686_msubj ? _7686_msubj->raw() : nullptr,_7686_msubj ? _7686_msubj->size(0) : 0);
              std::shared_ptr< monty::ndarray< double,1 > > _7687_mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7671_nnz)));
              _checked_ptr_1<double> _ptr__7687_mval(_7687_mval ? _7687_mval->raw() : nullptr,_7687_mval ? _7687_mval->size(0) : 0);
              _7669_mx->getDataAsTriplets(_7685_msubi,_7686_msubj,_7687_mval);
              return (::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7672_mdim0,_7673_mdim1,_7685_msubi,_7686_msubj,_7687_mval,::mosek::fusion::p_Expr::transpose(_7670_e))).as<::mosek::fusion::Expression>();
            }
          }
          else
          {
            {
              std::shared_ptr< monty::ndarray< int32_t,1 > > _7688_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7671_nnz)));
              _checked_ptr_1<int32_t> _ptr__7688_msubi(_7688_msubi ? _7688_msubi->raw() : nullptr,_7688_msubi ? _7688_msubi->size(0) : 0);
              std::shared_ptr< monty::ndarray< int32_t,1 > > _7689_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7671_nnz)));
              _checked_ptr_1<int32_t> _ptr__7689_msubj(_7689_msubj ? _7689_msubj->raw() : nullptr,_7689_msubj ? _7689_msubj->size(0) : 0);
              std::shared_ptr< monty::ndarray< double,1 > > _7690_mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7671_nnz)));
              _checked_ptr_1<double> _ptr__7690_mval(_7690_mval ? _7690_mval->raw() : nullptr,_7690_mval ? _7690_mval->size(0) : 0);
              _7669_mx->__mosek_2fusion_2Matrix__transpose()->getDataAsTriplets(_7688_msubi,_7689_msubj,_7690_mval);
              return ::mosek::fusion::p_Expr::transpose((::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7673_mdim1,_7672_mdim0,_7688_msubi,_7689_msubj,_7690_mval,_7670_e)).as<::mosek::fusion::Expression>());
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Mismatching dimensions for multiplication"));
        }
      }
    }
  }
  else
  {
    {
      if ((_7674_nd == (int)1))
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _7691_eshape = _7670_e->getShape();
          _checked_ptr_1<int32_t> _ptr__7691_eshape(_7691_eshape ? _7691_eshape->raw() : nullptr,_7691_eshape ? _7691_eshape->size(0) : 0);
          if (_7668_left)
          {
            {
              return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7672_mdim0)}),(::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7672_mdim0,_7673_mdim1,_7669_mx->getDataAsArray(),(::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)(_ptr__7691_eshape[(int)0])}),_7670_e)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
            }
          }
          else
          {
            {
              return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7673_mdim1)}),(::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7673_mdim1,_7672_mdim0,_7669_mx->__mosek_2fusion_2Matrix__transpose()->getDataAsArray(),(::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)(_ptr__7691_eshape[(int)0])}),_7670_e)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
            }
          }
        }
      }
      else if((_7674_nd == (int)2))
      {
        {
          if (_7668_left)
          {
            {
              return (::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7672_mdim0,_7673_mdim1,_7669_mx->getDataAsArray(),::mosek::fusion::p_Expr::transpose(_7670_e))).as<::mosek::fusion::Expression>();
            }
          }
          else
          {
            {
              return ::mosek::fusion::p_Expr::transpose((::mosek::fusion::p_ExprCrossDot::_new_ExprCrossDot(_7673_mdim1,_7672_mdim0,_7669_mx->__mosek_2fusion_2Matrix__transpose()->getDataAsArray(),_7670_e)).as<::mosek::fusion::Expression>());
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Mismatching dimensions for multiplication"));
        }
      }
    }
  }
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1393:6-1418:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( monty::rc_ptr< ::mosek::fusion::Variable > _7692_v,
    std::shared_ptr< monty::ndarray< double,2 > > _7693_mx) { return mosek::fusion::p_Expr::mul(_7692_v,_7693_mx); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(monty::rc_ptr< ::mosek::fusion::Variable > _7692_v,std::shared_ptr< monty::ndarray< double,2 > > _7693_mx)
{
  int32_t _7694_mdim0 = (int)((_7693_mx)->size(0));
  int32_t _7695_mdim1 = (int)((_7693_mx)->size(1));
  int32_t _7696_nnz = safe_mul( _7694_mdim0,_7695_mdim1 );
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7697_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7696_nnz)));
  _checked_ptr_1<int32_t> _ptr__7697_msubi(_7697_msubi ? _7697_msubi->raw() : nullptr,_7697_msubi ? _7697_msubi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7698_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7696_nnz)));
  _checked_ptr_1<int32_t> _ptr__7698_msubj(_7698_msubj ? _7698_msubj->raw() : nullptr,_7698_msubj ? _7698_msubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7699_mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7696_nnz)));
  _checked_ptr_1<double> _ptr__7699_mval(_7699_mval ? _7699_mval->raw() : nullptr,_7699_mval ? _7699_mval->size(0) : 0);
  {
    int32_t _7700_k = (int)0;
    int32_t _12830_ = (int)0;
    int32_t _12831_ = _7694_mdim0;
    for (int32_t _7701_i = _12830_; _7701_i < _12831_; ++_7701_i)
    {
      {
        int32_t _12832_ = (int)0;
        int32_t _12833_ = _7695_mdim1;
        for (int32_t _7702_j = _12832_; _7702_j < _12833_; ++_7702_j)
        {
          {
            _ptr__7697_msubi[_7700_k] = _7701_i;
            _ptr__7698_msubj[_7700_k] = _7702_j;
            _ptr__7699_mval[_7700_k] = ((*_7693_mx)(_7701_i,_7702_j));
            _7700_k += (int)1;
          }
        }
      }
    }
  }
  return ::mosek::fusion::p_Expr::mul(false,_7694_mdim0,_7695_mdim1,_7697_msubi,_7698_msubj,_7699_mval,_7692_v);
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1366:6-1391:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( std::shared_ptr< monty::ndarray< double,2 > > _7703_mx,
    monty::rc_ptr< ::mosek::fusion::Variable > _7704_v) { return mosek::fusion::p_Expr::mul(_7703_mx,_7704_v); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(std::shared_ptr< monty::ndarray< double,2 > > _7703_mx,monty::rc_ptr< ::mosek::fusion::Variable > _7704_v)
{
  int32_t _7705_mdim0 = (int)((_7703_mx)->size(0));
  int32_t _7706_mdim1 = (int)((_7703_mx)->size(1));
  int32_t _7707_nnz = safe_mul( _7705_mdim0,_7706_mdim1 );
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7708_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7707_nnz)));
  _checked_ptr_1<int32_t> _ptr__7708_msubi(_7708_msubi ? _7708_msubi->raw() : nullptr,_7708_msubi ? _7708_msubi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7709_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7707_nnz)));
  _checked_ptr_1<int32_t> _ptr__7709_msubj(_7709_msubj ? _7709_msubj->raw() : nullptr,_7709_msubj ? _7709_msubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7710_mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7707_nnz)));
  _checked_ptr_1<double> _ptr__7710_mval(_7710_mval ? _7710_mval->raw() : nullptr,_7710_mval ? _7710_mval->size(0) : 0);
  {
    int32_t _7711_k = (int)0;
    int32_t _12834_ = (int)0;
    int32_t _12835_ = _7705_mdim0;
    for (int32_t _7712_i = _12834_; _7712_i < _12835_; ++_7712_i)
    {
      {
        int32_t _12836_ = (int)0;
        int32_t _12837_ = _7706_mdim1;
        for (int32_t _7713_j = _12836_; _7713_j < _12837_; ++_7713_j)
        {
          {
            _ptr__7708_msubi[_7711_k] = _7712_i;
            _ptr__7709_msubj[_7711_k] = _7713_j;
            _ptr__7710_mval[_7711_k] = ((*_7703_mx)(_7712_i,_7713_j));
            _7711_k += (int)1;
          }
        }
      }
    }
  }
  return ::mosek::fusion::p_Expr::mul(true,_7705_mdim0,_7706_mdim1,_7708_msubi,_7709_msubj,_7710_mval,_7704_v);
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1356:6-1364:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( monty::rc_ptr< ::mosek::fusion::Variable > _7714_v,
    monty::rc_ptr< ::mosek::fusion::Matrix > _7715_mx) { return mosek::fusion::p_Expr::mul(_7714_v,_7715_mx); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(monty::rc_ptr< ::mosek::fusion::Variable > _7714_v,monty::rc_ptr< ::mosek::fusion::Matrix > _7715_mx)
{
  int32_t _7716_mdimi = _7715_mx->numRows();
  int32_t _7717_mdimj = _7715_mx->numColumns();
  std::shared_ptr< monty::ndarray< double,1 > > _7718_mcof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7715_mx->numNonzeros())));
  _checked_ptr_1<double> _ptr__7718_mcof(_7718_mcof ? _7718_mcof->raw() : nullptr,_7718_mcof ? _7718_mcof->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7719_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7715_mx->numNonzeros())));
  _checked_ptr_1<int32_t> _ptr__7719_msubj(_7719_msubj ? _7719_msubj->raw() : nullptr,_7719_msubj ? _7719_msubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7720_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7715_mx->numNonzeros())));
  _checked_ptr_1<int32_t> _ptr__7720_msubi(_7720_msubi ? _7720_msubi->raw() : nullptr,_7720_msubi ? _7720_msubi->size(0) : 0);
  _7715_mx->getDataAsTriplets(_7720_msubi,_7719_msubj,_7718_mcof);
  return ::mosek::fusion::p_Expr::mul(false,_7716_mdimi,_7717_mdimj,_7720_msubi,_7719_msubj,_7718_mcof,_7714_v);
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1346:6-1355:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _7721_mx,
    monty::rc_ptr< ::mosek::fusion::Variable > _7722_v) { return mosek::fusion::p_Expr::mul(_7721_mx,_7722_v); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(monty::rc_ptr< ::mosek::fusion::Matrix > _7721_mx,monty::rc_ptr< ::mosek::fusion::Variable > _7722_v)
{
  int32_t _7723_mdimi = _7721_mx->numRows();
  int32_t _7724_mdimj = _7721_mx->numColumns();
  std::shared_ptr< monty::ndarray< double,1 > > _7725_mcof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7721_mx->numNonzeros())));
  _checked_ptr_1<double> _ptr__7725_mcof(_7725_mcof ? _7725_mcof->raw() : nullptr,_7725_mcof ? _7725_mcof->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7726_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7721_mx->numNonzeros())));
  _checked_ptr_1<int32_t> _ptr__7726_msubj(_7726_msubj ? _7726_msubj->raw() : nullptr,_7726_msubj ? _7726_msubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7727_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7721_mx->numNonzeros())));
  _checked_ptr_1<int32_t> _ptr__7727_msubi(_7727_msubi ? _7727_msubi->raw() : nullptr,_7727_msubi ? _7727_msubi->size(0) : 0);
  _7721_mx->getDataAsTriplets(_7727_msubi,_7726_msubj,_7725_mcof);
  return ::mosek::fusion::p_Expr::mul(true,_7723_mdimi,_7724_mdimj,_7727_msubi,_7726_msubj,_7725_mcof,_7722_v);
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1332:6-1343:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(bool _7728_left,int32_t _7729_mdimi,int32_t _7730_mdimj,std::shared_ptr< monty::ndarray< int32_t,1 > > _7731_msubi,std::shared_ptr< monty::ndarray< int32_t,1 > > _7732_msubj,std::shared_ptr< monty::ndarray< double,1 > > _7733_mcof,monty::rc_ptr< ::mosek::fusion::Variable > _7734_v)
{
  _checked_ptr_1<int32_t> _ptr__7731_msubi(_7731_msubi ? _7731_msubi->raw() : nullptr, _7731_msubi ? _7731_msubi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__7732_msubj(_7732_msubj ? _7732_msubj->raw() : nullptr, _7732_msubj ? _7732_msubj->size(0) : 0);
  _checked_ptr_1<double> _ptr__7733_mcof(_7733_mcof ? _7733_mcof->raw() : nullptr, _7733_mcof ? _7733_mcof->size(0) : 0);
  if ((_7734_v->getND() == (int)0))
  {
    {
      return (::mosek::fusion::p_ExprMulScalarVar::_new_ExprMulScalarVar(_7729_mdimi,_7730_mdimj,_7731_msubi,_7732_msubj,_7733_mcof,_7734_v)).as<::mosek::fusion::Expression>();
    }
  }
  else if((_7734_v->getND() == (int)1))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7735_vshape = _7734_v->getShape();
      _checked_ptr_1<int32_t> _ptr__7735_vshape(_7735_vshape ? _7735_vshape->raw() : nullptr,_7735_vshape ? _7735_vshape->size(0) : 0);
      int32_t _12838_;
      bool _12839_ = _7728_left;
      if (_12839_)
      {
        _12838_ = _7729_mdimi;
      }
      else
      {
        _12838_ = _7730_mdimj;
      }
      std::shared_ptr< monty::ndarray< int32_t,1 > > _12840_;
      bool _12841_ = _7728_left;
      if (_12841_)
      {
        _12840_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_ptr__7735_vshape[(int)0]),(int32_t)((int)1)});
      }
      else
      {
        _12840_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)(_ptr__7735_vshape[(int)0])});
      }
      return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_12838_)}),(::mosek::fusion::p_ExprMulVar::_new_ExprMulVar(_7728_left,_7729_mdimi,_7730_mdimj,_7731_msubi,_7732_msubj,_7733_mcof,::mosek::fusion::p_Var::reshape(_7734_v,_12840_))).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
    }
  }
  else
  {
    {
      return (::mosek::fusion::p_ExprMulVar::_new_ExprMulVar(_7728_left,_7729_mdimi,_7730_mdimj,_7731_msubi,_7732_msubj,_7733_mcof,_7734_v)).as<::mosek::fusion::Expression>();
    }
  }
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1317:6-1330:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7736_expr,
    monty::rc_ptr< ::mosek::fusion::Parameter > _7737_p) { return mosek::fusion::p_Expr::mul(_7736_expr,_7737_p); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(monty::rc_ptr< ::mosek::fusion::Expression > _7736_expr,monty::rc_ptr< ::mosek::fusion::Parameter > _7737_p)
{
  if (((_7737_p->getND() == (int)2) && (_7736_expr->getND() == (int)2)))
  {
    {
      return (::mosek::fusion::p_ExprMulParamRight::_new_ExprMulParamRight(_7736_expr,_7737_p)).as<::mosek::fusion::Expression>();
    }
  }
  else if(((_7737_p->getND() == (int)1) && (_7736_expr->getND() == (int)2)))
  {
    {
      return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7736_expr->getDim((int)0))}),(::mosek::fusion::p_ExprMulParamRight::_new_ExprMulParamRight(_7736_expr,_7737_p->__mosek_2fusion_2Parameter__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7737_p->getDim((int)0)),(int32_t)((int)1)})))).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
    }
  }
  else if(((_7737_p->getND() == (int)2) && (_7736_expr->getND() == (int)1)))
  {
    {
      return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7737_p->getDim((int)1))}),(::mosek::fusion::p_ExprMulParamRight::_new_ExprMulParamRight((::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)(_7736_expr->getDim((int)0))}),_7736_expr)).as<::mosek::fusion::Expression>(),_7737_p)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
    }
  }
  else if((_7737_p->getND() == (int)0))
  {
    {
      return (::mosek::fusion::p_ExprMulParamScalar::_new_ExprMulParamScalar(_7737_p,_7736_expr)).as<::mosek::fusion::Expression>();
    }
  }
  else if((_7736_expr->getND() == (int)0))
  {
    {
      return (::mosek::fusion::p_ExprMulParamScalarExpr::_new_ExprMulParamScalarExpr(_7737_p,_7736_expr)).as<::mosek::fusion::Expression>();
    }
  }
  else
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions for multiplication"));
    }
  }
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.mul
// Method mosek.fusion.Expr.mul @ bld/grindsted/final/default/src/fusion/Expr.mbi:1303:6-1316:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mul
  ( monty::rc_ptr< ::mosek::fusion::Parameter > _7738_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _7739_expr) { return mosek::fusion::p_Expr::mul(_7738_p,_7739_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mul(monty::rc_ptr< ::mosek::fusion::Parameter > _7738_p,monty::rc_ptr< ::mosek::fusion::Expression > _7739_expr)
{
  if (((_7738_p->getND() == (int)2) && (_7739_expr->getND() == (int)2)))
  {
    {
      return (::mosek::fusion::p_ExprMulParamLeft::_new_ExprMulParamLeft(_7738_p,_7739_expr)).as<::mosek::fusion::Expression>();
    }
  }
  else if(((_7738_p->getND() == (int)1) && (_7739_expr->getND() == (int)2)))
  {
    {
      return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7739_expr->getDim((int)1))}),(::mosek::fusion::p_ExprMulParamLeft::_new_ExprMulParamLeft(_7738_p->__mosek_2fusion_2Parameter__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)(_7738_p->getDim((int)0))})),_7739_expr)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
    }
  }
  else if(((_7738_p->getND() == (int)2) && (_7739_expr->getND() == (int)1)))
  {
    {
      return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7738_p->getDim((int)0))}),(::mosek::fusion::p_ExprMulParamLeft::_new_ExprMulParamLeft(_7738_p,(::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_7739_expr->getDim((int)0)),(int32_t)((int)1)}),_7739_expr)).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>())).as<::mosek::fusion::Expression>();
    }
  }
  else if((_7738_p->getND() == (int)0))
  {
    {
      return (::mosek::fusion::p_ExprMulParamScalar::_new_ExprMulParamScalar(_7738_p,_7739_expr)).as<::mosek::fusion::Expression>();
    }
  }
  else if((_7739_expr->getND() == (int)0))
  {
    {
      return (::mosek::fusion::p_ExprMulParamScalarExpr::_new_ExprMulParamScalarExpr(_7738_p,_7739_expr)).as<::mosek::fusion::Expression>();
    }
  }
  else
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid operand dimensions for multiplication"));
    }
  }
}
// End mosek.fusion.Expr.mul

// Begin mosek.fusion.Expr.dot
// Method mosek.fusion.Expr.dot @ bld/grindsted/final/default/src/fusion/Expr.mbi:1282:6-1301:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::dot
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7740_e,
    monty::rc_ptr< ::mosek::fusion::Matrix > _7741_m) { return mosek::fusion::p_Expr::dot(_7740_e,_7741_m); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::dot(monty::rc_ptr< ::mosek::fusion::Expression > _7740_e,monty::rc_ptr< ::mosek::fusion::Matrix > _7741_m)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7742_eshape = _7740_e->getShape();
  _checked_ptr_1<int32_t> _ptr__7742_eshape(_7742_eshape ? _7742_eshape->raw() : nullptr,_7742_eshape ? _7742_eshape->size(0) : 0);
  if ((((int)((_7742_eshape)->size(0)) != (int)2) || ((mosek::fusion::p_Matrix::_get_impl(_7741_m)->dimi != _ptr__7742_eshape[(int)0]) || (mosek::fusion::p_Matrix::_get_impl(_7741_m)->dimj != _ptr__7742_eshape[(int)1]))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
    }
  }
  {}
  int64_t _7743_nnz = _7741_m->numNonzeros();
  if ((!_7741_m->isSparse()))
  {
    {
      std::vector<int64_t> _12842_;
      for (int64_t _7744_i = (int)0, _12843_ = _7743_nnz; _7744_i < _12843_ ; ++_7744_i)
      {
        _12842_.push_back(_7744_i);
      }
      auto _12844_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_12842_.size()),_12842_.begin(),_12842_.end()));
      return (::mosek::fusion::p_ExprInner::_new_ExprInner(_7740_e,_12844_,_7741_m->getDataAsArray())).as<::mosek::fusion::Expression>();
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7745_subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7743_nnz)));
      _checked_ptr_1<int32_t> _ptr__7745_subi(_7745_subi ? _7745_subi->raw() : nullptr,_7745_subi ? _7745_subi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7746_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7743_nnz)));
      _checked_ptr_1<int32_t> _ptr__7746_subj(_7746_subj ? _7746_subj->raw() : nullptr,_7746_subj ? _7746_subj->size(0) : 0);
      std::shared_ptr< monty::ndarray< double,1 > > _7747_cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7743_nnz)));
      _checked_ptr_1<double> _ptr__7747_cof(_7747_cof ? _7747_cof->raw() : nullptr,_7747_cof ? _7747_cof->size(0) : 0);
      int32_t _7748_dimj = _7741_m->numColumns();
      _7741_m->getDataAsTriplets(_7745_subi,_7746_subj,_7747_cof);
      std::vector<int64_t> _12845_;
      for (int32_t _7749_i = (int)0, _12846_ = (int)((_7745_subi)->size(0)); _7749_i < _12846_ ; ++_7749_i)
      {
        _12845_.push_back(safe_add( safe_mul( _ptr__7745_subi[_7749_i],_7748_dimj ),_ptr__7746_subj[_7749_i] ));
      }
      auto _12847_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_12845_.size()),_12845_.begin(),_12845_.end()));
      return (::mosek::fusion::p_ExprInner::_new_ExprInner(_7740_e,_12847_,_7747_cof)).as<::mosek::fusion::Expression>();
    }
  }
}
// End mosek.fusion.Expr.dot

// Begin mosek.fusion.Expr.dot
// Method mosek.fusion.Expr.dot @ bld/grindsted/final/default/src/fusion/Expr.mbi:1270:6-1281:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::dot
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7750_e,
    std::shared_ptr< monty::ndarray< double,2 > > _7751_c2) { return mosek::fusion::p_Expr::dot(_7750_e,_7751_c2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::dot(monty::rc_ptr< ::mosek::fusion::Expression > _7750_e,std::shared_ptr< monty::ndarray< double,2 > > _7751_c2)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7752_eshape = _7750_e->getShape();
  _checked_ptr_1<int32_t> _ptr__7752_eshape(_7752_eshape ? _7752_eshape->raw() : nullptr,_7752_eshape ? _7752_eshape->size(0) : 0);
  if (((int)2 != (int)((_7752_eshape)->size(0))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
    }
  }
  else
  {
    {
      if (((_ptr__7752_eshape[(int)0] != (int)((_7751_c2)->size(0))) || (_ptr__7752_eshape[(int)1] != (int)((_7751_c2)->size(1)))))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
        }
      }
      {}
    }
  }
  std::vector<int64_t> _12848_;
  for (int32_t _7753_i = (int)0, _12849_ = safe_mul( (int)((_7751_c2)->size(0)),(int)((_7751_c2)->size(1)) ); _7753_i < _12849_ ; ++_7753_i)
  {
    _12848_.push_back(_7753_i);
  }
  auto _12850_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_12848_.size()),_12848_.begin(),_12848_.end()));
  std::vector<double> _12851_;
  for (int32_t _7754_i = (int)0, _12852_ = (int)((_7751_c2)->size(0)); _7754_i < _12852_ ; ++_7754_i)
  {
    for (int32_t _7755_j = (int)0, _12853_ = (int)((_7751_c2)->size(1)); _7755_j < _12853_ ; ++_7755_j)
    {
      _12851_.push_back(((*_7751_c2)(_7754_i,_7755_j)));
    }
  }
  auto _12854_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_12851_.size()),_12851_.begin(),_12851_.end()));
  return (::mosek::fusion::p_ExprInner::_new_ExprInner(_7750_e,_12850_,_12854_)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.dot

// Begin mosek.fusion.Expr.dot
// Method mosek.fusion.Expr.dot @ bld/grindsted/final/default/src/fusion/Expr.mbi:1258:6-1268:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::dot
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7756_e,
    monty::rc_ptr< ::mosek::fusion::NDSparseArray > _7757_nda) { return mosek::fusion::p_Expr::dot(_7756_e,_7757_nda); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::dot(monty::rc_ptr< ::mosek::fusion::Expression > _7756_e,monty::rc_ptr< ::mosek::fusion::NDSparseArray > _7757_nda)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7758_eshape = _7756_e->getShape();
  _checked_ptr_1<int32_t> _ptr__7758_eshape(_7758_eshape ? _7758_eshape->raw() : nullptr,_7758_eshape ? _7758_eshape->size(0) : 0);
  if (((int)((mosek::fusion::p_NDSparseArray::_get_impl(_7757_nda)->dims)->size(0)) != (int)((_7758_eshape)->size(0))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
    }
  }
  else
  {
    {
      int32_t _12855_ = (int)0;
      int32_t _12856_ = (int)((_7758_eshape)->size(0));
      for (int32_t _7759_i = _12855_; _7759_i < _12856_; ++_7759_i)
      {
        {
          if ((((*mosek::fusion::p_NDSparseArray::_get_impl(_7757_nda)->dims)(_7759_i)) != _ptr__7758_eshape[_7759_i]))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
            }
          }
          {}
        }
      }
    }
  }
  return (::mosek::fusion::p_ExprInner::_new_ExprInner(_7756_e,mosek::fusion::p_NDSparseArray::_get_impl(_7757_nda)->inst,mosek::fusion::p_NDSparseArray::_get_impl(_7757_nda)->cof)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.dot

// Begin mosek.fusion.Expr.dot
// Method mosek.fusion.Expr.dot @ bld/grindsted/final/default/src/fusion/Expr.mbi:1241:6-1256:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::dot
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7760_e,
    std::shared_ptr< monty::ndarray< double,1 > > _7761_c1) { return mosek::fusion::p_Expr::dot(_7760_e,_7761_c1); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::dot(monty::rc_ptr< ::mosek::fusion::Expression > _7760_e,std::shared_ptr< monty::ndarray< double,1 > > _7761_c1)
{
  _checked_ptr_1<double> _ptr__7761_c1(_7761_c1 ? _7761_c1->raw() : nullptr, _7761_c1 ? _7761_c1->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7762_eshape = _7760_e->getShape();
  _checked_ptr_1<int32_t> _ptr__7762_eshape(_7762_eshape ? _7762_eshape->raw() : nullptr,_7762_eshape ? _7762_eshape->size(0) : 0);
  if (((_7760_e->getSize() == (int)((_7761_c1)->size(0))) && ((int)((_7762_eshape)->size(0)) > (int)1)))
  {
    {
      int32_t _7763_numnotone = (int)0;
      int32_t _12857_ = (int)0;
      int32_t _12858_ = (int)((_7762_eshape)->size(0));
      for (int32_t _7764_i = _12857_; _7764_i < _12858_; ++_7764_i)
      {
        {
          if ((_ptr__7762_eshape[_7764_i] > (int)1))
          {
            {
              ++ _7763_numnotone;
            }
          }
          {}
        }
      }
      if ((_7763_numnotone > (int)1))
      {
        {
          throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand shapes"));
        }
      }
      else
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _7765_newshape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int32_t)_7760_e->getSize())});
          _checked_ptr_1<int32_t> _ptr__7765_newshape(_7765_newshape ? _7765_newshape->raw() : nullptr,_7765_newshape ? _7765_newshape->size(0) : 0);
          return (::mosek::fusion::p_ExprInner::_new_ExprInner((::mosek::fusion::p_ExprReshape::_new_ExprReshape(_7765_newshape,_7760_e)).as<::mosek::fusion::Expression>(),_7761_c1)).as<::mosek::fusion::Expression>();
        }
      }
    }
  }
  else
  {
    {
      return (::mosek::fusion::p_ExprInner::_new_ExprInner(_7760_e,_7761_c1)).as<::mosek::fusion::Expression>();
    }
  }
}
// End mosek.fusion.Expr.dot

// Begin mosek.fusion.Expr.dot
// Method mosek.fusion.Expr.dot @ bld/grindsted/final/default/src/fusion/Expr.mbi:1239:6-99
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::dot
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _7766_m,
    monty::rc_ptr< ::mosek::fusion::Expression > _7767_e) { return mosek::fusion::p_Expr::dot(_7766_m,_7767_e); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::dot(monty::rc_ptr< ::mosek::fusion::Matrix > _7766_m,monty::rc_ptr< ::mosek::fusion::Expression > _7767_e)
{
  return ::mosek::fusion::p_Expr::dot(_7767_e,_7766_m);
}
// End mosek.fusion.Expr.dot

// Begin mosek.fusion.Expr.dot
// Method mosek.fusion.Expr.dot @ bld/grindsted/final/default/src/fusion/Expr.mbi:1238:6-101
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::dot
  ( monty::rc_ptr< ::mosek::fusion::NDSparseArray > _7768_nda,
    monty::rc_ptr< ::mosek::fusion::Expression > _7769_e) { return mosek::fusion::p_Expr::dot(_7768_nda,_7769_e); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::dot(monty::rc_ptr< ::mosek::fusion::NDSparseArray > _7768_nda,monty::rc_ptr< ::mosek::fusion::Expression > _7769_e)
{
  return ::mosek::fusion::p_Expr::dot(_7769_e,_7768_nda);
}
// End mosek.fusion.Expr.dot

// Begin mosek.fusion.Expr.dot
// Method mosek.fusion.Expr.dot @ bld/grindsted/final/default/src/fusion/Expr.mbi:1237:6-100
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::dot
  ( std::shared_ptr< monty::ndarray< double,2 > > _7770_c2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7771_e) { return mosek::fusion::p_Expr::dot(_7770_c2,_7771_e); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::dot(std::shared_ptr< monty::ndarray< double,2 > > _7770_c2,monty::rc_ptr< ::mosek::fusion::Expression > _7771_e)
{
  return ::mosek::fusion::p_Expr::dot(_7771_e,_7770_c2);
}
// End mosek.fusion.Expr.dot

// Begin mosek.fusion.Expr.dot
// Method mosek.fusion.Expr.dot @ bld/grindsted/final/default/src/fusion/Expr.mbi:1236:6-100
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::dot
  ( std::shared_ptr< monty::ndarray< double,1 > > _7772_c1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7773_e) { return mosek::fusion::p_Expr::dot(_7772_c1,_7773_e); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::dot(std::shared_ptr< monty::ndarray< double,1 > > _7772_c1,monty::rc_ptr< ::mosek::fusion::Expression > _7773_e)
{
  _checked_ptr_1<double> _ptr__7772_c1(_7772_c1 ? _7772_c1->raw() : nullptr, _7772_c1 ? _7772_c1->size(0) : 0);
  return ::mosek::fusion::p_Expr::dot(_7773_e,_7772_c1);
}
// End mosek.fusion.Expr.dot

// Begin mosek.fusion.Expr.dot
// Method mosek.fusion.Expr.dot @ bld/grindsted/final/default/src/fusion/Expr.mbi:1234:6-103
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::dot
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7774_e,
    monty::rc_ptr< ::mosek::fusion::Parameter > _7775_p) { return mosek::fusion::p_Expr::dot(_7774_e,_7775_p); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::dot(monty::rc_ptr< ::mosek::fusion::Expression > _7774_e,monty::rc_ptr< ::mosek::fusion::Parameter > _7775_p)
{
  return (::mosek::fusion::p_ExprDotParam::_new_ExprDotParam(_7775_p,_7774_e)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.dot

// Begin mosek.fusion.Expr.dot
// Method mosek.fusion.Expr.dot @ bld/grindsted/final/default/src/fusion/Expr.mbi:1233:6-103
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::dot
  ( monty::rc_ptr< ::mosek::fusion::Parameter > _7776_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _7777_e) { return mosek::fusion::p_Expr::dot(_7776_p,_7777_e); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::dot(monty::rc_ptr< ::mosek::fusion::Parameter > _7776_p,monty::rc_ptr< ::mosek::fusion::Expression > _7777_e)
{
  return (::mosek::fusion::p_ExprDotParam::_new_ExprDotParam(_7776_p,_7777_e)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.dot

// Begin mosek.fusion.Expr.outer
// Method mosek.fusion.Expr.outer @ bld/grindsted/final/default/src/fusion/Expr.mbi:1219:6-1231:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::outer
  ( monty::rc_ptr< ::mosek::fusion::Parameter > _7778_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _7779_e) { return mosek::fusion::p_Expr::outer(_7778_p,_7779_e); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::outer(monty::rc_ptr< ::mosek::fusion::Parameter > _7778_p,monty::rc_ptr< ::mosek::fusion::Expression > _7779_e)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7780_vshape = _7779_e->getShape();
  _checked_ptr_1<int32_t> _ptr__7780_vshape(_7780_vshape ? _7780_vshape->raw() : nullptr,_7780_vshape ? _7780_vshape->size(0) : 0);
  if ((!(((int)((_7780_vshape)->size(0)) == (int)1) || (((int)((_7780_vshape)->size(0)) == (int)2) && (_ptr__7780_vshape[(int)1] == (int)1)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Expression argument must be one-dimensional"));
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7781_pshape = _7778_p->getShape();
  _checked_ptr_1<int32_t> _ptr__7781_pshape(_7781_pshape ? _7781_pshape->raw() : nullptr,_7781_pshape ? _7781_pshape->size(0) : 0);
  if ((!((_7778_p->getND() == (int)1) || ((_7778_p->getND() == (int)2) && (_ptr__7781_pshape[(int)1] == (int)1)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Parameter argument must be one-dimensional"));
    }
  }
  {}
  return ::mosek::fusion::p_Expr::mul(_7778_p->__mosek_2fusion_2Parameter__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_ptr__7781_pshape[(int)0]),(int32_t)((int)1)})),::mosek::fusion::p_Expr::reshape(_7779_e,(int)1,_ptr__7780_vshape[(int)0]));
}
// End mosek.fusion.Expr.outer

// Begin mosek.fusion.Expr.outer
// Method mosek.fusion.Expr.outer @ bld/grindsted/final/default/src/fusion/Expr.mbi:1205:6-1217:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::outer
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7782_e,
    monty::rc_ptr< ::mosek::fusion::Parameter > _7783_p) { return mosek::fusion::p_Expr::outer(_7782_e,_7783_p); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::outer(monty::rc_ptr< ::mosek::fusion::Expression > _7782_e,monty::rc_ptr< ::mosek::fusion::Parameter > _7783_p)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7784_shape = _7782_e->getShape();
  _checked_ptr_1<int32_t> _ptr__7784_shape(_7784_shape ? _7784_shape->raw() : nullptr,_7784_shape ? _7784_shape->size(0) : 0);
  if ((!((_7782_e->getND() == (int)1) || ((_7782_e->getND() == (int)2) && (_ptr__7784_shape[(int)1] == (int)1)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Expression argument must be one-dimensional"));
    }
  }
  {}
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7785_pshape = _7783_p->getShape();
  _checked_ptr_1<int32_t> _ptr__7785_pshape(_7785_pshape ? _7785_pshape->raw() : nullptr,_7785_pshape ? _7785_pshape->size(0) : 0);
  if ((!((_7783_p->getND() == (int)1) || ((_7783_p->getND() == (int)2) && (_ptr__7785_pshape[(int)1] == (int)1)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Parameter argument must be one-dimensional"));
    }
  }
  {}
  return ::mosek::fusion::p_Expr::mul(::mosek::fusion::p_Expr::reshape(_7782_e,_ptr__7784_shape[(int)0],(int)1),_7783_p->__mosek_2fusion_2Parameter__reshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)(_ptr__7785_pshape[(int)0])})));
}
// End mosek.fusion.Expr.outer

// Begin mosek.fusion.Expr.outer
// Method mosek.fusion.Expr.outer @ bld/grindsted/final/default/src/fusion/Expr.mbi:1193:6-1203:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::outer
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _7786_m,
    monty::rc_ptr< ::mosek::fusion::Expression > _7787_e) { return mosek::fusion::p_Expr::outer(_7786_m,_7787_e); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::outer(monty::rc_ptr< ::mosek::fusion::Matrix > _7786_m,monty::rc_ptr< ::mosek::fusion::Expression > _7787_e)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7788_vshape = _7787_e->getShape();
  _checked_ptr_1<int32_t> _ptr__7788_vshape(_7788_vshape ? _7788_vshape->raw() : nullptr,_7788_vshape ? _7788_vshape->size(0) : 0);
  if ((!(((int)((_7788_vshape)->size(0)) == (int)1) || (((int)((_7788_vshape)->size(0)) == (int)2) && (_ptr__7788_vshape[(int)1] == (int)1)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Expression argument must be one-dimensional"));
    }
  }
  {}
  if ((mosek::fusion::p_Matrix::_get_impl(_7786_m)->dimj != (int)1))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Constant matrix must be a column-vector"));
    }
  }
  {}
  return ::mosek::fusion::p_Expr::mul(_7786_m,::mosek::fusion::p_Expr::reshape(_7787_e,(int)1,_ptr__7788_vshape[(int)0]));
}
// End mosek.fusion.Expr.outer

// Begin mosek.fusion.Expr.outer
// Method mosek.fusion.Expr.outer @ bld/grindsted/final/default/src/fusion/Expr.mbi:1181:6-1191:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::outer
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7789_e,
    monty::rc_ptr< ::mosek::fusion::Matrix > _7790_m) { return mosek::fusion::p_Expr::outer(_7789_e,_7790_m); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::outer(monty::rc_ptr< ::mosek::fusion::Expression > _7789_e,monty::rc_ptr< ::mosek::fusion::Matrix > _7790_m)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7791_shape = _7789_e->getShape();
  _checked_ptr_1<int32_t> _ptr__7791_shape(_7791_shape ? _7791_shape->raw() : nullptr,_7791_shape ? _7791_shape->size(0) : 0);
  if ((!((_7789_e->getND() == (int)1) || ((_7789_e->getND() == (int)2) && (_ptr__7791_shape[(int)1] == (int)1)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Expression argument must be one-dimensional"));
    }
  }
  {}
  if ((mosek::fusion::p_Matrix::_get_impl(_7790_m)->dimj != (int)1))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Constant matrix must be a column-vector"));
    }
  }
  {}
  return ::mosek::fusion::p_Expr::mul(::mosek::fusion::p_Expr::reshape(_7789_e,_ptr__7791_shape[(int)0],(int)1),_7790_m->__mosek_2fusion_2Matrix__transpose());
}
// End mosek.fusion.Expr.outer

// Begin mosek.fusion.Expr.outer
// Method mosek.fusion.Expr.outer @ bld/grindsted/final/default/src/fusion/Expr.mbi:1171:6-1179:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::outer
  ( std::shared_ptr< monty::ndarray< double,1 > > _7792_a,
    monty::rc_ptr< ::mosek::fusion::Expression > _7793_e) { return mosek::fusion::p_Expr::outer(_7792_a,_7793_e); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::outer(std::shared_ptr< monty::ndarray< double,1 > > _7792_a,monty::rc_ptr< ::mosek::fusion::Expression > _7793_e)
{
  _checked_ptr_1<double> _ptr__7792_a(_7792_a ? _7792_a->raw() : nullptr, _7792_a ? _7792_a->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7794_shape = _7793_e->getShape();
  _checked_ptr_1<int32_t> _ptr__7794_shape(_7794_shape ? _7794_shape->raw() : nullptr,_7794_shape ? _7794_shape->size(0) : 0);
  if ((!((_7793_e->getND() == (int)1) || ((_7793_e->getND() == (int)2) && (_ptr__7794_shape[(int)1] == (int)1)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Expression argument must be one-dimensional"));
    }
  }
  {}
  return ::mosek::fusion::p_Expr::mul(::mosek::fusion::p_Matrix::dense((int)((_7792_a)->size(0)),(int)1,_7792_a),::mosek::fusion::p_Expr::reshape(_7793_e,(int)1,_ptr__7794_shape[(int)0]));
}
// End mosek.fusion.Expr.outer

// Begin mosek.fusion.Expr.outer
// Method mosek.fusion.Expr.outer @ bld/grindsted/final/default/src/fusion/Expr.mbi:1161:6-1169:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::outer
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7795_e,
    std::shared_ptr< monty::ndarray< double,1 > > _7796_a) { return mosek::fusion::p_Expr::outer(_7795_e,_7796_a); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::outer(monty::rc_ptr< ::mosek::fusion::Expression > _7795_e,std::shared_ptr< monty::ndarray< double,1 > > _7796_a)
{
  _checked_ptr_1<double> _ptr__7796_a(_7796_a ? _7796_a->raw() : nullptr, _7796_a ? _7796_a->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7797_shape = _7795_e->getShape();
  _checked_ptr_1<int32_t> _ptr__7797_shape(_7797_shape ? _7797_shape->raw() : nullptr,_7797_shape ? _7797_shape->size(0) : 0);
  if ((!((_7795_e->getND() == (int)1) || ((_7795_e->getND() == (int)2) && (_ptr__7797_shape[(int)1] == (int)1)))))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Expression argument must be one-dimensional"));
    }
  }
  {}
  return ::mosek::fusion::p_Expr::mul(::mosek::fusion::p_Expr::reshape(_7795_e,_ptr__7797_shape[(int)0],(int)1),::mosek::fusion::p_Matrix::dense((int)1,(int)((_7796_a)->size(0)),_7796_a));
}
// End mosek.fusion.Expr.outer

// Begin mosek.fusion.Expr.outer_
// Method mosek.fusion.Expr.outer_ @ bld/grindsted/final/default/src/fusion/Expr.mbi:1064:6-1159:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::outer_(int32_t _7798_edim,std::shared_ptr< monty::ndarray< int64_t,1 > > _7799_eptrb,std::shared_ptr< monty::ndarray< int64_t,1 > > _7800_esubj,std::shared_ptr< monty::ndarray< double,1 > > _7801_ecof,std::shared_ptr< monty::ndarray< double,1 > > _7802_ebfix,std::shared_ptr< monty::ndarray< int64_t,1 > > _7803_einst,std::shared_ptr< monty::ndarray< double,1 > > _7804_a,std::shared_ptr< monty::ndarray< int32_t,1 > > _7805_sub,int32_t _7806_dim,bool _7807_transpose)
{
  _checked_ptr_1<int64_t> _ptr__7799_eptrb(_7799_eptrb ? _7799_eptrb->raw() : nullptr, _7799_eptrb ? _7799_eptrb->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__7800_esubj(_7800_esubj ? _7800_esubj->raw() : nullptr, _7800_esubj ? _7800_esubj->size(0) : 0);
  _checked_ptr_1<double> _ptr__7801_ecof(_7801_ecof ? _7801_ecof->raw() : nullptr, _7801_ecof ? _7801_ecof->size(0) : 0);
  _checked_ptr_1<double> _ptr__7802_ebfix(_7802_ebfix ? _7802_ebfix->raw() : nullptr, _7802_ebfix ? _7802_ebfix->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__7803_einst(_7803_einst ? _7803_einst->raw() : nullptr, _7803_einst ? _7803_einst->size(0) : 0);
  _checked_ptr_1<double> _ptr__7804_a(_7804_a ? _7804_a->raw() : nullptr, _7804_a ? _7804_a->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__7805_sub(_7805_sub ? _7805_sub->raw() : nullptr, _7805_sub ? _7805_sub->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _12859_;
  bool _12860_ = (!_7807_transpose);
  if (_12860_)
  {
    _12859_ = ::mosek::fusion::p_Set::make(_7798_edim,_7806_dim);
  }
  else
  {
    _12859_ = ::mosek::fusion::p_Set::make(_7806_dim,_7798_edim);
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7808_shape = _12859_;
  _checked_ptr_1<int32_t> _ptr__7808_shape(_7808_shape ? _7808_shape->raw() : nullptr,_7808_shape ? _7808_shape->size(0) : 0);
  int32_t _7809_nnzelm = safe_mul( (int)((_7804_a)->size(0)),(int)((_7803_einst)->size(0)) );
  int32_t _7810_nnz = safe_mul( (int)((_7804_a)->size(0)),(int)((_7800_esubj)->size(0)) );
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7811_inst = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_7809_nnzelm)));
  _checked_ptr_1<int64_t> _ptr__7811_inst(_7811_inst ? _7811_inst->raw() : nullptr,_7811_inst ? _7811_inst->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _12861_;
  bool _12862_ = (NULL != _7802_ebfix.get());
  if (_12862_)
  {
    _12861_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7809_nnzelm)));
  }
  else
  {
    _12861_ = nullptr;
  }
  std::shared_ptr< monty::ndarray< double,1 > > _7812_bfix = _12861_;
  _checked_ptr_1<double> _ptr__7812_bfix(_7812_bfix ? _7812_bfix->raw() : nullptr,_7812_bfix ? _7812_bfix->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7813_cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_7810_nnz)));
  _checked_ptr_1<double> _ptr__7813_cof(_7813_cof ? _7813_cof->raw() : nullptr,_7813_cof ? _7813_cof->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7814_subj = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_7810_nnz)));
  _checked_ptr_1<int64_t> _ptr__7814_subj(_7814_subj ? _7814_subj->raw() : nullptr,_7814_subj ? _7814_subj->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7815_ptrb = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( _7809_nnzelm,(int)1 ))));
  _checked_ptr_1<int64_t> _ptr__7815_ptrb(_7815_ptrb ? _7815_ptrb->raw() : nullptr,_7815_ptrb ? _7815_ptrb->size(0) : 0);
  int32_t _7816_ennz = (int32_t)_ptr__7815_ptrb[((int)((_7815_ptrb)->size(0)) - (int)1)];
  if ((!_7807_transpose))
  {
    {
      int64_t _7817_k = (int64_t)0;
      int64_t _7818_ptr = (int64_t)0;
      int32_t _12863_ = (int)0;
      int32_t _12864_ = (int)((_7803_einst)->size(0));
      for (int32_t _7819_i = _12863_; _7819_i < _12864_; ++_7819_i)
      {
        {
          int64_t _7820_num = (_ptr__7799_eptrb[safe_add( _7819_i,(int)1 )] - _ptr__7799_eptrb[_7819_i]);
          int32_t _12865_ = (int)0;
          int32_t _12866_ = (int)((_7804_a)->size(0));
          for (int32_t _7821_j = _12865_; _7821_j < _12866_; ++_7821_j)
          {
            {
              _ptr__7803_einst[_7817_k] = safe_add( safe_mul( _ptr__7803_einst[_7819_i],_7806_dim ),_ptr__7805_sub[_7821_j] );
              _ptr__7815_ptrb[safe_add( _7817_k,(int)1 )] = safe_add( _ptr__7815_ptrb[_7817_k],_7820_num );
              ++ _7817_k;
              int64_t _12867_ = _ptr__7799_eptrb[_7819_i];
              int64_t _12868_ = _ptr__7799_eptrb[safe_add( _7819_i,(int)1 )];
              for (int64_t _7822_l = _12867_; _7822_l < _12868_; ++_7822_l)
              {
                {
                  _ptr__7814_subj[_7818_ptr] = _ptr__7800_esubj[_7822_l];
                  _ptr__7813_cof[_7818_ptr] = (_ptr__7801_ecof[_7822_l] * _ptr__7804_a[_7821_j]);
                  ++ _7818_ptr;
                }
              }
            }
          }
        }
      }
      if ((NULL != _7812_bfix.get()))
      {
        {
          int32_t _7823_k = (int)0;
          int32_t _12869_ = (int)0;
          int32_t _12870_ = (int)((_7803_einst)->size(0));
          for (int32_t _7824_i = _12869_; _7824_i < _12870_; ++_7824_i)
          {
            {
              int32_t _12871_ = (int)0;
              int32_t _12872_ = (int)((_7804_a)->size(0));
              for (int32_t _7825_j = _12871_; _7825_j < _12872_; ++_7825_j)
              {
                {
                  _ptr__7812_bfix[_7823_k] = (_ptr__7804_a[_7825_j] * _ptr__7802_ebfix[_7824_i]);
                  ++ _7823_k;
                }
              }
            }
          }
        }
      }
      {}
    }
  }
  else
  {
    {
      int64_t _7826_k = (int64_t)0;
      int64_t _7827_ptr = (int64_t)0;
      int32_t _12873_ = (int)0;
      int32_t _12874_ = (int)((_7804_a)->size(0));
      for (int32_t _7828_j = _12873_; _7828_j < _12874_; ++_7828_j)
      {
        {
          double _7829_c = _ptr__7804_a[_7828_j];
          ::mosek::fusion::Utils::Tools::arraycopy(_7800_esubj,(int64_t)((int)0),_7814_subj,_7827_ptr,(int64_t)(_7816_ennz));
          int32_t _12875_ = (int)0;
          int32_t _12876_ = _7816_ennz;
          for (int32_t _7830_l = _12875_; _7830_l < _12876_; ++_7830_l)
          {
            {
              _ptr__7813_cof[safe_add( _7827_ptr,_7830_l )] = (_ptr__7801_ecof[_7830_l] * _ptr__7804_a[_7828_j]);
            }
          }
          int32_t _12877_ = (int)0;
          int32_t _12878_ = (int)((_7803_einst)->size(0));
          for (int32_t _7831_i = _12877_; _7831_i < _12878_; ++_7831_i)
          {
            {
              int64_t _7832_num = (_ptr__7799_eptrb[safe_add( _7831_i,(int)1 )] - _ptr__7799_eptrb[_7831_i]);
              _ptr__7803_einst[_7826_k] = safe_add( safe_mul( _ptr__7803_einst[_7831_i],_7806_dim ),_ptr__7805_sub[_7828_j] );
              _ptr__7815_ptrb[safe_add( _7826_k,(int)1 )] = safe_add( _ptr__7815_ptrb[_7826_k],_7832_num );
              ++ _7826_k;
            }
          }
          _7827_ptr += _7816_ennz;
        }
      }
      if ((NULL != _7812_bfix.get()))
      {
        {
          int32_t _7833_k = (int)0;
          int32_t _12879_ = (int)0;
          int32_t _12880_ = (int)((_7804_a)->size(0));
          for (int32_t _7834_j = _12879_; _7834_j < _12880_; ++_7834_j)
          {
            {
              double _7835_c = _ptr__7804_a[_7834_j];
              int32_t _12881_ = (int)0;
              int32_t _12882_ = (int)((_7803_einst)->size(0));
              for (int32_t _7836_i = _12881_; _7836_i < _12882_; ++_7836_i)
              {
                {
                  _ptr__7812_bfix[_7833_k] = (_ptr__7802_ebfix[_7836_i] * _7835_c);
                  ++ _7833_k;
                }
              }
            }
          }
        }
      }
      {}
    }
  }
  return (::mosek::fusion::p_Expr::_new_Expr(_7815_ptrb,_7814_subj,_7813_cof,_7812_bfix,_7808_shape,_7811_inst)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.outer_

// Begin mosek.fusion.Expr.outer_
// Method mosek.fusion.Expr.outer_ @ bld/grindsted/final/default/src/fusion/Expr.mbi:985:6-1051:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::outer_(monty::rc_ptr< ::mosek::fusion::Variable > _7837_v,int32_t _7838_vdim,std::shared_ptr< monty::ndarray< double,1 > > _7839_a,std::shared_ptr< monty::ndarray< int32_t,1 > > _7840_sub,int32_t _7841_dim,bool _7842_transpose)
{
  _checked_ptr_1<double> _ptr__7839_a(_7839_a ? _7839_a->raw() : nullptr, _7839_a ? _7839_a->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__7840_sub(_7840_sub ? _7840_sub->raw() : nullptr, _7840_sub ? _7840_sub->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _12883_;
  bool _12884_ = (!_7842_transpose);
  if (_12884_)
  {
    _12883_ = ::mosek::fusion::p_Set::make(_7838_vdim,_7841_dim);
  }
  else
  {
    _12883_ = ::mosek::fusion::p_Set::make(_7841_dim,_7838_vdim);
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7843_shape = _12883_;
  _checked_ptr_1<int32_t> _ptr__7843_shape(_7843_shape ? _7843_shape->raw() : nullptr,_7843_shape ? _7843_shape->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _12885_;
  bool _12886_ = (_7841_dim == (int)((_7839_a)->size(0)));
  if (_12886_)
  {
    _12885_ = nullptr;
  }
  else
  {
    _12885_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_mul( (int)((_7839_a)->size(0)),_7838_vdim ))));
  }
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7844_inst = _12885_;
  _checked_ptr_1<int64_t> _ptr__7844_inst(_7844_inst ? _7844_inst->raw() : nullptr,_7844_inst ? _7844_inst->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7845_bfix = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(safe_mul( (int)((_7839_a)->size(0)),_7838_vdim ))));
  _checked_ptr_1<double> _ptr__7845_bfix(_7845_bfix ? _7845_bfix->raw() : nullptr,_7845_bfix ? _7845_bfix->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _7846_cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(safe_mul( (int)((_7839_a)->size(0)),_7838_vdim ))));
  _checked_ptr_1<double> _ptr__7846_cof(_7846_cof ? _7846_cof->raw() : nullptr,_7846_cof ? _7846_cof->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7847_subj = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_mul( (int)((_7839_a)->size(0)),_7838_vdim ))));
  _checked_ptr_1<int64_t> _ptr__7847_subj(_7847_subj ? _7847_subj->raw() : nullptr,_7847_subj ? _7847_subj->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _7848_ptrb = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( safe_mul( (int)((_7839_a)->size(0)),_7838_vdim ),(int)1 ))));
  _checked_ptr_1<int64_t> _ptr__7848_ptrb(_7848_ptrb ? _7848_ptrb->raw() : nullptr,_7848_ptrb ? _7848_ptrb->size(0) : 0);
  if ((_7841_dim == (int)((_7839_a)->size(0))))
  {
    {
      int64_t _7849_k = (int64_t)0;
      if ((!_7842_transpose))
      {
        {
          int32_t _12887_ = (int)0;
          int32_t _12888_ = _7838_vdim;
          for (int32_t _7850_j = _12887_; _7850_j < _12888_; ++_7850_j)
          {
            {
              int32_t _12889_ = (int)0;
              int32_t _12890_ = _7841_dim;
              for (int32_t _7851_i = _12889_; _7851_i < _12890_; ++_7851_i)
              {
                {
                  _ptr__7848_ptrb[safe_add( _7849_k,(int)1 )] = safe_add( _7849_k,(int)1 );
                  _ptr__7847_subj[_7849_k] = (int64_t)_7850_j;
                  _ptr__7846_cof[_7849_k] = _ptr__7839_a[_7851_i];
                  ++ _7849_k;
                }
              }
            }
          }
        }
      }
      else
      {
        {
          int32_t _12891_ = (int)0;
          int32_t _12892_ = _7841_dim;
          for (int32_t _7852_i = _12891_; _7852_i < _12892_; ++_7852_i)
          {
            {
              int32_t _12893_ = (int)0;
              int32_t _12894_ = _7838_vdim;
              for (int32_t _7853_j = _12893_; _7853_j < _12894_; ++_7853_j)
              {
                {
                  _ptr__7848_ptrb[safe_add( _7849_k,(int)1 )] = safe_add( _7849_k,(int)1 );
                  _ptr__7847_subj[_7849_k] = (int64_t)_7853_j;
                  _ptr__7846_cof[_7849_k] = _ptr__7839_a[_7852_i];
                  ++ _7849_k;
                }
              }
            }
          }
        }
      }
    }
  }
  else
  {
    {
      int64_t _7854_k = (int64_t)0;
      if ((!_7842_transpose))
      {
        {
          int32_t _12895_ = (int)0;
          int32_t _12896_ = _7838_vdim;
          for (int32_t _7855_j = _12895_; _7855_j < _12896_; ++_7855_j)
          {
            {
              int32_t _12897_ = (int)0;
              int32_t _12898_ = (int)((_7839_a)->size(0));
              for (int32_t _7856_i = _12897_; _7856_i < _12898_; ++_7856_i)
              {
                {
                  _ptr__7848_ptrb[safe_add( _7854_k,(int)1 )] = safe_add( _7854_k,(int)1 );
                  _ptr__7847_subj[_7854_k] = (int64_t)_7855_j;
                  _ptr__7846_cof[_7854_k] = _ptr__7839_a[_7856_i];
                  _ptr__7844_inst[_7854_k] = safe_add( safe_mul( _7855_j,_7841_dim ),_ptr__7840_sub[_7856_i] );
                  ++ _7854_k;
                }
              }
            }
          }
        }
      }
      else
      {
        {
          int32_t _12899_ = (int)0;
          int32_t _12900_ = (int)((_7839_a)->size(0));
          for (int32_t _7857_i = _12899_; _7857_i < _12900_; ++_7857_i)
          {
            {
              int32_t _12901_ = (int)0;
              int32_t _12902_ = _7838_vdim;
              for (int32_t _7858_j = _12901_; _7858_j < _12902_; ++_7858_j)
              {
                {
                  _ptr__7848_ptrb[safe_add( _7854_k,(int)1 )] = safe_add( _7854_k,(int)1 );
                  _ptr__7847_subj[_7854_k] = (int64_t)_7858_j;
                  _ptr__7846_cof[_7854_k] = _ptr__7839_a[_7857_i];
                  _ptr__7844_inst[_7854_k] = safe_add( safe_mul( _ptr__7840_sub[_7857_i],_7838_vdim ),_7858_j );
                  ++ _7854_k;
                }
              }
            }
          }
        }
      }
    }
  }
  return (::mosek::fusion::p_Expr::_new_Expr(_7848_ptrb,_7847_subj,_7846_cof,_7845_bfix,_7843_shape,_7844_inst)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.outer_

// Begin mosek.fusion.Expr.stack
// Method mosek.fusion.Expr.stack @ bld/grindsted/final/default/src/fusion/Expr.mbi:964:6-978:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::stack
  ( std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >,1 > > _7859_exprs) { return mosek::fusion::p_Expr::stack(_7859_exprs); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack(std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >,1 > > _7859_exprs)
{
  if ((NULL == _7859_exprs.get()))
  {
    {
      throw monty::NullPointerException(std::string ("Argument exprs may not be null"));
    }
  }
  {}
  int32_t _12903_ = (int)0;
  int32_t _12904_ = (int)((_7859_exprs)->size(0));
  for (int32_t _7860_i = _12903_; _7860_i < _12904_; ++_7860_i)
  {
    {
      std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7861_es = ((*_7859_exprs)(_7860_i));
      if ((NULL == _7861_es.get()))
      {
        {
          throw monty::NullPointerException(std::string ("Arguments for stack may not be null"));
        }
      }
      {}
      int32_t _12905_ = (int)0;
      int32_t _12906_ = (int)((_7861_es)->size(0));
      for (int32_t _7862_j = _12905_; _7862_j < _12906_; ++_7862_j)
      {
        {
          if ((NULL == ((*_7861_es)(_7862_j)).get()))
          {
            {
              throw monty::NullPointerException(std::string ("Arguments for stack may not be null"));
            }
          }
          {}
        }
      }
    }
  }
  std::vector<monty::rc_ptr< ::mosek::fusion::Expression >> _12907_;
  for (int32_t _7864_i = (int)0, _12908_ = (int)((_7859_exprs)->size(0)); _7864_i < _12908_ ; ++_7864_i)
  {
    _12907_.push_back(::mosek::fusion::p_Expr::stack_(((*_7859_exprs)(_7864_i)),(int)1));
  }
  auto _12909_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >(monty::shape(_12907_.size()),_12907_.begin(),_12907_.end()));
  std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7863_tmp = _12909_;
  return ::mosek::fusion::p_Expr::stack_(_7863_tmp,(int)0);
}
// End mosek.fusion.Expr.stack

// Begin mosek.fusion.Expr.vstack
// Method mosek.fusion.Expr.vstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:954:6-160
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::vstack
  ( double _7865_a1,
    double _7866_a2,
    double _7867_a3) { return mosek::fusion::p_Expr::vstack(_7865_a1,_7866_a2,_7867_a3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::vstack(double _7865_a1,double _7866_a2,double _7867_a3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7865_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7866_a2).get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7867_a3).get())}),(int)0);
}
// End mosek.fusion.Expr.vstack

// Begin mosek.fusion.Expr.vstack
// Method mosek.fusion.Expr.vstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:953:6-149
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::vstack
  ( double _7868_a1,
    double _7869_a2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7870_e3) { return mosek::fusion::p_Expr::vstack(_7868_a1,_7869_a2,_7870_e3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::vstack(double _7868_a1,double _7869_a2,monty::rc_ptr< ::mosek::fusion::Expression > _7870_e3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7868_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7869_a2).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7870_e3.get())}),(int)0);
}
// End mosek.fusion.Expr.vstack

// Begin mosek.fusion.Expr.vstack
// Method mosek.fusion.Expr.vstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:952:6-149
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::vstack
  ( double _7871_a1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7872_e2,
    double _7873_a3) { return mosek::fusion::p_Expr::vstack(_7871_a1,_7872_e2,_7873_a3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::vstack(double _7871_a1,monty::rc_ptr< ::mosek::fusion::Expression > _7872_e2,double _7873_a3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7871_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7872_e2.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7873_a3).get())}),(int)0);
}
// End mosek.fusion.Expr.vstack

// Begin mosek.fusion.Expr.vstack
// Method mosek.fusion.Expr.vstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:951:6-138
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::vstack
  ( double _7874_a1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7875_e2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7876_e3) { return mosek::fusion::p_Expr::vstack(_7874_a1,_7875_e2,_7876_e3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::vstack(double _7874_a1,monty::rc_ptr< ::mosek::fusion::Expression > _7875_e2,monty::rc_ptr< ::mosek::fusion::Expression > _7876_e3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7874_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7875_e2.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7876_e3.get())}),(int)0);
}
// End mosek.fusion.Expr.vstack

// Begin mosek.fusion.Expr.vstack
// Method mosek.fusion.Expr.vstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:949:6-153
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::vstack
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7877_e1,
    double _7878_a2,
    double _7879_a3) { return mosek::fusion::p_Expr::vstack(_7877_e1,_7878_a2,_7879_a3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::vstack(monty::rc_ptr< ::mosek::fusion::Expression > _7877_e1,double _7878_a2,double _7879_a3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7877_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7878_a2).get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7879_a3).get())}),(int)0);
}
// End mosek.fusion.Expr.vstack

// Begin mosek.fusion.Expr.vstack
// Method mosek.fusion.Expr.vstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:948:6-142
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::vstack
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7880_e1,
    double _7881_a2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7882_e3) { return mosek::fusion::p_Expr::vstack(_7880_e1,_7881_a2,_7882_e3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::vstack(monty::rc_ptr< ::mosek::fusion::Expression > _7880_e1,double _7881_a2,monty::rc_ptr< ::mosek::fusion::Expression > _7882_e3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7880_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7881_a2).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7882_e3.get())}),(int)0);
}
// End mosek.fusion.Expr.vstack

// Begin mosek.fusion.Expr.vstack
// Method mosek.fusion.Expr.vstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:947:6-142
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::vstack
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7883_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7884_e2,
    double _7885_a3) { return mosek::fusion::p_Expr::vstack(_7883_e1,_7884_e2,_7885_a3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::vstack(monty::rc_ptr< ::mosek::fusion::Expression > _7883_e1,monty::rc_ptr< ::mosek::fusion::Expression > _7884_e2,double _7885_a3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7883_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7884_e2.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7885_a3).get())}),(int)0);
}
// End mosek.fusion.Expr.vstack

// Begin mosek.fusion.Expr.vstack
// Method mosek.fusion.Expr.vstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:946:6-131
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::vstack
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7886_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7887_e2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7888_e3) { return mosek::fusion::p_Expr::vstack(_7886_e1,_7887_e2,_7888_e3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::vstack(monty::rc_ptr< ::mosek::fusion::Expression > _7886_e1,monty::rc_ptr< ::mosek::fusion::Expression > _7887_e2,monty::rc_ptr< ::mosek::fusion::Expression > _7888_e3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7886_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7887_e2.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7888_e3.get())}),(int)0);
}
// End mosek.fusion.Expr.vstack

// Begin mosek.fusion.Expr.vstack
// Method mosek.fusion.Expr.vstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:942:6-120
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::vstack
  ( double _7889_a1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7890_e2) { return mosek::fusion::p_Expr::vstack(_7889_a1,_7890_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::vstack(double _7889_a1,monty::rc_ptr< ::mosek::fusion::Expression > _7890_e2)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7889_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7890_e2.get())}),(int)0);
}
// End mosek.fusion.Expr.vstack

// Begin mosek.fusion.Expr.vstack
// Method mosek.fusion.Expr.vstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:941:6-124
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::vstack
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7891_e1,
    double _7892_a2) { return mosek::fusion::p_Expr::vstack(_7891_e1,_7892_a2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::vstack(monty::rc_ptr< ::mosek::fusion::Expression > _7891_e1,double _7892_a2)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7891_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7892_a2).get())}),(int)0);
}
// End mosek.fusion.Expr.vstack

// Begin mosek.fusion.Expr.vstack
// Method mosek.fusion.Expr.vstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:940:6-113
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::vstack
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7893_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7894_e2) { return mosek::fusion::p_Expr::vstack(_7893_e1,_7894_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::vstack(monty::rc_ptr< ::mosek::fusion::Expression > _7893_e1,monty::rc_ptr< ::mosek::fusion::Expression > _7894_e2)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7893_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7894_e2.get())}),(int)0);
}
// End mosek.fusion.Expr.vstack

// Begin mosek.fusion.Expr.vstack
// Method mosek.fusion.Expr.vstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:929:6-936:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::vstack
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7895_exprs) { return mosek::fusion::p_Expr::vstack(_7895_exprs); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::vstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7895_exprs)
{
  if ((NULL == _7895_exprs.get()))
  {
    {
      throw monty::NullPointerException(std::string ("Argument exprs may not be null"));
    }
  }
  {}
  int32_t _12910_ = (int)0;
  int32_t _12911_ = (int)((_7895_exprs)->size(0));
  for (int32_t _7896_i = _12910_; _7896_i < _12911_; ++_7896_i)
  {
    {
      if ((NULL == ((*_7895_exprs)(_7896_i)).get()))
      {
        {
          throw monty::NullPointerException(std::string ("Arguments for vstack may not be null"));
        }
      }
      {}
    }
  }
  return ::mosek::fusion::p_Expr::stack_(_7895_exprs,(int)0);
}
// End mosek.fusion.Expr.vstack

// Begin mosek.fusion.Expr.hstack
// Method mosek.fusion.Expr.hstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:921:6-250
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::hstack
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7897_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7898_e2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7899_e3) { return mosek::fusion::p_Expr::hstack(_7897_e1,_7898_e2,_7899_e3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::hstack(monty::rc_ptr< ::mosek::fusion::Expression > _7897_e1,monty::rc_ptr< ::mosek::fusion::Expression > _7898_e2,monty::rc_ptr< ::mosek::fusion::Expression > _7899_e3)
{
  if (((NULL == _7897_e1.get()) || ((NULL == _7898_e2.get()) || (NULL == _7899_e3.get()))))
  {
    {
      throw monty::NullPointerException(std::string ("Arguments e1, e2 and e3 may not be null"));
    }
  }
  {}
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7897_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7898_e2.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7899_e3.get())}),(int)1);
}
// End mosek.fusion.Expr.hstack

// Begin mosek.fusion.Expr.hstack
// Method mosek.fusion.Expr.hstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:890:6-153
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::hstack
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7900_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7901_e2,
    double _7902_a3) { return mosek::fusion::p_Expr::hstack(_7900_e1,_7901_e2,_7902_a3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::hstack(monty::rc_ptr< ::mosek::fusion::Expression > _7900_e1,monty::rc_ptr< ::mosek::fusion::Expression > _7901_e2,double _7902_a3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7900_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7901_e2.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7902_a3).get())}),(int)1);
}
// End mosek.fusion.Expr.hstack

// Begin mosek.fusion.Expr.hstack
// Method mosek.fusion.Expr.hstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:889:6-153
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::hstack
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7903_e1,
    double _7904_a2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7905_e3) { return mosek::fusion::p_Expr::hstack(_7903_e1,_7904_a2,_7905_e3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::hstack(monty::rc_ptr< ::mosek::fusion::Expression > _7903_e1,double _7904_a2,monty::rc_ptr< ::mosek::fusion::Expression > _7905_e3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7903_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7904_a2).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7905_e3.get())}),(int)1);
}
// End mosek.fusion.Expr.hstack

// Begin mosek.fusion.Expr.hstack
// Method mosek.fusion.Expr.hstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:888:6-153
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::hstack
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7906_e1,
    double _7907_a2,
    double _7908_a3) { return mosek::fusion::p_Expr::hstack(_7906_e1,_7907_a2,_7908_a3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::hstack(monty::rc_ptr< ::mosek::fusion::Expression > _7906_e1,double _7907_a2,double _7908_a3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7906_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7907_a2).get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7908_a3).get())}),(int)1);
}
// End mosek.fusion.Expr.hstack

// Begin mosek.fusion.Expr.hstack
// Method mosek.fusion.Expr.hstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:886:6-164
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::hstack
  ( double _7909_a1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7910_e2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7911_e3) { return mosek::fusion::p_Expr::hstack(_7909_a1,_7910_e2,_7911_e3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::hstack(double _7909_a1,monty::rc_ptr< ::mosek::fusion::Expression > _7910_e2,monty::rc_ptr< ::mosek::fusion::Expression > _7911_e3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7909_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7910_e2.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7911_e3.get())}),(int)1);
}
// End mosek.fusion.Expr.hstack

// Begin mosek.fusion.Expr.hstack
// Method mosek.fusion.Expr.hstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:885:6-164
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::hstack
  ( double _7912_a1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7913_e2,
    double _7914_a3) { return mosek::fusion::p_Expr::hstack(_7912_a1,_7913_e2,_7914_a3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::hstack(double _7912_a1,monty::rc_ptr< ::mosek::fusion::Expression > _7913_e2,double _7914_a3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7912_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7913_e2.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7914_a3).get())}),(int)1);
}
// End mosek.fusion.Expr.hstack

// Begin mosek.fusion.Expr.hstack
// Method mosek.fusion.Expr.hstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:884:6-164
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::hstack
  ( double _7915_a1,
    double _7916_a2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7917_e3) { return mosek::fusion::p_Expr::hstack(_7915_a1,_7916_a2,_7917_e3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::hstack(double _7915_a1,double _7916_a2,monty::rc_ptr< ::mosek::fusion::Expression > _7917_e3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7915_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7916_a2).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7917_e3.get())}),(int)1);
}
// End mosek.fusion.Expr.hstack

// Begin mosek.fusion.Expr.hstack
// Method mosek.fusion.Expr.hstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:882:6-122
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::hstack
  ( double _7918_a1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7919_e2) { return mosek::fusion::p_Expr::hstack(_7918_a1,_7919_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::hstack(double _7918_a1,monty::rc_ptr< ::mosek::fusion::Expression > _7919_e2)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7918_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7919_e2.get())}),(int)1);
}
// End mosek.fusion.Expr.hstack

// Begin mosek.fusion.Expr.hstack
// Method mosek.fusion.Expr.hstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:881:6-124
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::hstack
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7920_e1,
    double _7921_a2) { return mosek::fusion::p_Expr::hstack(_7920_e1,_7921_a2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::hstack(monty::rc_ptr< ::mosek::fusion::Expression > _7920_e1,double _7921_a2)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7920_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7921_a2).get())}),(int)1);
}
// End mosek.fusion.Expr.hstack

// Begin mosek.fusion.Expr.hstack
// Method mosek.fusion.Expr.hstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:880:6-113
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::hstack
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7922_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7923_e2) { return mosek::fusion::p_Expr::hstack(_7922_e1,_7923_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::hstack(monty::rc_ptr< ::mosek::fusion::Expression > _7922_e1,monty::rc_ptr< ::mosek::fusion::Expression > _7923_e2)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7922_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7923_e2.get())}),(int)1);
}
// End mosek.fusion.Expr.hstack

// Begin mosek.fusion.Expr.hstack
// Method mosek.fusion.Expr.hstack @ bld/grindsted/final/default/src/fusion/Expr.mbi:870:6-878:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::hstack
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7924_exprs) { return mosek::fusion::p_Expr::hstack(_7924_exprs); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::hstack(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7924_exprs)
{
  if ((NULL == _7924_exprs.get()))
  {
    {
      throw monty::NullPointerException(std::string ("Argument exprs may not be null"));
    }
  }
  {}
  int32_t _12912_ = (int)0;
  int32_t _12913_ = (int)((_7924_exprs)->size(0));
  for (int32_t _7925_i = _12912_; _7925_i < _12913_; ++_7925_i)
  {
    {
      if ((NULL == ((*_7924_exprs)(_7925_i)).get()))
      {
        {
          throw monty::NullPointerException(std::string ("Arguments for hstack may not be null"));
        }
      }
      {}
    }
  }
  return ::mosek::fusion::p_Expr::stack_(_7924_exprs,(int)1);
}
// End mosek.fusion.Expr.hstack

// Begin mosek.fusion.Expr.stack
// Method mosek.fusion.Expr.stack @ bld/grindsted/final/default/src/fusion/Expr.mbi:867:6-165
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::stack
  ( int32_t _7926_dim,
    monty::rc_ptr< ::mosek::fusion::Expression > _7927_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7928_e2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7929_e3) { return mosek::fusion::p_Expr::stack(_7926_dim,_7927_e1,_7928_e2,_7929_e3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack(int32_t _7926_dim,monty::rc_ptr< ::mosek::fusion::Expression > _7927_e1,monty::rc_ptr< ::mosek::fusion::Expression > _7928_e2,monty::rc_ptr< ::mosek::fusion::Expression > _7929_e3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7927_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7928_e2.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7929_e3.get())}),_7926_dim);
}
// End mosek.fusion.Expr.stack

// Begin mosek.fusion.Expr.stack
// Method mosek.fusion.Expr.stack @ bld/grindsted/final/default/src/fusion/Expr.mbi:866:6-165
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::stack
  ( int32_t _7930_dim,
    monty::rc_ptr< ::mosek::fusion::Expression > _7931_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7932_e2,
    double _7933_a3) { return mosek::fusion::p_Expr::stack(_7930_dim,_7931_e1,_7932_e2,_7933_a3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack(int32_t _7930_dim,monty::rc_ptr< ::mosek::fusion::Expression > _7931_e1,monty::rc_ptr< ::mosek::fusion::Expression > _7932_e2,double _7933_a3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7931_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7932_e2.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7933_a3).get())}),_7930_dim);
}
// End mosek.fusion.Expr.stack

// Begin mosek.fusion.Expr.stack
// Method mosek.fusion.Expr.stack @ bld/grindsted/final/default/src/fusion/Expr.mbi:865:6-165
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::stack
  ( int32_t _7934_dim,
    monty::rc_ptr< ::mosek::fusion::Expression > _7935_e1,
    double _7936_a2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7937_e3) { return mosek::fusion::p_Expr::stack(_7934_dim,_7935_e1,_7936_a2,_7937_e3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack(int32_t _7934_dim,monty::rc_ptr< ::mosek::fusion::Expression > _7935_e1,double _7936_a2,monty::rc_ptr< ::mosek::fusion::Expression > _7937_e3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7935_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7936_a2).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7937_e3.get())}),_7934_dim);
}
// End mosek.fusion.Expr.stack

// Begin mosek.fusion.Expr.stack
// Method mosek.fusion.Expr.stack @ bld/grindsted/final/default/src/fusion/Expr.mbi:864:6-165
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::stack
  ( int32_t _7938_dim,
    monty::rc_ptr< ::mosek::fusion::Expression > _7939_e1,
    double _7940_a2,
    double _7941_a3) { return mosek::fusion::p_Expr::stack(_7938_dim,_7939_e1,_7940_a2,_7941_a3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack(int32_t _7938_dim,monty::rc_ptr< ::mosek::fusion::Expression > _7939_e1,double _7940_a2,double _7941_a3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7939_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7940_a2).get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7941_a3).get())}),_7938_dim);
}
// End mosek.fusion.Expr.stack

// Begin mosek.fusion.Expr.stack
// Method mosek.fusion.Expr.stack @ bld/grindsted/final/default/src/fusion/Expr.mbi:862:6-176
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::stack
  ( int32_t _7942_dim,
    double _7943_a1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7944_e2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7945_e3) { return mosek::fusion::p_Expr::stack(_7942_dim,_7943_a1,_7944_e2,_7945_e3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack(int32_t _7942_dim,double _7943_a1,monty::rc_ptr< ::mosek::fusion::Expression > _7944_e2,monty::rc_ptr< ::mosek::fusion::Expression > _7945_e3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7943_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7944_e2.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7945_e3.get())}),_7942_dim);
}
// End mosek.fusion.Expr.stack

// Begin mosek.fusion.Expr.stack
// Method mosek.fusion.Expr.stack @ bld/grindsted/final/default/src/fusion/Expr.mbi:861:6-176
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::stack
  ( int32_t _7946_dim,
    double _7947_a1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7948_e2,
    double _7949_a3) { return mosek::fusion::p_Expr::stack(_7946_dim,_7947_a1,_7948_e2,_7949_a3); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack(int32_t _7946_dim,double _7947_a1,monty::rc_ptr< ::mosek::fusion::Expression > _7948_e2,double _7949_a3)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7947_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7948_e2.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7949_a3).get())}),_7946_dim);
}
// End mosek.fusion.Expr.stack

// Begin mosek.fusion.Expr.stack
// Method mosek.fusion.Expr.stack @ bld/grindsted/final/default/src/fusion/Expr.mbi:860:6-176
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::stack
  ( int32_t _7950_dim,
    double _7951_a1,
    double _7952_a2,
    monty::rc_ptr< ::mosek::fusion::Expression > _7953_e1) { return mosek::fusion::p_Expr::stack(_7950_dim,_7951_a1,_7952_a2,_7953_e1); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack(int32_t _7950_dim,double _7951_a1,double _7952_a2,monty::rc_ptr< ::mosek::fusion::Expression > _7953_e1)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7951_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7952_a2).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7953_e1.get())}),_7950_dim);
}
// End mosek.fusion.Expr.stack

// Begin mosek.fusion.Expr.stack
// Method mosek.fusion.Expr.stack @ bld/grindsted/final/default/src/fusion/Expr.mbi:859:6-134
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::stack
  ( int32_t _7954_dim,
    double _7955_a1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7956_e2) { return mosek::fusion::p_Expr::stack(_7954_dim,_7955_a1,_7956_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack(int32_t _7954_dim,double _7955_a1,monty::rc_ptr< ::mosek::fusion::Expression > _7956_e2)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7955_a1).get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7956_e2.get())}),_7954_dim);
}
// End mosek.fusion.Expr.stack

// Begin mosek.fusion.Expr.stack
// Method mosek.fusion.Expr.stack @ bld/grindsted/final/default/src/fusion/Expr.mbi:858:6-136
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::stack
  ( int32_t _7957_dim,
    monty::rc_ptr< ::mosek::fusion::Expression > _7958_e1,
    double _7959_a2) { return mosek::fusion::p_Expr::stack(_7957_dim,_7958_e1,_7959_a2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack(int32_t _7957_dim,monty::rc_ptr< ::mosek::fusion::Expression > _7958_e1,double _7959_a2)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7958_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(::mosek::fusion::p_Expr::constTerm(_7959_a2).get())}),_7957_dim);
}
// End mosek.fusion.Expr.stack

// Begin mosek.fusion.Expr.stack
// Method mosek.fusion.Expr.stack @ bld/grindsted/final/default/src/fusion/Expr.mbi:857:6-125
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::stack
  ( int32_t _7960_dim,
    monty::rc_ptr< ::mosek::fusion::Expression > _7961_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _7962_e2) { return mosek::fusion::p_Expr::stack(_7960_dim,_7961_e1,_7962_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack(int32_t _7960_dim,monty::rc_ptr< ::mosek::fusion::Expression > _7961_e1,monty::rc_ptr< ::mosek::fusion::Expression > _7962_e2)
{
  return ::mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >{::monty::rc_ptr<::mosek::fusion::Expression>(_7961_e1.get()),::monty::rc_ptr<::mosek::fusion::Expression>(_7962_e2.get())}),_7960_dim);
}
// End mosek.fusion.Expr.stack

// Begin mosek.fusion.Expr.stack
// Method mosek.fusion.Expr.stack @ bld/grindsted/final/default/src/fusion/Expr.mbi:856:6-105
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::stack
  ( int32_t _7963_dim,
    std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7964_exprs) { return mosek::fusion::p_Expr::stack(_7963_dim,_7964_exprs); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack(int32_t _7963_dim,std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7964_exprs)
{
  return ::mosek::fusion::p_Expr::stack_(_7964_exprs,_7963_dim);
}
// End mosek.fusion.Expr.stack

// Begin mosek.fusion.Expr.stack_
// Method mosek.fusion.Expr.stack_ @ bld/grindsted/final/default/src/fusion/Expr.mbi:845:6-854:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::stack_(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7965_exprs,int32_t _7966_dim)
{
  if (((int)((_7965_exprs)->size(0)) == (int)1))
  {
    {
      return ((*_7965_exprs)((int)0));
    }
  }
  else
  {
    {
      return (::mosek::fusion::p_ExprStack::_new_ExprStack(::mosek::fusion::p_Expr::promote(_7965_exprs,_7966_dim),_7966_dim)).as<::mosek::fusion::Expression>();
    }
  }
}
// End mosek.fusion.Expr.stack_

// Begin mosek.fusion.Expr.promote
// Method mosek.fusion.Expr.promote @ bld/grindsted/final/default/src/fusion/Expr.mbi:814:6-843:7
std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > mosek::fusion::p_Expr::promote(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7967_exprs,int32_t _7968_dim)
{
  int32_t _7969_n = (int)((_7967_exprs)->size(0));
  std::vector<int32_t> _12914_;
  for (int32_t _7971_i = (int)0, _12915_ = _7969_n; _7971_i < _12915_ ; ++_7971_i)
  {
    _12914_.push_back(((*_7967_exprs)(_7971_i))->getND());
  }
  auto _12916_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12914_.size()),_12914_.begin(),_12914_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _7970_nds = _12916_;
  _checked_ptr_1<int32_t> _ptr__7970_nds(_7970_nds ? _7970_nds->raw() : nullptr,_7970_nds ? _7970_nds->size(0) : 0);
  int32_t _7972_maxnd = _ptr__7970_nds[(int)0];
  int32_t _7973_minnd = _ptr__7970_nds[(int)0];
  int32_t _12917_ = (int)1;
  int32_t _12918_ = _7969_n;
  for (int32_t _7974_i = _12917_; _7974_i < _12918_; ++_7974_i)
  {
    {
      if ((_ptr__7970_nds[_7974_i] < _7973_minnd))
      {
        {
          _7973_minnd = _ptr__7970_nds[_7974_i];
        }
      }
      {}
      if ((_ptr__7970_nds[_7974_i] > _7972_maxnd))
      {
        {
          _7972_maxnd = _ptr__7970_nds[_7974_i];
        }
      }
      {}
    }
  }
  if ((_7972_maxnd < _7968_dim))
  {
    {
      _7972_maxnd = _7968_dim;
    }
  }
  {}
  if ((_7973_minnd < _7972_maxnd))
  {
    {
      std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7975_rexprs = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 >(monty::shape(_7969_n)));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7976_shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_7972_maxnd)));
      _checked_ptr_1<int32_t> _ptr__7976_shape(_7976_shape ? _7976_shape->raw() : nullptr,_7976_shape ? _7976_shape->size(0) : 0);
      int32_t _12919_ = (int)0;
      int32_t _12920_ = _7969_n;
      for (int32_t _7977_i = _12919_; _7977_i < _12920_; ++_7977_i)
      {
        {
          if ((((*_7967_exprs)(_7977_i))->getND() == _7972_maxnd))
          {
            {
              ((*_7975_rexprs)(_7977_i)) = ((*_7967_exprs)(_7977_i));
            }
          }
          else
          {
            {
              std::shared_ptr< monty::ndarray< int32_t,1 > > _7978_s = ((*_7967_exprs)(_7977_i))->getShape();
              _checked_ptr_1<int32_t> _ptr__7978_s(_7978_s ? _7978_s->raw() : nullptr,_7978_s ? _7978_s->size(0) : 0);
              int32_t _12921_ = (int)0;
              int32_t _12922_ = (int)((_7978_s)->size(0));
              for (int32_t _7979_j = _12921_; _7979_j < _12922_; ++_7979_j)
              {
                {
                  _ptr__7976_shape[_7979_j] = _ptr__7978_s[_7979_j];
                }
              }
              int32_t _12923_ = (int)((_7978_s)->size(0));
              int32_t _12924_ = _7972_maxnd;
              for (int32_t _7980_j = _12923_; _7980_j < _12924_; ++_7980_j)
              {
                {
                  _ptr__7976_shape[_7980_j] = (int)1;
                }
              }
              ((*_7975_rexprs)(_7977_i)) = (::mosek::fusion::p_ExprReshape::_new_ExprReshape(_7976_shape,((*_7967_exprs)(_7977_i)))).as<::mosek::fusion::Expression>();
            }
          }
        }
      }
      return _7975_rexprs;
    }
  }
  else
  {
    {
      return _7967_exprs;
    }
  }
}
// End mosek.fusion.Expr.promote

// Begin mosek.fusion.Expr.repeat
// Method mosek.fusion.Expr.repeat @ bld/grindsted/final/default/src/fusion/Expr.mbi:809:6-811:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::repeat
  ( monty::rc_ptr< ::mosek::fusion::Variable > _7981_x,
    int32_t _7982_n,
    int32_t _7983_d) { return mosek::fusion::p_Expr::repeat(_7981_x,_7982_n,_7983_d); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::repeat(monty::rc_ptr< ::mosek::fusion::Variable > _7981_x,int32_t _7982_n,int32_t _7983_d)
{
  return ::mosek::fusion::p_Expr::repeat(_7981_x->__mosek_2fusion_2Variable__asExpr(),_7982_n,_7983_d);
}
// End mosek.fusion.Expr.repeat

// Begin mosek.fusion.Expr.repeat
// Method mosek.fusion.Expr.repeat @ bld/grindsted/final/default/src/fusion/Expr.mbi:792:6-807:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::repeat
  ( monty::rc_ptr< ::mosek::fusion::Expression > _7984_e,
    int32_t _7985_n,
    int32_t _7986_d) { return mosek::fusion::p_Expr::repeat(_7984_e,_7985_n,_7986_d); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::repeat(monty::rc_ptr< ::mosek::fusion::Expression > _7984_e,int32_t _7985_n,int32_t _7986_d)
{
  if ((_7985_n <= (int)0))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Cannot repeat Expression 0 or less times"));
    }
  }
  {}
  if (((_7986_d < (int)0) || (_7986_d > _7984_e->getND())))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Invalid stacking dimension"));
    }
  }
  else
  {
    {
      if ((_7986_d == _7984_e->getND()))
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _7987_s = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(safe_add( _7986_d,(int)1 ))));
          _checked_ptr_1<int32_t> _ptr__7987_s(_7987_s ? _7987_s->raw() : nullptr,_7987_s ? _7987_s->size(0) : 0);
          int32_t _12925_ = (int)0;
          int32_t _12926_ = _7986_d;
          for (int32_t _7988_i = _12925_; _7988_i < _12926_; ++_7988_i)
          {
            {
              _ptr__7987_s[_7988_i] = _7984_e->getDim(_7988_i);
            }
          }
          _ptr__7987_s[_7986_d] = (int)1;
          return (::mosek::fusion::p_ExprRepeat::_new_ExprRepeat(::mosek::fusion::p_Expr::reshape(_7984_e,_7987_s),_7986_d,_7985_n)).as<::mosek::fusion::Expression>();
        }
      }
      else
      {
        {
          return (::mosek::fusion::p_ExprRepeat::_new_ExprRepeat(_7984_e,_7986_d,_7985_n)).as<::mosek::fusion::Expression>();
        }
      }
    }
  }
}
// End mosek.fusion.Expr.repeat

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:785:6-790:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7989_exps) { return mosek::fusion::p_Expr::add(_7989_exps); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Expression >,1 > > _7989_exps)
{
  std::vector<double> _12927_;
  for (int32_t _7990_i = (int)0, _12928_ = (int)((_7989_exps)->size(0)); _7990_i < _12928_ ; ++_7990_i)
  {
    _12927_.push_back(1.0);
  }
  auto _12929_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_12927_.size()),_12927_.begin(),_12927_.end()));
  return (::mosek::fusion::p_ExprWSum::_new_ExprWSum(_7989_exps,_12929_)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:715:6-771:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _7991_vs) { return mosek::fusion::p_Expr::add(_7991_vs); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _7991_vs)
{
  if ((NULL == _7991_vs.get()))
  {
    {
      throw monty::NullPointerException(std::string ("Argument vs may not be null"));
    }
  }
  {}
  if (((int)((_7991_vs)->size(0)) == (int)0))
  {
    {
      return (::mosek::fusion::p_Expr::_new_Expr(std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >{(int64_t)((int)0)}),std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)0))),std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)0))),nullptr,::mosek::fusion::p_Set::make((int)0),std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)0))),(int)1)).as<::mosek::fusion::Expression>();
    }
  }
  {}
  if ((((int)((_7991_vs)->size(0)) > (int)0) && (NULL == ((*_7991_vs)((int)0)).get())))
  {
    {
      throw monty::NullPointerException(std::string ("Argument vs may contain null"));
    }
  }
  {}
  int32_t _7992_nd = ((*_7991_vs)((int)0))->getND();
  int32_t _12930_ = (int)1;
  int32_t _12931_ = (int)((_7991_vs)->size(0));
  for (int32_t _7993_i = _12930_; _7993_i < _12931_; ++_7993_i)
  {
    {
      if ((_7992_nd < ((*_7991_vs)(_7993_i))->getND()))
      {
        {
          _7992_nd = ((*_7991_vs)(_7993_i))->getND();
        }
      }
      {}
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,2 > > _7994_shapes = std::shared_ptr< monty::ndarray< int32_t,2 > >(new monty::ndarray< int32_t,2 >(monty::shape((int)((_7991_vs)->size(0)),_7992_nd)));
  int32_t _12932_ = (int)0;
  int32_t _12933_ = (int)((_7991_vs)->size(0));
  for (int32_t _7995_i = _12932_; _7995_i < _12933_; ++_7995_i)
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _7996_shp = ((*_7991_vs)(_7995_i))->getShape();
      _checked_ptr_1<int32_t> _ptr__7996_shp(_7996_shp ? _7996_shp->raw() : nullptr,_7996_shp ? _7996_shp->size(0) : 0);
      int32_t _12934_ = (int)0;
      int32_t _12935_ = (int)((_7996_shp)->size(0));
      for (int32_t _7997_j = _12934_; _7997_j < _12935_; ++_7997_j)
      {
        {
          ((*_7994_shapes)(_7995_i,_7997_j)) = _ptr__7996_shp[_7997_j];
        }
      }
      int32_t _12936_ = (int)((_7996_shp)->size(0));
      int32_t _12937_ = _7992_nd;
      for (int32_t _7998_j = _12936_; _7998_j < _12937_; ++_7998_j)
      {
        {
          ((*_7994_shapes)(_7995_i,_7998_j)) = (int)1;
        }
      }
    }
  }
  int32_t _12938_ = (int)1;
  int32_t _12939_ = (int)((_7991_vs)->size(0));
  for (int32_t _7999_i = _12938_; _7999_i < _12939_; ++_7999_i)
  {
    {
      int32_t _12940_ = (int)0;
      int32_t _12941_ = _7992_nd;
      for (int32_t _8000_j = _12940_; _8000_j < _12941_; ++_8000_j)
      {
        {
          if ((((*_7994_shapes)((int)0,_8000_j)) != ((*_7994_shapes)(_7999_i,_8000_j))))
          {
            {
              throw ::mosek::fusion::DimensionError(std::string ("Mismatching operand dimensions"));
            }
          }
          {}
        }
      }
    }
  }
  std::vector<int32_t> _12942_;
  for (int32_t _8002_j = (int)0, _12943_ = _7992_nd; _8002_j < _12943_ ; ++_8002_j)
  {
    _12942_.push_back(((*_7994_shapes)((int)0,_8002_j)));
  }
  auto _12944_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12942_.size()),_12942_.begin(),_12942_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8001_shape = _12944_;
  _checked_ptr_1<int32_t> _ptr__8001_shape(_8001_shape ? _8001_shape->raw() : nullptr,_8001_shape ? _8001_shape->size(0) : 0);
  int32_t _8003_sz = (int)1;
  int32_t _12945_ = (int)0;
  int32_t _12946_ = _7992_nd;
  for (int32_t _8004_i = _12945_; _8004_i < _12946_; ++_8004_i)
  {
    {
      _8003_sz *= _ptr__8001_shape[_8004_i];
    }
  }
  int32_t _8005_nnz = (int)0;
  int32_t _8006_maxnnz = (int)0;
  int32_t _12947_ = (int)0;
  int32_t _12948_ = (int)((_7991_vs)->size(0));
  for (int32_t _8007_i = _12947_; _8007_i < _12948_; ++_8007_i)
  {
    {
      int32_t _8008_n = ((*_7991_vs)(_8007_i))->numInst();
      _8005_nnz += _8008_n;
      int32_t _12949_;
      bool _12950_ = (_8006_maxnnz > _8008_n);
      if (_12950_)
      {
        _12949_ = _8006_maxnnz;
      }
      else
      {
        _12949_ = _8008_n;
      }
      _8006_maxnnz = _12949_;
    }
  }
  std::shared_ptr< monty::ndarray< int64_t,1 > > _8009_ptrb = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( _8003_sz,(int)1 ))));
  _checked_ptr_1<int64_t> _ptr__8009_ptrb(_8009_ptrb ? _8009_ptrb->raw() : nullptr,_8009_ptrb ? _8009_ptrb->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _8010_subj = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_8005_nnz)));
  _checked_ptr_1<int64_t> _ptr__8010_subj(_8010_subj ? _8010_subj->raw() : nullptr,_8010_subj ? _8010_subj->size(0) : 0);
  std::vector<double> _12951_;
  for (int32_t _8012_i = (int)0, _12952_ = _8005_nnz; _8012_i < _12952_ ; ++_8012_i)
  {
    _12951_.push_back(1.0);
  }
  auto _12953_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_12951_.size()),_12951_.begin(),_12951_.end()));
  std::shared_ptr< monty::ndarray< double,1 > > _8011_cof = _12953_;
  _checked_ptr_1<double> _ptr__8011_cof(_8011_cof ? _8011_cof->raw() : nullptr,_8011_cof ? _8011_cof->size(0) : 0);
  {
    std::shared_ptr< monty::ndarray< int64_t,1 > > _8013_ii = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_8006_maxnnz)));
    _checked_ptr_1<int64_t> _ptr__8013_ii(_8013_ii ? _8013_ii->raw() : nullptr,_8013_ii ? _8013_ii->size(0) : 0);
    std::shared_ptr< monty::ndarray< int64_t,1 > > _8014_idxs = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_8006_maxnnz)));
    _checked_ptr_1<int64_t> _ptr__8014_idxs(_8014_idxs ? _8014_idxs->raw() : nullptr,_8014_idxs ? _8014_idxs->size(0) : 0);
    int32_t _12954_ = (int)0;
    int32_t _12955_ = (int)((_7991_vs)->size(0));
    for (int32_t _8015_i = _12954_; _8015_i < _12955_; ++_8015_i)
    {
      {
        int32_t _8016_n = ((*_7991_vs)(_8015_i))->inst((int)0,_8013_ii,(int)0,_8014_idxs);
        int32_t _12956_ = (int)0;
        int32_t _12957_ = _8016_n;
        for (int32_t _8017_j = _12956_; _8017_j < _12957_; ++_8017_j)
        {
          {
            _ptr__8009_ptrb[safe_add( _ptr__8013_ii[_8017_j],(int)1 )] += (int)1;
          }
        }
      }
    }
    int32_t _12958_ = (int)0;
    int32_t _12959_ = _8003_sz;
    for (int32_t _8018_i = _12958_; _8018_i < _12959_; ++_8018_i)
    {
      {
        _ptr__8009_ptrb[safe_add( _8018_i,(int)1 )] += _ptr__8009_ptrb[_8018_i];
      }
    }
    int32_t _12960_ = (int)0;
    int32_t _12961_ = (int)((_7991_vs)->size(0));
    for (int32_t _8019_i = _12960_; _8019_i < _12961_; ++_8019_i)
    {
      {
        int32_t _8020_n = ((*_7991_vs)(_8019_i))->inst((int)0,_8013_ii,(int)0,_8014_idxs);
        int32_t _12962_ = (int)0;
        int32_t _12963_ = _8020_n;
        for (int32_t _8021_j = _12962_; _8021_j < _12963_; ++_8021_j)
        {
          {
            _ptr__8010_subj[_ptr__8009_ptrb[_ptr__8013_ii[_8021_j]]] = _ptr__8014_idxs[_8021_j];
            ++ _ptr__8009_ptrb[_ptr__8013_ii[_8021_j]];
          }
        }
      }
    }
    int32_t _12964_ = (int)0;
    int32_t _12965_ = _8003_sz;
    for (int32_t _8022_i = _12964_; _8022_i < _12965_; ++_8022_i)
    {
      {
        _ptr__8009_ptrb[(_8003_sz - _8022_i)] = _ptr__8009_ptrb[((_8003_sz - _8022_i) - (int)1)];
      }
    }
    _ptr__8009_ptrb[(int)0] = (int)0;
  }
  std::vector<double> _12966_;
  for (int32_t _8023_i = (int)0, _12967_ = _8003_sz; _8023_i < _12967_ ; ++_8023_i)
  {
    _12966_.push_back(0.0);
  }
  auto _12968_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_12966_.size()),_12966_.begin(),_12966_.end()));
  return (::mosek::fusion::p_Expr::_new_Expr(_8009_ptrb,_8010_subj,_8011_cof,_12968_,_8001_shape,nullptr,(int)1)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.add_
// Method mosek.fusion.Expr.add_ @ bld/grindsted/final/default/src/fusion/Expr.mbi:672:6-699:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add_(monty::rc_ptr< ::mosek::fusion::Expression > _8024_e1,double _8025_m1,monty::rc_ptr< ::mosek::fusion::Expression > _8026_e2,double _8027_m2)
{
  int32_t _8028_nd1 = _8024_e1->getND();
  int32_t _8029_nd2 = _8026_e2->getND();
  if ((_8028_nd1 == _8029_nd2))
  {
    {
      return (::mosek::fusion::p_ExprAdd::_new_ExprAdd(_8024_e1,_8026_e2,_8025_m1,_8027_m2)).as<::mosek::fusion::Expression>();
    }
  }
  else
  {
    {
      int32_t _12969_;
      bool _12970_ = (_8028_nd1 > _8029_nd2);
      if (_12970_)
      {
        _12969_ = _8028_nd1;
      }
      else
      {
        _12969_ = _8029_nd2;
      }
      int32_t _8030_nd = _12969_;
      std::shared_ptr< monty::ndarray< int32_t,1 > > _8031_shape = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8030_nd)));
      _checked_ptr_1<int32_t> _ptr__8031_shape(_8031_shape ? _8031_shape->raw() : nullptr,_8031_shape ? _8031_shape->size(0) : 0);
      if ((_8028_nd1 < _8029_nd2))
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _8032_sh = _8024_e1->getShape();
          _checked_ptr_1<int32_t> _ptr__8032_sh(_8032_sh ? _8032_sh->raw() : nullptr,_8032_sh ? _8032_sh->size(0) : 0);
          int32_t _12971_ = (int)0;
          int32_t _12972_ = _8028_nd1;
          for (int32_t _8033_i = _12971_; _8033_i < _12972_; ++_8033_i)
          {
            {
              _ptr__8031_shape[_8033_i] = _ptr__8032_sh[_8033_i];
            }
          }
          int32_t _12973_ = _8028_nd1;
          int32_t _12974_ = _8030_nd;
          for (int32_t _8034_i = _12973_; _8034_i < _12974_; ++_8034_i)
          {
            {
              _ptr__8031_shape[_8034_i] = (int)1;
            }
          }
          return (::mosek::fusion::p_ExprAdd::_new_ExprAdd((::mosek::fusion::p_ExprReshape::_new_ExprReshape(_8031_shape,_8024_e1)).as<::mosek::fusion::Expression>(),_8026_e2,_8025_m1,_8027_m2)).as<::mosek::fusion::Expression>();
        }
      }
      else
      {
        {
          std::shared_ptr< monty::ndarray< int32_t,1 > > _8035_sh = _8026_e2->getShape();
          _checked_ptr_1<int32_t> _ptr__8035_sh(_8035_sh ? _8035_sh->raw() : nullptr,_8035_sh ? _8035_sh->size(0) : 0);
          int32_t _12975_ = (int)0;
          int32_t _12976_ = _8029_nd2;
          for (int32_t _8036_i = _12975_; _8036_i < _12976_; ++_8036_i)
          {
            {
              _ptr__8031_shape[_8036_i] = _ptr__8035_sh[_8036_i];
            }
          }
          int32_t _12977_ = _8029_nd2;
          int32_t _12978_ = _8030_nd;
          for (int32_t _8037_i = _12977_; _8037_i < _12978_; ++_8037_i)
          {
            {
              _ptr__8031_shape[_8037_i] = (int)1;
            }
          }
          return (::mosek::fusion::p_ExprAdd::_new_ExprAdd(_8024_e1,(::mosek::fusion::p_ExprReshape::_new_ExprReshape(_8031_shape,_8026_e2)).as<::mosek::fusion::Expression>(),_8025_m1,_8027_m2)).as<::mosek::fusion::Expression>();
        }
      }
    }
  }
}
// End mosek.fusion.Expr.add_

// Begin mosek.fusion.Expr.transpose
// Method mosek.fusion.Expr.transpose @ bld/grindsted/final/default/src/fusion/Expr.mbi:661:6-670:7
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::transpose
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8038_e) { return mosek::fusion::p_Expr::transpose(_8038_e); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::transpose(monty::rc_ptr< ::mosek::fusion::Expression > _8038_e)
{
  if ((_8038_e->getND() == (int)0))
  {
    {
      return _8038_e;
    }
  }
  else if((_8038_e->getND() == (int)1))
  {
    {
      return (::mosek::fusion::p_ExprReshape::_new_ExprReshape(std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)((int)1),(int32_t)(_8038_e->getDim((int)0))}),_8038_e)).as<::mosek::fusion::Expression>();
    }
  }
  else if((_8038_e->getND() == (int)2))
  {
    {
      return (::mosek::fusion::p_ExprTranspose::_new_ExprTranspose(_8038_e)).as<::mosek::fusion::Expression>();
    }
  }
  else
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Incorrect number of dimensions for transpose"));
    }
  }
}
// End mosek.fusion.Expr.transpose

// Begin mosek.fusion.Expr.mulElm
// Method mosek.fusion.Expr.mulElm @ bld/grindsted/final/default/src/fusion/Expr.mbi:656:6-114
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulElm
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _8039_m,
    monty::rc_ptr< ::mosek::fusion::Expression > _8040_expr) { return mosek::fusion::p_Expr::mulElm(_8039_m,_8040_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm(monty::rc_ptr< ::mosek::fusion::Matrix > _8039_m,monty::rc_ptr< ::mosek::fusion::Expression > _8040_expr)
{
  return ::mosek::fusion::p_Expr::mulElm_(_8039_m,_8040_expr);
}
// End mosek.fusion.Expr.mulElm

// Begin mosek.fusion.Expr.mulElm
// Method mosek.fusion.Expr.mulElm @ bld/grindsted/final/default/src/fusion/Expr.mbi:655:6-116
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulElm
  ( monty::rc_ptr< ::mosek::fusion::NDSparseArray > _8041_spm,
    monty::rc_ptr< ::mosek::fusion::Expression > _8042_expr) { return mosek::fusion::p_Expr::mulElm(_8041_spm,_8042_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm(monty::rc_ptr< ::mosek::fusion::NDSparseArray > _8041_spm,monty::rc_ptr< ::mosek::fusion::Expression > _8042_expr)
{
  return ::mosek::fusion::p_Expr::mulElm_(_8041_spm,_8042_expr);
}
// End mosek.fusion.Expr.mulElm

// Begin mosek.fusion.Expr.mulElm
// Method mosek.fusion.Expr.mulElm @ bld/grindsted/final/default/src/fusion/Expr.mbi:654:6-129
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulElm
  ( std::shared_ptr< monty::ndarray< double,2 > > _8043_a2,
    monty::rc_ptr< ::mosek::fusion::Expression > _8044_expr) { return mosek::fusion::p_Expr::mulElm(_8043_a2,_8044_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm(std::shared_ptr< monty::ndarray< double,2 > > _8043_a2,monty::rc_ptr< ::mosek::fusion::Expression > _8044_expr)
{
  return ::mosek::fusion::p_Expr::mulElm_(::mosek::fusion::p_Matrix::dense(_8043_a2),_8044_expr);
}
// End mosek.fusion.Expr.mulElm

// Begin mosek.fusion.Expr.mulElm
// Method mosek.fusion.Expr.mulElm @ bld/grindsted/final/default/src/fusion/Expr.mbi:653:6-115
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulElm
  ( std::shared_ptr< monty::ndarray< double,1 > > _8045_a1,
    monty::rc_ptr< ::mosek::fusion::Expression > _8046_expr) { return mosek::fusion::p_Expr::mulElm(_8045_a1,_8046_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm(std::shared_ptr< monty::ndarray< double,1 > > _8045_a1,monty::rc_ptr< ::mosek::fusion::Expression > _8046_expr)
{
  _checked_ptr_1<double> _ptr__8045_a1(_8045_a1 ? _8045_a1->raw() : nullptr, _8045_a1 ? _8045_a1->size(0) : 0);
  return ::mosek::fusion::p_Expr::mulElm_(_8045_a1,_8046_expr);
}
// End mosek.fusion.Expr.mulElm

// Begin mosek.fusion.Expr.mulElm
// Method mosek.fusion.Expr.mulElm @ bld/grindsted/final/default/src/fusion/Expr.mbi:652:6-114
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulElm
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8047_expr,
    monty::rc_ptr< ::mosek::fusion::Matrix > _8048_m) { return mosek::fusion::p_Expr::mulElm(_8047_expr,_8048_m); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm(monty::rc_ptr< ::mosek::fusion::Expression > _8047_expr,monty::rc_ptr< ::mosek::fusion::Matrix > _8048_m)
{
  return ::mosek::fusion::p_Expr::mulElm_(_8048_m,_8047_expr);
}
// End mosek.fusion.Expr.mulElm

// Begin mosek.fusion.Expr.mulElm
// Method mosek.fusion.Expr.mulElm @ bld/grindsted/final/default/src/fusion/Expr.mbi:651:6-129
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulElm
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8049_expr,
    std::shared_ptr< monty::ndarray< double,2 > > _8050_a2) { return mosek::fusion::p_Expr::mulElm(_8049_expr,_8050_a2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm(monty::rc_ptr< ::mosek::fusion::Expression > _8049_expr,std::shared_ptr< monty::ndarray< double,2 > > _8050_a2)
{
  return ::mosek::fusion::p_Expr::mulElm_(::mosek::fusion::p_Matrix::dense(_8050_a2),_8049_expr);
}
// End mosek.fusion.Expr.mulElm

// Begin mosek.fusion.Expr.mulElm
// Method mosek.fusion.Expr.mulElm @ bld/grindsted/final/default/src/fusion/Expr.mbi:650:6-115
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulElm
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8051_expr,
    std::shared_ptr< monty::ndarray< double,1 > > _8052_a1) { return mosek::fusion::p_Expr::mulElm(_8051_expr,_8052_a1); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm(monty::rc_ptr< ::mosek::fusion::Expression > _8051_expr,std::shared_ptr< monty::ndarray< double,1 > > _8052_a1)
{
  _checked_ptr_1<double> _ptr__8052_a1(_8052_a1 ? _8052_a1->raw() : nullptr, _8052_a1 ? _8052_a1->size(0) : 0);
  return ::mosek::fusion::p_Expr::mulElm_(_8052_a1,_8051_expr);
}
// End mosek.fusion.Expr.mulElm

// Begin mosek.fusion.Expr.mulElm
// Method mosek.fusion.Expr.mulElm @ bld/grindsted/final/default/src/fusion/Expr.mbi:649:6-116
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulElm
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8053_expr,
    monty::rc_ptr< ::mosek::fusion::NDSparseArray > _8054_spm) { return mosek::fusion::p_Expr::mulElm(_8053_expr,_8054_spm); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm(monty::rc_ptr< ::mosek::fusion::Expression > _8053_expr,monty::rc_ptr< ::mosek::fusion::NDSparseArray > _8054_spm)
{
  return ::mosek::fusion::p_Expr::mulElm_(_8054_spm,_8053_expr);
}
// End mosek.fusion.Expr.mulElm

// Begin mosek.fusion.Expr.mulElm
// Method mosek.fusion.Expr.mulElm @ bld/grindsted/final/default/src/fusion/Expr.mbi:648:6-127
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulElm
  ( monty::rc_ptr< ::mosek::fusion::Parameter > _8055_p,
    monty::rc_ptr< ::mosek::fusion::Expression > _8056_expr) { return mosek::fusion::p_Expr::mulElm(_8055_p,_8056_expr); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm(monty::rc_ptr< ::mosek::fusion::Parameter > _8055_p,monty::rc_ptr< ::mosek::fusion::Expression > _8056_expr)
{
  return (::mosek::fusion::p_ExprMulParamElem::_new_ExprMulParamElem(_8055_p,_8056_expr)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mulElm

// Begin mosek.fusion.Expr.mulElm
// Method mosek.fusion.Expr.mulElm @ bld/grindsted/final/default/src/fusion/Expr.mbi:647:6-127
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::mulElm
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8057_expr,
    monty::rc_ptr< ::mosek::fusion::Parameter > _8058_p) { return mosek::fusion::p_Expr::mulElm(_8057_expr,_8058_p); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::mulElm(monty::rc_ptr< ::mosek::fusion::Expression > _8057_expr,monty::rc_ptr< ::mosek::fusion::Parameter > _8058_p)
{
  return (::mosek::fusion::p_ExprMulParamElem::_new_ExprMulParamElem(_8058_p,_8057_expr)).as<::mosek::fusion::Expression>();
}
// End mosek.fusion.Expr.mulElm

// Begin mosek.fusion.Expr.sub
// Method mosek.fusion.Expr.sub @ bld/grindsted/final/default/src/fusion/Expr.mbi:645:6-167
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sub
  ( monty::rc_ptr< ::mosek::fusion::NDSparseArray > _8059_n,
    monty::rc_ptr< ::mosek::fusion::Expression > _8060_e2) { return mosek::fusion::p_Expr::sub(_8059_n,_8060_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sub(monty::rc_ptr< ::mosek::fusion::NDSparseArray > _8059_n,monty::rc_ptr< ::mosek::fusion::Expression > _8060_e2)
{
  return ::mosek::fusion::p_Expr::add_(::mosek::fusion::p_Expr::constTerm(_8059_n),1.0,_8060_e2,(-1.0));
}
// End mosek.fusion.Expr.sub

// Begin mosek.fusion.Expr.sub
// Method mosek.fusion.Expr.sub @ bld/grindsted/final/default/src/fusion/Expr.mbi:644:6-167
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sub
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8061_e1,
    monty::rc_ptr< ::mosek::fusion::NDSparseArray > _8062_n) { return mosek::fusion::p_Expr::sub(_8061_e1,_8062_n); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sub(monty::rc_ptr< ::mosek::fusion::Expression > _8061_e1,monty::rc_ptr< ::mosek::fusion::NDSparseArray > _8062_n)
{
  return ::mosek::fusion::p_Expr::add_(_8061_e1,1.0,::mosek::fusion::p_Expr::constTerm(_8062_n),(-1.0));
}
// End mosek.fusion.Expr.sub

// Begin mosek.fusion.Expr.sub
// Method mosek.fusion.Expr.sub @ bld/grindsted/final/default/src/fusion/Expr.mbi:643:6-167
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sub
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _8063_m,
    monty::rc_ptr< ::mosek::fusion::Expression > _8064_e2) { return mosek::fusion::p_Expr::sub(_8063_m,_8064_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sub(monty::rc_ptr< ::mosek::fusion::Matrix > _8063_m,monty::rc_ptr< ::mosek::fusion::Expression > _8064_e2)
{
  return ::mosek::fusion::p_Expr::add_(::mosek::fusion::p_Expr::constTerm(_8063_m),1.0,_8064_e2,(-1.0));
}
// End mosek.fusion.Expr.sub

// Begin mosek.fusion.Expr.sub
// Method mosek.fusion.Expr.sub @ bld/grindsted/final/default/src/fusion/Expr.mbi:642:6-167
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sub
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8065_e1,
    monty::rc_ptr< ::mosek::fusion::Matrix > _8066_m) { return mosek::fusion::p_Expr::sub(_8065_e1,_8066_m); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sub(monty::rc_ptr< ::mosek::fusion::Expression > _8065_e1,monty::rc_ptr< ::mosek::fusion::Matrix > _8066_m)
{
  return ::mosek::fusion::p_Expr::add_(_8065_e1,1.0,::mosek::fusion::p_Expr::constTerm(_8066_m),(-1.0));
}
// End mosek.fusion.Expr.sub

// Begin mosek.fusion.Expr.sub
// Method mosek.fusion.Expr.sub @ bld/grindsted/final/default/src/fusion/Expr.mbi:641:6-167
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sub
  ( double _8067_c,
    monty::rc_ptr< ::mosek::fusion::Expression > _8068_e2) { return mosek::fusion::p_Expr::sub(_8067_c,_8068_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sub(double _8067_c,monty::rc_ptr< ::mosek::fusion::Expression > _8068_e2)
{
  return ::mosek::fusion::p_Expr::add_(::mosek::fusion::p_Expr::constTerm(_8068_e2->getShape(),_8067_c),1.0,_8068_e2,(-1.0));
}
// End mosek.fusion.Expr.sub

// Begin mosek.fusion.Expr.sub
// Method mosek.fusion.Expr.sub @ bld/grindsted/final/default/src/fusion/Expr.mbi:640:6-167
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sub
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8069_e1,
    double _8070_c) { return mosek::fusion::p_Expr::sub(_8069_e1,_8070_c); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sub(monty::rc_ptr< ::mosek::fusion::Expression > _8069_e1,double _8070_c)
{
  return ::mosek::fusion::p_Expr::add_(_8069_e1,1.0,::mosek::fusion::p_Expr::constTerm(_8069_e1->getShape(),_8070_c),(-1.0));
}
// End mosek.fusion.Expr.sub

// Begin mosek.fusion.Expr.sub
// Method mosek.fusion.Expr.sub @ bld/grindsted/final/default/src/fusion/Expr.mbi:639:6-167
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sub
  ( std::shared_ptr< monty::ndarray< double,2 > > _8071_a2,
    monty::rc_ptr< ::mosek::fusion::Expression > _8072_e2) { return mosek::fusion::p_Expr::sub(_8071_a2,_8072_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sub(std::shared_ptr< monty::ndarray< double,2 > > _8071_a2,monty::rc_ptr< ::mosek::fusion::Expression > _8072_e2)
{
  return ::mosek::fusion::p_Expr::add_(::mosek::fusion::p_Expr::constTerm(_8071_a2),1.0,_8072_e2,(-1.0));
}
// End mosek.fusion.Expr.sub

// Begin mosek.fusion.Expr.sub
// Method mosek.fusion.Expr.sub @ bld/grindsted/final/default/src/fusion/Expr.mbi:638:6-167
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sub
  ( std::shared_ptr< monty::ndarray< double,1 > > _8073_a1,
    monty::rc_ptr< ::mosek::fusion::Expression > _8074_e2) { return mosek::fusion::p_Expr::sub(_8073_a1,_8074_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sub(std::shared_ptr< monty::ndarray< double,1 > > _8073_a1,monty::rc_ptr< ::mosek::fusion::Expression > _8074_e2)
{
  _checked_ptr_1<double> _ptr__8073_a1(_8073_a1 ? _8073_a1->raw() : nullptr, _8073_a1 ? _8073_a1->size(0) : 0);
  return ::mosek::fusion::p_Expr::add_(::mosek::fusion::p_Expr::constTerm(_8073_a1),1.0,_8074_e2,(-1.0));
}
// End mosek.fusion.Expr.sub

// Begin mosek.fusion.Expr.sub
// Method mosek.fusion.Expr.sub @ bld/grindsted/final/default/src/fusion/Expr.mbi:637:6-167
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sub
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8075_e1,
    std::shared_ptr< monty::ndarray< double,2 > > _8076_a2) { return mosek::fusion::p_Expr::sub(_8075_e1,_8076_a2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sub(monty::rc_ptr< ::mosek::fusion::Expression > _8075_e1,std::shared_ptr< monty::ndarray< double,2 > > _8076_a2)
{
  return ::mosek::fusion::p_Expr::add_(_8075_e1,1.0,::mosek::fusion::p_Expr::constTerm(_8076_a2),(-1.0));
}
// End mosek.fusion.Expr.sub

// Begin mosek.fusion.Expr.sub
// Method mosek.fusion.Expr.sub @ bld/grindsted/final/default/src/fusion/Expr.mbi:636:6-167
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sub
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8077_e1,
    std::shared_ptr< monty::ndarray< double,1 > > _8078_a1) { return mosek::fusion::p_Expr::sub(_8077_e1,_8078_a1); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sub(monty::rc_ptr< ::mosek::fusion::Expression > _8077_e1,std::shared_ptr< monty::ndarray< double,1 > > _8078_a1)
{
  _checked_ptr_1<double> _ptr__8078_a1(_8078_a1 ? _8078_a1->raw() : nullptr, _8078_a1 ? _8078_a1->size(0) : 0);
  return ::mosek::fusion::p_Expr::add_(_8077_e1,1.0,::mosek::fusion::p_Expr::constTerm(_8078_a1),(-1.0));
}
// End mosek.fusion.Expr.sub

// Begin mosek.fusion.Expr.sub
// Method mosek.fusion.Expr.sub @ bld/grindsted/final/default/src/fusion/Expr.mbi:635:6-167
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::sub
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8079_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _8080_e2) { return mosek::fusion::p_Expr::sub(_8079_e1,_8080_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::sub(monty::rc_ptr< ::mosek::fusion::Expression > _8079_e1,monty::rc_ptr< ::mosek::fusion::Expression > _8080_e2)
{
  return ::mosek::fusion::p_Expr::add_(_8079_e1,1.0,_8080_e2,(-1.0));
}
// End mosek.fusion.Expr.sub

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:631:6-166
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( monty::rc_ptr< ::mosek::fusion::NDSparseArray > _8081_n,
    monty::rc_ptr< ::mosek::fusion::Expression > _8082_e2) { return mosek::fusion::p_Expr::add(_8081_n,_8082_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(monty::rc_ptr< ::mosek::fusion::NDSparseArray > _8081_n,monty::rc_ptr< ::mosek::fusion::Expression > _8082_e2)
{
  return ::mosek::fusion::p_Expr::add_(_8082_e2,1.0,::mosek::fusion::p_Expr::constTerm(_8081_n),1.0);
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:630:6-166
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8083_e1,
    monty::rc_ptr< ::mosek::fusion::NDSparseArray > _8084_n) { return mosek::fusion::p_Expr::add(_8083_e1,_8084_n); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(monty::rc_ptr< ::mosek::fusion::Expression > _8083_e1,monty::rc_ptr< ::mosek::fusion::NDSparseArray > _8084_n)
{
  return ::mosek::fusion::p_Expr::add_(_8083_e1,1.0,::mosek::fusion::p_Expr::constTerm(_8084_n),1.0);
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:629:6-166
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _8085_m,
    monty::rc_ptr< ::mosek::fusion::Expression > _8086_e2) { return mosek::fusion::p_Expr::add(_8085_m,_8086_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(monty::rc_ptr< ::mosek::fusion::Matrix > _8085_m,monty::rc_ptr< ::mosek::fusion::Expression > _8086_e2)
{
  return ::mosek::fusion::p_Expr::add_(_8086_e2,1.0,::mosek::fusion::p_Expr::constTerm(_8085_m),1.0);
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:628:6-166
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8087_e1,
    monty::rc_ptr< ::mosek::fusion::Matrix > _8088_m) { return mosek::fusion::p_Expr::add(_8087_e1,_8088_m); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(monty::rc_ptr< ::mosek::fusion::Expression > _8087_e1,monty::rc_ptr< ::mosek::fusion::Matrix > _8088_m)
{
  return ::mosek::fusion::p_Expr::add_(_8087_e1,1.0,::mosek::fusion::p_Expr::constTerm(_8088_m),1.0);
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:627:6-169
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( double _8089_c,
    monty::rc_ptr< ::mosek::fusion::Expression > _8090_e2) { return mosek::fusion::p_Expr::add(_8089_c,_8090_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(double _8089_c,monty::rc_ptr< ::mosek::fusion::Expression > _8090_e2)
{
  return ::mosek::fusion::p_Expr::add_(_8090_e2,1.0,::mosek::fusion::p_Expr::constTerm(_8090_e2->getShape(),_8089_c),1.0);
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:626:6-169
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8091_e1,
    double _8092_c) { return mosek::fusion::p_Expr::add(_8091_e1,_8092_c); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(monty::rc_ptr< ::mosek::fusion::Expression > _8091_e1,double _8092_c)
{
  return ::mosek::fusion::p_Expr::add_(_8091_e1,1.0,::mosek::fusion::p_Expr::constTerm(_8091_e1->getShape(),_8092_c),1.0);
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:625:6-166
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( std::shared_ptr< monty::ndarray< double,2 > > _8093_a2,
    monty::rc_ptr< ::mosek::fusion::Expression > _8094_e2) { return mosek::fusion::p_Expr::add(_8093_a2,_8094_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(std::shared_ptr< monty::ndarray< double,2 > > _8093_a2,monty::rc_ptr< ::mosek::fusion::Expression > _8094_e2)
{
  return ::mosek::fusion::p_Expr::add_(_8094_e2,1.0,::mosek::fusion::p_Expr::constTerm(_8093_a2),1.0);
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:624:6-166
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( std::shared_ptr< monty::ndarray< double,1 > > _8095_a1,
    monty::rc_ptr< ::mosek::fusion::Expression > _8096_e2) { return mosek::fusion::p_Expr::add(_8095_a1,_8096_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(std::shared_ptr< monty::ndarray< double,1 > > _8095_a1,monty::rc_ptr< ::mosek::fusion::Expression > _8096_e2)
{
  _checked_ptr_1<double> _ptr__8095_a1(_8095_a1 ? _8095_a1->raw() : nullptr, _8095_a1 ? _8095_a1->size(0) : 0);
  return ::mosek::fusion::p_Expr::add_(_8096_e2,1.0,::mosek::fusion::p_Expr::constTerm(_8095_a1),1.0);
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:623:6-166
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8097_e1,
    std::shared_ptr< monty::ndarray< double,2 > > _8098_a2) { return mosek::fusion::p_Expr::add(_8097_e1,_8098_a2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(monty::rc_ptr< ::mosek::fusion::Expression > _8097_e1,std::shared_ptr< monty::ndarray< double,2 > > _8098_a2)
{
  return ::mosek::fusion::p_Expr::add_(_8097_e1,1.0,::mosek::fusion::p_Expr::constTerm(_8098_a2),1.0);
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:622:6-166
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8099_e1,
    std::shared_ptr< monty::ndarray< double,1 > > _8100_a1) { return mosek::fusion::p_Expr::add(_8099_e1,_8100_a1); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(monty::rc_ptr< ::mosek::fusion::Expression > _8099_e1,std::shared_ptr< monty::ndarray< double,1 > > _8100_a1)
{
  _checked_ptr_1<double> _ptr__8100_a1(_8100_a1 ? _8100_a1->raw() : nullptr, _8100_a1 ? _8100_a1->size(0) : 0);
  return ::mosek::fusion::p_Expr::add_(_8099_e1,1.0,::mosek::fusion::p_Expr::constTerm(_8100_a1),1.0);
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.add
// Method mosek.fusion.Expr.add @ bld/grindsted/final/default/src/fusion/Expr.mbi:621:6-166
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::Expr::add
  ( monty::rc_ptr< ::mosek::fusion::Expression > _8101_e1,
    monty::rc_ptr< ::mosek::fusion::Expression > _8102_e2) { return mosek::fusion::p_Expr::add(_8101_e1,_8102_e2); }
monty::rc_ptr< ::mosek::fusion::Expression > mosek::fusion::p_Expr::add(monty::rc_ptr< ::mosek::fusion::Expression > _8101_e1,monty::rc_ptr< ::mosek::fusion::Expression > _8102_e2)
{
  return ::mosek::fusion::p_Expr::add_(_8101_e1,1.0,_8102_e2,1.0);
}
// End mosek.fusion.Expr.add

// Begin mosek.fusion.Expr.eval
// Method mosek.fusion.Expr.eval @ bld/grindsted/final/default/src/fusion/Expr.mbi:571:6-614:7
void mosek::fusion::Expr :: eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _8103_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _8104_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _8105_xs,bool _8106_cache_eval) { mosek::fusion::p_Expr::_get_impl(this)->eval(_8103_rs,_8104_ws,_8105_xs,_8106_cache_eval); }
void mosek::fusion::p_Expr::eval(monty::rc_ptr< ::mosek::fusion::WorkStack > _8103_rs,monty::rc_ptr< ::mosek::fusion::WorkStack > _8104_ws,monty::rc_ptr< ::mosek::fusion::WorkStack > _8105_xs,bool _8106_cache_eval)
{
  int32_t _8107_nelem = ((int)((ptrb)->size(0)) - (int)1);
  int32_t _8108_nnz = (int32_t)((*ptrb)(_8107_nelem));
  bool _8109_zerob = true;
  int32_t _12979_ = (int)0;
  int32_t _12980_ = _8107_nelem;
  for (int32_t _8110_i = _12979_; _8110_i < _12980_; ++_8110_i)
  {
    {
      _8109_zerob = (_8109_zerob && ((((*bfix)(_8110_i)) <= 0.0) && (((*bfix)(_8110_i)) >= 0.0)));
    }
  }
  if ((!_8109_zerob))
  {
    {
      _8108_nnz += _8107_nelem;
    }
  }
  {}
  int32_t _8111_nd = (int)((shape)->size(0));
  _8103_rs->alloc_expr(_8111_nd,_8107_nelem,_8108_nnz,(NULL != inst.get()));
  int32_t _8112_ptr_base = mosek::fusion::p_WorkStack::_get_impl(_8103_rs)->ptr_base;
  int32_t _8113_nidxs_base = mosek::fusion::p_WorkStack::_get_impl(_8103_rs)->nidxs_base;
  int32_t _8114_sp_base = mosek::fusion::p_WorkStack::_get_impl(_8103_rs)->sp_base;
  int32_t _8115_cof_base = mosek::fusion::p_WorkStack::_get_impl(_8103_rs)->cof_base;
  int32_t _8116_shape_base = mosek::fusion::p_WorkStack::_get_impl(_8103_rs)->shape_base;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8117_i32 = mosek::fusion::p_WorkStack::_get_impl(_8103_rs)->i32;
  _checked_ptr_1<int32_t> _ptr__8117_i32(_8117_i32 ? _8117_i32->raw() : nullptr,_8117_i32 ? _8117_i32->size(0) : 0);
  std::shared_ptr< monty::ndarray< int64_t,1 > > _8118_i64 = mosek::fusion::p_WorkStack::_get_impl(_8103_rs)->i64;
  _checked_ptr_1<int64_t> _ptr__8118_i64(_8118_i64 ? _8118_i64->raw() : nullptr,_8118_i64 ? _8118_i64->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _8119_f64 = mosek::fusion::p_WorkStack::_get_impl(_8103_rs)->f64;
  _checked_ptr_1<double> _ptr__8119_f64(_8119_f64 ? _8119_f64->raw() : nullptr,_8119_f64 ? _8119_f64->size(0) : 0);
  {
    int32_t _12981_ = (int)0;
    int32_t _12982_ = _8111_nd;
    for (int32_t _8120_i = _12981_; _8120_i < _12982_; ++_8120_i)
    {
      {
        _ptr__8117_i32[safe_add( _8116_shape_base,_8120_i )] = ((*shape)(_8120_i));
      }
    }
    _ptr__8117_i32[_8112_ptr_base] = (int)0;
    int32_t _8121_p = (int)0;
    int32_t _12983_ = (int)0;
    int32_t _12984_ = _8107_nelem;
    for (int32_t _8122_i = _12983_; _8122_i < _12984_; ++_8122_i)
    {
      {
        int64_t _12985_ = ((*ptrb)(_8122_i));
        int64_t _12986_ = ((*ptrb)(safe_add( _8122_i,(int)1 )));
        for (int64_t _8123_j = _12985_; _8123_j < _12986_; ++_8123_j)
        {
          {
            _ptr__8118_i64[safe_add( _8113_nidxs_base,_8121_p )] = ((*subj)(_8123_j));
            _ptr__8119_f64[safe_add( _8115_cof_base,_8121_p )] = ((*cof_v)(_8123_j));
            ++ _8121_p;
          }
        }
        if ((!_8109_zerob))
        {
          {
            _ptr__8118_i64[safe_add( _8113_nidxs_base,_8121_p )] = (int)0;
            _ptr__8119_f64[safe_add( _8115_cof_base,_8121_p )] = ((*bfix)(_8122_i));
            ++ _8121_p;
          }
        }
        {}
        _ptr__8117_i32[safe_add( safe_add( _8112_ptr_base,_8122_i ),(int)1 )] = _8121_p;
      }
    }
  }
}
// End mosek.fusion.Expr.eval

// Begin mosek.fusion.Expr.validateData
// Method mosek.fusion.Expr.validateData @ bld/grindsted/final/default/src/fusion/Expr.mbi:393:6-455:7
void mosek::fusion::p_Expr::validateData(std::shared_ptr< monty::ndarray< int64_t,1 > > _8124_ptrb,std::shared_ptr< monty::ndarray< int64_t,1 > > _8125_subj,std::shared_ptr< monty::ndarray< double,1 > > _8126_cof,std::shared_ptr< monty::ndarray< double,1 > > _8127_bfix,std::shared_ptr< monty::ndarray< int32_t,1 > > _8128_shape,std::shared_ptr< monty::ndarray< int64_t,1 > > _8129_inst)
{
  _checked_ptr_1<int64_t> _ptr__8124_ptrb(_8124_ptrb ? _8124_ptrb->raw() : nullptr, _8124_ptrb ? _8124_ptrb->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__8125_subj(_8125_subj ? _8125_subj->raw() : nullptr, _8125_subj ? _8125_subj->size(0) : 0);
  _checked_ptr_1<double> _ptr__8126_cof(_8126_cof ? _8126_cof->raw() : nullptr, _8126_cof ? _8126_cof->size(0) : 0);
  _checked_ptr_1<double> _ptr__8127_bfix(_8127_bfix ? _8127_bfix->raw() : nullptr, _8127_bfix ? _8127_bfix->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__8128_shape(_8128_shape ? _8128_shape->raw() : nullptr, _8128_shape ? _8128_shape->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__8129_inst(_8129_inst ? _8129_inst->raw() : nullptr, _8129_inst ? _8129_inst->size(0) : 0);
  if ((NULL == _8128_shape.get()))
  {
    {
      throw ::mosek::fusion::ExpressionError(std::string ("Array 'shape' in expression is null"));
    }
  }
  {}
  int32_t _8130_exprnume = ((int)((_8124_ptrb)->size(0)) - (int)1);
  int64_t _8131_numelm = _ptr__8124_ptrb[((int)((_8124_ptrb)->size(0)) - (int)1)];
  int32_t _8132_nd = (int)((_8128_shape)->size(0));
  int64_t _8133_size = (int64_t)1;
  int32_t _12987_ = (int)0;
  int32_t _12988_ = _8132_nd;
  for (int32_t _8134_i = _12987_; _8134_i < _12988_; ++_8134_i)
  {
    {
      _8133_size *= _ptr__8128_shape[_8134_i];
    }
  }
  if (((int)((_8124_ptrb)->size(0)) < (int)1))
  {
    {
      throw ::mosek::fusion::ExpressionError(std::string ("Array 'ptrb' in expression has wrong size"));
    }
  }
  {}
  if ((_8131_numelm != (int)((_8125_subj)->size(0))))
  {
    {
      throw ::mosek::fusion::ExpressionError(std::string ("Array 'subj' in expression has wrong size"));
    }
  }
  {}
  if ((_8131_numelm != (int)((_8126_cof)->size(0))))
  {
    {
      throw ::mosek::fusion::ExpressionError(std::string ("Array 'cof' in expression has wrong size"));
    }
  }
  {}
  if (((NULL == _8127_bfix.get()) || (_8130_exprnume != (int)((_8127_bfix)->size(0)))))
  {
    {
      throw ::mosek::fusion::ExpressionError(std::string ("Array 'bfix' in expression has wrong length"));
    }
  }
  {}
  if (((NULL != _8129_inst.get()) && ((int)((_8129_inst)->size(0)) < _8133_size)))
  {
    {
      if (((int)((_8129_inst)->size(0)) != ((int)((_8124_ptrb)->size(0)) - (int)1)))
      {
        {
          throw ::mosek::fusion::ExpressionError(std::string ("Array 'inst' in expression has wrong length"));
        }
      }
      {}
      if (((int)((_8129_inst)->size(0)) > (int)0))
      {
        {
          if (((_ptr__8129_inst[(int)0] < (int)0) || (_ptr__8129_inst[(int)0] >= _8133_size)))
          {
            {
              throw ::mosek::fusion::ExpressionError(std::string ("Array 'inst' contains an invalid index"));
            }
          }
          {}
          bool _8135_sorted_in_range = true;
          int64_t _8136_tot_size = _8133_size;
          int32_t _12989_ = (int)1;
          int32_t _12990_ = (int)((_8129_inst)->size(0));
          for (int32_t _8137_i = _12989_; _8137_i < _12990_; ++_8137_i)
          {
            {
              _8135_sorted_in_range = (_8135_sorted_in_range && ((_ptr__8129_inst[_8137_i] >= (int)0) && ((_ptr__8129_inst[_8137_i] < _8136_tot_size) && (_ptr__8129_inst[_8137_i] > _ptr__8129_inst[(_8137_i - (int)1)]))));
            }
          }
          if ((!_8135_sorted_in_range))
          {
            {
              throw ::mosek::fusion::ExpressionError(std::string ("Invalid array 'inst'"));
            }
          }
          {}
        }
      }
      {}
    }
  }
  else
  {
    {
      if ((_8133_size != ((int64_t)((_8124_ptrb)->size(0)) - (int)1)))
      {
        {
          throw ::mosek::fusion::ExpressionError(std::string ("Array 'ptrb' in expression has wrong length"));
        }
      }
      {}
    }
  }
  bool _8138_invalid_ptrb = false;
  bool _8139_invalid_subj = false;
  if ((_ptr__8124_ptrb[(int)0] != (int64_t)0))
  {
    {
      throw ::mosek::fusion::ExpressionError(std::string ("Invalid 'ptrb' argument in expression"));
    }
  }
  {}
  bool _8140_ptrb_sorted = true;
  int32_t _12991_ = (int)0;
  int32_t _12992_ = _8130_exprnume;
  for (int32_t _8141_i = _12991_; _8141_i < _12992_; ++_8141_i)
  {
    {
      _8140_ptrb_sorted = (_8140_ptrb_sorted && (_ptr__8124_ptrb[_8141_i] <= _ptr__8124_ptrb[safe_add( _8141_i,(int)1 )]));
    }
  }
  if ((!_8140_ptrb_sorted))
  {
    {
      throw ::mosek::fusion::ExpressionError(std::string ("Invalid 'ptrb' argument in expression"));
    }
  }
  {}
}
// End mosek.fusion.Expr.validateData

// Begin mosek.fusion.Expr.extractModel
// Method mosek.fusion.Expr.extractModel @ bld/grindsted/final/default/src/fusion/Expr.mbi:392:6-128
monty::rc_ptr< ::mosek::fusion::Model > mosek::fusion::p_Expr::extractModel(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Variable >,1 > > _8142_v)
{
  monty::rc_ptr< ::mosek::fusion::Model > _12993_;
  bool _12994_ = ((NULL == _8142_v.get()) || ((int)((_8142_v)->size(0)) == (int)0));
  if (_12994_)
  {
    _12993_ = nullptr;
  }
  else
  {
    _12993_ = ((*_8142_v)((int)0))->__mosek_2fusion_2Expression__getModel();
  }
  return _12993_;
}
// End mosek.fusion.Expr.extractModel

void mosek::fusion::p_Expr::destroy()
{
  inst.reset();
  cof_v.reset();
  subj.reset();
  ptrb.reset();
  bfix.reset();
  shape.reset();
}
void mosek::fusion::Expr::destroy() { mosek::fusion::p_Expr::_get_impl(this)->destroy(); }
// } class Expr
// class Expression { // @ bld/grindsted/final/default/src/fusion/Expression.mbi:38:4-115:5
// Begin mosek.fusion.Expression.toString
// End mosek.fusion.Expression.toString

// Begin mosek.fusion.Expression.pick
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Expression::pick(std::shared_ptr< monty::ndarray< int32_t,2 > > _8143_indexrows) { return __mosek_2fusion_2Expression__pick(_8143_indexrows); }
// End mosek.fusion.Expression.pick

// Begin mosek.fusion.Expression.pick
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Expression::pick(std::shared_ptr< monty::ndarray< int32_t,1 > > _8144_indexes) { return __mosek_2fusion_2Expression__pick(_8144_indexes); }
// End mosek.fusion.Expression.pick

// Begin mosek.fusion.Expression.index
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Expression::index(std::shared_ptr< monty::ndarray< int32_t,1 > > _8145_indexes) { return __mosek_2fusion_2Expression__index(_8145_indexes); }
// End mosek.fusion.Expression.index

// Begin mosek.fusion.Expression.index
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Expression::index(int32_t _8146_i) { return __mosek_2fusion_2Expression__index(_8146_i); }
// End mosek.fusion.Expression.index

// Begin mosek.fusion.Expression.slice
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Expression::slice(std::shared_ptr< monty::ndarray< int32_t,1 > > _8147_firsta,std::shared_ptr< monty::ndarray< int32_t,1 > > _8148_lasta) { return __mosek_2fusion_2Expression__slice(_8147_firsta,_8148_lasta); }
// End mosek.fusion.Expression.slice

// Begin mosek.fusion.Expression.slice
monty::rc_ptr< mosek::fusion::Expression > mosek::fusion::Expression::slice(int32_t _8149_first,int32_t _8150_last) { return __mosek_2fusion_2Expression__slice(_8149_first,_8150_last); }
// End mosek.fusion.Expression.slice

// Begin mosek.fusion.Expression.compress_when_caching
// End mosek.fusion.Expression.compress_when_caching

// Begin mosek.fusion.Expression.recursive_eval
// End mosek.fusion.Expression.recursive_eval

// Begin mosek.fusion.Expression.eval
// End mosek.fusion.Expression.eval

// Begin mosek.fusion.Expression.eval
// End mosek.fusion.Expression.eval

// Begin mosek.fusion.Expression.getND
// End mosek.fusion.Expression.getND

// Begin mosek.fusion.Expression.getDim
// End mosek.fusion.Expression.getDim

// Begin mosek.fusion.Expression.getSize
// End mosek.fusion.Expression.getSize

// Begin mosek.fusion.Expression.getShape
// End mosek.fusion.Expression.getShape

// Begin mosek.fusion.Expression.getModel
monty::rc_ptr< mosek::fusion::Model > mosek::fusion::Expression::getModel() { return __mosek_2fusion_2Expression__getModel(); }
// End mosek.fusion.Expression.getModel

// } class Expression
// class SymmetricMatrix { // @ bld/grindsted/final/default/src/fusion/SymmetricMatrix.monty:16:4-180:5
mosek::fusion::SymmetricMatrix::SymmetricMatrix(mosek::fusion::p_SymmetricMatrix *_impl) : _impl(_impl) { /*std::cout << "SymmetricMatrix() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::SymmetricMatrix::~SymmetricMatrix() { delete _impl; _impl = nullptr; }
mosek::fusion::p_SymmetricMatrix::p_SymmetricMatrix
  (::mosek::fusion::SymmetricMatrix * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.SymmetricMatrix.ctor @ bld/grindsted/final/default/src/fusion/SymmetricMatrix.monty:39:6-60:7
mosek::fusion::SymmetricMatrix::t mosek::fusion::p_SymmetricMatrix::_new_SymmetricMatrix
  (int32_t _8163_dim0,
    int32_t _8164_dim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8165_usubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8166_usubj,
    std::shared_ptr< monty::ndarray< double,1 > > _8167_uval,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8168_vsubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8169_vsubj,
    std::shared_ptr< monty::ndarray< double,1 > > _8170_vval,
    double _8171_scale)
{ return new mosek::fusion::SymmetricMatrix(_8163_dim0,_8164_dim1,_8165_usubi,_8166_usubj,_8167_uval,_8168_vsubi,_8169_vsubj,_8170_vval,_8171_scale); }
mosek::fusion::SymmetricMatrix::SymmetricMatrix
  (int32_t _8163_dim0,
    int32_t _8164_dim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8165_usubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8166_usubj,
    std::shared_ptr< monty::ndarray< double,1 > > _8167_uval,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8168_vsubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8169_vsubj,
    std::shared_ptr< monty::ndarray< double,1 > > _8170_vval,
    double _8171_scale) : 
   SymmetricMatrix(new mosek::fusion::p_SymmetricMatrix(this))
{ mosek::fusion::p_SymmetricMatrix::_get_impl(this)->_initialize(_8163_dim0,_8164_dim1,_8165_usubi,_8166_usubj,_8167_uval,_8168_vsubi,_8169_vsubj,_8170_vval,_8171_scale); }
void mosek::fusion::p_SymmetricMatrix::_initialize  (int32_t _8163_dim0,
    int32_t _8164_dim1,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8165_usubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8166_usubj,
    std::shared_ptr< monty::ndarray< double,1 > > _8167_uval,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8168_vsubi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8169_vsubj,
    std::shared_ptr< monty::ndarray< double,1 > > _8170_vval,
    double _8171_scale)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__8165_usubi(_8165_usubi ? _8165_usubi->raw() : nullptr, _8165_usubi ? _8165_usubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__8166_usubj(_8166_usubj ? _8166_usubj->raw() : nullptr, _8166_usubj ? _8166_usubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__8167_uval(_8167_uval ? _8167_uval->raw() : nullptr, _8167_uval ? _8167_uval->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__8168_vsubi(_8168_vsubi ? _8168_vsubi->raw() : nullptr, _8168_vsubi ? _8168_vsubi->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__8169_vsubj(_8169_vsubj ? _8169_vsubj->raw() : nullptr, _8169_vsubj ? _8169_vsubj->size(0) : 0);
    _checked_ptr_1<double> _ptr__8170_vval(_8170_vval ? _8170_vval->raw() : nullptr, _8170_vval ? _8170_vval->size(0) : 0);
    mosek::fusion::p_SymmetricMatrix::_get_impl(::mosek::fusion::SymmetricMatrix::t(_pubthis))->d0 = _8163_dim0;
    mosek::fusion::p_SymmetricMatrix::_get_impl(::mosek::fusion::SymmetricMatrix::t(_pubthis))->d1 = _8164_dim1;
    mosek::fusion::p_SymmetricMatrix::_get_impl(::mosek::fusion::SymmetricMatrix::t(_pubthis))->usubi = _8165_usubi;
    mosek::fusion::p_SymmetricMatrix::_get_impl(::mosek::fusion::SymmetricMatrix::t(_pubthis))->usubj = _8166_usubj;
    mosek::fusion::p_SymmetricMatrix::_get_impl(::mosek::fusion::SymmetricMatrix::t(_pubthis))->uval = _8167_uval;
    mosek::fusion::p_SymmetricMatrix::_get_impl(::mosek::fusion::SymmetricMatrix::t(_pubthis))->vsubi = _8168_vsubi;
    mosek::fusion::p_SymmetricMatrix::_get_impl(::mosek::fusion::SymmetricMatrix::t(_pubthis))->vsubj = _8169_vsubj;
    mosek::fusion::p_SymmetricMatrix::_get_impl(::mosek::fusion::SymmetricMatrix::t(_pubthis))->vval = _8170_vval;
    mosek::fusion::p_SymmetricMatrix::_get_impl(::mosek::fusion::SymmetricMatrix::t(_pubthis))->scale = _8171_scale;
    nnz = (-(int)1);
  }
}
// mosek.fusion.SymmetricMatrix.ctor

// Begin mosek.fusion.SymmetricMatrix.rankOne
// Method mosek.fusion.SymmetricMatrix.rankOne @ bld/grindsted/final/default/src/fusion/SymmetricMatrix.monty:166:6-179:7
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::SymmetricMatrix::rankOne
  ( int32_t _8172_n,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8173_sub,
    std::shared_ptr< monty::ndarray< double,1 > > _8174_v) { return mosek::fusion::p_SymmetricMatrix::rankOne(_8172_n,_8173_sub,_8174_v); }
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::p_SymmetricMatrix::rankOne(int32_t _8172_n,std::shared_ptr< monty::ndarray< int32_t,1 > > _8173_sub,std::shared_ptr< monty::ndarray< double,1 > > _8174_v)
{
  _checked_ptr_1<int32_t> _ptr__8173_sub(_8173_sub ? _8173_sub->raw() : nullptr, _8173_sub ? _8173_sub->size(0) : 0);
  _checked_ptr_1<double> _ptr__8174_v(_8174_v ? _8174_v->raw() : nullptr, _8174_v ? _8174_v->size(0) : 0);
  if (((int)((_8173_sub)->size(0)) != (int)((_8174_v)->size(0))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Mismatching array lengths"));
    }
  }
  {}
  int32_t _12995_ = (int)0;
  int32_t _12996_ = (int)((_8173_sub)->size(0));
  for (int32_t _8175_i = _12995_; _8175_i < _12996_; ++_8175_i)
  {
    {
      if (((_ptr__8173_sub[_8175_i] < (int)0) || (_ptr__8173_sub[_8175_i] >= _8172_n)))
      {
        {
          throw ::mosek::fusion::LengthError(std::string ("Invalid index in argument 'sub'"));
        }
      }
      {}
    }
  }
  std::vector<int32_t> _12997_;
  for (int32_t _8177_i = (int)0, _12998_ = (int)((_8173_sub)->size(0)); _8177_i < _12998_ ; ++_8177_i)
  {
    _12997_.push_back(_ptr__8173_sub[_8177_i]);
  }
  auto _12999_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_12997_.size()),_12997_.begin(),_12997_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8176_subi = _12999_;
  _checked_ptr_1<int32_t> _ptr__8176_subi(_8176_subi ? _8176_subi->raw() : nullptr,_8176_subi ? _8176_subi->size(0) : 0);
  std::vector<int32_t> _13000_;
  for (int32_t _8179_i = (int)0, _13001_ = (int)((_8173_sub)->size(0)); _8179_i < _13001_ ; ++_8179_i)
  {
    _13000_.push_back((int)1);
  }
  auto _13002_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_13000_.size()),_13000_.begin(),_13000_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8178_subj = _13002_;
  _checked_ptr_1<int32_t> _ptr__8178_subj(_8178_subj ? _8178_subj->raw() : nullptr,_8178_subj ? _8178_subj->size(0) : 0);
  std::vector<double> _13003_;
  for (int32_t _8181_i = (int)0, _13004_ = (int)((_8174_v)->size(0)); _8181_i < _13004_ ; ++_8181_i)
  {
    _13003_.push_back(_ptr__8174_v[_8181_i]);
  }
  auto _13005_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_13003_.size()),_13003_.begin(),_13003_.end()));
  std::shared_ptr< monty::ndarray< double,1 > > _8180_val = _13005_;
  _checked_ptr_1<double> _ptr__8180_val(_8180_val ? _8180_val->raw() : nullptr,_8180_val ? _8180_val->size(0) : 0);
  return ::mosek::fusion::p_SymmetricMatrix::_new_SymmetricMatrix(_8172_n,(int)1,_8176_subi,_8178_subj,_8180_val,_8176_subi,_8178_subj,_8180_val,1.0);
}
// End mosek.fusion.SymmetricMatrix.rankOne

// Begin mosek.fusion.SymmetricMatrix.rankOne
// Method mosek.fusion.SymmetricMatrix.rankOne @ bld/grindsted/final/default/src/fusion/SymmetricMatrix.monty:157:6-164:7
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::SymmetricMatrix::rankOne
  ( std::shared_ptr< monty::ndarray< double,1 > > _8182_v) { return mosek::fusion::p_SymmetricMatrix::rankOne(_8182_v); }
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::p_SymmetricMatrix::rankOne(std::shared_ptr< monty::ndarray< double,1 > > _8182_v)
{
  _checked_ptr_1<double> _ptr__8182_v(_8182_v ? _8182_v->raw() : nullptr, _8182_v ? _8182_v->size(0) : 0);
  int32_t _8183_n = (int)((_8182_v)->size(0));
  std::vector<int32_t> _13006_;
  for (int32_t _8185_i = (int)0, _13007_ = _8183_n; _8185_i < _13007_ ; ++_8185_i)
  {
    _13006_.push_back(_8185_i);
  }
  auto _13008_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_13006_.size()),_13006_.begin(),_13006_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8184_subi = _13008_;
  _checked_ptr_1<int32_t> _ptr__8184_subi(_8184_subi ? _8184_subi->raw() : nullptr,_8184_subi ? _8184_subi->size(0) : 0);
  std::vector<int32_t> _13009_;
  for (int32_t _8187_i = (int)0, _13010_ = _8183_n; _8187_i < _13010_ ; ++_8187_i)
  {
    _13009_.push_back((int)1);
  }
  auto _13011_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_13009_.size()),_13009_.begin(),_13009_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8186_subj = _13011_;
  _checked_ptr_1<int32_t> _ptr__8186_subj(_8186_subj ? _8186_subj->raw() : nullptr,_8186_subj ? _8186_subj->size(0) : 0);
  std::vector<double> _13012_;
  for (int32_t _8189_i = (int)0, _13013_ = _8183_n; _8189_i < _13013_ ; ++_8189_i)
  {
    _13012_.push_back(_ptr__8182_v[_8189_i]);
  }
  auto _13014_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_13012_.size()),_13012_.begin(),_13012_.end()));
  std::shared_ptr< monty::ndarray< double,1 > > _8188_val = _13014_;
  _checked_ptr_1<double> _ptr__8188_val(_8188_val ? _8188_val->raw() : nullptr,_8188_val ? _8188_val->size(0) : 0);
  return ::mosek::fusion::p_SymmetricMatrix::_new_SymmetricMatrix(_8183_n,(int)1,_8184_subi,_8186_subj,_8188_val,_8184_subi,_8186_subj,_8188_val,1.0);
}
// End mosek.fusion.SymmetricMatrix.rankOne

// Begin mosek.fusion.SymmetricMatrix.antiDiag
// Method mosek.fusion.SymmetricMatrix.antiDiag @ bld/grindsted/final/default/src/fusion/SymmetricMatrix.monty:147:6-155:7
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::SymmetricMatrix::antiDiag
  ( std::shared_ptr< monty::ndarray< double,1 > > _8190_vals) { return mosek::fusion::p_SymmetricMatrix::antiDiag(_8190_vals); }
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::p_SymmetricMatrix::antiDiag(std::shared_ptr< monty::ndarray< double,1 > > _8190_vals)
{
  _checked_ptr_1<double> _ptr__8190_vals(_8190_vals ? _8190_vals->raw() : nullptr, _8190_vals ? _8190_vals->size(0) : 0);
  int32_t _8191_n = (int)((_8190_vals)->size(0));
  std::vector<int32_t> _13015_;
  for (int32_t _8193_i = (int)0, _13016_ = _8191_n; _8193_i < _13016_ ; ++_8193_i)
  {
    _13015_.push_back(_8193_i);
  }
  auto _13017_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_13015_.size()),_13015_.begin(),_13015_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8192_subarr = _13017_;
  _checked_ptr_1<int32_t> _ptr__8192_subarr(_8192_subarr ? _8192_subarr->raw() : nullptr,_8192_subarr ? _8192_subarr->size(0) : 0);
  std::vector<int32_t> _13018_;
  for (int32_t _8194_i = (int)0, _13019_ = _8191_n; _8194_i < _13019_ ; ++_8194_i)
  {
    _13018_.push_back((_8191_n - _8194_i));
  }
  auto _13020_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_13018_.size()),_13018_.begin(),_13018_.end()));
  std::vector<double> _13021_;
  for (int32_t _8195_i = (int)0, _13022_ = _8191_n; _8195_i < _13022_ ; ++_8195_i)
  {
    _13021_.push_back(_ptr__8190_vals[_8195_i]);
  }
  auto _13023_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_13021_.size()),_13021_.begin(),_13021_.end()));
  std::vector<double> _13024_;
  for (int32_t _8196_i = (int)0, _13025_ = _8191_n; _8196_i < _13025_ ; ++_8196_i)
  {
    _13024_.push_back(1.0);
  }
  auto _13026_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_13024_.size()),_13024_.begin(),_13024_.end()));
  return ::mosek::fusion::p_SymmetricMatrix::_new_SymmetricMatrix(_8191_n,_8191_n,_8192_subarr,_13020_,_13023_,_8192_subarr,_8192_subarr,_13026_,1.0);
}
// End mosek.fusion.SymmetricMatrix.antiDiag

// Begin mosek.fusion.SymmetricMatrix.diag
// Method mosek.fusion.SymmetricMatrix.diag @ bld/grindsted/final/default/src/fusion/SymmetricMatrix.monty:137:6-145:7
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::SymmetricMatrix::diag
  ( std::shared_ptr< monty::ndarray< double,1 > > _8197_vals) { return mosek::fusion::p_SymmetricMatrix::diag(_8197_vals); }
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::p_SymmetricMatrix::diag(std::shared_ptr< monty::ndarray< double,1 > > _8197_vals)
{
  _checked_ptr_1<double> _ptr__8197_vals(_8197_vals ? _8197_vals->raw() : nullptr, _8197_vals ? _8197_vals->size(0) : 0);
  int32_t _8198_n = (int)((_8197_vals)->size(0));
  std::vector<int32_t> _13027_;
  for (int32_t _8200_i = (int)0, _13028_ = _8198_n; _8200_i < _13028_ ; ++_8200_i)
  {
    _13027_.push_back(_8200_i);
  }
  auto _13029_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_13027_.size()),_13027_.begin(),_13027_.end()));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8199_subarr = _13029_;
  _checked_ptr_1<int32_t> _ptr__8199_subarr(_8199_subarr ? _8199_subarr->raw() : nullptr,_8199_subarr ? _8199_subarr->size(0) : 0);
  std::vector<double> _13030_;
  for (int32_t _8201_i = (int)0, _13031_ = _8198_n; _8201_i < _13031_ ; ++_8201_i)
  {
    _13030_.push_back(_ptr__8197_vals[_8201_i]);
  }
  auto _13032_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_13030_.size()),_13030_.begin(),_13030_.end()));
  std::vector<double> _13033_;
  for (int32_t _8202_i = (int)0, _13034_ = _8198_n; _8202_i < _13034_ ; ++_8202_i)
  {
    _13033_.push_back(1.0);
  }
  auto _13035_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_13033_.size()),_13033_.begin(),_13033_.end()));
  return ::mosek::fusion::p_SymmetricMatrix::_new_SymmetricMatrix(_8198_n,_8198_n,_8199_subarr,_8199_subarr,_13032_,_8199_subarr,_8199_subarr,_13035_,1.0);
}
// End mosek.fusion.SymmetricMatrix.diag

// Begin mosek.fusion.SymmetricMatrix.add
// Method mosek.fusion.SymmetricMatrix.add @ bld/grindsted/final/default/src/fusion/SymmetricMatrix.monty:75:6-133:7
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::SymmetricMatrix :: __mosek_2fusion_2SymmetricMatrix__add(monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > _8203_m) { return mosek::fusion::p_SymmetricMatrix::_get_impl(this)->__mosek_2fusion_2SymmetricMatrix__add(_8203_m); }
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::SymmetricMatrix::add(monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > _8203_m) { return __mosek_2fusion_2SymmetricMatrix__add(_8203_m); }
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::p_SymmetricMatrix::__mosek_2fusion_2SymmetricMatrix__add(monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > _8203_m)
{
  int32_t _8204_n = _pubthis->getdim();
  if ((_8203_m->getdim() != _8204_n))
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Mismatching dimensions"));
    }
  }
  {}
  int32_t _8205_unnz = (int)((usubi)->size(0));
  int32_t _8206_munnz = (int)((mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->usubi)->size(0));
  int32_t _8207_newunnz = safe_add( _8205_unnz,_8206_munnz );
  int32_t _8208_vnnz = (int)((vsubi)->size(0));
  int32_t _8209_mvnnz = (int)((mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->vsubi)->size(0));
  int32_t _8210_newvnnz = safe_add( _8208_vnnz,_8209_mvnnz );
  std::shared_ptr< monty::ndarray< double,1 > > _8211_new_vval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8210_newvnnz)));
  _checked_ptr_1<double> _ptr__8211_new_vval(_8211_new_vval ? _8211_new_vval->raw() : nullptr,_8211_new_vval ? _8211_new_vval->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8212_new_vsubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8210_newvnnz)));
  _checked_ptr_1<int32_t> _ptr__8212_new_vsubj(_8212_new_vsubj ? _8212_new_vsubj->raw() : nullptr,_8212_new_vsubj ? _8212_new_vsubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8213_new_vsubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8210_newvnnz)));
  _checked_ptr_1<int32_t> _ptr__8213_new_vsubi(_8213_new_vsubi ? _8213_new_vsubi->raw() : nullptr,_8213_new_vsubi ? _8213_new_vsubi->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _8214_new_uval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8207_newunnz)));
  _checked_ptr_1<double> _ptr__8214_new_uval(_8214_new_uval ? _8214_new_uval->raw() : nullptr,_8214_new_uval ? _8214_new_uval->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8215_new_usubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8207_newunnz)));
  _checked_ptr_1<int32_t> _ptr__8215_new_usubj(_8215_new_usubj ? _8215_new_usubj->raw() : nullptr,_8215_new_usubj ? _8215_new_usubj->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8216_new_usubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8207_newunnz)));
  _checked_ptr_1<int32_t> _ptr__8216_new_usubi(_8216_new_usubi ? _8216_new_usubi->raw() : nullptr,_8216_new_usubi ? _8216_new_usubi->size(0) : 0);
  ::mosek::fusion::Utils::Tools::arraycopy(usubi,(int)0,_8216_new_usubi,(int)0,_8205_unnz);
  ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->usubi,(int)0,_8216_new_usubi,_8205_unnz,_8206_munnz);
  ::mosek::fusion::Utils::Tools::arraycopy(usubj,(int)0,_8215_new_usubj,(int)0,_8205_unnz);
  int32_t _13036_ = (int)0;
  int32_t _13037_ = _8206_munnz;
  for (int32_t _8217_i = _13036_; _8217_i < _13037_; ++_8217_i)
  {
    {
      _ptr__8215_new_usubj[safe_add( _8217_i,_8205_unnz )] = safe_add( ((*mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->usubj)(_8217_i)),d1 );
    }
  }
  if (((scale > 1.0) || (scale < 1.0)))
  {
    {
      ::mosek::fusion::Utils::Tools::arraycopy(uval,(int)0,_8214_new_uval,(int)0,_8205_unnz);
    }
  }
  else
  {
    {
      int32_t _13038_ = (int)0;
      int32_t _13039_ = _8205_unnz;
      for (int32_t _8218_i = _13038_; _8218_i < _13039_; ++_8218_i)
      {
        {
          _ptr__8214_new_uval[_8218_i] = (scale * ((*uval)(_8218_i)));
        }
      }
    }
  }
  if (((mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->scale > 1.0) || (mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->scale < 1.0)))
  {
    {
      ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->uval,(int)0,_8214_new_uval,_8205_unnz,_8206_munnz);
    }
  }
  else
  {
    {
      int32_t _13040_ = (int)0;
      int32_t _13041_ = _8206_munnz;
      for (int32_t _8219_i = _13040_; _8219_i < _13041_; ++_8219_i)
      {
        {
          _ptr__8214_new_uval[safe_add( _8219_i,_8205_unnz )] = (mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->scale * ((*mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->uval)(_8219_i)));
        }
      }
    }
  }
  ::mosek::fusion::Utils::Tools::arraycopy(usubi,(int)0,_8216_new_usubi,(int)0,_8205_unnz);
  int32_t _13042_ = (int)0;
  int32_t _13043_ = _8209_mvnnz;
  for (int32_t _8220_i = _13042_; _8220_i < _13043_; ++_8220_i)
  {
    {
      _ptr__8213_new_vsubi[safe_add( _8220_i,_8208_vnnz )] = safe_add( ((*mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->vsubi)(_8220_i)),mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->d1 );
    }
  }
  ::mosek::fusion::Utils::Tools::arraycopy(vsubj,(int)0,_8212_new_vsubj,(int)0,_8208_vnnz);
  ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->vsubj,_8208_vnnz,_8212_new_vsubj,_8208_vnnz,_8209_mvnnz);
  if (((scale > 1.0) || (scale < 1.0)))
  {
    {
      ::mosek::fusion::Utils::Tools::arraycopy(vval,(int)0,_8211_new_vval,(int)0,_8208_vnnz);
    }
  }
  else
  {
    {
      int32_t _13044_ = (int)0;
      int32_t _13045_ = _8208_vnnz;
      for (int32_t _8221_i = _13044_; _8221_i < _13045_; ++_8221_i)
      {
        {
          _ptr__8211_new_vval[_8221_i] = (scale * ((*vval)(_8221_i)));
        }
      }
    }
  }
  if (((mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->scale > 1.0) || (mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->scale < 1.0)))
  {
    {
      ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->vval,(int)0,_8211_new_vval,_8208_vnnz,_8209_mvnnz);
    }
  }
  else
  {
    {
      int32_t _13046_ = (int)0;
      int32_t _13047_ = _8209_mvnnz;
      for (int32_t _8222_i = _13046_; _8222_i < _13047_; ++_8222_i)
      {
        {
          _ptr__8211_new_vval[safe_add( _8222_i,_8208_vnnz )] = (mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->scale * ((*mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->vval)(_8222_i)));
        }
      }
    }
  }
  return ::mosek::fusion::p_SymmetricMatrix::_new_SymmetricMatrix(d0,safe_add( d1,mosek::fusion::p_SymmetricMatrix::_get_impl(_8203_m)->d1 ),_8216_new_usubi,_8215_new_usubj,_8214_new_uval,_8213_new_vsubi,_8212_new_vsubj,_8211_new_vval,1.0);
}
// End mosek.fusion.SymmetricMatrix.add

// Begin mosek.fusion.SymmetricMatrix.sub
// Method mosek.fusion.SymmetricMatrix.sub @ bld/grindsted/final/default/src/fusion/SymmetricMatrix.monty:70:6-73:7
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::SymmetricMatrix :: __mosek_2fusion_2SymmetricMatrix__sub(monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > _8223_m) { return mosek::fusion::p_SymmetricMatrix::_get_impl(this)->__mosek_2fusion_2SymmetricMatrix__sub(_8223_m); }
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::SymmetricMatrix::sub(monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > _8223_m) { return __mosek_2fusion_2SymmetricMatrix__sub(_8223_m); }
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::p_SymmetricMatrix::__mosek_2fusion_2SymmetricMatrix__sub(monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > _8223_m)
{
  return _pubthis->__mosek_2fusion_2SymmetricMatrix__add(_8223_m->__mosek_2fusion_2SymmetricMatrix__mul((-1.0)));
}
// End mosek.fusion.SymmetricMatrix.sub

// Begin mosek.fusion.SymmetricMatrix.mul
// Method mosek.fusion.SymmetricMatrix.mul @ bld/grindsted/final/default/src/fusion/SymmetricMatrix.monty:65:6-68:7
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::SymmetricMatrix :: __mosek_2fusion_2SymmetricMatrix__mul(double _8224_v) { return mosek::fusion::p_SymmetricMatrix::_get_impl(this)->__mosek_2fusion_2SymmetricMatrix__mul(_8224_v); }
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::SymmetricMatrix::mul(double _8224_v) { return __mosek_2fusion_2SymmetricMatrix__mul(_8224_v); }
monty::rc_ptr< ::mosek::fusion::SymmetricMatrix > mosek::fusion::p_SymmetricMatrix::__mosek_2fusion_2SymmetricMatrix__mul(double _8224_v)
{
  return ::mosek::fusion::p_SymmetricMatrix::_new_SymmetricMatrix(d0,d1,usubi,usubj,uval,vsubi,vsubj,vval,(scale * _8224_v));
}
// End mosek.fusion.SymmetricMatrix.mul

// Begin mosek.fusion.SymmetricMatrix.getdim
// Method mosek.fusion.SymmetricMatrix.getdim @ bld/grindsted/final/default/src/fusion/SymmetricMatrix.monty:63:6-51
int32_t mosek::fusion::SymmetricMatrix :: getdim() { return mosek::fusion::p_SymmetricMatrix::_get_impl(this)->getdim(); }
int32_t mosek::fusion::p_SymmetricMatrix::getdim()
{
  return d0;
}
// End mosek.fusion.SymmetricMatrix.getdim

void mosek::fusion::p_SymmetricMatrix::destroy()
{
  vval.reset();
  vsubj.reset();
  vsubi.reset();
  uval.reset();
  usubj.reset();
  usubi.reset();
}
void mosek::fusion::SymmetricMatrix::destroy() { mosek::fusion::p_SymmetricMatrix::_get_impl(this)->destroy(); }
// } class SymmetricMatrix
// class NDSparseArray { // @ bld/grindsted/final/default/src/fusion/Matrix.mbi:976:4-1151:5
mosek::fusion::NDSparseArray::NDSparseArray(mosek::fusion::p_NDSparseArray *_impl) : _impl(_impl) { /*std::cout << "NDSparseArray() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::NDSparseArray::~NDSparseArray() { delete _impl; _impl = nullptr; }
mosek::fusion::p_NDSparseArray::p_NDSparseArray
  (::mosek::fusion::NDSparseArray * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.NDSparseArray.ctor @ bld/grindsted/final/default/src/fusion/Matrix.mbi:1072:6-1150:7
mosek::fusion::NDSparseArray::t mosek::fusion::p_NDSparseArray::_new_NDSparseArray
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _8225_dims_,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _8226_sub,
    std::shared_ptr< monty::ndarray< double,1 > > _8227_cof_)
{ return new mosek::fusion::NDSparseArray(_8225_dims_,_8226_sub,_8227_cof_); }
mosek::fusion::NDSparseArray::NDSparseArray
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _8225_dims_,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _8226_sub,
    std::shared_ptr< monty::ndarray< double,1 > > _8227_cof_) : 
   NDSparseArray(new mosek::fusion::p_NDSparseArray(this))
{ mosek::fusion::p_NDSparseArray::_get_impl(this)->_initialize(_8225_dims_,_8226_sub,_8227_cof_); }
void mosek::fusion::p_NDSparseArray::_initialize  (std::shared_ptr< monty::ndarray< int32_t,1 > > _8225_dims_,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _8226_sub,
    std::shared_ptr< monty::ndarray< double,1 > > _8227_cof_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__8225_dims_(_8225_dims_ ? _8225_dims_->raw() : nullptr, _8225_dims_ ? _8225_dims_->size(0) : 0);
    _checked_ptr_1<double> _ptr__8227_cof_(_8227_cof_ ? _8227_cof_->raw() : nullptr, _8227_cof_ ? _8227_cof_->size(0) : 0);
    std::shared_ptr< monty::ndarray< int64_t,1 > > _8228_inst_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape((int)((_8226_sub)->size(0)))));
    _checked_ptr_1<int64_t> _ptr__8228_inst_(_8228_inst_ ? _8228_inst_->raw() : nullptr,_8228_inst_ ? _8228_inst_->size(0) : 0);
    size = (int64_t)1;
    int32_t _13048_ = (int)0;
    int32_t _13049_ = (int)((_8225_dims_)->size(0));
    for (int32_t _8229_i = _13048_; _8229_i < _13049_; ++_8229_i)
    {
      {
        size = safe_mul( size,_ptr__8225_dims_[_8229_i] );
      }
    }
    int32_t _8230_nd = (int)((_8225_dims_)->size(0));
    if (((int)((_8226_sub)->size(0)) != (int)((_8227_cof_)->size(0))))
    {
      {
        throw ::mosek::fusion::LengthError(std::string ("Mismatching data array length"));
      }
    }
    {}
    if (((int)((_8226_sub)->size(1)) != _8230_nd))
    {
      {
        throw ::mosek::fusion::IndexError(std::string ("An index key in sub has wrong length"));
      }
    }
    {}
    bool _8231_outofbounds = false;
    int32_t _13050_ = (int)0;
    int32_t _13051_ = (int)((_8226_sub)->size(0));
    for (int32_t _8232_i = _13050_; _8232_i < _13051_; ++_8232_i)
    {
      {
        int32_t _13052_ = (int)0;
        int32_t _13053_ = (int)((_8226_sub)->size(1));
        for (int32_t _8233_j = _13052_; _8233_j < _13053_; ++_8233_j)
        {
          {
            if (((((*_8226_sub)(_8232_i,_8233_j)) < (int)0) || (((*_8226_sub)(_8232_i,_8233_j)) >= _ptr__8225_dims_[_8233_j])))
            {
              {
                _8231_outofbounds = true;
              }
            }
            {}
          }
        }
      }
    }
    if (_8231_outofbounds)
    {
      {
        throw ::mosek::fusion::IndexError(std::string ("An index in sub is out of bounds"));
      }
    }
    {}
    int32_t _13054_ = (int)0;
    int32_t _13055_ = (int)((_8226_sub)->size(0));
    for (int32_t _8234_i = _13054_; _8234_i < _13055_; ++_8234_i)
    {
      {
        int64_t _8235_k = (int64_t)0;
        int32_t _13056_ = (int)0;
        int32_t _13057_ = (int)((_8226_sub)->size(1));
        for (int32_t _8236_j = _13056_; _8236_j < _13057_; ++_8236_j)
        {
          {
            _8235_k = safe_add( safe_mul( _8235_k,_ptr__8225_dims_[_8236_j] ),((*_8226_sub)(_8234_i,_8236_j)) );
          }
        }
        _ptr__8228_inst_[_8234_i] = _8235_k;
      }
    }
    dims = ::mosek::fusion::Utils::Tools::arraycopy(_8225_dims_);
    bool _8237_issorted = true;
    int32_t _13058_ = (int)1;
    int32_t _13059_ = (int)((_8228_inst_)->size(0));
    for (int32_t _8238_i = _13058_; _8238_i < _13059_; ++_8238_i)
    {
      {
        _8237_issorted = (_8237_issorted && (_ptr__8228_inst_[_8238_i] >= _ptr__8228_inst_[(_8238_i - (int)1)]));
      }
    }
    if (_8237_issorted)
    {
      {
        int32_t _8239_nunique = (int)1;
        int32_t _13060_ = (int)1;
        int32_t _13061_ = (int)((_8228_inst_)->size(0));
        for (int32_t _8240_i = _13060_; _8240_i < _13061_; ++_8240_i)
        {
          {
            if ((_ptr__8228_inst_[(_8240_i - (int)1)] < _ptr__8228_inst_[_8240_i]))
            {
              {
                ++ _8239_nunique;
              }
            }
            {}
          }
        }
        if ((_8239_nunique == (int)((_8228_inst_)->size(0))))
        {
          {
            inst = ::mosek::fusion::Utils::Tools::arraycopy(_8228_inst_);
            cof = ::mosek::fusion::Utils::Tools::arraycopy(_8227_cof_);
          }
        }
        else
        {
          {
            inst = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_8239_nunique)));
            ((*inst)((int)0)) = _ptr__8228_inst_[(int)0];
            cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8239_nunique)));
            ((*cof)((int)0)) = _ptr__8227_cof_[(int)0];
            int32_t _8241_j = (int)0;
            int32_t _13062_ = (int)1;
            int32_t _13063_ = (int)((_8228_inst_)->size(0));
            for (int32_t _8242_i = _13062_; _8242_i < _13063_; ++_8242_i)
            {
              {
                if ((_ptr__8228_inst_[_8242_i] > _ptr__8228_inst_[(_8242_i - (int)1)]))
                {
                  {
                    ++ _8241_j;
                    ((*inst)(_8241_j)) = _ptr__8228_inst_[_8242_i];
                    ((*cof)(_8241_j)) = _ptr__8227_cof_[_8242_i];
                  }
                }
                else
                {
                  {
                    ((*cof)(_8241_j)) = (((*cof)(_8241_j)) + _ptr__8227_cof_[_8242_i]);
                  }
                }
              }
            }
          }
        }
      }
    }
    else
    {
      {
        std::shared_ptr< monty::ndarray< int64_t,1 > > _8243_perm = ::mosek::fusion::Utils::Tools::range((int64_t)((_8228_inst_)->size(0)));
        _checked_ptr_1<int64_t> _ptr__8243_perm(_8243_perm ? _8243_perm->raw() : nullptr,_8243_perm ? _8243_perm->size(0) : 0);
        ::mosek::fusion::p_CommonTools::argQsort(_8243_perm,_8228_inst_,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),(int64_t)0,(int64_t)((_8228_inst_)->size(0)));
        int32_t _8244_nunique = (int)1;
        int32_t _13064_ = (int)1;
        int32_t _13065_ = (int)((_8228_inst_)->size(0));
        for (int32_t _8245_i = _13064_; _8245_i < _13065_; ++_8245_i)
        {
          {
            if ((_ptr__8228_inst_[_ptr__8243_perm[(_8245_i - (int)1)]] < _ptr__8228_inst_[_ptr__8243_perm[_8245_i]]))
            {
              {
                ++ _8244_nunique;
              }
            }
            {}
          }
        }
        inst = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_8244_nunique)));
        ((*inst)((int)0)) = _ptr__8228_inst_[_ptr__8243_perm[(int)0]];
        cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8244_nunique)));
        ((*cof)((int)0)) = _ptr__8227_cof_[_ptr__8243_perm[(int)0]];
        int32_t _8246_j = (int)0;
        int32_t _13066_ = (int)1;
        int32_t _13067_ = (int)((_8228_inst_)->size(0));
        for (int32_t _8247_i = _13066_; _8247_i < _13067_; ++_8247_i)
        {
          {
            if ((_ptr__8228_inst_[_ptr__8243_perm[_8247_i]] > _ptr__8228_inst_[_ptr__8243_perm[(_8247_i - (int)1)]]))
            {
              {
                ++ _8246_j;
                ((*inst)(_8246_j)) = _ptr__8228_inst_[_ptr__8243_perm[_8247_i]];
                ((*cof)(_8246_j)) = _ptr__8227_cof_[_ptr__8243_perm[_8247_i]];
              }
            }
            else
            {
              {
                ((*cof)(_8246_j)) = (((*cof)(_8246_j)) + _ptr__8227_cof_[_ptr__8243_perm[_8247_i]]);
              }
            }
          }
        }
      }
    }
  }
}
// mosek.fusion.NDSparseArray.ctor

// mosek.fusion.NDSparseArray.ctor @ bld/grindsted/final/default/src/fusion/Matrix.mbi:1004:6-1070:7
mosek::fusion::NDSparseArray::t mosek::fusion::p_NDSparseArray::_new_NDSparseArray
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _8248_dims_,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _8249_inst_,
    std::shared_ptr< monty::ndarray< double,1 > > _8250_cof_)
{ return new mosek::fusion::NDSparseArray(_8248_dims_,_8249_inst_,_8250_cof_); }
mosek::fusion::NDSparseArray::NDSparseArray
  (std::shared_ptr< monty::ndarray< int32_t,1 > > _8248_dims_,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _8249_inst_,
    std::shared_ptr< monty::ndarray< double,1 > > _8250_cof_) : 
   NDSparseArray(new mosek::fusion::p_NDSparseArray(this))
{ mosek::fusion::p_NDSparseArray::_get_impl(this)->_initialize(_8248_dims_,_8249_inst_,_8250_cof_); }
void mosek::fusion::p_NDSparseArray::_initialize  (std::shared_ptr< monty::ndarray< int32_t,1 > > _8248_dims_,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _8249_inst_,
    std::shared_ptr< monty::ndarray< double,1 > > _8250_cof_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__8248_dims_(_8248_dims_ ? _8248_dims_->raw() : nullptr, _8248_dims_ ? _8248_dims_->size(0) : 0);
    _checked_ptr_1<int64_t> _ptr__8249_inst_(_8249_inst_ ? _8249_inst_->raw() : nullptr, _8249_inst_ ? _8249_inst_->size(0) : 0);
    _checked_ptr_1<double> _ptr__8250_cof_(_8250_cof_ ? _8250_cof_->raw() : nullptr, _8250_cof_ ? _8250_cof_->size(0) : 0);
    size = (int64_t)1;
    int32_t _13068_ = (int)0;
    int32_t _13069_ = (int)((_8248_dims_)->size(0));
    for (int32_t _8251_i = _13068_; _8251_i < _13069_; ++_8251_i)
    {
      {
        size = safe_mul( size,_ptr__8248_dims_[_8251_i] );
      }
    }
    int32_t _8252_n = (int)((_8249_inst_)->size(0));
    if ((_8252_n != (int)((_8250_cof_)->size(0))))
    {
      {
        throw ::mosek::fusion::LengthError(std::string ("Mismatching data array length"));
      }
    }
    {}
    {
      bool _8253_err = false;
      int32_t _13070_ = (int)0;
      int32_t _13071_ = _8252_n;
      for (int32_t _8254_i = _13070_; _8254_i < _13071_; ++_8254_i)
      {
        {
          _8253_err = (_8253_err || ((_ptr__8249_inst_[_8254_i] < (int)0) || (_ptr__8249_inst_[_8254_i] >= size)));
        }
      }
      if (_8253_err)
      {
        {
          throw ::mosek::fusion::IndexError(std::string ("An index in inst is out of bounds"));
        }
      }
      {}
    }
    dims = ::mosek::fusion::Utils::Tools::arraycopy(_8248_dims_);
    bool _8255_issorted = true;
    int32_t _13072_ = (int)1;
    int32_t _13073_ = (int)((_8249_inst_)->size(0));
    for (int32_t _8256_i = _13072_; _8256_i < _13073_; ++_8256_i)
    {
      {
        _8255_issorted = (_8255_issorted && (_ptr__8249_inst_[_8256_i] >= _ptr__8249_inst_[(_8256_i - (int)1)]));
      }
    }
    if (_8255_issorted)
    {
      {
        int32_t _8257_nunique = (int)1;
        int32_t _13074_ = (int)1;
        int32_t _13075_ = (int)((_8249_inst_)->size(0));
        for (int32_t _8258_i = _13074_; _8258_i < _13075_; ++_8258_i)
        {
          {
            if ((_ptr__8249_inst_[(_8258_i - (int)1)] < _ptr__8249_inst_[_8258_i]))
            {
              {
                ++ _8257_nunique;
              }
            }
            {}
          }
        }
        if ((_8257_nunique == (int)((_8249_inst_)->size(0))))
        {
          {
            inst = ::mosek::fusion::Utils::Tools::arraycopy(_8249_inst_);
            cof = ::mosek::fusion::Utils::Tools::arraycopy(_8250_cof_);
          }
        }
        else
        {
          {
            inst = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_8257_nunique)));
            ((*inst)((int)0)) = _ptr__8249_inst_[(int)0];
            cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8257_nunique)));
            ((*cof)((int)0)) = _ptr__8250_cof_[(int)0];
            int32_t _8259_j = (int)0;
            int32_t _13076_ = (int)1;
            int32_t _13077_ = (int)((_8249_inst_)->size(0));
            for (int32_t _8260_i = _13076_; _8260_i < _13077_; ++_8260_i)
            {
              {
                if ((_ptr__8249_inst_[_8260_i] > _ptr__8249_inst_[(_8260_i - (int)1)]))
                {
                  {
                    ++ _8259_j;
                    ((*inst)(_8259_j)) = _ptr__8249_inst_[_8260_i];
                    ((*cof)(_8259_j)) = _ptr__8250_cof_[_8260_i];
                  }
                }
                else
                {
                  {
                    ((*cof)(_8259_j)) = (((*cof)(_8259_j)) + _ptr__8250_cof_[_8260_i]);
                  }
                }
              }
            }
          }
        }
      }
    }
    else
    {
      {
        std::shared_ptr< monty::ndarray< int64_t,1 > > _8261_perm = ::mosek::fusion::Utils::Tools::range((int64_t)((_8249_inst_)->size(0)));
        _checked_ptr_1<int64_t> _ptr__8261_perm(_8261_perm ? _8261_perm->raw() : nullptr,_8261_perm ? _8261_perm->size(0) : 0);
        ::mosek::fusion::p_CommonTools::argQsort(_8261_perm,_8249_inst_,std::shared_ptr< monty::ndarray< int64_t,1 > >(nullptr),(int64_t)0,(int64_t)((_8249_inst_)->size(0)));
        int32_t _8262_nunique = (int)1;
        int32_t _13078_ = (int)1;
        int32_t _13079_ = (int)((_8249_inst_)->size(0));
        for (int32_t _8263_i = _13078_; _8263_i < _13079_; ++_8263_i)
        {
          {
            if ((_ptr__8249_inst_[_ptr__8261_perm[(_8263_i - (int)1)]] < _ptr__8249_inst_[_ptr__8261_perm[_8263_i]]))
            {
              {
                ++ _8262_nunique;
              }
            }
            {}
          }
        }
        inst = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_8262_nunique)));
        ((*inst)((int)0)) = _ptr__8249_inst_[_ptr__8261_perm[(int)0]];
        cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8262_nunique)));
        ((*cof)((int)0)) = _ptr__8250_cof_[_ptr__8261_perm[(int)0]];
        int32_t _8264_j = (int)0;
        int32_t _13080_ = (int)1;
        int32_t _13081_ = (int)((_8249_inst_)->size(0));
        for (int32_t _8265_i = _13080_; _8265_i < _13081_; ++_8265_i)
        {
          {
            if ((_ptr__8249_inst_[_ptr__8261_perm[_8265_i]] > ((*inst)(_ptr__8261_perm[(_8265_i - (int)1)]))))
            {
              {
                ++ _8264_j;
                ((*inst)(_8264_j)) = _ptr__8249_inst_[_ptr__8261_perm[_8265_i]];
                ((*cof)(_8264_j)) = _ptr__8250_cof_[_ptr__8261_perm[_8265_i]];
              }
            }
            else
            {
              {
                ((*cof)(_8264_j)) = (((*cof)(_8264_j)) + _ptr__8250_cof_[_ptr__8261_perm[_8265_i]]);
              }
            }
          }
        }
      }
    }
  }
}
// mosek.fusion.NDSparseArray.ctor

// mosek.fusion.NDSparseArray.ctor @ bld/grindsted/final/default/src/fusion/Matrix.mbi:987:6-1001:7
mosek::fusion::NDSparseArray::t mosek::fusion::p_NDSparseArray::_new_NDSparseArray
  (monty::rc_ptr< ::mosek::fusion::Matrix > _8266_m)
{ return new mosek::fusion::NDSparseArray(_8266_m); }
mosek::fusion::NDSparseArray::NDSparseArray
  (monty::rc_ptr< ::mosek::fusion::Matrix > _8266_m) : 
   NDSparseArray(new mosek::fusion::p_NDSparseArray(this))
{ mosek::fusion::p_NDSparseArray::_get_impl(this)->_initialize(_8266_m); }
void mosek::fusion::p_NDSparseArray::_initialize  (monty::rc_ptr< ::mosek::fusion::Matrix > _8266_m)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    int64_t _8267_nnz = _8266_m->numNonzeros();
    int32_t _8268_dim1 = _8266_m->numColumns();
    int32_t _8269_dim0 = _8266_m->numRows();
    std::shared_ptr< monty::ndarray< double,1 > > _8270_val = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8267_nnz)));
    _checked_ptr_1<double> _ptr__8270_val(_8270_val ? _8270_val->raw() : nullptr,_8270_val ? _8270_val->size(0) : 0);
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8271_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8267_nnz)));
    _checked_ptr_1<int32_t> _ptr__8271_subj(_8271_subj ? _8271_subj->raw() : nullptr,_8271_subj ? _8271_subj->size(0) : 0);
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8272_subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8267_nnz)));
    _checked_ptr_1<int32_t> _ptr__8272_subi(_8272_subi ? _8272_subi->raw() : nullptr,_8272_subi ? _8272_subi->size(0) : 0);
    _8266_m->getDataAsTriplets(_8272_subi,_8271_subj,_8270_val);
    size = safe_mul( (int64_t)_8266_m->numRows(),(int64_t)_8266_m->numColumns() );
    dims = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >{(int32_t)(_8269_dim0),(int32_t)(_8268_dim1)});
    std::vector<int64_t> _13082_;
    for (int64_t _8273_i = (int64_t)0, _13083_ = _8267_nnz; _8273_i < _13083_ ; ++_8273_i)
    {
      _13082_.push_back(safe_add( safe_mul( (int64_t)_ptr__8272_subi[_8273_i],_8268_dim1 ),(int64_t)_ptr__8271_subj[_8273_i] ));
    }
    auto _13084_ = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(_13082_.size()),_13082_.begin(),_13082_.end()));
    inst = _13084_;
    cof = _8270_val;
  }
}
// mosek.fusion.NDSparseArray.ctor

// Begin mosek.fusion.NDSparseArray.make
// Method mosek.fusion.NDSparseArray.make @ bld/grindsted/final/default/src/fusion/Matrix.mbi:985:6-88
monty::rc_ptr< ::mosek::fusion::NDSparseArray > mosek::fusion::NDSparseArray::make
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _8274_m) { return mosek::fusion::p_NDSparseArray::make(_8274_m); }
monty::rc_ptr< ::mosek::fusion::NDSparseArray > mosek::fusion::p_NDSparseArray::make(monty::rc_ptr< ::mosek::fusion::Matrix > _8274_m)
{
  return ::mosek::fusion::p_NDSparseArray::_new_NDSparseArray(_8274_m);
}
// End mosek.fusion.NDSparseArray.make

// Begin mosek.fusion.NDSparseArray.make
// Method mosek.fusion.NDSparseArray.make @ bld/grindsted/final/default/src/fusion/Matrix.mbi:984:6-133
monty::rc_ptr< ::mosek::fusion::NDSparseArray > mosek::fusion::NDSparseArray::make
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _8275_dims,
    std::shared_ptr< monty::ndarray< int64_t,1 > > _8276_inst,
    std::shared_ptr< monty::ndarray< double,1 > > _8277_cof) { return mosek::fusion::p_NDSparseArray::make(_8275_dims,_8276_inst,_8277_cof); }
monty::rc_ptr< ::mosek::fusion::NDSparseArray > mosek::fusion::p_NDSparseArray::make(std::shared_ptr< monty::ndarray< int32_t,1 > > _8275_dims,std::shared_ptr< monty::ndarray< int64_t,1 > > _8276_inst,std::shared_ptr< monty::ndarray< double,1 > > _8277_cof)
{
  _checked_ptr_1<int32_t> _ptr__8275_dims(_8275_dims ? _8275_dims->raw() : nullptr, _8275_dims ? _8275_dims->size(0) : 0);
  _checked_ptr_1<int64_t> _ptr__8276_inst(_8276_inst ? _8276_inst->raw() : nullptr, _8276_inst ? _8276_inst->size(0) : 0);
  _checked_ptr_1<double> _ptr__8277_cof(_8277_cof ? _8277_cof->raw() : nullptr, _8277_cof ? _8277_cof->size(0) : 0);
  return ::mosek::fusion::p_NDSparseArray::_new_NDSparseArray(_8275_dims,_8276_inst,_8277_cof);
}
// End mosek.fusion.NDSparseArray.make

// Begin mosek.fusion.NDSparseArray.make
// Method mosek.fusion.NDSparseArray.make @ bld/grindsted/final/default/src/fusion/Matrix.mbi:983:6-131
monty::rc_ptr< ::mosek::fusion::NDSparseArray > mosek::fusion::NDSparseArray::make
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _8278_dims,
    std::shared_ptr< monty::ndarray< int32_t,2 > > _8279_sub,
    std::shared_ptr< monty::ndarray< double,1 > > _8280_cof) { return mosek::fusion::p_NDSparseArray::make(_8278_dims,_8279_sub,_8280_cof); }
monty::rc_ptr< ::mosek::fusion::NDSparseArray > mosek::fusion::p_NDSparseArray::make(std::shared_ptr< monty::ndarray< int32_t,1 > > _8278_dims,std::shared_ptr< monty::ndarray< int32_t,2 > > _8279_sub,std::shared_ptr< monty::ndarray< double,1 > > _8280_cof)
{
  _checked_ptr_1<int32_t> _ptr__8278_dims(_8278_dims ? _8278_dims->raw() : nullptr, _8278_dims ? _8278_dims->size(0) : 0);
  _checked_ptr_1<double> _ptr__8280_cof(_8280_cof ? _8280_cof->raw() : nullptr, _8280_cof ? _8280_cof->size(0) : 0);
  return ::mosek::fusion::p_NDSparseArray::_new_NDSparseArray(_8278_dims,_8279_sub,_8280_cof);
}
// End mosek.fusion.NDSparseArray.make

void mosek::fusion::p_NDSparseArray::destroy()
{
  cof.reset();
  inst.reset();
  dims.reset();
}
void mosek::fusion::NDSparseArray::destroy() { mosek::fusion::p_NDSparseArray::_get_impl(this)->destroy(); }
// } class NDSparseArray
// class DenseMatrix { // @ bld/grindsted/final/default/src/fusion/Matrix.mbi:796:4-959:5
mosek::fusion::DenseMatrix::DenseMatrix(mosek::fusion::p_DenseMatrix *_impl) : mosek::fusion::Matrix(_impl) { /*std::cout << "DenseMatrix()" << this << std::endl; */ }
mosek::fusion::DenseMatrix::~DenseMatrix() {  /* std::cout << "~DenseMatrix()" << this << std::endl << std::flush; */ }
mosek::fusion::p_DenseMatrix::p_DenseMatrix
  (::mosek::fusion::DenseMatrix * _pubthis) :     mosek::fusion::p_Matrix(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.DenseMatrix.ctor @ bld/grindsted/final/default/src/fusion/Matrix.mbi:907:6-916:7
mosek::fusion::DenseMatrix::t mosek::fusion::p_DenseMatrix::_new_DenseMatrix
  (int32_t _8281_dimi_,
    int32_t _8282_dimj_,
    std::shared_ptr< monty::ndarray< double,1 > > _8283_cof)
{ return new mosek::fusion::DenseMatrix(_8281_dimi_,_8282_dimj_,_8283_cof); }
mosek::fusion::DenseMatrix::DenseMatrix
  (int32_t _8281_dimi_,
    int32_t _8282_dimj_,
    std::shared_ptr< monty::ndarray< double,1 > > _8283_cof) : 
   DenseMatrix(new mosek::fusion::p_DenseMatrix(this))
{ mosek::fusion::p_DenseMatrix::_get_impl(this)->_initialize(_8281_dimi_,_8282_dimj_,_8283_cof); }
void mosek::fusion::p_DenseMatrix::_initialize  (int32_t _8281_dimi_,
    int32_t _8282_dimj_,
    std::shared_ptr< monty::ndarray< double,1 > > _8283_cof)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<double> _ptr__8283_cof(_8283_cof ? _8283_cof->raw() : nullptr, _8283_cof ? _8283_cof->size(0) : 0);
    mosek::fusion::p_Matrix::_initialize(_8281_dimi_,_8282_dimj_);
    nnz = (int64_t)safe_mul( _8281_dimi_,_8282_dimj_ );
    data = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(safe_mul( _8281_dimi_,_8282_dimj_ ))));
    ::mosek::fusion::Utils::Tools::arraycopy(_8283_cof,(int)0,data,(int)0,safe_mul( _8281_dimi_,_8282_dimj_ ));
  }
}
// mosek.fusion.DenseMatrix.ctor

// mosek.fusion.DenseMatrix.ctor @ bld/grindsted/final/default/src/fusion/Matrix.mbi:873:6-895:7
mosek::fusion::DenseMatrix::t mosek::fusion::p_DenseMatrix::_new_DenseMatrix
  (monty::rc_ptr< ::mosek::fusion::Matrix > _8284_m_)
{ return new mosek::fusion::DenseMatrix(_8284_m_); }
mosek::fusion::DenseMatrix::DenseMatrix
  (monty::rc_ptr< ::mosek::fusion::Matrix > _8284_m_) : 
   DenseMatrix(new mosek::fusion::p_DenseMatrix(this))
{ mosek::fusion::p_DenseMatrix::_get_impl(this)->_initialize(_8284_m_); }
void mosek::fusion::p_DenseMatrix::_initialize  (monty::rc_ptr< ::mosek::fusion::Matrix > _8284_m_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_Matrix::_initialize(mosek::fusion::p_Matrix::_get_impl(_8284_m_)->dimi,mosek::fusion::p_Matrix::_get_impl(_8284_m_)->dimj);
    monty::rc_ptr< ::mosek::fusion::Matrix > _13085_ = _8284_m_;
    if (false) {}
    else if (nullptr != dynamic_cast<::mosek::fusion::DenseMatrix*>(_13085_.get()))
    {
      ::mosek::fusion::DenseMatrix::t _8285_m (dynamic_cast<::mosek::fusion::DenseMatrix*>(_13085_.get()));
      {
        data = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_DenseMatrix::_get_impl(_8285_m)->data);
      }
    }
    else if (nullptr != dynamic_cast<::mosek::fusion::SparseMatrix*>(_13085_.get()))
    {
      ::mosek::fusion::SparseMatrix::t _8286_m (dynamic_cast<::mosek::fusion::SparseMatrix*>(_13085_.get()));
      {
        data = ::mosek::fusion::Utils::Tools::zeros(safe_mul( mosek::fusion::p_Matrix::_get_impl(_8286_m)->dimi,mosek::fusion::p_Matrix::_get_impl(_8286_m)->dimj ));
        int64_t _13086_ = (int64_t)0;
        int64_t _13087_ = mosek::fusion::p_SparseMatrix::_get_impl(_8286_m)->nnz;
        for (int64_t _8288_i = _13086_; _8288_i < _13087_; ++_8288_i)
        {
          {
            ((*data)(safe_add( safe_mul( ((*mosek::fusion::p_SparseMatrix::_get_impl(_8286_m)->subi)(_8288_i)),dimj ),((*mosek::fusion::p_SparseMatrix::_get_impl(_8286_m)->subj)(_8288_i)) ))) = ((*mosek::fusion::p_SparseMatrix::_get_impl(_8286_m)->val)(_8288_i));
          }
        }
      }
    }
    else
    {
      mosek::fusion::Matrix::t _8287_m = _13085_;
      {
        throw ::mosek::fusion::MatrixError(std::string ("Unknown matrix type."));
      }
    }
    nnz = (int64_t)safe_mul( dimi,dimj );
  }
}
// mosek.fusion.DenseMatrix.ctor

// mosek.fusion.DenseMatrix.ctor @ bld/grindsted/final/default/src/fusion/Matrix.mbi:862:6-867:7
mosek::fusion::DenseMatrix::t mosek::fusion::p_DenseMatrix::_new_DenseMatrix
  (std::shared_ptr< monty::ndarray< double,2 > > _8289_d)
{ return new mosek::fusion::DenseMatrix(_8289_d); }
mosek::fusion::DenseMatrix::DenseMatrix
  (std::shared_ptr< monty::ndarray< double,2 > > _8289_d) : 
   DenseMatrix(new mosek::fusion::p_DenseMatrix(this))
{ mosek::fusion::p_DenseMatrix::_get_impl(this)->_initialize(_8289_d); }
void mosek::fusion::p_DenseMatrix::_initialize  (std::shared_ptr< monty::ndarray< double,2 > > _8289_d)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_Matrix::_initialize((int)((_8289_d)->size(0)),(int)((_8289_d)->size(1)));
    std::vector<double> _13088_;
    for (int32_t _8290_i = (int)0, _13089_ = dimi; _8290_i < _13089_ ; ++_8290_i)
    {
      for (int32_t _8291_j = (int)0, _13090_ = dimj; _8291_j < _13090_ ; ++_8291_j)
      {
        _13088_.push_back(((*_8289_d)(_8290_i,_8291_j)));
      }
    }
    auto _13091_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_13088_.size()),_13088_.begin(),_13088_.end()));
    data = _13091_;
    nnz = (int64_t)safe_mul( dimi,dimj );
  }
}
// mosek.fusion.DenseMatrix.ctor

// mosek.fusion.DenseMatrix.ctor @ bld/grindsted/final/default/src/fusion/Matrix.mbi:851:6-856:7
mosek::fusion::DenseMatrix::t mosek::fusion::p_DenseMatrix::_new_DenseMatrix
  (int32_t _8292_dimi_,
    int32_t _8293_dimj_,
    double _8294_value_)
{ return new mosek::fusion::DenseMatrix(_8292_dimi_,_8293_dimj_,_8294_value_); }
mosek::fusion::DenseMatrix::DenseMatrix
  (int32_t _8292_dimi_,
    int32_t _8293_dimj_,
    double _8294_value_) : 
   DenseMatrix(new mosek::fusion::p_DenseMatrix(this))
{ mosek::fusion::p_DenseMatrix::_get_impl(this)->_initialize(_8292_dimi_,_8293_dimj_,_8294_value_); }
void mosek::fusion::p_DenseMatrix::_initialize  (int32_t _8292_dimi_,
    int32_t _8293_dimj_,
    double _8294_value_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_Matrix::_initialize(_8292_dimi_,_8293_dimj_);
    std::vector<double> _13092_;
    for (int32_t _8295_i = (int)0, _13093_ = _8292_dimi_; _8295_i < _13093_ ; ++_8295_i)
    {
      for (int32_t _8296_j = (int)0, _13094_ = _8293_dimj_; _8296_j < _13094_ ; ++_8296_j)
      {
        _13092_.push_back(_8294_value_);
      }
    }
    auto _13095_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_13092_.size()),_13092_.begin(),_13092_.end()));
    data = _13095_;
    nnz = (int64_t)safe_mul( _8292_dimi_,_8293_dimj_ );
  }
}
// mosek.fusion.DenseMatrix.ctor

// Begin mosek.fusion.DenseMatrix.toString
// Method mosek.fusion.DenseMatrix.toString @ bld/grindsted/final/default/src/fusion/Matrix.mbi:940:6-958:7
std::string mosek::fusion::DenseMatrix :: toString() { return mosek::fusion::p_DenseMatrix::_get_impl(this)->toString(); }
std::string mosek::fusion::p_DenseMatrix::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _8297_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  _8297_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("DenseMatrix("));
  _8297_sb->__mosek_2fusion_2Utils_2StringBuffer__a(dimi);
  _8297_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","));
  _8297_sb->__mosek_2fusion_2Utils_2StringBuffer__a(dimj);
  _8297_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (": "));
  int32_t _8298_k = (int)0;
  {
    int32_t _8299_i = (int)0;
    for(;(_8299_i < dimi);++ _8299_i)
    {
      {
        if ((_8299_i > (int)0))
        {
          {
            _8297_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","));
          }
        }
        {}
        _8297_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("[ "));
        _8297_sb->__mosek_2fusion_2Utils_2StringBuffer__a(((*data)(_8298_k)));
        ++ _8298_k;
        {
          int32_t _8300_j = (int)1;
          for(;(_8300_j < dimj);++ _8300_j)
          {
            {
              _8297_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","));
              _8297_sb->__mosek_2fusion_2Utils_2StringBuffer__a(((*data)(_8298_k)));
              ++ _8298_k;
            }
          }
        }
        _8297_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (" ]"));
      }
    }
  }
  _8297_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"));
  return _8297_sb->toString();
}
// End mosek.fusion.DenseMatrix.toString

// Begin mosek.fusion.DenseMatrix.transpose
// Method mosek.fusion.DenseMatrix.transpose @ bld/grindsted/final/default/src/fusion/Matrix.mbi:919:6-938:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::DenseMatrix :: __mosek_2fusion_2DenseMatrix__transpose() { return mosek::fusion::p_DenseMatrix::_get_impl(this)->__mosek_2fusion_2DenseMatrix__transpose(); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::DenseMatrix::transpose() { return __mosek_2fusion_2DenseMatrix__transpose(); }
/* override: mosek.fusion.Matrix.transpose*/
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::DenseMatrix::__mosek_2fusion_2Matrix__transpose() { return __mosek_2fusion_2DenseMatrix__transpose(); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_DenseMatrix::__mosek_2fusion_2DenseMatrix__transpose()
{
  std::shared_ptr< monty::ndarray< double,1 > > _8301_newdata = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(safe_mul( dimi,dimj ))));
  _checked_ptr_1<double> _ptr__8301_newdata(_8301_newdata ? _8301_newdata->raw() : nullptr,_8301_newdata ? _8301_newdata->size(0) : 0);
  int32_t _8302_srci = (int)0;
  int32_t _8303_step = dimi;
  int32_t _13096_ = (int)0;
  int32_t _13097_ = dimi;
  for (int32_t _8304_i = _13096_; _8304_i < _13097_; ++_8304_i)
  {
    {
      int32_t _8305_dsti = _8304_i;
      int32_t _13098_ = (int)0;
      int32_t _13099_ = dimj;
      for (int32_t _8306_j = _13098_; _8306_j < _13099_; ++_8306_j)
      {
        {
          _ptr__8301_newdata[_8305_dsti] = ((*data)(_8302_srci));
          _8305_dsti = safe_add( _8305_dsti,_8303_step );
          ++ _8302_srci;
        }
      }
    }
  }
  return (::mosek::fusion::p_DenseMatrix::_new_DenseMatrix(dimj,dimi,_8301_newdata)).as<::mosek::fusion::Matrix>();
}
// End mosek.fusion.DenseMatrix.transpose

// Begin mosek.fusion.DenseMatrix.isSparse
// Method mosek.fusion.DenseMatrix.isSparse @ bld/grindsted/final/default/src/fusion/Matrix.mbi:842:6-54
bool mosek::fusion::DenseMatrix :: isSparse() { return mosek::fusion::p_DenseMatrix::_get_impl(this)->isSparse(); }
bool mosek::fusion::p_DenseMatrix::isSparse()
{
  return false;
}
// End mosek.fusion.DenseMatrix.isSparse

// Begin mosek.fusion.DenseMatrix.getDataAsArray
// Method mosek.fusion.DenseMatrix.getDataAsArray @ bld/grindsted/final/default/src/fusion/Matrix.mbi:837:6-840:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::DenseMatrix :: getDataAsArray() { return mosek::fusion::p_DenseMatrix::_get_impl(this)->getDataAsArray(); }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_DenseMatrix::getDataAsArray()
{
  return ::mosek::fusion::Utils::Tools::arraycopy(data);
}
// End mosek.fusion.DenseMatrix.getDataAsArray

// Begin mosek.fusion.DenseMatrix.getDataAsTriplets
// Method mosek.fusion.DenseMatrix.getDataAsTriplets @ bld/grindsted/final/default/src/fusion/Matrix.mbi:812:6-835:7
void mosek::fusion::DenseMatrix :: getDataAsTriplets(std::shared_ptr< monty::ndarray< int32_t,1 > > _8307_subi,std::shared_ptr< monty::ndarray< int32_t,1 > > _8308_subj,std::shared_ptr< monty::ndarray< double,1 > > _8309_cof) { mosek::fusion::p_DenseMatrix::_get_impl(this)->getDataAsTriplets(_8307_subi,_8308_subj,_8309_cof); }
void mosek::fusion::p_DenseMatrix::getDataAsTriplets(std::shared_ptr< monty::ndarray< int32_t,1 > > _8307_subi,std::shared_ptr< monty::ndarray< int32_t,1 > > _8308_subj,std::shared_ptr< monty::ndarray< double,1 > > _8309_cof)
{
  _checked_ptr_1<int32_t> _ptr__8307_subi(_8307_subi ? _8307_subi->raw() : nullptr, _8307_subi ? _8307_subi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__8308_subj(_8308_subj ? _8308_subj->raw() : nullptr, _8308_subj ? _8308_subj->size(0) : 0);
  _checked_ptr_1<double> _ptr__8309_cof(_8309_cof ? _8309_cof->raw() : nullptr, _8309_cof ? _8309_cof->size(0) : 0);
  if ((((int)((_8307_subi)->size(0)) < nnz) || (((int)((_8308_subj)->size(0)) < nnz) || ((int)((_8309_cof)->size(0)) < nnz))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Output arrays are not long enough."));
    }
  }
  {}
  ::mosek::fusion::Utils::Tools::arraycopy(data,(int)0,_8309_cof,(int)0,(int)((data)->size(0)));
  int32_t _8310_k = (int)0;
  int32_t _13100_ = (int)0;
  int32_t _13101_ = dimi;
  for (int32_t _8311_i = _13100_; _8311_i < _13101_; ++_8311_i)
  {
    {
      int32_t _13102_ = (int)0;
      int32_t _13103_ = dimj;
      for (int32_t _8312_j = _13102_; _8312_j < _13103_; ++_8312_j)
      {
        {
          _ptr__8307_subi[_8310_k] = _8311_i;
          _ptr__8308_subj[_8310_k] = _8312_j;
          ++ _8310_k;
        }
      }
    }
  }
}
// End mosek.fusion.DenseMatrix.getDataAsTriplets

// Begin mosek.fusion.DenseMatrix.get
// Method mosek.fusion.DenseMatrix.get @ bld/grindsted/final/default/src/fusion/Matrix.mbi:810:6-82
double mosek::fusion::DenseMatrix :: get(int32_t _8313_i,int32_t _8314_j) { return mosek::fusion::p_DenseMatrix::_get_impl(this)->get(_8313_i,_8314_j); }
double mosek::fusion::p_DenseMatrix::get(int32_t _8313_i,int32_t _8314_j)
{
  return ((*data)(safe_add( safe_mul( _8313_i,dimj ),_8314_j )));
}
// End mosek.fusion.DenseMatrix.get

// Begin mosek.fusion.DenseMatrix.numNonzeros
// Method mosek.fusion.DenseMatrix.numNonzeros @ bld/grindsted/final/default/src/fusion/Matrix.mbi:805:6-808:7
int64_t mosek::fusion::DenseMatrix :: numNonzeros() { return mosek::fusion::p_DenseMatrix::_get_impl(this)->numNonzeros(); }
int64_t mosek::fusion::p_DenseMatrix::numNonzeros()
{
  return (int64_t)safe_mul( dimi,dimj );
}
// End mosek.fusion.DenseMatrix.numNonzeros

void mosek::fusion::p_DenseMatrix::destroy()
{
  data.reset();
}
void mosek::fusion::DenseMatrix::destroy() { mosek::fusion::p_DenseMatrix::_get_impl(this)->destroy(); }
// } class DenseMatrix
// class SparseMatrix { // @ bld/grindsted/final/default/src/fusion/Matrix.mbi:575:4-790:5
mosek::fusion::SparseMatrix::SparseMatrix(mosek::fusion::p_SparseMatrix *_impl) : mosek::fusion::Matrix(_impl) { /*std::cout << "SparseMatrix()" << this << std::endl; */ }
mosek::fusion::SparseMatrix::~SparseMatrix() {  /* std::cout << "~SparseMatrix()" << this << std::endl << std::flush; */ }
mosek::fusion::p_SparseMatrix::p_SparseMatrix
  (::mosek::fusion::SparseMatrix * _pubthis) :     mosek::fusion::p_Matrix(_pubthis),
    _pubthis(_pubthis)
{}
// mosek.fusion.SparseMatrix.ctor @ bld/grindsted/final/default/src/fusion/Matrix.mbi:668:6-713:7
mosek::fusion::SparseMatrix::t mosek::fusion::p_SparseMatrix::_new_SparseMatrix
  (int32_t _8315_dimi_,
    int32_t _8316_dimj_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8317_subi_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8318_subj_,
    std::shared_ptr< monty::ndarray< double,1 > > _8319_val_,
    int64_t _8320_nelm)
{ return new mosek::fusion::SparseMatrix(_8315_dimi_,_8316_dimj_,_8317_subi_,_8318_subj_,_8319_val_,_8320_nelm); }
mosek::fusion::SparseMatrix::SparseMatrix
  (int32_t _8315_dimi_,
    int32_t _8316_dimj_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8317_subi_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8318_subj_,
    std::shared_ptr< monty::ndarray< double,1 > > _8319_val_,
    int64_t _8320_nelm) : 
   SparseMatrix(new mosek::fusion::p_SparseMatrix(this))
{ mosek::fusion::p_SparseMatrix::_get_impl(this)->_initialize(_8315_dimi_,_8316_dimj_,_8317_subi_,_8318_subj_,_8319_val_,_8320_nelm); }
void mosek::fusion::p_SparseMatrix::_initialize  (int32_t _8315_dimi_,
    int32_t _8316_dimj_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8317_subi_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8318_subj_,
    std::shared_ptr< monty::ndarray< double,1 > > _8319_val_,
    int64_t _8320_nelm)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__8317_subi_(_8317_subi_ ? _8317_subi_->raw() : nullptr, _8317_subi_ ? _8317_subi_->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__8318_subj_(_8318_subj_ ? _8318_subj_->raw() : nullptr, _8318_subj_ ? _8318_subj_->size(0) : 0);
    _checked_ptr_1<double> _ptr__8319_val_(_8319_val_ ? _8319_val_->raw() : nullptr, _8319_val_ ? _8319_val_->size(0) : 0);
    mosek::fusion::p_Matrix::_initialize(_8315_dimi_,_8316_dimj_);
    if ((_8320_nelm > (int)0))
    {
      {
        if ((((int)((_8317_subi_)->size(0)) < _8320_nelm) || (((int)((_8318_subj_)->size(0)) < _8320_nelm) || ((int)((_8319_val_)->size(0)) < _8320_nelm))))
        {
          {
            throw ::mosek::fusion::SparseFormatError(std::string ("Mismatching arrays in sparse data."));
          }
        }
        {}
        bool _8321_outofbounds = false;
        int64_t _13104_ = (int64_t)0;
        int64_t _13105_ = _8320_nelm;
        for (int64_t _8322_i = _13104_; _8322_i < _13105_; ++_8322_i)
        {
          {
            if (((_ptr__8317_subi_[_8322_i] < (int)0) || ((_ptr__8317_subi_[_8322_i] >= dimi) || ((_ptr__8318_subj_[_8322_i] < (int)0) || (_ptr__8318_subj_[_8322_i] >= dimj)))))
            {
              {
                _8321_outofbounds = true;
              }
            }
            {}
          }
        }
        if (_8321_outofbounds)
        {
          {
            throw ::mosek::fusion::SparseFormatError(std::string ("Subscript out of bounds."));
          }
        }
        {}
        std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _8323_ressubi = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 >(monty::shape((int)1)));
        std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > > _8324_ressubj = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< int32_t,1 > >,1 >(monty::shape((int)1)));
        std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< double,1 > >,1 > > _8325_resval = std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< double,1 > >,1 > >(new monty::ndarray< std::shared_ptr< monty::ndarray< double,1 > >,1 >(monty::shape((int)1)));
        ::mosek::fusion::p_CommonTools::tripletSort(_8317_subi_,_8318_subj_,_8319_val_,_8323_ressubi,_8324_ressubj,_8325_resval,_8320_nelm,dimi,dimj);
        subi = ((*_8323_ressubi)((int)0));
        subj = ((*_8324_ressubj)((int)0));
        val = ((*_8325_resval)((int)0));
        nnz = (int64_t)((val)->size(0));
      }
    }
    else
    {
      {
        subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0)));
        subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0)));
        val = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)0)));
        nnz = (int64_t)0;
      }
    }
  }
}
// mosek.fusion.SparseMatrix.ctor

// mosek.fusion.SparseMatrix.ctor @ bld/grindsted/final/default/src/fusion/Matrix.mbi:617:6-653:7
mosek::fusion::SparseMatrix::t mosek::fusion::p_SparseMatrix::_new_SparseMatrix
  (int32_t _8326_dimi_,
    int32_t _8327_dimj_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8328_subi_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8329_subj_,
    std::shared_ptr< monty::ndarray< double,1 > > _8330_val_)
{ return new mosek::fusion::SparseMatrix(_8326_dimi_,_8327_dimj_,_8328_subi_,_8329_subj_,_8330_val_); }
mosek::fusion::SparseMatrix::SparseMatrix
  (int32_t _8326_dimi_,
    int32_t _8327_dimj_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8328_subi_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8329_subj_,
    std::shared_ptr< monty::ndarray< double,1 > > _8330_val_) : 
   SparseMatrix(new mosek::fusion::p_SparseMatrix(this))
{ mosek::fusion::p_SparseMatrix::_get_impl(this)->_initialize(_8326_dimi_,_8327_dimj_,_8328_subi_,_8329_subj_,_8330_val_); }
void mosek::fusion::p_SparseMatrix::_initialize  (int32_t _8326_dimi_,
    int32_t _8327_dimj_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8328_subi_,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8329_subj_,
    std::shared_ptr< monty::ndarray< double,1 > > _8330_val_)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    _checked_ptr_1<int32_t> _ptr__8328_subi_(_8328_subi_ ? _8328_subi_->raw() : nullptr, _8328_subi_ ? _8328_subi_->size(0) : 0);
    _checked_ptr_1<int32_t> _ptr__8329_subj_(_8329_subj_ ? _8329_subj_->raw() : nullptr, _8329_subj_ ? _8329_subj_->size(0) : 0);
    _checked_ptr_1<double> _ptr__8330_val_(_8330_val_ ? _8330_val_->raw() : nullptr, _8330_val_ ? _8330_val_->size(0) : 0);
    mosek::fusion::p_Matrix::_initialize(_8326_dimi_,_8327_dimj_);
    int32_t _8331_n = (int)0;
    int32_t _13106_ = (int)0;
    int32_t _13107_ = (int)((_8330_val_)->size(0));
    for (int32_t _8332_i = _13106_; _8332_i < _13107_; ++_8332_i)
    {
      {
        if (((_ptr__8330_val_[_8332_i] > (int)0) || (_ptr__8330_val_[_8332_i] < (int)0)))
        {
          {
            ++ _8331_n;
          }
        }
        {}
      }
    }
    if (((_8331_n > (int)0) && (_8331_n < (int)((_8328_subi_)->size(0)))))
    {
      {
        subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8331_n)));
        subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8331_n)));
        val = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8331_n)));
        nnz = _8331_n;
        int32_t _8333_j = (int)0;
        int32_t _13108_ = (int)0;
        int32_t _13109_ = (int)((_8330_val_)->size(0));
        for (int32_t _8334_i = _13108_; _8334_i < _13109_; ++_8334_i)
        {
          {
            if (((_ptr__8330_val_[_8334_i] < (int)0) || (_ptr__8330_val_[_8334_i] > (int)0)))
            {
              {
                ((*val)(_8333_j)) = _ptr__8330_val_[_8334_i];
                ((*subj)(_8333_j)) = _ptr__8329_subj_[_8334_i];
                ((*subi)(_8333_j)) = _ptr__8328_subi_[_8334_i];
                ++ _8333_j;
              }
            }
            {}
          }
        }
      }
    }
    else
    {
      {
        subi = _8328_subi_;
        subj = _8329_subj_;
        val = _8330_val_;
        if ((NULL == _8328_subi_.get()))
        {
          {
            nnz = (int64_t)0;
          }
        }
        else
        {
          {
            nnz = (int64_t)((subi)->size(0));
          }
        }
      }
    }
  }
}
// mosek.fusion.SparseMatrix.ctor

// Begin mosek.fusion.SparseMatrix.formPtrb
// Method mosek.fusion.SparseMatrix.formPtrb @ bld/grindsted/final/default/src/fusion/Matrix.mbi:775:6-789:7
std::shared_ptr< monty::ndarray< int64_t,1 > > mosek::fusion::p_SparseMatrix::formPtrb()
{
  std::shared_ptr< monty::ndarray< int64_t,1 > > _8335_ptrb = std::shared_ptr< monty::ndarray< int64_t,1 > >(new monty::ndarray< int64_t,1 >(monty::shape(safe_add( dimi,(int)1 ))));
  _checked_ptr_1<int64_t> _ptr__8335_ptrb(_8335_ptrb ? _8335_ptrb->raw() : nullptr,_8335_ptrb ? _8335_ptrb->size(0) : 0);
  int64_t _8336_pos = (int64_t)0;
  int32_t _13110_ = (int)0;
  int32_t _13111_ = dimi;
  for (int32_t _8337_row = _13110_; _8337_row < _13111_; ++_8337_row)
  {
    {
      _ptr__8335_ptrb[_8337_row] = _8336_pos;
      {
        for(;((_8336_pos < nnz) && (((*subi)(_8336_pos)) == _8337_row));++ _8336_pos)
        {
          {
          }
        }
      }
    }
  }
  _ptr__8335_ptrb[dimi] = _8336_pos;
  return _8335_ptrb;
}
// End mosek.fusion.SparseMatrix.formPtrb

// Begin mosek.fusion.SparseMatrix.toString
// Method mosek.fusion.SparseMatrix.toString @ bld/grindsted/final/default/src/fusion/Matrix.mbi:760:6-772:7
std::string mosek::fusion::SparseMatrix :: toString() { return mosek::fusion::p_SparseMatrix::_get_impl(this)->toString(); }
std::string mosek::fusion::p_SparseMatrix::toString()
{
  monty::rc_ptr< ::mosek::fusion::Utils::StringBuffer > _8338_sb = ::mosek::fusion::Utils::p_StringBuffer::_new_StringBuffer();
  _8338_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("SparseMatrix("))->__mosek_2fusion_2Utils_2StringBuffer__a(dimi)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(dimj)->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (", ["));
  if (((NULL != subi.get()) && ((int)((subi)->size(0)) > (int)0)))
  {
    {
      _8338_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string ("("))->__mosek_2fusion_2Utils_2StringBuffer__a(((*subi)((int)0)))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*subj)((int)0)))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*val)((int)0)))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"));
      int32_t _13112_ = (int)1;
      int32_t _13113_ = (int)((subi)->size(0));
      for (int32_t _8339_i = _13112_; _8339_i < _13113_; ++_8339_i)
      {
        {
          _8338_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (",("))->__mosek_2fusion_2Utils_2StringBuffer__a(((*subi)(_8339_i)))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*subj)(_8339_i)))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (","))->__mosek_2fusion_2Utils_2StringBuffer__a(((*val)(_8339_i)))->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (")"));
        }
      }
    }
  }
  {}
  _8338_sb->__mosek_2fusion_2Utils_2StringBuffer__a(std::string (" ])"));
  return _8338_sb->toString();
}
// End mosek.fusion.SparseMatrix.toString

// Begin mosek.fusion.SparseMatrix.numNonzeros
// Method mosek.fusion.SparseMatrix.numNonzeros @ bld/grindsted/final/default/src/fusion/Matrix.mbi:755:6-758:7
int64_t mosek::fusion::SparseMatrix :: numNonzeros() { return mosek::fusion::p_SparseMatrix::_get_impl(this)->numNonzeros(); }
int64_t mosek::fusion::p_SparseMatrix::numNonzeros()
{
  return nnz;
}
// End mosek.fusion.SparseMatrix.numNonzeros

// Begin mosek.fusion.SparseMatrix.transpose
// Method mosek.fusion.SparseMatrix.transpose @ bld/grindsted/final/default/src/fusion/Matrix.mbi:748:6-752:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::SparseMatrix :: __mosek_2fusion_2SparseMatrix__transpose() { return mosek::fusion::p_SparseMatrix::_get_impl(this)->__mosek_2fusion_2SparseMatrix__transpose(); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::SparseMatrix::transpose() { return __mosek_2fusion_2SparseMatrix__transpose(); }
/* override: mosek.fusion.Matrix.transpose*/
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::SparseMatrix::__mosek_2fusion_2Matrix__transpose() { return __mosek_2fusion_2SparseMatrix__transpose(); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_SparseMatrix::__mosek_2fusion_2SparseMatrix__transpose()
{
  return ::mosek::fusion::p_Matrix::sparse(dimj,dimi,subj,subi,val);
}
// End mosek.fusion.SparseMatrix.transpose

// Begin mosek.fusion.SparseMatrix.isSparse
// Method mosek.fusion.SparseMatrix.isSparse @ bld/grindsted/final/default/src/fusion/Matrix.mbi:745:6-53
bool mosek::fusion::SparseMatrix :: isSparse() { return mosek::fusion::p_SparseMatrix::_get_impl(this)->isSparse(); }
bool mosek::fusion::p_SparseMatrix::isSparse()
{
  return true;
}
// End mosek.fusion.SparseMatrix.isSparse

// Begin mosek.fusion.SparseMatrix.getDataAsArray
// Method mosek.fusion.SparseMatrix.getDataAsArray @ bld/grindsted/final/default/src/fusion/Matrix.mbi:737:6-743:7
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::SparseMatrix :: getDataAsArray() { return mosek::fusion::p_SparseMatrix::_get_impl(this)->getDataAsArray(); }
std::shared_ptr< monty::ndarray< double,1 > > mosek::fusion::p_SparseMatrix::getDataAsArray()
{
  std::shared_ptr< monty::ndarray< double,1 > > _8340_r = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(safe_mul( dimi,dimj ))));
  _checked_ptr_1<double> _ptr__8340_r(_8340_r ? _8340_r->raw() : nullptr,_8340_r ? _8340_r->size(0) : 0);
  int32_t _13114_ = (int)0;
  int32_t _13115_ = (int)((subi)->size(0));
  for (int32_t _8341_i = _13114_; _8341_i < _13115_; ++_8341_i)
  {
    {
      _ptr__8340_r[safe_add( safe_mul( ((*subi)(_8341_i)),dimj ),((*subj)(_8341_i)) )] = ((*val)(_8341_i));
    }
  }
  return _8340_r;
}
// End mosek.fusion.SparseMatrix.getDataAsArray

// Begin mosek.fusion.SparseMatrix.getDataAsTriplets
// Method mosek.fusion.SparseMatrix.getDataAsTriplets @ bld/grindsted/final/default/src/fusion/Matrix.mbi:717:6-735:7
void mosek::fusion::SparseMatrix :: getDataAsTriplets(std::shared_ptr< monty::ndarray< int32_t,1 > > _8342_subi_,std::shared_ptr< monty::ndarray< int32_t,1 > > _8343_subj_,std::shared_ptr< monty::ndarray< double,1 > > _8344_cof_) { mosek::fusion::p_SparseMatrix::_get_impl(this)->getDataAsTriplets(_8342_subi_,_8343_subj_,_8344_cof_); }
void mosek::fusion::p_SparseMatrix::getDataAsTriplets(std::shared_ptr< monty::ndarray< int32_t,1 > > _8342_subi_,std::shared_ptr< monty::ndarray< int32_t,1 > > _8343_subj_,std::shared_ptr< monty::ndarray< double,1 > > _8344_cof_)
{
  _checked_ptr_1<int32_t> _ptr__8342_subi_(_8342_subi_ ? _8342_subi_->raw() : nullptr, _8342_subi_ ? _8342_subi_->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__8343_subj_(_8343_subj_ ? _8343_subj_->raw() : nullptr, _8343_subj_ ? _8343_subj_->size(0) : 0);
  _checked_ptr_1<double> _ptr__8344_cof_(_8344_cof_ ? _8344_cof_->raw() : nullptr, _8344_cof_ ? _8344_cof_->size(0) : 0);
  if ((((int64_t)((_8342_subi_)->size(0)) < nnz) || (((int64_t)((_8343_subj_)->size(0)) < nnz) || ((int64_t)((_8344_cof_)->size(0)) < nnz))))
  {
    {
      throw ::mosek::fusion::LengthError(std::string ("Output arrays are not long enough."));
    }
  }
  {}
  if (((NULL != subi.get()) && ((int)((subi)->size(0)) > (int)0)))
  {
    {
      ::mosek::fusion::Utils::Tools::arraycopy(subi,(int64_t)0,_8342_subi_,(int64_t)0,nnz);
      ::mosek::fusion::Utils::Tools::arraycopy(subj,(int64_t)0,_8343_subj_,(int64_t)0,nnz);
      ::mosek::fusion::Utils::Tools::arraycopy(val,(int64_t)0,_8344_cof_,(int64_t)0,nnz);
    }
  }
  {}
}
// End mosek.fusion.SparseMatrix.getDataAsTriplets

// Begin mosek.fusion.SparseMatrix.get
// Method mosek.fusion.SparseMatrix.get @ bld/grindsted/final/default/src/fusion/Matrix.mbi:588:6-606:7
double mosek::fusion::SparseMatrix :: get(int32_t _8345_i,int32_t _8346_j) { return mosek::fusion::p_SparseMatrix::_get_impl(this)->get(_8345_i,_8346_j); }
double mosek::fusion::p_SparseMatrix::get(int32_t _8345_i,int32_t _8346_j)
{
  if (((_8345_i < (int)0) || ((_8345_i >= dimi) || ((_8346_j < (int)0) || (_8346_j >= dimj)))))
  {
    {
      throw ::mosek::fusion::IndexError(std::string ("Index out if bounds"));
    }
  }
  {}
  int32_t _8347_e = (int)((subi)->size(0));
  int32_t _8348_b = (int)0;
  while ( ((_8347_e - _8348_b) > (int)1) )
  {
    {
      int32_t _8349_p = (safe_add( _8348_b,_8347_e ) / (int)2);
      if (((((*subi)(_8349_p)) < _8345_i) || ((((*subi)(_8349_p)) == _8345_i) && (((*subj)(_8349_p)) < _8346_j))))
      {
        {
          _8348_b = _8349_p;
        }
      }
      else if(((((*subi)(_8349_p)) > _8345_i) || ((((*subi)(_8349_p)) == _8345_i) && (((*subj)(_8349_p)) > _8346_j))))
      {
        {
          _8347_e = _8349_p;
        }
      }
      else
      {
        {
          return ((*val)(_8349_p));
        }
      }
    }
  }
  if (((((*subi)(_8348_b)) == _8345_i) && (((*subj)(_8348_b)) == _8346_j)))
  {
    {
      return ((*val)(_8348_b));
    }
  }
  else
  {
    {
      return 0.0;
    }
  }
}
// End mosek.fusion.SparseMatrix.get

void mosek::fusion::p_SparseMatrix::destroy()
{
  val.reset();
  subj.reset();
  subi.reset();
}
void mosek::fusion::SparseMatrix::destroy() { mosek::fusion::p_SparseMatrix::_get_impl(this)->destroy(); }
// } class SparseMatrix
// class Matrix { // @ bld/grindsted/final/default/src/fusion/Matrix.mbi:58:4-569:5
mosek::fusion::Matrix::Matrix(mosek::fusion::p_Matrix *_impl) : _impl(_impl) { /*std::cout << "Matrix() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::Matrix::~Matrix() { delete _impl; _impl = nullptr; }
mosek::fusion::p_Matrix::p_Matrix
  (::mosek::fusion::Matrix * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.Matrix.ctor @ bld/grindsted/final/default/src/fusion/Matrix.mbi:65:6-71:7
void mosek::fusion::p_Matrix::_initialize  (int32_t _8350_di,
    int32_t _8351_dj)
{
  monty::rc_reserve __reserve_this(_pubthis); 
  {
    if (((_8350_di < (int)0) || (_8351_dj < (int)0)))
    {
      {
        throw ::mosek::fusion::DimensionError(std::string ("Invalid dimensions"));
      }
    }
    {}
    dimi = _8350_di;
    dimj = _8351_dj;
  }
}
// mosek.fusion.Matrix.ctor

// Begin mosek.fusion.Matrix.toString
// Method mosek.fusion.Matrix.toString @ bld/grindsted/final/default/src/fusion/Matrix.mbi:568:6-52
std::string mosek::fusion::Matrix :: toString() { return mosek::fusion::p_Matrix::_get_impl(this)->toString(); }
std::string mosek::fusion::p_Matrix::toString()
{
  return std::string ("");
}
// End mosek.fusion.Matrix.toString

// Begin mosek.fusion.Matrix.switchDims
// Method mosek.fusion.Matrix.switchDims @ bld/grindsted/final/default/src/fusion/Matrix.mbi:560:6-564:7
void mosek::fusion::p_Matrix::switchDims()
{
  int32_t _8352_tmp = dimi;
  dimi = dimj;
  dimj = _8352_tmp;
}
// End mosek.fusion.Matrix.switchDims

// Begin mosek.fusion.Matrix.diag
// Method mosek.fusion.Matrix.diag @ bld/grindsted/final/default/src/fusion/Matrix.mbi:556:6-107
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::diag
  ( int32_t _8353_num,
    monty::rc_ptr< ::mosek::fusion::Matrix > _8354_mv) { return mosek::fusion::p_Matrix::diag(_8353_num,_8354_mv); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::diag(int32_t _8353_num,monty::rc_ptr< ::mosek::fusion::Matrix > _8354_mv)
{
  std::vector<monty::rc_ptr< ::mosek::fusion::Matrix >> _13116_;
  for (int32_t _8355_i = (int)0, _13117_ = _8353_num; _8355_i < _13117_ ; ++_8355_i)
  {
    _13116_.push_back(_8354_mv);
  }
  auto _13118_ = std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Matrix >,1 > >(new monty::ndarray< monty::rc_ptr< ::mosek::fusion::Matrix >,1 >(monty::shape(_13116_.size()),_13116_.begin(),_13116_.end()));
  return ::mosek::fusion::p_Matrix::diag(_13118_);
}
// End mosek.fusion.Matrix.diag

// Begin mosek.fusion.Matrix.diag
// Method mosek.fusion.Matrix.diag @ bld/grindsted/final/default/src/fusion/Matrix.mbi:505:6-548:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::diag
  ( std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Matrix >,1 > > _8356_md) { return mosek::fusion::p_Matrix::diag(_8356_md); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::diag(std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Matrix >,1 > > _8356_md)
{
  std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Matrix >,1 > > _8357_d = _8356_md;
  int64_t _8358_numelm = (int64_t)0;
  int32_t _8359_dimj = (int)0;
  int32_t _8360_dimi = (int)0;
  int32_t _13119_ = (int)0;
  int32_t _13120_ = (int)((_8356_md)->size(0));
  for (int32_t _8361_i = _13119_; _8361_i < _13120_; ++_8361_i)
  {
    {
      _8360_dimi = safe_add( _8360_dimi,mosek::fusion::p_Matrix::_get_impl(((*_8356_md)(_8361_i)))->dimi );
      _8359_dimj = safe_add( _8359_dimj,mosek::fusion::p_Matrix::_get_impl(((*_8356_md)(_8361_i)))->dimj );
      _8358_numelm = safe_add( _8358_numelm,((*_8356_md)(_8361_i))->numNonzeros() );
    }
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8362_subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8358_numelm)));
  _checked_ptr_1<int32_t> _ptr__8362_subi(_8362_subi ? _8362_subi->raw() : nullptr,_8362_subi ? _8362_subi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8363_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8358_numelm)));
  _checked_ptr_1<int32_t> _ptr__8363_subj(_8363_subj ? _8363_subj->raw() : nullptr,_8363_subj ? _8363_subj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _8364_val = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8358_numelm)));
  _checked_ptr_1<double> _ptr__8364_val(_8364_val ? _8364_val->raw() : nullptr,_8364_val ? _8364_val->size(0) : 0);
  {
    int32_t _8365_offsetj = (int)0;
    int32_t _8366_offseti = (int)0;
    int64_t _8367_k = (int64_t)0;
    int32_t _13121_ = (int)0;
    int32_t _13122_ = (int)((_8356_md)->size(0));
    for (int32_t _8368_i = _13121_; _8368_i < _13122_; ++_8368_i)
    {
      {
        int64_t _8369_N = ((*_8356_md)(_8368_i))->numNonzeros();
        std::shared_ptr< monty::ndarray< double,1 > > _8370_mval = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8369_N)));
        _checked_ptr_1<double> _ptr__8370_mval(_8370_mval ? _8370_mval->raw() : nullptr,_8370_mval ? _8370_mval->size(0) : 0);
        std::shared_ptr< monty::ndarray< int32_t,1 > > _8371_msubj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8369_N)));
        _checked_ptr_1<int32_t> _ptr__8371_msubj(_8371_msubj ? _8371_msubj->raw() : nullptr,_8371_msubj ? _8371_msubj->size(0) : 0);
        std::shared_ptr< monty::ndarray< int32_t,1 > > _8372_msubi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8369_N)));
        _checked_ptr_1<int32_t> _ptr__8372_msubi(_8372_msubi ? _8372_msubi->raw() : nullptr,_8372_msubi ? _8372_msubi->size(0) : 0);
        ((*_8356_md)(_8368_i))->getDataAsTriplets(_8372_msubi,_8371_msubj,_8370_mval);
        ::mosek::fusion::Utils::Tools::arraycopy(_8370_mval,(int64_t)0,_8364_val,_8367_k,_8369_N);
        int64_t _13123_ = (int64_t)0;
        int64_t _13124_ = _8369_N;
        for (int64_t _8373_j = _13123_; _8373_j < _13124_; ++_8373_j)
        {
          {
            _ptr__8362_subi[safe_add( _8367_k,_8373_j )] = safe_add( _ptr__8372_msubi[_8373_j],_8366_offseti );
            _ptr__8363_subj[safe_add( _8367_k,_8373_j )] = safe_add( _ptr__8372_msubi[_8373_j],_8365_offsetj );
          }
        }
        _8367_k = safe_add( _8367_k,_8369_N );
        _8366_offseti = safe_add( _8366_offseti,mosek::fusion::p_Matrix::_get_impl(((*_8356_md)(_8368_i)))->dimi );
        _8365_offsetj = safe_add( _8365_offsetj,mosek::fusion::p_Matrix::_get_impl(((*_8356_md)(_8368_i)))->dimj );
      }
    }
  }
  return (::mosek::fusion::p_SparseMatrix::_new_SparseMatrix(_8360_dimi,_8359_dimj,_8362_subi,_8363_subj,_8364_val)).as<::mosek::fusion::Matrix>();
}
// End mosek.fusion.Matrix.diag

// Begin mosek.fusion.Matrix.antidiag
// Method mosek.fusion.Matrix.antidiag @ bld/grindsted/final/default/src/fusion/Matrix.mbi:485:6-494:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::antidiag
  ( int32_t _8374_n,
    double _8375_val,
    int32_t _8376_k) { return mosek::fusion::p_Matrix::antidiag(_8374_n,_8375_val,_8376_k); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::antidiag(int32_t _8374_n,double _8375_val,int32_t _8376_k)
{
  if (((_8376_k < _8374_n) && (_8376_k >= (int)0)))
  {
    {
      return ::mosek::fusion::p_Matrix::antidiag(::mosek::fusion::Utils::Tools::makevector(_8375_val,(_8374_n - _8376_k)),_8376_k);
    }
  }
  else if(((_8376_k > (-_8374_n)) && (_8376_k < (int)0)))
  {
    {
      return ::mosek::fusion::p_Matrix::antidiag(::mosek::fusion::Utils::Tools::makevector(_8375_val,safe_add( _8374_n,_8376_k )),_8376_k);
    }
  }
  else
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Diagonal index out of bounds"));
    }
  }
}
// End mosek.fusion.Matrix.antidiag

// Begin mosek.fusion.Matrix.antidiag
// Method mosek.fusion.Matrix.antidiag @ bld/grindsted/final/default/src/fusion/Matrix.mbi:480:6-483:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::antidiag
  ( int32_t _8377_n,
    double _8378_val) { return mosek::fusion::p_Matrix::antidiag(_8377_n,_8378_val); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::antidiag(int32_t _8377_n,double _8378_val)
{
  return ::mosek::fusion::p_Matrix::antidiag(::mosek::fusion::Utils::Tools::makevector(_8378_val,_8377_n),(int)0);
}
// End mosek.fusion.Matrix.antidiag

// Begin mosek.fusion.Matrix.diag
// Method mosek.fusion.Matrix.diag @ bld/grindsted/final/default/src/fusion/Matrix.mbi:469:6-478:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::diag
  ( int32_t _8379_n,
    double _8380_val,
    int32_t _8381_k) { return mosek::fusion::p_Matrix::diag(_8379_n,_8380_val,_8381_k); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::diag(int32_t _8379_n,double _8380_val,int32_t _8381_k)
{
  if (((_8381_k < _8379_n) && (_8381_k >= (int)0)))
  {
    {
      return ::mosek::fusion::p_Matrix::diag(::mosek::fusion::Utils::Tools::makevector(_8380_val,(_8379_n - _8381_k)),_8381_k);
    }
  }
  else if(((_8381_k > (-_8379_n)) && (_8381_k < (int)0)))
  {
    {
      return ::mosek::fusion::p_Matrix::diag(::mosek::fusion::Utils::Tools::makevector(_8380_val,safe_add( _8379_n,_8381_k )),_8381_k);
    }
  }
  else
  {
    {
      throw ::mosek::fusion::DimensionError(std::string ("Diagonal index out of bounds"));
    }
  }
}
// End mosek.fusion.Matrix.diag

// Begin mosek.fusion.Matrix.diag
// Method mosek.fusion.Matrix.diag @ bld/grindsted/final/default/src/fusion/Matrix.mbi:464:6-467:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::diag
  ( int32_t _8382_n,
    double _8383_val) { return mosek::fusion::p_Matrix::diag(_8382_n,_8383_val); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::diag(int32_t _8382_n,double _8383_val)
{
  return ::mosek::fusion::p_Matrix::diag(::mosek::fusion::Utils::Tools::makevector(_8383_val,_8382_n),(int)0);
}
// End mosek.fusion.Matrix.diag

// Begin mosek.fusion.Matrix.antidiag
// Method mosek.fusion.Matrix.antidiag @ bld/grindsted/final/default/src/fusion/Matrix.mbi:442:6-461:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::antidiag
  ( std::shared_ptr< monty::ndarray< double,1 > > _8384_d,
    int32_t _8385_k) { return mosek::fusion::p_Matrix::antidiag(_8384_d,_8385_k); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::antidiag(std::shared_ptr< monty::ndarray< double,1 > > _8384_d,int32_t _8385_k)
{
  _checked_ptr_1<double> _ptr__8384_d(_8384_d ? _8384_d->raw() : nullptr, _8384_d ? _8384_d->size(0) : 0);
  int32_t _13125_;
  bool _13126_ = (_8385_k > (int)0);
  if (_13126_)
  {
    _13125_ = _8385_k;
  }
  else
  {
    _13125_ = (-_8385_k);
  }
  int32_t _8386_absk = _13125_;
  int32_t _8387_dimi = safe_add( (int)((_8384_d)->size(0)),_8386_absk );
  int32_t _8388_n = (int)((_8384_d)->size(0));
  if ((_8385_k >= (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _8389_subi = ::mosek::fusion::Utils::Tools::range(_8385_k,safe_add( _8388_n,_8385_k ));
      _checked_ptr_1<int32_t> _ptr__8389_subi(_8389_subi ? _8389_subi->raw() : nullptr,_8389_subi ? _8389_subi->size(0) : 0);
      std::vector<int32_t> _13127_;
      for (int32_t _8391_i = (int)1, _13128_ = safe_add( _8388_n,(int)1 ); _8391_i < _13128_ ; ++_8391_i)
      {
        _13127_.push_back((safe_add( _8388_n,_8385_k ) - _8391_i));
      }
      auto _13129_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_13127_.size()),_13127_.begin(),_13127_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _8390_subj = _13129_;
      _checked_ptr_1<int32_t> _ptr__8390_subj(_8390_subj ? _8390_subj->raw() : nullptr,_8390_subj ? _8390_subj->size(0) : 0);
      return (::mosek::fusion::p_SparseMatrix::_new_SparseMatrix(_8387_dimi,_8387_dimi,_8389_subi,_8390_subj,_8384_d)).as<::mosek::fusion::Matrix>();
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _8392_subi = ::mosek::fusion::Utils::Tools::range((int)0,_8388_n);
      _checked_ptr_1<int32_t> _ptr__8392_subi(_8392_subi ? _8392_subi->raw() : nullptr,_8392_subi ? _8392_subi->size(0) : 0);
      std::vector<int32_t> _13130_;
      for (int32_t _8394_i = (int)1, _13131_ = safe_add( _8388_n,(int)1 ); _8394_i < _13131_ ; ++_8394_i)
      {
        _13130_.push_back((_8388_n - _8394_i));
      }
      auto _13132_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_13130_.size()),_13130_.begin(),_13130_.end()));
      std::shared_ptr< monty::ndarray< int32_t,1 > > _8393_subj = _13132_;
      _checked_ptr_1<int32_t> _ptr__8393_subj(_8393_subj ? _8393_subj->raw() : nullptr,_8393_subj ? _8393_subj->size(0) : 0);
      return (::mosek::fusion::p_SparseMatrix::_new_SparseMatrix(_8387_dimi,_8387_dimi,_8392_subi,_8393_subj,_8384_d)).as<::mosek::fusion::Matrix>();
    }
  }
}
// End mosek.fusion.Matrix.antidiag

// Begin mosek.fusion.Matrix.antidiag
// Method mosek.fusion.Matrix.antidiag @ bld/grindsted/final/default/src/fusion/Matrix.mbi:437:6-440:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::antidiag
  ( std::shared_ptr< monty::ndarray< double,1 > > _8395_d) { return mosek::fusion::p_Matrix::antidiag(_8395_d); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::antidiag(std::shared_ptr< monty::ndarray< double,1 > > _8395_d)
{
  _checked_ptr_1<double> _ptr__8395_d(_8395_d ? _8395_d->raw() : nullptr, _8395_d ? _8395_d->size(0) : 0);
  return ::mosek::fusion::p_Matrix::antidiag(_8395_d,(int)0);
}
// End mosek.fusion.Matrix.antidiag

// Begin mosek.fusion.Matrix.diag
// Method mosek.fusion.Matrix.diag @ bld/grindsted/final/default/src/fusion/Matrix.mbi:416:6-435:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::diag
  ( std::shared_ptr< monty::ndarray< double,1 > > _8396_d,
    int32_t _8397_k) { return mosek::fusion::p_Matrix::diag(_8396_d,_8397_k); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::diag(std::shared_ptr< monty::ndarray< double,1 > > _8396_d,int32_t _8397_k)
{
  _checked_ptr_1<double> _ptr__8396_d(_8396_d ? _8396_d->raw() : nullptr, _8396_d ? _8396_d->size(0) : 0);
  int32_t _13133_;
  bool _13134_ = (_8397_k > (int)0);
  if (_13134_)
  {
    _13133_ = _8397_k;
  }
  else
  {
    _13133_ = (-_8397_k);
  }
  int32_t _8398_absk = _13133_;
  int32_t _8399_dimi = safe_add( (int)((_8396_d)->size(0)),_8398_absk );
  int32_t _8400_n = (int)((_8396_d)->size(0));
  if ((_8397_k >= (int)0))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _8401_subi = ::mosek::fusion::Utils::Tools::range((int)0,_8400_n);
      _checked_ptr_1<int32_t> _ptr__8401_subi(_8401_subi ? _8401_subi->raw() : nullptr,_8401_subi ? _8401_subi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _8402_subj = ::mosek::fusion::Utils::Tools::range(_8398_absk,safe_add( _8400_n,_8398_absk ));
      _checked_ptr_1<int32_t> _ptr__8402_subj(_8402_subj ? _8402_subj->raw() : nullptr,_8402_subj ? _8402_subj->size(0) : 0);
      return (::mosek::fusion::p_SparseMatrix::_new_SparseMatrix(_8399_dimi,_8399_dimi,_8401_subi,_8402_subj,_8396_d)).as<::mosek::fusion::Matrix>();
    }
  }
  else
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _8403_subi = ::mosek::fusion::Utils::Tools::range(_8398_absk,safe_add( _8400_n,_8398_absk ));
      _checked_ptr_1<int32_t> _ptr__8403_subi(_8403_subi ? _8403_subi->raw() : nullptr,_8403_subi ? _8403_subi->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _8404_subj = ::mosek::fusion::Utils::Tools::range((int)0,_8400_n);
      _checked_ptr_1<int32_t> _ptr__8404_subj(_8404_subj ? _8404_subj->raw() : nullptr,_8404_subj ? _8404_subj->size(0) : 0);
      return (::mosek::fusion::p_SparseMatrix::_new_SparseMatrix(_8399_dimi,_8399_dimi,_8403_subi,_8404_subj,_8396_d)).as<::mosek::fusion::Matrix>();
    }
  }
}
// End mosek.fusion.Matrix.diag

// Begin mosek.fusion.Matrix.diag
// Method mosek.fusion.Matrix.diag @ bld/grindsted/final/default/src/fusion/Matrix.mbi:411:6-414:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::diag
  ( std::shared_ptr< monty::ndarray< double,1 > > _8405_d) { return mosek::fusion::p_Matrix::diag(_8405_d); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::diag(std::shared_ptr< monty::ndarray< double,1 > > _8405_d)
{
  _checked_ptr_1<double> _ptr__8405_d(_8405_d ? _8405_d->raw() : nullptr, _8405_d ? _8405_d->size(0) : 0);
  return ::mosek::fusion::p_Matrix::diag(_8405_d,(int)0);
}
// End mosek.fusion.Matrix.diag

// Begin mosek.fusion.Matrix.ones
// Method mosek.fusion.Matrix.ones @ bld/grindsted/final/default/src/fusion/Matrix.mbi:408:6-83
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::ones
  ( int32_t _8406_n,
    int32_t _8407_m) { return mosek::fusion::p_Matrix::ones(_8406_n,_8407_m); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::ones(int32_t _8406_n,int32_t _8407_m)
{
  return ::mosek::fusion::p_Matrix::dense(_8406_n,_8407_m,1.0);
}
// End mosek.fusion.Matrix.ones

// Begin mosek.fusion.Matrix.eye
// Method mosek.fusion.Matrix.eye @ bld/grindsted/final/default/src/fusion/Matrix.mbi:398:6-90
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::eye
  ( int32_t _8408_n) { return mosek::fusion::p_Matrix::eye(_8408_n); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::eye(int32_t _8408_n)
{
  std::vector<double> _13135_;
  for (int32_t _8409_i = (int)0, _13136_ = _8408_n; _8409_i < _13136_ ; ++_8409_i)
  {
    _13135_.push_back(1.0);
  }
  auto _13137_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_13135_.size()),_13135_.begin(),_13135_.end()));
  return ::mosek::fusion::p_Matrix::diag(_13137_);
}
// End mosek.fusion.Matrix.eye

// Begin mosek.fusion.Matrix.dense
// Method mosek.fusion.Matrix.dense @ bld/grindsted/final/default/src/fusion/Matrix.mbi:388:6-114
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::dense
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _8410_other) { return mosek::fusion::p_Matrix::dense(_8410_other); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::dense(monty::rc_ptr< ::mosek::fusion::Matrix > _8410_other)
{
  return (::mosek::fusion::p_DenseMatrix::_new_DenseMatrix(_8410_other)).as<::mosek::fusion::Matrix>();
}
// End mosek.fusion.Matrix.dense

// Begin mosek.fusion.Matrix.dense
// Method mosek.fusion.Matrix.dense @ bld/grindsted/final/default/src/fusion/Matrix.mbi:387:6-126
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::dense
  ( int32_t _8411_dimi,
    int32_t _8412_dimj,
    double _8413_value) { return mosek::fusion::p_Matrix::dense(_8411_dimi,_8412_dimj,_8413_value); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::dense(int32_t _8411_dimi,int32_t _8412_dimj,double _8413_value)
{
  return (::mosek::fusion::p_DenseMatrix::_new_DenseMatrix(_8411_dimi,_8412_dimj,_8413_value)).as<::mosek::fusion::Matrix>();
}
// End mosek.fusion.Matrix.dense

// Begin mosek.fusion.Matrix.dense
// Method mosek.fusion.Matrix.dense @ bld/grindsted/final/default/src/fusion/Matrix.mbi:386:6-125
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::dense
  ( int32_t _8414_dimi,
    int32_t _8415_dimj,
    std::shared_ptr< monty::ndarray< double,1 > > _8416_data) { return mosek::fusion::p_Matrix::dense(_8414_dimi,_8415_dimj,_8416_data); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::dense(int32_t _8414_dimi,int32_t _8415_dimj,std::shared_ptr< monty::ndarray< double,1 > > _8416_data)
{
  _checked_ptr_1<double> _ptr__8416_data(_8416_data ? _8416_data->raw() : nullptr, _8416_data ? _8416_data->size(0) : 0);
  return (::mosek::fusion::p_DenseMatrix::_new_DenseMatrix(_8414_dimi,_8415_dimj,_8416_data)).as<::mosek::fusion::Matrix>();
}
// End mosek.fusion.Matrix.dense

// Begin mosek.fusion.Matrix.dense
// Method mosek.fusion.Matrix.dense @ bld/grindsted/final/default/src/fusion/Matrix.mbi:385:6-113
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::dense
  ( std::shared_ptr< monty::ndarray< double,2 > > _8417_data) { return mosek::fusion::p_Matrix::dense(_8417_data); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::dense(std::shared_ptr< monty::ndarray< double,2 > > _8417_data)
{
  return (::mosek::fusion::p_DenseMatrix::_new_DenseMatrix(_8417_data)).as<::mosek::fusion::Matrix>();
}
// End mosek.fusion.Matrix.dense

// Begin mosek.fusion.Matrix.sparse
// Method mosek.fusion.Matrix.sparse @ bld/grindsted/final/default/src/fusion/Matrix.mbi:374:6-382:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::sparse
  ( monty::rc_ptr< ::mosek::fusion::Matrix > _8418_mx) { return mosek::fusion::p_Matrix::sparse(_8418_mx); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::sparse(monty::rc_ptr< ::mosek::fusion::Matrix > _8418_mx)
{
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8419_subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8418_mx->numNonzeros())));
  _checked_ptr_1<int32_t> _ptr__8419_subi(_8419_subi ? _8419_subi->raw() : nullptr,_8419_subi ? _8419_subi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8420_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8418_mx->numNonzeros())));
  _checked_ptr_1<int32_t> _ptr__8420_subj(_8420_subj ? _8420_subj->raw() : nullptr,_8420_subj ? _8420_subj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _8421_val = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8418_mx->numNonzeros())));
  _checked_ptr_1<double> _ptr__8421_val(_8421_val ? _8421_val->raw() : nullptr,_8421_val ? _8421_val->size(0) : 0);
  _8418_mx->getDataAsTriplets(_8419_subi,_8420_subj,_8421_val);
  return (::mosek::fusion::p_SparseMatrix::_new_SparseMatrix(_8418_mx->numRows(),_8418_mx->numColumns(),_8419_subi,_8420_subj,_8421_val)).as<::mosek::fusion::Matrix>();
}
// End mosek.fusion.Matrix.sparse

// Begin mosek.fusion.Matrix.sparse
// Method mosek.fusion.Matrix.sparse @ bld/grindsted/final/default/src/fusion/Matrix.mbi:231:6-371:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::sparse
  ( std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Matrix >,1 > >,1 > > _8422_blocks) { return mosek::fusion::p_Matrix::sparse(_8422_blocks); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::sparse(std::shared_ptr< monty::ndarray< std::shared_ptr< monty::ndarray< monty::rc_ptr< ::mosek::fusion::Matrix >,1 > >,1 > > _8422_blocks)
{
  int32_t _8423_maxi = (int)((_8422_blocks)->size(0));
  int32_t _8424_maxj = (int)((((*_8422_blocks)((int)0)))->size(0));
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8425_idims = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8423_maxi)));
  _checked_ptr_1<int32_t> _ptr__8425_idims(_8425_idims ? _8425_idims->raw() : nullptr,_8425_idims ? _8425_idims->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8426_jdims = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8424_maxj)));
  _checked_ptr_1<int32_t> _ptr__8426_jdims(_8426_jdims ? _8426_jdims->raw() : nullptr,_8426_jdims ? _8426_jdims->size(0) : 0);
  int64_t _8427_nelm = (int64_t)0;
  int32_t _8428_k = (int)0;
  {
    int32_t _8429_i = (int)0;
    for(;(_8429_i < _8423_maxi);++ _8429_i)
    {
      {
        {
          int32_t _8430_j = (int)0;
          for(;(_8430_j < _8424_maxj);++ _8430_j)
          {
            {
              monty::rc_ptr< ::mosek::fusion::Matrix > _8431_m = ((*((*_8422_blocks)(_8429_i)))(_8430_j));
              if ((NULL != _8431_m.get()))
              {
                {
                  if ((_ptr__8426_jdims[_8430_j] == (int)0))
                  {
                    {
                      _ptr__8426_jdims[_8430_j] = mosek::fusion::p_Matrix::_get_impl(_8431_m)->dimj;
                    }
                  }
                  else if((_ptr__8426_jdims[_8430_j] != mosek::fusion::p_Matrix::_get_impl(_8431_m)->dimj))
                  {
                    {
                      throw ::mosek::fusion::SparseFormatError(std::string ("Sparse matrix construction blocks are not aligned"));
                    }
                  }
                  {}
                  if ((_ptr__8425_idims[_8429_i] == (int)0))
                  {
                    {
                      _ptr__8425_idims[_8429_i] = mosek::fusion::p_Matrix::_get_impl(_8431_m)->dimi;
                    }
                  }
                  else if((_ptr__8425_idims[_8429_i] != mosek::fusion::p_Matrix::_get_impl(_8431_m)->dimi))
                  {
                    {
                      throw ::mosek::fusion::SparseFormatError(std::string ("Sparse matrix construction blocks are not aligned"));
                    }
                  }
                  {}
                  _8427_nelm = safe_add( _8427_nelm,_8431_m->numNonzeros() );
                }
              }
              {}
              ++ _8428_k;
            }
          }
        }
      }
    }
  }
  std::shared_ptr< monty::ndarray< double,1 > > _8432_cof = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8427_nelm)));
  _checked_ptr_1<double> _ptr__8432_cof(_8432_cof ? _8432_cof->raw() : nullptr,_8432_cof ? _8432_cof->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8433_subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8427_nelm)));
  _checked_ptr_1<int32_t> _ptr__8433_subi(_8433_subi ? _8433_subi->raw() : nullptr,_8433_subi ? _8433_subi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8434_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8427_nelm)));
  _checked_ptr_1<int32_t> _ptr__8434_subj(_8434_subj ? _8434_subj->raw() : nullptr,_8434_subj ? _8434_subj->size(0) : 0);
  int32_t _8435_dstp = (int)0;
  int32_t _8436_offseti = (int)0;
  {
    int32_t _8437_i = (int)0;
    for(;(_8437_i < _8423_maxi);++ _8437_i)
    {
      {
        std::shared_ptr< monty::ndarray< int32_t,1 > > _8438_lidxs = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8424_maxj)));
        _checked_ptr_1<int32_t> _ptr__8438_lidxs(_8438_lidxs ? _8438_lidxs->raw() : nullptr,_8438_lidxs ? _8438_lidxs->size(0) : 0);
        {
          int32_t _8439_ii = (int)0;
          for(;(_8439_ii < _ptr__8425_idims[_8437_i]);++ _8439_ii)
          {
            {
              int32_t _8440_offsetj = (int)0;
              {
                int32_t _8441_j = (int)0;
                for(;(_8441_j < _8424_maxj);++ _8441_j)
                {
                  {
                    monty::rc_ptr< ::mosek::fusion::Matrix > _8442_m_ = ((*((*_8422_blocks)(_8437_i)))(_8441_j));
                    if ((NULL != _8442_m_.get()))
                    {
                      {
                        monty::rc_ptr< ::mosek::fusion::Matrix > _13138_ = _8442_m_;
                        if (false) {}
                        else if (nullptr != dynamic_cast<::mosek::fusion::DenseMatrix*>(_13138_.get()))
                        {
                          ::mosek::fusion::DenseMatrix::t _8443_m (dynamic_cast<::mosek::fusion::DenseMatrix*>(_13138_.get()));
                          {
                            int32_t _8446_kk = _ptr__8438_lidxs[_8441_j];
                            {
                              int32_t _8447_jj = (int)0;
                              for(;(_8447_jj < mosek::fusion::p_Matrix::_get_impl(_8443_m)->dimj);++ _8447_jj)
                              {
                                {
                                  _ptr__8432_cof[_8435_dstp] = ((*mosek::fusion::p_DenseMatrix::_get_impl(_8443_m)->data)(_8446_kk));
                                  _ptr__8433_subi[_8435_dstp] = safe_add( _8436_offseti,_8439_ii );
                                  _ptr__8434_subj[_8435_dstp] = safe_add( _8440_offsetj,_8447_jj );
                                  ++ _8446_kk;
                                  ++ _8435_dstp;
                                }
                              }
                            }
                            _ptr__8438_lidxs[_8441_j] = _8446_kk;
                          }
                        }
                        else if (nullptr != dynamic_cast<::mosek::fusion::SparseMatrix*>(_13138_.get()))
                        {
                          ::mosek::fusion::SparseMatrix::t _8444_m (dynamic_cast<::mosek::fusion::SparseMatrix*>(_13138_.get()));
                          {
                            int32_t _8448_kk;
                            {
                              _8448_kk = _ptr__8438_lidxs[_8441_j];
                              for(;((_8448_kk < mosek::fusion::p_SparseMatrix::_get_impl(_8444_m)->nnz) && (((*mosek::fusion::p_SparseMatrix::_get_impl(_8444_m)->subi)(_8448_kk)) == _8439_ii));++ _8448_kk)
                              {
                                {
                                  _ptr__8432_cof[_8435_dstp] = ((*mosek::fusion::p_SparseMatrix::_get_impl(_8444_m)->val)(_8448_kk));
                                  _ptr__8434_subj[_8435_dstp] = safe_add( ((*mosek::fusion::p_SparseMatrix::_get_impl(_8444_m)->subj)(_8448_kk)),_8440_offsetj );
                                  _ptr__8433_subi[_8435_dstp] = safe_add( _8436_offseti,_8439_ii );
                                  ++ _8435_dstp;
                                }
                              }
                            }
                            _ptr__8438_lidxs[_8441_j] = _8448_kk;
                          }
                        }
                        else
                        {
                          mosek::fusion::Matrix::t _8445_m = _13138_;
                          {
                            throw ::mosek::fusion::MatrixError(std::string ("Unknown matrix type."));
                          }
                        }
                      }
                    }
                    {}
                    _8440_offsetj = safe_add( _8440_offsetj,_ptr__8426_jdims[_8441_j] );
                  }
                }
              }
            }
          }
        }
        _8436_offseti = safe_add( _8436_offseti,_ptr__8425_idims[_8437_i] );
      }
    }
  }
  int32_t _8449_dimi = (int)0;
  int32_t _8450_dimj = (int)0;
  {
    int32_t _8451_i = (int)0;
    for(;(_8451_i < _8423_maxi);++ _8451_i)
    {
      {
        _8449_dimi = safe_add( _8449_dimi,_ptr__8425_idims[_8451_i] );
      }
    }
  }
  {
    int32_t _8452_j = (int)0;
    for(;(_8452_j < _8424_maxj);++ _8452_j)
    {
      {
        _8450_dimj = safe_add( _8450_dimj,_ptr__8426_jdims[_8452_j] );
      }
    }
  }
  return (::mosek::fusion::p_SparseMatrix::_new_SparseMatrix(_8449_dimi,_8450_dimj,_8433_subi,_8434_subj,_8432_cof)).as<::mosek::fusion::Matrix>();
}
// End mosek.fusion.Matrix.sparse

// Begin mosek.fusion.Matrix.sparse
// Method mosek.fusion.Matrix.sparse @ bld/grindsted/final/default/src/fusion/Matrix.mbi:208:6-228:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::sparse
  ( std::shared_ptr< monty::ndarray< double,2 > > _8453_data) { return mosek::fusion::p_Matrix::sparse(_8453_data); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::sparse(std::shared_ptr< monty::ndarray< double,2 > > _8453_data)
{
  int32_t _8454_dimi = (int)((_8453_data)->size(0));
  int32_t _8455_dimj = (int)((_8453_data)->size(1));
  int64_t _8456_nelem = (int64_t)safe_mul( _8454_dimi,_8455_dimj );
  int32_t _8457_k = (int)0;
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8458_subi = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8456_nelem)));
  _checked_ptr_1<int32_t> _ptr__8458_subi(_8458_subi ? _8458_subi->raw() : nullptr,_8458_subi ? _8458_subi->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8459_subj = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8456_nelem)));
  _checked_ptr_1<int32_t> _ptr__8459_subj(_8459_subj ? _8459_subj->raw() : nullptr,_8459_subj ? _8459_subj->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _8460_val = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape(_8456_nelem)));
  _checked_ptr_1<double> _ptr__8460_val(_8460_val ? _8460_val->raw() : nullptr,_8460_val ? _8460_val->size(0) : 0);
  {
    int32_t _8461_i = (int)0;
    for(;(_8461_i < _8454_dimi);++ _8461_i)
    {
      {
        {
          int32_t _8462_j = (int)0;
          for(;(_8462_j < _8455_dimj);++ _8462_j)
          {
            {
              _ptr__8458_subi[_8457_k] = _8461_i;
              _ptr__8459_subj[_8457_k] = _8462_j;
              _ptr__8460_val[_8457_k] = ((*_8453_data)(_8461_i,_8462_j));
              ++ _8457_k;
            }
          }
        }
      }
    }
  }
  return (::mosek::fusion::p_SparseMatrix::_new_SparseMatrix(_8454_dimi,_8455_dimj,_8458_subi,_8459_subj,_8460_val)).as<::mosek::fusion::Matrix>();
}
// End mosek.fusion.Matrix.sparse

// Begin mosek.fusion.Matrix.sparse
// Method mosek.fusion.Matrix.sparse @ bld/grindsted/final/default/src/fusion/Matrix.mbi:202:6-205:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::sparse
  ( int32_t _8463_nrow,
    int32_t _8464_ncol) { return mosek::fusion::p_Matrix::sparse(_8463_nrow,_8464_ncol); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::sparse(int32_t _8463_nrow,int32_t _8464_ncol)
{
  return (::mosek::fusion::p_SparseMatrix::_new_SparseMatrix(_8463_nrow,_8464_ncol,std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0))),std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)0))),(int64_t)0)).as<::mosek::fusion::Matrix>();
}
// End mosek.fusion.Matrix.sparse

// Begin mosek.fusion.Matrix.sparse
// Method mosek.fusion.Matrix.sparse @ bld/grindsted/final/default/src/fusion/Matrix.mbi:188:6-199:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::sparse
  ( int32_t _8465_nrow,
    int32_t _8466_ncol,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8467_subi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8468_subj,
    double _8469_val) { return mosek::fusion::p_Matrix::sparse(_8465_nrow,_8466_ncol,_8467_subi,_8468_subj,_8469_val); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::sparse(int32_t _8465_nrow,int32_t _8466_ncol,std::shared_ptr< monty::ndarray< int32_t,1 > > _8467_subi,std::shared_ptr< monty::ndarray< int32_t,1 > > _8468_subj,double _8469_val)
{
  _checked_ptr_1<int32_t> _ptr__8467_subi(_8467_subi ? _8467_subi->raw() : nullptr, _8467_subi ? _8467_subi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__8468_subj(_8468_subj ? _8468_subj->raw() : nullptr, _8468_subj ? _8468_subj->size(0) : 0);
  int32_t _8470_sz = (int)0;
  if ((NULL != _8467_subi.get()))
  {
    {
      _8470_sz = (int)((_8467_subi)->size(0));
    }
  }
  else if((NULL != _8468_subj.get()))
  {
    {
      _8470_sz = (int)((_8468_subj)->size(0));
    }
  }
  {}
  return ::mosek::fusion::p_Matrix::sparse(_8465_nrow,_8466_ncol,_8467_subi,_8468_subj,::mosek::fusion::Utils::Tools::makevector(_8469_val,_8470_sz));
}
// End mosek.fusion.Matrix.sparse

// Begin mosek.fusion.Matrix.sparse
// Method mosek.fusion.Matrix.sparse @ bld/grindsted/final/default/src/fusion/Matrix.mbi:170:6-185:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::sparse
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _8471_subi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8472_subj,
    double _8473_val) { return mosek::fusion::p_Matrix::sparse(_8471_subi,_8472_subj,_8473_val); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::sparse(std::shared_ptr< monty::ndarray< int32_t,1 > > _8471_subi,std::shared_ptr< monty::ndarray< int32_t,1 > > _8472_subj,double _8473_val)
{
  _checked_ptr_1<int32_t> _ptr__8471_subi(_8471_subi ? _8471_subi->raw() : nullptr, _8471_subi ? _8471_subi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__8472_subj(_8472_subj ? _8472_subj->raw() : nullptr, _8472_subj ? _8472_subj->size(0) : 0);
  int32_t _8474_maxj = (int)0;
  int32_t _8475_maxi = (int)0;
  int32_t _8476_num = (int)((_8471_subi)->size(0));
  if ((_8476_num > (int)((_8472_subj)->size(0))))
  {
    {
      _8476_num = (int)((_8472_subj)->size(0));
    }
  }
  {}
  int32_t _13139_ = (int)0;
  int32_t _13140_ = _8476_num;
  for (int32_t _8477_i = _13139_; _8477_i < _13140_; ++_8477_i)
  {
    {
      if ((_8475_maxi < _ptr__8471_subi[_8477_i]))
      {
        {
          _8475_maxi = _ptr__8471_subi[_8477_i];
        }
      }
      {}
      if ((_8474_maxj < _ptr__8472_subj[_8477_i]))
      {
        {
          _8474_maxj = _ptr__8472_subj[_8477_i];
        }
      }
      {}
    }
  }
  return ::mosek::fusion::p_Matrix::sparse(safe_add( _8475_maxi,(int)1 ),safe_add( _8474_maxj,(int)1 ),_8471_subi,_8472_subj,_8473_val);
}
// End mosek.fusion.Matrix.sparse

// Begin mosek.fusion.Matrix.sparse
// Method mosek.fusion.Matrix.sparse @ bld/grindsted/final/default/src/fusion/Matrix.mbi:151:6-167:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::sparse
  ( std::shared_ptr< monty::ndarray< int32_t,1 > > _8478_subi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8479_subj,
    std::shared_ptr< monty::ndarray< double,1 > > _8480_val) { return mosek::fusion::p_Matrix::sparse(_8478_subi,_8479_subj,_8480_val); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::sparse(std::shared_ptr< monty::ndarray< int32_t,1 > > _8478_subi,std::shared_ptr< monty::ndarray< int32_t,1 > > _8479_subj,std::shared_ptr< monty::ndarray< double,1 > > _8480_val)
{
  _checked_ptr_1<int32_t> _ptr__8478_subi(_8478_subi ? _8478_subi->raw() : nullptr, _8478_subi ? _8478_subi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__8479_subj(_8479_subj ? _8479_subj->raw() : nullptr, _8479_subj ? _8479_subj->size(0) : 0);
  _checked_ptr_1<double> _ptr__8480_val(_8480_val ? _8480_val->raw() : nullptr, _8480_val ? _8480_val->size(0) : 0);
  int32_t _8481_maxj = (int)0;
  int32_t _8482_maxi = (int)0;
  int32_t _8483_num = (int)((_8478_subi)->size(0));
  if ((_8483_num > (int)((_8479_subj)->size(0))))
  {
    {
      _8483_num = (int)((_8479_subj)->size(0));
    }
  }
  {}
  if ((_8483_num > (int)((_8480_val)->size(0))))
  {
    {
      _8483_num = (int)((_8480_val)->size(0));
    }
  }
  {}
  int32_t _13141_ = (int)0;
  int32_t _13142_ = _8483_num;
  for (int32_t _8484_i = _13141_; _8484_i < _13142_; ++_8484_i)
  {
    {
      if ((_8482_maxi < _ptr__8478_subi[_8484_i]))
      {
        {
          _8482_maxi = _ptr__8478_subi[_8484_i];
        }
      }
      {}
      if ((_8481_maxj < _ptr__8479_subj[_8484_i]))
      {
        {
          _8481_maxj = _ptr__8479_subj[_8484_i];
        }
      }
      {}
    }
  }
  return ::mosek::fusion::p_Matrix::sparse(safe_add( _8482_maxi,(int)1 ),safe_add( _8481_maxj,(int)1 ),_8478_subi,_8479_subj,_8480_val);
}
// End mosek.fusion.Matrix.sparse

// Begin mosek.fusion.Matrix.sparse
// Method mosek.fusion.Matrix.sparse @ bld/grindsted/final/default/src/fusion/Matrix.mbi:128:6-148:7
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix::sparse
  ( int32_t _8485_nrow,
    int32_t _8486_ncol,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8487_subi,
    std::shared_ptr< monty::ndarray< int32_t,1 > > _8488_subj,
    std::shared_ptr< monty::ndarray< double,1 > > _8489_val) { return mosek::fusion::p_Matrix::sparse(_8485_nrow,_8486_ncol,_8487_subi,_8488_subj,_8489_val); }
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::p_Matrix::sparse(int32_t _8485_nrow,int32_t _8486_ncol,std::shared_ptr< monty::ndarray< int32_t,1 > > _8487_subi,std::shared_ptr< monty::ndarray< int32_t,1 > > _8488_subj,std::shared_ptr< monty::ndarray< double,1 > > _8489_val)
{
  _checked_ptr_1<int32_t> _ptr__8487_subi(_8487_subi ? _8487_subi->raw() : nullptr, _8487_subi ? _8487_subi->size(0) : 0);
  _checked_ptr_1<int32_t> _ptr__8488_subj(_8488_subj ? _8488_subj->raw() : nullptr, _8488_subj ? _8488_subj->size(0) : 0);
  _checked_ptr_1<double> _ptr__8489_val(_8489_val ? _8489_val->raw() : nullptr, _8489_val ? _8489_val->size(0) : 0);
  std::shared_ptr< monty::ndarray< double,1 > > _13143_;
  bool _13144_ = (NULL != _8489_val.get());
  if (_13144_)
  {
    _13143_ = _8489_val;
  }
  else
  {
    _13143_ = std::shared_ptr< monty::ndarray< double,1 > >(new monty::ndarray< double,1 >(monty::shape((int)0)));
  }
  std::shared_ptr< monty::ndarray< double,1 > > _8490_vl = _13143_;
  _checked_ptr_1<double> _ptr__8490_vl(_8490_vl ? _8490_vl->raw() : nullptr,_8490_vl ? _8490_vl->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _13145_;
  bool _13146_ = (NULL != _8488_subj.get());
  if (_13146_)
  {
    _13145_ = _8488_subj;
  }
  else
  {
    _13145_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0)));
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8491_sj = _13145_;
  _checked_ptr_1<int32_t> _ptr__8491_sj(_8491_sj ? _8491_sj->raw() : nullptr,_8491_sj ? _8491_sj->size(0) : 0);
  std::shared_ptr< monty::ndarray< int32_t,1 > > _13147_;
  bool _13148_ = (NULL != _8487_subi.get());
  if (_13148_)
  {
    _13147_ = _8487_subi;
  }
  else
  {
    _13147_ = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape((int)0)));
  }
  std::shared_ptr< monty::ndarray< int32_t,1 > > _8492_si = _13147_;
  _checked_ptr_1<int32_t> _ptr__8492_si(_8492_si ? _8492_si->raw() : nullptr,_8492_si ? _8492_si->size(0) : 0);
  int64_t _8493_nnz = (int64_t)((_8492_si)->size(0));
  if ((((int64_t)((_8491_sj)->size(0)) != _8493_nnz) || ((int64_t)((_8490_vl)->size(0)) != _8493_nnz)))
  {
    {
      throw ::mosek::fusion::SparseFormatError(std::string ("Arrays defining sparse data have different lengths"));
    }
  }
  {}
  return (::mosek::fusion::p_SparseMatrix::_new_SparseMatrix(_8485_nrow,_8486_ncol,_8492_si,_8491_sj,_8490_vl,_8493_nnz)).as<::mosek::fusion::Matrix>();
}
// End mosek.fusion.Matrix.sparse

// Begin mosek.fusion.Matrix.get
// End mosek.fusion.Matrix.get

// Begin mosek.fusion.Matrix.isSparse
// End mosek.fusion.Matrix.isSparse

// Begin mosek.fusion.Matrix.getDataAsArray
// End mosek.fusion.Matrix.getDataAsArray

// Begin mosek.fusion.Matrix.getDataAsTriplets
// End mosek.fusion.Matrix.getDataAsTriplets

// Begin mosek.fusion.Matrix.transpose
monty::rc_ptr< ::mosek::fusion::Matrix > mosek::fusion::Matrix :: transpose() { return __mosek_2fusion_2Matrix__transpose(); }
// End mosek.fusion.Matrix.transpose

// Begin mosek.fusion.Matrix.numNonzeros
// End mosek.fusion.Matrix.numNonzeros

// Begin mosek.fusion.Matrix.numColumns
// Method mosek.fusion.Matrix.numColumns @ bld/grindsted/final/default/src/fusion/Matrix.mbi:79:6-54
int32_t mosek::fusion::Matrix :: numColumns() { return mosek::fusion::p_Matrix::_get_impl(this)->numColumns(); }
int32_t mosek::fusion::p_Matrix::numColumns()
{
  return dimj;
}
// End mosek.fusion.Matrix.numColumns

// Begin mosek.fusion.Matrix.numRows
// Method mosek.fusion.Matrix.numRows @ bld/grindsted/final/default/src/fusion/Matrix.mbi:75:6-51
int32_t mosek::fusion::Matrix :: numRows() { return mosek::fusion::p_Matrix::_get_impl(this)->numRows(); }
int32_t mosek::fusion::p_Matrix::numRows()
{
  return dimi;
}
// End mosek.fusion.Matrix.numRows

void mosek::fusion::p_Matrix::destroy()
{
}
void mosek::fusion::Matrix::destroy() { mosek::fusion::p_Matrix::_get_impl(this)->destroy(); }
// } class Matrix
// class UnimplementedError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:284:4-292:5
// mosek.fusion.UnimplementedError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:288:8-291:9
mosek::fusion::UnimplementedError::UnimplementedError
  ( const std::string &  _8499_msg)
 : RuntimeException(_8499_msg)
  {
  }
// mosek.fusion.UnimplementedError.ctor

// } class UnimplementedError
// class FatalError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:273:4-281:5
// mosek.fusion.FatalError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:277:8-280:9
mosek::fusion::FatalError::FatalError
  ( const std::string &  _8500_msg)
 : RuntimeException(_8500_msg)
  {
  }
// mosek.fusion.FatalError.ctor

// } class FatalError
// class UnexpectedError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:257:4-270:5
// mosek.fusion.UnexpectedError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:266:8-269:9
mosek::fusion::UnexpectedError::UnexpectedError
  ( ::mosek::fusion::FusionException _8501_e)
 : RuntimeException(_8501_e.toString())
  {
  }
// mosek.fusion.UnexpectedError.ctor

// mosek.fusion.UnexpectedError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:261:8-264:9
mosek::fusion::UnexpectedError::UnexpectedError
  ( const std::string &  _8502_msg)
 : RuntimeException(_8502_msg)
  {
  }
// mosek.fusion.UnexpectedError.ctor

// } class UnexpectedError
// class SparseFormatError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:245:4-253:5
// mosek.fusion.SparseFormatError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:249:8-252:9
mosek::fusion::SparseFormatError::SparseFormatError
  ( const std::string &  _8503_msg)
 : mosek::fusion::FusionRuntimeException(_8503_msg)
  {
  }
// mosek.fusion.SparseFormatError.ctor

// } class SparseFormatError
// class SolutionError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:229:4-242:5
// mosek.fusion.SolutionError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:238:8-241:9
mosek::fusion::SolutionError::SolutionError
  ( )
 : mosek::fusion::FusionException(std::string ("Solution is invalid or undefined"))
  {
  }
// mosek.fusion.SolutionError.ctor

// mosek.fusion.SolutionError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:233:8-236:9
mosek::fusion::SolutionError::SolutionError
  ( const std::string &  _8504_msg)
 : mosek::fusion::FusionException(_8504_msg)
  {
  }
// mosek.fusion.SolutionError.ctor

// } class SolutionError
// class SliceError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:213:4-226:5
// mosek.fusion.SliceError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:222:8-225:9
mosek::fusion::SliceError::SliceError
  ( )
 : mosek::fusion::FusionRuntimeException(std::string ("Invalid slice range"))
  {
  }
// mosek.fusion.SliceError.ctor

// mosek.fusion.SliceError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:217:8-220:9
mosek::fusion::SliceError::SliceError
  ( const std::string &  _8505_msg)
 : mosek::fusion::FusionRuntimeException(_8505_msg)
  {
  }
// mosek.fusion.SliceError.ctor

// } class SliceError
// class UpdateError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:196:4-209:5
// mosek.fusion.UpdateError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:205:8-208:9
mosek::fusion::UpdateError::UpdateError
  ( )
 : mosek::fusion::FusionRuntimeException(std::string ("Cannot update parameterized item"))
  {
  }
// mosek.fusion.UpdateError.ctor

// mosek.fusion.UpdateError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:200:8-203:9
mosek::fusion::UpdateError::UpdateError
  ( const std::string &  _8506_msg)
 : mosek::fusion::FusionRuntimeException(_8506_msg)
  {
  }
// mosek.fusion.UpdateError.ctor

// } class UpdateError
// class SetDefinitionError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:185:4-193:5
// mosek.fusion.SetDefinitionError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:189:8-192:9
mosek::fusion::SetDefinitionError::SetDefinitionError
  ( const std::string &  _8507_msg)
 : mosek::fusion::FusionRuntimeException(_8507_msg)
  {
  }
// mosek.fusion.SetDefinitionError.ctor

// } class SetDefinitionError
// class OptimizeError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:173:4-181:5
// mosek.fusion.OptimizeError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:177:8-180:9
mosek::fusion::OptimizeError::OptimizeError
  ( const std::string &  _8508_msg)
 : mosek::fusion::FusionRuntimeException(_8508_msg)
  {
  }
// mosek.fusion.OptimizeError.ctor

// } class OptimizeError
// class NameError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:162:4-170:5
// mosek.fusion.NameError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:166:8-169:9
mosek::fusion::NameError::NameError
  ( const std::string &  _8509_msg)
 : mosek::fusion::FusionRuntimeException(_8509_msg)
  {
  }
// mosek.fusion.NameError.ctor

// } class NameError
// class DeletionError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:151:4-159:5
// mosek.fusion.DeletionError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:155:8-158:9
mosek::fusion::DeletionError::DeletionError
  ( const std::string &  _8510_msg)
 : mosek::fusion::FusionRuntimeException(_8510_msg)
  {
  }
// mosek.fusion.DeletionError.ctor

// } class DeletionError
// class ModelError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:138:4-147:5
// mosek.fusion.ModelError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:143:8-146:9
mosek::fusion::ModelError::ModelError
  ( const std::string &  _8511_msg)
 : mosek::fusion::FusionRuntimeException(_8511_msg)
  {
  }
// mosek.fusion.ModelError.ctor

// } class ModelError
// class MatrixError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:128:4-133:5
// mosek.fusion.MatrixError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:132:8-55
mosek::fusion::MatrixError::MatrixError
  ( const std::string &  _8512_msg)
 : mosek::fusion::FusionRuntimeException(_8512_msg)
  {
  }
// mosek.fusion.MatrixError.ctor

// } class MatrixError
// class DimensionError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:117:4-122:5
// mosek.fusion.DimensionError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:121:8-56
mosek::fusion::DimensionError::DimensionError
  ( const std::string &  _8513_msg)
 : mosek::fusion::FusionRuntimeException(_8513_msg)
  {
  }
// mosek.fusion.DimensionError.ctor

// } class DimensionError
// class LengthError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:105:4-110:5
// mosek.fusion.LengthError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:109:8-56
mosek::fusion::LengthError::LengthError
  ( const std::string &  _8514_msg)
 : mosek::fusion::FusionRuntimeException(_8514_msg)
  {
  }
// mosek.fusion.LengthError.ctor

// } class LengthError
// class RangeError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:96:4-100:5
// mosek.fusion.RangeError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:99:8-56
mosek::fusion::RangeError::RangeError
  ( const std::string &  _8515_msg)
 : mosek::fusion::FusionRuntimeException(_8515_msg)
  {
  }
// mosek.fusion.RangeError.ctor

// } class RangeError
// class IndexError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:88:4-93:5
// mosek.fusion.IndexError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:92:8-56
mosek::fusion::IndexError::IndexError
  ( const std::string &  _8516_msg)
 : mosek::fusion::FusionRuntimeException(_8516_msg)
  {
  }
// mosek.fusion.IndexError.ctor

// } class IndexError
// class DomainError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:80:4-85:5
// mosek.fusion.DomainError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:84:6-54
mosek::fusion::DomainError::DomainError
  ( const std::string &  _8517_msg)
 : mosek::fusion::FusionRuntimeException(_8517_msg)
  {
  }
// mosek.fusion.DomainError.ctor

// } class DomainError
// class ValueConversionError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:68:4-76:5
// mosek.fusion.ValueConversionError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:72:6-75:7
mosek::fusion::ValueConversionError::ValueConversionError
  ( const std::string &  _8518_msg)
 : mosek::fusion::FusionRuntimeException(_8518_msg)
  {
  }
// mosek.fusion.ValueConversionError.ctor

// } class ValueConversionError
// class ParameterError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:57:4-65:5
// mosek.fusion.ParameterError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:61:6-64:7
mosek::fusion::ParameterError::ParameterError
  ( const std::string &  _8519_msg)
 : mosek::fusion::FusionRuntimeException(_8519_msg)
  {
  }
// mosek.fusion.ParameterError.ctor

// } class ParameterError
// class ExpressionError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:46:4-54:5
// mosek.fusion.ExpressionError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:50:6-53:7
mosek::fusion::ExpressionError::ExpressionError
  ( const std::string &  _8520_msg)
 : mosek::fusion::FusionRuntimeException(_8520_msg)
  {
  }
// mosek.fusion.ExpressionError.ctor

// } class ExpressionError
// class IOError { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:38:4-43:5
// mosek.fusion.IOError.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:42:8-56
mosek::fusion::IOError::IOError
  ( const std::string &  _8521_msg)
 : mosek::fusion::FusionRuntimeException(_8521_msg)
  {
  }
// mosek.fusion.IOError.ctor

// } class IOError
// class FusionRuntimeException { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:24:4-34:5
// mosek.fusion.FusionRuntimeException.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:28:6-68
mosek::fusion::FusionRuntimeException::FusionRuntimeException
  ( const std::string &  _8522_msg_)
 : RuntimeException(_8522_msg_)
  {
    msg = _8522_msg_;
  }
// mosek.fusion.FusionRuntimeException.ctor

// Begin mosek.fusion.FusionRuntimeException.toString
// Method mosek.fusion.FusionRuntimeException.toString @ bld/grindsted/final/default/src/fusion/Errors.mbi:33:6-53
std::string mosek::fusion::FusionRuntimeException::toString()
{
  return msg;
}
// End mosek.fusion.FusionRuntimeException.toString

// } class FusionRuntimeException
// class FusionException { // @ bld/grindsted/final/default/src/fusion/Errors.mbi:9:4-18:5
// mosek.fusion.FusionException.ctor @ bld/grindsted/final/default/src/fusion/Errors.mbi:13:6-67
mosek::fusion::FusionException::FusionException
  ( const std::string &  _8523_msg_)
 : Exception(_8523_msg_)
  {
    msg = _8523_msg_;
  }
// mosek.fusion.FusionException.ctor

// Begin mosek.fusion.FusionException.toString
// Method mosek.fusion.FusionException.toString @ bld/grindsted/final/default/src/fusion/Errors.mbi:17:6-53
std::string mosek::fusion::FusionException::toString()
{
  return msg;
}
// End mosek.fusion.FusionException.toString

// } class FusionException
// class LinkedBlocks { // @ bld/grindsted/final/default/src/fusion/LinkedList.monty:204:4-271:5
mosek::fusion::LinkedBlocks::LinkedBlocks(mosek::fusion::p_LinkedBlocks *_impl) : _impl(_impl) { /*std::cout << "LinkedBlocks() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::LinkedBlocks::~LinkedBlocks() { delete _impl; _impl = nullptr; }
mosek::fusion::p_LinkedBlocks::p_LinkedBlocks
  (::mosek::fusion::LinkedBlocks * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.LinkedBlocks.ctor @ bld/grindsted/final/default/src/fusion/LinkedList.monty:225:6-32
mosek::fusion::LinkedBlocks::t mosek::fusion::p_LinkedBlocks::_new_LinkedBlocks
  ()
{ return new mosek::fusion::LinkedBlocks(); }
mosek::fusion::LinkedBlocks::LinkedBlocks
  () : 
   LinkedBlocks(new mosek::fusion::p_LinkedBlocks(this))
{ mosek::fusion::p_LinkedBlocks::_get_impl(this)->_initialize(); }
void mosek::fusion::p_LinkedBlocks::_initialize  ()
{
monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_LinkedBlocks::_initialize((int)0);
  }
}
// mosek.fusion.LinkedBlocks.ctor

// mosek.fusion.LinkedBlocks.ctor @ bld/grindsted/final/default/src/fusion/LinkedList.monty:217:6-223:7
mosek::fusion::LinkedBlocks::t mosek::fusion::p_LinkedBlocks::_new_LinkedBlocks
  (int32_t _8524_n)
{ return new mosek::fusion::LinkedBlocks(_8524_n); }
mosek::fusion::LinkedBlocks::LinkedBlocks
  (int32_t _8524_n) : 
   LinkedBlocks(new mosek::fusion::p_LinkedBlocks(this))
{ mosek::fusion::p_LinkedBlocks::_get_impl(this)->_initialize(_8524_n); }
void mosek::fusion::p_LinkedBlocks::_initialize  (int32_t _8524_n)
{
monty::rc_reserve __reserve_this(_pubthis); 
  {
    int32_t _8525_basesize = (int)128;
    ints = ::mosek::fusion::p_LinkedInts::_new_LinkedInts(_8524_n);
    blocks = ::mosek::fusion::p_LinkedInts::_new_LinkedInts(_8525_basesize);
    bsize = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8525_basesize)));
    bfirst = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8525_basesize)));
  }
}
// mosek.fusion.LinkedBlocks.ctor

// mosek.fusion.LinkedBlocks.ctor @ bld/grindsted/final/default/src/fusion/LinkedList.monty:210:6-215:7
mosek::fusion::LinkedBlocks::t mosek::fusion::p_LinkedBlocks::_new_LinkedBlocks
  (monty::rc_ptr< ::mosek::fusion::LinkedBlocks > _8526_other)
{ return new mosek::fusion::LinkedBlocks(_8526_other); }
mosek::fusion::LinkedBlocks::LinkedBlocks
  (monty::rc_ptr< ::mosek::fusion::LinkedBlocks > _8526_other) : 
   LinkedBlocks(new mosek::fusion::p_LinkedBlocks(this))
{ mosek::fusion::p_LinkedBlocks::_get_impl(this)->_initialize(_8526_other); }
void mosek::fusion::p_LinkedBlocks::_initialize  (monty::rc_ptr< ::mosek::fusion::LinkedBlocks > _8526_other)
{
monty::rc_reserve __reserve_this(_pubthis); 
  {
    ints = ::mosek::fusion::p_LinkedInts::_new_LinkedInts(mosek::fusion::p_LinkedBlocks::_get_impl(_8526_other)->ints);
    blocks = ::mosek::fusion::p_LinkedInts::_new_LinkedInts(mosek::fusion::p_LinkedBlocks::_get_impl(_8526_other)->blocks);
    bsize = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_LinkedBlocks::_get_impl(_8526_other)->bsize);
    bfirst = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_LinkedBlocks::_get_impl(_8526_other)->bfirst);
  }
}
// mosek.fusion.LinkedBlocks.ctor

// Begin mosek.fusion.LinkedBlocks.free
// Method mosek.fusion.LinkedBlocks.free @ bld/grindsted/final/default/src/fusion/LinkedList.monty:264:6-270:7
void mosek::fusion::LinkedBlocks :: free(int32_t _8527_bkey) { mosek::fusion::p_LinkedBlocks::_get_impl(this)->free(_8527_bkey); }
void mosek::fusion::p_LinkedBlocks::free(int32_t _8527_bkey)
{
  int32_t _8528_key = ((*bfirst)(_8527_bkey));
  ints->free(_8528_key,((*bsize)(_8527_bkey)));
  ((*bsize)(_8527_bkey)) = (-(int)1);
  ((*bfirst)(_8527_bkey)) = (-(int)1);
  blocks->free(_8527_bkey,(int)1);
}
// End mosek.fusion.LinkedBlocks.free

// Begin mosek.fusion.LinkedBlocks.alloc
// Method mosek.fusion.LinkedBlocks.alloc @ bld/grindsted/final/default/src/fusion/LinkedList.monty:246:6-262:7
int32_t mosek::fusion::LinkedBlocks :: alloc(int32_t _8529_size) { return mosek::fusion::p_LinkedBlocks::_get_impl(this)->alloc(_8529_size); }
int32_t mosek::fusion::p_LinkedBlocks::alloc(int32_t _8529_size)
{
  int32_t _13149_;
  bool _13150_ = (_8529_size > (int)0);
  if (_13150_)
  {
    _13149_ = ints->alloc(_8529_size);
  }
  else
  {
    _13149_ = (-(int)1);
  }
  int32_t _8530_key = _13149_;
  int32_t _8531_bkey = blocks->alloc();
  if ((blocks->capacity() > (int)((bsize)->size(0))))
  {
    {
      std::shared_ptr< monty::ndarray< int32_t,1 > > _8532_nbsize = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(blocks->capacity())));
      _checked_ptr_1<int32_t> _ptr__8532_nbsize(_8532_nbsize ? _8532_nbsize->raw() : nullptr,_8532_nbsize ? _8532_nbsize->size(0) : 0);
      std::shared_ptr< monty::ndarray< int32_t,1 > > _8533_nbfirst = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(blocks->capacity())));
      _checked_ptr_1<int32_t> _ptr__8533_nbfirst(_8533_nbfirst ? _8533_nbfirst->raw() : nullptr,_8533_nbfirst ? _8533_nbfirst->size(0) : 0);
      ::mosek::fusion::Utils::Tools::arraycopy(bsize,(int)0,_8532_nbsize,(int)0,(int)((bsize)->size(0)));
      ::mosek::fusion::Utils::Tools::arraycopy(bfirst,(int)0,_8533_nbfirst,(int)0,(int)((bfirst)->size(0)));
      bsize = _8532_nbsize;
      bfirst = _8533_nbfirst;
    }
  }
  {}
  ((*bfirst)(_8531_bkey)) = _8530_key;
  ((*bsize)(_8531_bkey)) = _8529_size;
  return _8531_bkey;
}
// End mosek.fusion.LinkedBlocks.alloc

// Begin mosek.fusion.LinkedBlocks.maxidx
// Method mosek.fusion.LinkedBlocks.maxidx @ bld/grindsted/final/default/src/fusion/LinkedList.monty:242:6-244:7
int32_t mosek::fusion::LinkedBlocks :: maxidx(int32_t _8534_bkey) { return mosek::fusion::p_LinkedBlocks::_get_impl(this)->maxidx(_8534_bkey); }
int32_t mosek::fusion::p_LinkedBlocks::maxidx(int32_t _8534_bkey)
{
  return ints->maxidx(((*bfirst)(_8534_bkey)),((*bsize)(_8534_bkey)));
}
// End mosek.fusion.LinkedBlocks.maxidx

// Begin mosek.fusion.LinkedBlocks.numallocated
// Method mosek.fusion.LinkedBlocks.numallocated @ bld/grindsted/final/default/src/fusion/LinkedList.monty:240:6-72
int32_t mosek::fusion::LinkedBlocks :: numallocated() { return mosek::fusion::p_LinkedBlocks::_get_impl(this)->numallocated(); }
int32_t mosek::fusion::p_LinkedBlocks::numallocated()
{
  return ints->numallocated();
}
// End mosek.fusion.LinkedBlocks.numallocated

// Begin mosek.fusion.LinkedBlocks.get
// Method mosek.fusion.LinkedBlocks.get @ bld/grindsted/final/default/src/fusion/LinkedList.monty:234:6-238:7
void mosek::fusion::LinkedBlocks :: get(int32_t _8535_bkey,std::shared_ptr< monty::ndarray< int32_t,1 > > _8536_target,int32_t _8537_offset) { mosek::fusion::p_LinkedBlocks::_get_impl(this)->get(_8535_bkey,_8536_target,_8537_offset); }
void mosek::fusion::p_LinkedBlocks::get(int32_t _8535_bkey,std::shared_ptr< monty::ndarray< int32_t,1 > > _8536_target,int32_t _8537_offset)
{
  _checked_ptr_1<int32_t> _ptr__8536_target(_8536_target ? _8536_target->raw() : nullptr, _8536_target ? _8536_target->size(0) : 0);
  ints->get(((*bfirst)(_8535_bkey)),((*bsize)(_8535_bkey)),_8536_target,_8537_offset);
}
// End mosek.fusion.LinkedBlocks.get

// Begin mosek.fusion.LinkedBlocks.numblocks
// Method mosek.fusion.LinkedBlocks.numblocks @ bld/grindsted/final/default/src/fusion/LinkedList.monty:232:6-60
int32_t mosek::fusion::LinkedBlocks :: numblocks() { return mosek::fusion::p_LinkedBlocks::_get_impl(this)->numblocks(); }
int32_t mosek::fusion::p_LinkedBlocks::numblocks()
{
  return (int)((bsize)->size(0));
}
// End mosek.fusion.LinkedBlocks.numblocks

// Begin mosek.fusion.LinkedBlocks.blocksize
// Method mosek.fusion.LinkedBlocks.blocksize @ bld/grindsted/final/default/src/fusion/LinkedList.monty:231:6-71
int32_t mosek::fusion::LinkedBlocks :: blocksize(int32_t _8538_bkey) { return mosek::fusion::p_LinkedBlocks::_get_impl(this)->blocksize(_8538_bkey); }
int32_t mosek::fusion::p_LinkedBlocks::blocksize(int32_t _8538_bkey)
{
  return ((*bsize)(_8538_bkey));
}
// End mosek.fusion.LinkedBlocks.blocksize

// Begin mosek.fusion.LinkedBlocks.block_capacity
// Method mosek.fusion.LinkedBlocks.block_capacity @ bld/grindsted/final/default/src/fusion/LinkedList.monty:230:6-73
int32_t mosek::fusion::LinkedBlocks :: block_capacity() { return mosek::fusion::p_LinkedBlocks::_get_impl(this)->block_capacity(); }
int32_t mosek::fusion::p_LinkedBlocks::block_capacity()
{
  return blocks->capacity();
}
// End mosek.fusion.LinkedBlocks.block_capacity

// Begin mosek.fusion.LinkedBlocks.capacity
// Method mosek.fusion.LinkedBlocks.capacity @ bld/grindsted/final/default/src/fusion/LinkedList.monty:229:6-65
int32_t mosek::fusion::LinkedBlocks :: capacity() { return mosek::fusion::p_LinkedBlocks::_get_impl(this)->capacity(); }
int32_t mosek::fusion::p_LinkedBlocks::capacity()
{
  return ints->capacity();
}
// End mosek.fusion.LinkedBlocks.capacity

// Begin mosek.fusion.LinkedBlocks.validate
// Method mosek.fusion.LinkedBlocks.validate @ bld/grindsted/final/default/src/fusion/LinkedList.monty:227:6-86
bool mosek::fusion::LinkedBlocks :: validate() { return mosek::fusion::p_LinkedBlocks::_get_impl(this)->validate(); }
bool mosek::fusion::p_LinkedBlocks::validate()
{
  return (ints->validate() && blocks->validate());
}
// End mosek.fusion.LinkedBlocks.validate

void mosek::fusion::p_LinkedBlocks::destroy()
{
bfirst.reset();
bsize.reset();
blocks.reset();
ints.reset();
}
void mosek::fusion::LinkedBlocks::destroy() { mosek::fusion::p_LinkedBlocks::_get_impl(this)->destroy(); }
// } class LinkedBlocks
// class LinkedInts { // @ bld/grindsted/final/default/src/fusion/LinkedList.monty:4:4-201:5
mosek::fusion::LinkedInts::LinkedInts(mosek::fusion::p_LinkedInts *_impl) : _impl(_impl) { /*std::cout << "LinkedInts() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::LinkedInts::~LinkedInts() { delete _impl; _impl = nullptr; }
mosek::fusion::p_LinkedInts::p_LinkedInts
  (::mosek::fusion::LinkedInts * _pubthis) :     _pubthis(_pubthis)
{}
// mosek.fusion.LinkedInts.ctor @ bld/grindsted/final/default/src/fusion/LinkedList.monty:73:6-85:7
mosek::fusion::LinkedInts::t mosek::fusion::p_LinkedInts::_new_LinkedInts
  (int32_t _8539_cap_)
{ return new mosek::fusion::LinkedInts(_8539_cap_); }
mosek::fusion::LinkedInts::LinkedInts
  (int32_t _8539_cap_) : 
   LinkedInts(new mosek::fusion::p_LinkedInts(this))
{ mosek::fusion::p_LinkedInts::_get_impl(this)->_initialize(_8539_cap_); }
void mosek::fusion::p_LinkedInts::_initialize  (int32_t _8539_cap_)
{
monty::rc_reserve __reserve_this(_pubthis); 
  {
    int32_t _13151_;
    bool _13152_ = (_8539_cap_ > (int)0);
    if (_13152_)
    {
      _13151_ = _8539_cap_;
    }
    else
    {
      _13151_ = (int)128;
    }
    int32_t _8540_cap = _13151_;
    next = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8540_cap)));
    prev = std::shared_ptr< monty::ndarray< int32_t,1 > >(new monty::ndarray< int32_t,1 >(monty::shape(_8540_cap)));
    first_used = (-(int)1);
    first_free = (int)0;
    last_free = (_8540_cap - (int)1);
    int32_t _13153_ = (int)1;
    int32_t _13154_ = _8540_cap;
    for (int32_t _8541_i = _13153_; _8541_i < _13154_; ++_8541_i)
    {
      {
        ((*prev)(_8541_i)) = (_8541_i - (int)1);
        ((*next)((_8541_i - (int)1))) = _8541_i;
      }
    }
    ((*prev)((int)0)) = (-(int)1);
    ((*next)((_8540_cap - (int)1))) = (-(int)1);
    nfree = _8540_cap;
  }
}
// mosek.fusion.LinkedInts.ctor

// mosek.fusion.LinkedInts.ctor @ bld/grindsted/final/default/src/fusion/LinkedList.monty:71:6-34
mosek::fusion::LinkedInts::t mosek::fusion::p_LinkedInts::_new_LinkedInts
  ()
{ return new mosek::fusion::LinkedInts(); }
mosek::fusion::LinkedInts::LinkedInts
  () : 
   LinkedInts(new mosek::fusion::p_LinkedInts(this))
{ mosek::fusion::p_LinkedInts::_get_impl(this)->_initialize(); }
void mosek::fusion::p_LinkedInts::_initialize  ()
{
monty::rc_reserve __reserve_this(_pubthis); 
  {
    mosek::fusion::p_LinkedInts::_initialize((int)128);
  }
}
// mosek.fusion.LinkedInts.ctor

// mosek.fusion.LinkedInts.ctor @ bld/grindsted/final/default/src/fusion/LinkedList.monty:62:6-69:7
mosek::fusion::LinkedInts::t mosek::fusion::p_LinkedInts::_new_LinkedInts
  (monty::rc_ptr< ::mosek::fusion::LinkedInts > _8542_other)
{ return new mosek::fusion::LinkedInts(_8542_other); }
mosek::fusion::LinkedInts::LinkedInts
  (monty::rc_ptr< ::mosek::fusion::LinkedInts > _8542_other) : 
   LinkedInts(new mosek::fusion::p_LinkedInts(this))
{ mosek::fusion::p_LinkedInts::_get_impl(this)->_initialize(_8542_other); }
void mosek::fusion::p_LinkedInts::_initialize  (monty::rc_ptr< ::mosek::fusion::LinkedInts > _8542_other)
{
monty::rc_reserve __reserve_this(_pubthis); 
  {
    next = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_LinkedInts::_get_impl(_8542_other)->next);
    prev = ::mosek::fusion::Utils::Tools::arraycopy(mosek::fusion::p_LinkedInts::_get_impl(_8542_other)->prev);
    first_used = mosek::fusion::p_LinkedInts::_get_impl(_8542_other)->first_used;
    first_free = mosek::fusion::p_LinkedInts::_get_impl(_8542_other)->first_free;
    last_free = mosek::fusion::p_LinkedInts::_get_impl(_8542_other)->last_free;
    nfree = mosek::fusion::p_LinkedInts::_get_impl(_8542_other)->nfree;
  }
}
// mosek.fusion.LinkedInts.ctor

// Begin mosek.fusion.LinkedInts.free
// Method mosek.fusion.LinkedInts.free @ bld/grindsted/final/default/src/fusion/LinkedList.monty:181:6-200:7
void mosek::fusion::LinkedInts :: free(int32_t _8543_i,int32_t _8544_num) { mosek::fusion::p_LinkedInts::_get_impl(this)->free(_8543_i,_8544_num); }
void mosek::fusion::p_LinkedInts::free(int32_t _8543_i,int32_t _8544_num)
{
  int32_t _8545_i0 = _8543_i;
  int32_t _8546_i1 = _8545_i0;
  int32_t _13155_ = (int)0;
  int32_t _13156_ = (_8544_num - (int)1);
  for (int32_t _8547_k = _13155_; _8547_k < _13156_; ++_8547_k)
  {
    {
      _8546_i1 = ((*next)(_8546_i1));
    }
  }
  int32_t _8548_p0 = ((*prev)(_8545_i0));
  int32_t _8549_n1 = ((*next)(_8546_i1));
  if ((_8548_p0 >= (int)0))
  {
    {
      ((*next)(_8548_p0)) = _8549_n1;
    }
  }
  else
  {
    {
      first_used = _8549_n1;
    }
  }
  if ((_8549_n1 >= (int)0))
  {
    {
      ((*prev)(_8549_n1)) = _8548_p0;
    }
  }
  {}
  ((*prev)(_8545_i0)) = (-(int)1);
  ((*next)(_8546_i1)) = first_free;
  if ((first_free >= (int)0))
  {
    {
      ((*prev)(first_free)) = _8546_i1;
    }
  }
  {}
  first_free = _8545_i0;
  if ((last_free < (int)0))
  {
    {
      last_free = _8546_i1;
    }
  }
  {}
  nfree += _8544_num;
}
// End mosek.fusion.LinkedInts.free

// Begin mosek.fusion.LinkedInts.alloc
// Method mosek.fusion.LinkedInts.alloc @ bld/grindsted/final/default/src/fusion/LinkedList.monty:177:6-179:7
int32_t mosek::fusion::LinkedInts :: alloc() { return mosek::fusion::p_LinkedInts::_get_impl(this)->alloc(); }
int32_t mosek::fusion::p_LinkedInts::alloc()
{
  return allocblock((int)1);
}
// End mosek.fusion.LinkedInts.alloc

// Begin mosek.fusion.LinkedInts.alloc
// Method mosek.fusion.LinkedInts.alloc @ bld/grindsted/final/default/src/fusion/LinkedList.monty:173:6-175:7
int32_t mosek::fusion::LinkedInts :: alloc(int32_t _8550_n) { return mosek::fusion::p_LinkedInts::_get_impl(this)->alloc(_8550_n); }
int32_t mosek::fusion::p_LinkedInts::alloc(int32_t _8550_n)
{
  return allocblock(_8550_n);
}
// End mosek.fusion.LinkedInts.alloc

// Begin mosek.fusion.LinkedInts.alloc
// Method mosek.fusion.LinkedInts.alloc @ bld/grindsted/final/default/src/fusion/LinkedList.monty:165:6-171:7
void mosek::fusion::LinkedInts :: alloc(int32_t _8551_num,std::shared_ptr< monty::ndarray< int32_t,1 > > _8552_target,int32_t _8553_offset) { mosek::fusion::p_LinkedInts::_get_impl(this)->alloc(_8551_num,_8552_target,_8553_offset); }
void mosek::fusion::p_LinkedInts::alloc(int32_t _8551_num,std::shared_ptr< monty::ndarray< int32_t,1 > > _8552_target,int32_t _8553_offset)
{
  _checked_ptr_1<int32_t> _ptr__8552_target(_8552_target ? _8552_target->raw() : nullptr, _8552_target ? _8552_target->size(0) : 0);
  int32_t _8554_i = allocblock(_8551_num);
  int32_t _13157_ = (int)0;
  int32_t _13158_ = _8551_num;
  for (int32_t _8555_j = _13157_; _8555_j < _13158_; ++_8555_j)
  {
    {
      _ptr__8552_target[safe_add( _8555_j,_8553_offset )] = _8554_i;
      _8554_i = ((*next)(_8554_i));
    }
  }
}
// End mosek.fusion.LinkedInts.alloc

// Begin mosek.fusion.LinkedInts.get
// Method mosek.fusion.LinkedInts.get @ bld/grindsted/final/default/src/fusion/LinkedList.monty:157:6-163:7
void mosek::fusion::LinkedInts :: get(int32_t _8556_i,int32_t _8557_num,std::shared_ptr< monty::ndarray< int32_t,1 > > _8558_target,int32_t _8559_offset) { mosek::fusion::p_LinkedInts::_get_impl(this)->get(_8556_i,_8557_num,_8558_target,_8559_offset); }
void mosek::fusion::p_LinkedInts::get(int32_t _8556_i,int32_t _8557_num,std::shared_ptr< monty::ndarray< int32_t,1 > > _8558_target,int32_t _8559_offset)
{
  _checked_ptr_1<int32_t> _ptr__8558_target(_8558_target ? _8558_target->raw() : nullptr, _8558_target ? _8558_target->size(0) : 0);
  int32_t _8560_ii = _8556_i;
  int32_t _13159_ = (int)0;
  int32_t _13160_ = _8557_num;
  for (int32_t _8561_j = _13159_; _8561_j < _13160_; ++_8561_j)
  {
    {
      _ptr__8558_target[safe_add( _8561_j,_8559_offset )] = _8560_ii;
      _8560_ii = ((*next)(_8560_ii));
    }
  }
}
// End mosek.fusion.LinkedInts.get

// Begin mosek.fusion.LinkedInts.numallocated
// Method mosek.fusion.LinkedInts.numallocated @ bld/grindsted/final/default/src/fusion/LinkedList.monty:155:6-68
int32_t mosek::fusion::LinkedInts :: numallocated() { return mosek::fusion::p_LinkedInts::_get_impl(this)->numallocated(); }
int32_t mosek::fusion::p_LinkedInts::numallocated()
{
  return ((int)((next)->size(0)) - nfree);
}
// End mosek.fusion.LinkedInts.numallocated

// Begin mosek.fusion.LinkedInts.maxidx
// Method mosek.fusion.LinkedInts.maxidx @ bld/grindsted/final/default/src/fusion/LinkedList.monty:144:6-152:7
int32_t mosek::fusion::LinkedInts :: maxidx(int32_t _8562_i,int32_t _8563_num) { return mosek::fusion::p_LinkedInts::_get_impl(this)->maxidx(_8562_i,_8563_num); }
int32_t mosek::fusion::p_LinkedInts::maxidx(int32_t _8562_i,int32_t _8563_num)
{
  int32_t _8564_maxi = _8562_i;
  int32_t _8565_ii = _8562_i;
  int32_t _13161_ = (int)1;
  int32_t _13162_ = _8563_num;
  for (int32_t _8566_j = _13161_; _8566_j < _13162_; ++_8566_j)
  {
    {
      _8565_ii = ((*next)(_8565_ii));
      if ((_8564_maxi < _8565_ii))
      {
        {
          _8564_maxi = _8565_ii;
        }
      }
      {}
    }
  }
  return _8564_maxi;
}
// End mosek.fusion.LinkedInts.maxidx

// Begin mosek.fusion.LinkedInts.allocblock
// Method mosek.fusion.LinkedInts.allocblock @ bld/grindsted/final/default/src/fusion/LinkedList.monty:116:6-141:7
int32_t mosek::fusion::p_LinkedInts::allocblock(int32_t _8567_num)
{
  int32_t _8568_cap = (int)((next)->size(0));
  if ((nfree < _8567_num))
  {
    {
      int32_t _8569_nalloc = (_8567_num - nfree);
      if ((_8569_nalloc < _8568_cap))
      {
        {
          _8569_nalloc = _8568_cap;
        }
      }
      {}
      recap(safe_add( _8569_nalloc,_8568_cap ));
    }
  }
  {}
  int32_t _8570_i0 = first_free;
  int32_t _8571_i1 = _8570_i0;
  int32_t _13163_ = (int)0;
  int32_t _13164_ = (_8567_num - (int)1);
  for (int32_t _8572_i = _13163_; _8572_i < _13164_; ++_8572_i)
  {
    {
      _8571_i1 = ((*next)(_8571_i1));
    }
  }
  first_free = ((*next)(_8571_i1));
  if ((first_free < (int)0))
  {
    {
      last_free = (-(int)1);
    }
  }
  else
  {
    {
      ((*prev)(first_free)) = (-(int)1);
    }
  }
  ((*next)(_8571_i1)) = first_used;
  if ((first_used >= (int)0))
  {
    {
      ((*prev)(first_used)) = _8571_i1;
    }
  }
  {}
  first_used = _8570_i0;
  nfree -= _8567_num;
  return _8570_i0;
}
// End mosek.fusion.LinkedInts.allocblock

// Begin mosek.fusion.LinkedInts.recap
// Method mosek.fusion.LinkedInts.recap @ bld/grindsted/final/default/src/fusion/LinkedList.monty:89:6-113:7
void mosek::fusion::p_LinkedInts::recap(int32_t _8573_ncap)
{
  int32_t _8574_cap = (int)((next)->size(0));
  if ((_8573_ncap > _8574_cap))
  {
    {
      next = ::mosek::fusion::p_CommonTools::resize(next,_8573_ncap);
      prev = ::mosek::fusion::p_CommonTools::resize(prev,_8573_ncap);
      int32_t _13165_ = _8574_cap;
      int32_t _13166_ = (_8573_ncap - (int)1);
      for (int32_t _8575_i = _13165_; _8575_i < _13166_; ++_8575_i)
      {
        {
          ((*next)(_8575_i)) = safe_add( _8575_i,(int)1 );
          ((*prev)(safe_add( _8575_i,(int)1 ))) = _8575_i;
        }
      }
      ((*next)((_8573_ncap - (int)1))) = (-(int)1);
      ((*prev)(_8574_cap)) = last_free;
      if ((last_free < (int)0))
      {
        {
          first_free = _8574_cap;
        }
      }
      else
      {
        {
          ((*next)(last_free)) = _8574_cap;
        }
      }
      last_free = (_8573_ncap - (int)1);
      nfree += (_8573_ncap - _8574_cap);
    }
  }
  {}
}
// End mosek.fusion.LinkedInts.recap

// Begin mosek.fusion.LinkedInts.capacity
// Method mosek.fusion.LinkedInts.capacity @ bld/grindsted/final/default/src/fusion/LinkedList.monty:87:6-58
int32_t mosek::fusion::LinkedInts :: capacity() { return mosek::fusion::p_LinkedInts::_get_impl(this)->capacity(); }
int32_t mosek::fusion::p_LinkedInts::capacity()
{
  return (int)((next)->size(0));
}
// End mosek.fusion.LinkedInts.capacity

// Begin mosek.fusion.LinkedInts.validate
// Method mosek.fusion.LinkedInts.validate @ bld/grindsted/final/default/src/fusion/LinkedList.monty:16:6-60:7
bool mosek::fusion::LinkedInts :: validate() { return mosek::fusion::p_LinkedInts::_get_impl(this)->validate(); }
bool mosek::fusion::p_LinkedInts::validate()
{
  std::shared_ptr< monty::ndarray< bool,1 > > _8576_flags = std::shared_ptr< monty::ndarray< bool,1 > >(new monty::ndarray< bool,1 >(monty::shape((int)((next)->size(0)))));
  int32_t _8577_p = first_used;
  while ( (_8577_p >= (int)0) )
  {
    {
      ((*_8576_flags)(_8577_p)) = true;
      _8577_p = ((*next)(_8577_p));
      if (((_8577_p >= (int)0) && ((*_8576_flags)(_8577_p))))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("used list/next is inconsistent"));
        }
      }
      {}
    }
  }
  _8577_p = first_free;
  int32_t _8578_n = (int)0;
  while ( (_8577_p >= (int)0) )
  {
    {
      ++ _8578_n;
      ((*_8576_flags)(_8577_p)) = true;
      _8577_p = ((*next)(_8577_p));
      if (((_8577_p >= (int)0) && ((*_8576_flags)(_8577_p))))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("free list/next is inconsistent"));
        }
      }
      {}
    }
  }
  if ((_8578_n != nfree))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("free next list did not contain nfree elements"));
    }
  }
  {}
  int32_t _13167_ = (int)0;
  int32_t _13168_ = (int)((_8576_flags)->size(0));
  for (int32_t _8579_i = _13167_; _8579_i < _13168_; ++_8579_i)
  {
    {
      if ((!((*_8576_flags)(_8577_p))))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("elements missing from used+free list"));
        }
      }
      {}
    }
  }
  int32_t _13169_ = (int)0;
  int32_t _13170_ = (int)((_8576_flags)->size(0));
  for (int32_t _8580_i = _13169_; _8580_i < _13170_; ++_8580_i)
  {
    {
      ((*_8576_flags)(_8580_i)) = false;
    }
  }
  _8577_p = last_free;
  int32_t _8581_n = (int)0;
  while ( (_8577_p >= (int)0) )
  {
    {
      ++ _8581_n;
      ((*_8576_flags)(_8577_p)) = true;
      _8577_p = ((*prev)(_8577_p));
      if (((_8577_p >= (int)0) && ((*_8576_flags)(_8577_p))))
      {
        {
          throw ::mosek::fusion::UnexpectedError(std::string ("prev list is inconsistent"));
        }
      }
      {}
    }
  }
  if ((_8581_n != nfree))
  {
    {
      throw ::mosek::fusion::UnexpectedError(std::string ("free prev list did not contain nfree elements"));
    }
  }
  {}
  return true;
}
// End mosek.fusion.LinkedInts.validate

void mosek::fusion::p_LinkedInts::destroy()
{
prev.reset();
next.reset();
}
void mosek::fusion::LinkedInts::destroy() { mosek::fusion::p_LinkedInts::_get_impl(this)->destroy(); }
// } class LinkedInts
// class Parameters { // @ bld/grindsted/final/default/src/fusion/Parameters.mbi:4:4-6672:4
mosek::fusion::Parameters::Parameters(mosek::fusion::p_Parameters *_impl) : _impl(_impl) { /*std::cout << "Parameters() " << this << std::endl;*/ _impl->_pubthis = this; }
mosek::fusion::Parameters::~Parameters() { delete _impl; _impl = nullptr; }
mosek::fusion::p_Parameters::p_Parameters
  (::mosek::fusion::Parameters * _pubthis) :     _pubthis(_pubthis)
{}
// Begin mosek.fusion.Parameters.setParameter
// Method mosek.fusion.Parameters.setParameter @ bld/grindsted/final/default/src/fusion/Parameters.mbi:5143:0-6669:1
void mosek::fusion::Parameters::setParameter
  ( monty::rc_ptr< ::mosek::fusion::Model > _8582_M,
    const std::string & _8583_name,
    double _8584_value) { mosek::fusion::p_Parameters::setParameter(_8582_M,_8583_name,_8584_value); }
void mosek::fusion::p_Parameters::setParameter(monty::rc_ptr< ::mosek::fusion::Model > _8582_M,const std::string & _8583_name,double _8584_value)
{
  if (false)
  {
    {
    }
  }
  else if((_8583_name == std::string ("autoUpdateSolInfo")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (autoUpdateSolInfo)"));
    }
  }
  else if((_8583_name == std::string ("removeUnusedSolutions")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (removeUnusedSolutions)"));
    }
  }
  {}
  if ((_8583_name == std::string ("numThreads")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8585_v = _8584_value;
          if (((int)0 <= _8585_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_NUM_THREADS"),_8585_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (numThreads)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (numThreads)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mtSpincount")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8586_v = _8584_value;
          if ((((int)0 <= _8586_v) && (_8586_v <= (int)1000000000)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MT_SPINCOUNT"),_8586_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mtSpincount)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mtSpincount)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("optimizer")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (optimizer)"));
    }
  }
  else if((_8583_name == std::string ("simPrecision")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecision)"));
    }
  }
  {}
  if ((_8583_name == std::string ("biMaxIterations")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8587_v = _8584_value;
          if (((int)0 <= _8587_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_BI_MAX_ITERATIONS"),_8587_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biMaxIterations)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biMaxIterations)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("licenseTrhExpiryWrn")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8588_v = _8584_value;
          if (((int)0 <= _8588_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LICENSE_TRH_EXPIRY_WRN"),_8588_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseTrhExpiryWrn)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseTrhExpiryWrn)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("logCutSecondOpt")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8589_v = _8584_value;
          if (((int)0 <= _8589_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_CUT_SECOND_OPT"),_8589_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logCutSecondOpt)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logCutSecondOpt)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("logLocalInfo")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logLocalInfo)"));
    }
  }
  {}
  if ((_8583_name == std::string ("logBi")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8590_v = _8584_value;
          if (((int)0 <= _8590_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_BI"),_8590_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logBi)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logBi)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("logBiFreq")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8591_v = _8584_value;
          if (((int)0 <= _8591_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_BI_FREQ"),_8591_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logBiFreq)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logBiFreq)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("biCleanOptimizer")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biCleanOptimizer)"));
    }
  }
  else if((_8583_name == std::string ("intpntStartingPoint")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntStartingPoint)"));
    }
  }
  else if((_8583_name == std::string ("intpntDiffStep")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntDiffStep)"));
    }
  }
  else if((_8583_name == std::string ("intpntScaling")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntScaling)"));
    }
  }
  else if((_8583_name == std::string ("intpntSolveForm")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntSolveForm)"));
    }
  }
  {}
  if ((_8583_name == std::string ("logIntpnt")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8592_v = _8584_value;
          if (((int)0 <= _8592_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_INTPNT"),_8592_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logIntpnt)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logIntpnt)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntMaxIterations")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8593_v = _8584_value;
          if (((int)0 <= _8593_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_MAX_ITERATIONS"),_8593_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntMaxIterations)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntMaxIterations)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntOffColTrh")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8594_v = _8584_value;
          if (((int)0 <= _8594_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_OFF_COL_TRH"),_8594_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOffColTrh)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOffColTrh)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("intpntOrderMethod")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOrderMethod)"));
    }
  }
  {}
  if ((_8583_name == std::string ("intpntOrderGpNumSeeds")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8595_v = _8584_value;
          if (((int)0 <= _8595_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_ORDER_GP_NUM_SEEDS"),_8595_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOrderGpNumSeeds)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOrderGpNumSeeds)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("intpntBasis")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntBasis)"));
    }
  }
  else if((_8583_name == std::string ("biIgnoreMaxIter")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biIgnoreMaxIter)"));
    }
  }
  else if((_8583_name == std::string ("biIgnoreNumError")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biIgnoreNumError)"));
    }
  }
  {}
  if ((_8583_name == std::string ("intpntMaxNumCor")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8596_v = _8584_value;
          if (((-(int)1) <= _8596_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_MAX_NUM_COR"),_8596_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntMaxNumCor)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntMaxNumCor)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("presolveUse")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveUse)"));
    }
  }
  {}
  if ((_8583_name == std::string ("logPresolve")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8597_v = _8584_value;
          if (((int)0 <= _8597_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_PRESOLVE"),_8597_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logPresolve)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logPresolve)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("presolveLindepUse")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepUse)"));
    }
  }
  else if((_8583_name == std::string ("presolveLindepNew")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepNew)"));
    }
  }
  {}
  if ((_8583_name == std::string ("presolveMaxNumPass")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8598_v = _8584_value;
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_MAX_NUM_PASS"),_8598_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveMaxNumPass)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveMaxNumPass)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("presolveEliminatorMaxNumTries")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8599_v = _8584_value;
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_ELIMINATOR_MAX_NUM_TRIES"),_8599_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveEliminatorMaxNumTries)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveEliminatorMaxNumTries)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("presolveEliminatorMaxFill")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8600_v = _8584_value;
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_ELIMINATOR_MAX_FILL"),_8600_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveEliminatorMaxFill)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveEliminatorMaxFill)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("foldingUse")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (foldingUse)"));
    }
  }
  {}
  if ((_8583_name == std::string ("simPrimalCrash")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8601_v = _8584_value;
          if (((int)0 <= _8601_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_PRIMAL_CRASH"),_8601_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalCrash)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalCrash)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("logSim")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8602_v = _8584_value;
          if (((int)0 <= _8602_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_SIM"),_8602_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSim)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSim)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("logSimFreq")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8603_v = _8584_value;
          if (((int)0 <= _8603_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_SIM_FREQ"),_8603_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSimFreq)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSimFreq)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("logSimFreqGigaTicks")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8604_v = _8584_value;
          if (((-(int)1) <= _8604_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_SIM_FREQ_GIGA_TICKS"),_8604_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSimFreqGigaTicks)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSimFreqGigaTicks)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("heartbeatSimFreqTicks")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8605_v = _8584_value;
          if (((-(int)1) <= _8605_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_HEARTBEAT_SIM_FREQ_TICKS"),_8605_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (heartbeatSimFreqTicks)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (heartbeatSimFreqTicks)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("simPrimalRestrictSelection")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8606_v = _8584_value;
          if ((((int)0 <= _8606_v) && (_8606_v <= (int)100)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_PRIMAL_RESTRICT_SELECTION"),_8606_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalRestrictSelection)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalRestrictSelection)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("simPrimalSelection")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalSelection)"));
    }
  }
  {}
  if ((_8583_name == std::string ("simDualRestrictSelection")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8607_v = _8584_value;
          if ((((int)0 <= _8607_v) && (_8607_v <= (int)100)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_DUAL_RESTRICT_SELECTION"),_8607_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualRestrictSelection)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualRestrictSelection)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("simDualSelection")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualSelection)"));
    }
  }
  {}
  if ((_8583_name == std::string ("simMaxIterations")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8608_v = _8584_value;
          if (((int)0 <= _8608_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_MAX_ITERATIONS"),_8608_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simMaxIterations)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simMaxIterations)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("simHotstartLu")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simHotstartLu)"));
    }
  }
  {}
  if ((_8583_name == std::string ("simRefactorFreq")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8609_v = _8584_value;
          if (((int)0 <= _8609_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_REFACTOR_FREQ"),_8609_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simRefactorFreq)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simRefactorFreq)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("simSeed")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8610_v = _8584_value;
          if ((((int)0 <= _8610_v) && (_8610_v <= (int)32749)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_SEED"),_8610_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSeed)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSeed)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("mioMode")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMode)"));
    }
  }
  {}
  if ((_8583_name == std::string ("logMio")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8611_v = _8584_value;
          if (((int)0 <= _8611_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_MIO"),_8611_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logMio)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logMio)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("logMioFreq")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8612_v = _8584_value;
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_MIO_FREQ"),_8612_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logMioFreq)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logMioFreq)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioMaxNumRelaxs")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8613_v = _8584_value;
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_RELAXS"),_8613_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRelaxs)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRelaxs)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioMaxNumBranches")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8614_v = _8584_value;
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_BRANCHES"),_8614_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumBranches)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumBranches)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioMaxNumRestarts")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8615_v = _8584_value;
          if (((int)0 <= _8615_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_RESTARTS"),_8615_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRestarts)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRestarts)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioMaxNumRootCutRounds")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8616_v = _8584_value;
          if (((int)0 <= _8616_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_ROOT_CUT_ROUNDS"),_8616_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRootCutRounds)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRootCutRounds)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioMaxNumSolutions")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8617_v = _8584_value;
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_SOLUTIONS"),_8617_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumSolutions)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumSolutions)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("mioNodeSelection")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioNodeSelection)"));
    }
  }
  else if((_8583_name == std::string ("mioVarSelection")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioVarSelection)"));
    }
  }
  {}
  if ((_8583_name == std::string ("mioMinRel")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8618_v = _8584_value;
          if (((int)0 <= _8618_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MIN_REL"),_8618_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMinRel)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMinRel)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioHeuristicLevel")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8619_v = _8584_value;
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_HEURISTIC_LEVEL"),_8619_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioHeuristicLevel)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioHeuristicLevel)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioProbingLevel")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8620_v = _8584_value;
          if ((((-(int)1) <= _8620_v) && (_8620_v <= (int)3)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_PROBING_LEVEL"),_8620_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioProbingLevel)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioProbingLevel)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioSymmetryLevel")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8621_v = _8584_value;
          if ((((-(int)1) <= _8621_v) && (_8621_v <= (int)4)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_SYMMETRY_LEVEL"),_8621_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioSymmetryLevel)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioSymmetryLevel)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioDualRayAnalysisLevel")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8622_v = _8584_value;
          if ((((-(int)1) <= _8622_v) && (_8622_v <= (int)2)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_DUAL_RAY_ANALYSIS_LEVEL"),_8622_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioDualRayAnalysisLevel)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioDualRayAnalysisLevel)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioConflictAnalysisLevel")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8623_v = _8584_value;
          if ((((-(int)1) <= _8623_v) && (_8623_v <= (int)2)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CONFLICT_ANALYSIS_LEVEL"),_8623_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioConflictAnalysisLevel)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioConflictAnalysisLevel)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("mioPresolveAggregatorUse")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioPresolveAggregatorUse)"));
    }
  }
  {}
  if ((_8583_name == std::string ("mioNumericalEmphasisLevel")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8624_v = _8584_value;
          if ((((int)0 <= _8624_v) && (_8624_v <= (int)2)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_NUMERICAL_EMPHASIS_LEVEL"),_8624_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioNumericalEmphasisLevel)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioNumericalEmphasisLevel)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioMemoryEmphasisLevel")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8625_v = _8584_value;
          if ((((int)0 <= _8625_v) && (_8625_v <= (int)1)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MEMORY_EMPHASIS_LEVEL"),_8625_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMemoryEmphasisLevel)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMemoryEmphasisLevel)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioCutSelectionLevel")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8626_v = _8584_value;
          if ((((-(int)1) <= _8626_v) && (_8626_v <= (int)1)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CUT_SELECTION_LEVEL"),_8626_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutSelectionLevel)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutSelectionLevel)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioVbDetectionLevel")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8627_v = _8584_value;
          if ((((-(int)1) <= _8627_v) && (_8627_v <= (int)2)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_VB_DETECTION_LEVEL"),_8627_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioVbDetectionLevel)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioVbDetectionLevel)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("mioBranchDir")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioBranchDir)"));
    }
  }
  else if((_8583_name == std::string ("mioRootOptimizer")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRootOptimizer)"));
    }
  }
  else if((_8583_name == std::string ("mioNodeOptimizer")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioNodeOptimizer)"));
    }
  }
  else if((_8583_name == std::string ("mioPerspectiveReformulate")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioPerspectiveReformulate)"));
    }
  }
  else if((_8583_name == std::string ("mioPropagateObjectiveConstraint")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioPropagateObjectiveConstraint)"));
    }
  }
  {}
  if ((_8583_name == std::string ("mioSeed")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8628_v = _8584_value;
          if (((int)0 <= _8628_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_SEED"),_8628_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioSeed)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioSeed)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("mioConicOuterApproximation")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioConicOuterApproximation)"));
    }
  }
  else if((_8583_name == std::string ("mioQcqoReformulationMethod")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioQcqoReformulationMethod)"));
    }
  }
  else if((_8583_name == std::string ("mioDataPermutationMethod")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioDataPermutationMethod)"));
    }
  }
  else if((_8583_name == std::string ("writeMpsFormat")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeMpsFormat)"));
    }
  }
  {}
  if ((_8583_name == std::string ("writeLpLineWidth")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8629_v = _8584_value;
          if (((int)40 <= _8629_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_WRITE_LP_LINE_WIDTH"),_8629_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeLpLineWidth)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeLpLineWidth)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("writeLpFullObj")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeLpFullObj)"));
    }
  }
  else if((_8583_name == std::string ("writeJsonIndentation")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeJsonIndentation)"));
    }
  }
  else if((_8583_name == std::string ("infeasReportAuto")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (infeasReportAuto)"));
    }
  }
  else if((_8583_name == std::string ("licenseWait")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseWait)"));
    }
  }
  else if((_8583_name == std::string ("licenseSuppressExpireWrns")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseSuppressExpireWrns)"));
    }
  }
  {}
  if ((_8583_name == std::string ("licensePauseTime")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8630_v = _8584_value;
          if ((((int)0 <= _8630_v) && (_8630_v <= (int)1000000)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LICENSE_PAUSE_TIME"),_8630_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licensePauseTime)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licensePauseTime)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("licenseDebug")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseDebug)"));
    }
  }
  {}
  if ((_8583_name == std::string ("log")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8631_v = _8584_value;
          if (((int)0 <= _8631_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG"),_8631_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (log)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (log)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("logExpand")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8632_v = _8584_value;
          if (((int)0 <= _8632_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_EXPAND"),_8632_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logExpand)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logExpand)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("logFile")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8633_v = _8584_value;
          if (((int)0 <= _8633_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_FILE"),_8633_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logFile)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logFile)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("logOrder")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8634_v = _8584_value;
          if (((int)0 <= _8634_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_ORDER"),_8634_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logOrder)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logOrder)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("simScaling")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simScaling)"));
    }
  }
  else if((_8583_name == std::string ("simScalingMethod")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simScalingMethod)"));
    }
  }
  {}
  if ((_8583_name == std::string ("simPrimalPhaseoneMethod")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8635_v = _8584_value;
          if ((((int)0 <= _8635_v) && (_8635_v <= (int)10)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_PRIMAL_PHASEONE_METHOD"),_8635_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalPhaseoneMethod)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalPhaseoneMethod)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("simDualPhaseoneMethod")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8636_v = _8584_value;
          if ((((int)0 <= _8636_v) && (_8636_v <= (int)10)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_DUAL_PHASEONE_METHOD"),_8636_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualPhaseoneMethod)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualPhaseoneMethod)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("simMaxNumSetbacks")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8637_v = _8584_value;
          if (((int)0 <= _8637_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_MAX_NUM_SETBACKS"),_8637_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simMaxNumSetbacks)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simMaxNumSetbacks)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("simHotstart")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simHotstart)"));
    }
  }
  else if((_8583_name == std::string ("simBasisFactorUse")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simBasisFactorUse)"));
    }
  }
  else if((_8583_name == std::string ("simPrecisionBoost")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecisionBoost)"));
    }
  }
  else if((_8583_name == std::string ("simDegen")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDegen)"));
    }
  }
  else if((_8583_name == std::string ("simReformulation")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simReformulation)"));
    }
  }
  else if((_8583_name == std::string ("simExploitDupvec")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simExploitDupvec)"));
    }
  }
  else if((_8583_name == std::string ("simSaveLu")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSaveLu)"));
    }
  }
  else if((_8583_name == std::string ("simNonSingular")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simNonSingular)"));
    }
  }
  {}
  if ((_8583_name == std::string ("simDualCrash")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8638_v = _8584_value;
          if (((int)0 <= _8638_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_DUAL_CRASH"),_8638_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualCrash)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualCrash)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("ptfWriteTransform")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (ptfWriteTransform)"));
    }
  }
  else if((_8583_name == std::string ("ptfWriteSolutions")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (ptfWriteSolutions)"));
    }
  }
  else if((_8583_name == std::string ("ptfWriteParameters")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (ptfWriteParameters)"));
    }
  }
  else if((_8583_name == std::string ("ptfWriteSinglePsdTerms")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (ptfWriteSinglePsdTerms)"));
    }
  }
  else if((_8583_name == std::string ("mioCutCmir")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutCmir)"));
    }
  }
  else if((_8583_name == std::string ("mioCutClique")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutClique)"));
    }
  }
  else if((_8583_name == std::string ("mioCutImpliedBound")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutImpliedBound)"));
    }
  }
  else if((_8583_name == std::string ("mioCutKnapsackCover")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutKnapsackCover)"));
    }
  }
  else if((_8583_name == std::string ("mioCutGmi")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutGmi)"));
    }
  }
  else if((_8583_name == std::string ("mioCutLipro")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutLipro)"));
    }
  }
  else if((_8583_name == std::string ("mioConstructSol")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioConstructSol)"));
    }
  }
  {}
  if ((_8583_name == std::string ("presolveLindepRelWorkTrh")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8639_v = _8584_value;
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_LINDEP_REL_WORK_TRH"),_8639_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepRelWorkTrh)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepRelWorkTrh)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("presolveLindepAbsWorkTrh")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8640_v = _8584_value;
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_LINDEP_ABS_WORK_TRH"),_8640_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepAbsWorkTrh)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepAbsWorkTrh)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("cacheLicense")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (cacheLicense)"));
    }
  }
  else if((_8583_name == std::string ("intpntRegularizationUse")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntRegularizationUse)"));
    }
  }
  else if((_8583_name == std::string ("simSolveForm")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSolveForm)"));
    }
  }
  else if((_8583_name == std::string ("simSwitchOptimizer")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSwitchOptimizer)"));
    }
  }
  else if((_8583_name == std::string ("autoSortABeforeOpt")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (autoSortABeforeOpt)"));
    }
  }
  {}
  if ((_8583_name == std::string ("mioRinsMaxNodes")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8641_v = _8584_value;
          if (((-(int)1) <= _8641_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_RINS_MAX_NODES"),_8641_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRinsMaxNodes)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRinsMaxNodes)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioRensMaxNodes")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8642_v = _8584_value;
          if (((-(int)1) <= _8642_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_RENS_MAX_NODES"),_8642_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRensMaxNodes)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRensMaxNodes)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioCrossoverMaxNodes")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8643_v = _8584_value;
          if (((-(int)1) <= _8643_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CROSSOVER_MAX_NODES"),_8643_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCrossoverMaxNodes)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCrossoverMaxNodes)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioOptFaceMaxNodes")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8644_v = _8584_value;
          if (((-(int)1) <= _8644_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_OPT_FACE_MAX_NODES"),_8644_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioOptFaceMaxNodes)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioOptFaceMaxNodes)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioFeaspumpLevel")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8645_v = _8584_value;
          if ((((-(int)1) <= _8645_v) && (_8645_v <= (int)2)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_FEASPUMP_LEVEL"),_8645_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioFeaspumpLevel)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioFeaspumpLevel)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioIndependentBlockLevel")))
  {
    {
      if (((_8584_value - (int32_t)_8584_value) == 0.0))
      {
        {
          double _8646_v = _8584_value;
          if ((((-(int)1) <= _8646_v) && (_8646_v <= (int)3)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_INDEPENDENT_BLOCK_LEVEL"),_8646_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioIndependentBlockLevel)"));
            }
          }
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioIndependentBlockLevel)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("remoteUseCompression")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (remoteUseCompression)"));
    }
  }
  {}
  if ((_8583_name == std::string ("semidefiniteTolApprox")))
  {
    {
      double _8647_v = _8584_value;
      if ((1.000000e-15 <= _8647_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_SEMIDEFINITE_TOL_APPROX"),_8647_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (semidefiniteTolApprox)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("optimizerMaxTime")))
  {
    {
      double _8648_v = _8584_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_OPTIMIZER_MAX_TIME"),_8648_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (optimizerMaxTime)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("optimizerMaxTicks")))
  {
    {
      double _8649_v = _8584_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_OPTIMIZER_MAX_TICKS"),_8649_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (optimizerMaxTicks)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("lowerObjCut")))
  {
    {
      double _8650_v = _8584_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_LOWER_OBJ_CUT"),_8650_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (lowerObjCut)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("upperObjCut")))
  {
    {
      double _8651_v = _8584_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_UPPER_OBJ_CUT"),_8651_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (upperObjCut)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("upperObjCutFiniteTrh")))
  {
    {
      double _8652_v = _8584_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_UPPER_OBJ_CUT_FINITE_TRH"),_8652_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (upperObjCutFiniteTrh)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("lowerObjCutFiniteTrh")))
  {
    {
      double _8653_v = _8584_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_LOWER_OBJ_CUT_FINITE_TRH"),_8653_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (lowerObjCutFiniteTrh)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntTolRelGap")))
  {
    {
      double _8654_v = _8584_value;
      if ((1.000000e-14 <= _8654_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_REL_GAP"),_8654_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolRelGap)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntTolStepSize")))
  {
    {
      double _8655_v = _8584_value;
      if (((0.000000e+00 <= _8655_v) && (_8655_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_STEP_SIZE"),_8655_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolStepSize)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("simLuTolRelPiv")))
  {
    {
      double _8656_v = _8584_value;
      if (((1.000000e-06 <= _8656_v) && (_8656_v <= 9.999990e-01)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_SIM_LU_TOL_REL_PIV"),_8656_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simLuTolRelPiv)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntTolRelStep")))
  {
    {
      double _8657_v = _8584_value;
      if (((1.000000e-04 <= _8657_v) && (_8657_v <= 9.999990e-01)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_REL_STEP"),_8657_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolRelStep)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntTolPath")))
  {
    {
      double _8658_v = _8584_value;
      if (((0.000000e+00 <= _8658_v) && (_8658_v <= 9.999000e-01)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_PATH"),_8658_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolPath)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntTolPfeas")))
  {
    {
      double _8659_v = _8584_value;
      if (((0.000000e+00 <= _8659_v) && (_8659_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_PFEAS"),_8659_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolPfeas)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntTolDfeas")))
  {
    {
      double _8660_v = _8584_value;
      if (((0.000000e+00 <= _8660_v) && (_8660_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_DFEAS"),_8660_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolDfeas)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntTolMuRed")))
  {
    {
      double _8661_v = _8584_value;
      if (((0.000000e+00 <= _8661_v) && (_8661_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_MU_RED"),_8661_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolMuRed)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntTolInfeas")))
  {
    {
      double _8662_v = _8584_value;
      if (((0.000000e+00 <= _8662_v) && (_8662_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_INFEAS"),_8662_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolInfeas)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntCoTolRelGap")))
  {
    {
      double _8663_v = _8584_value;
      if (((0.000000e+00 <= _8663_v) && (_8663_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_REL_GAP"),_8663_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolRelGap)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntCoTolPfeas")))
  {
    {
      double _8664_v = _8584_value;
      if (((0.000000e+00 <= _8664_v) && (_8664_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_PFEAS"),_8664_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolPfeas)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntCoTolDfeas")))
  {
    {
      double _8665_v = _8584_value;
      if (((0.000000e+00 <= _8665_v) && (_8665_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_DFEAS"),_8665_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolDfeas)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntCoTolMuRed")))
  {
    {
      double _8666_v = _8584_value;
      if (((0.000000e+00 <= _8666_v) && (_8666_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_MU_RED"),_8666_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolMuRed)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntCoTolNearRel")))
  {
    {
      double _8667_v = _8584_value;
      if ((1.000000e+00 <= _8667_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_NEAR_REL"),_8667_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolNearRel)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntCoTolInfeas")))
  {
    {
      double _8668_v = _8584_value;
      if (((0.000000e+00 <= _8668_v) && (_8668_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_INFEAS"),_8668_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolInfeas)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntTolPsafe")))
  {
    {
      double _8669_v = _8584_value;
      if ((1.000000e-04 <= _8669_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_PSAFE"),_8669_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolPsafe)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("intpntTolDsafe")))
  {
    {
      double _8670_v = _8584_value;
      if ((1.000000e-04 <= _8670_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_DSAFE"),_8670_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolDsafe)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioMaxTime")))
  {
    {
      double _8671_v = _8584_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_MAX_TIME"),_8671_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxTime)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioRelGapConst")))
  {
    {
      double _8672_v = _8584_value;
      if ((1.000000e-15 <= _8672_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_REL_GAP_CONST"),_8672_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRelGapConst)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioTolRelGap")))
  {
    {
      double _8673_v = _8584_value;
      if ((0.000000e+00 <= _8673_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_REL_GAP"),_8673_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolRelGap)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioTolAbsGap")))
  {
    {
      double _8674_v = _8584_value;
      if ((0.000000e+00 <= _8674_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_ABS_GAP"),_8674_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolAbsGap)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioTolAbsRelaxInt")))
  {
    {
      double _8675_v = _8584_value;
      if ((1.000000e-09 <= _8675_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_ABS_RELAX_INT"),_8675_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolAbsRelaxInt)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioDjcMaxBigm")))
  {
    {
      double _8676_v = _8584_value;
      if ((0.000000e+00 <= _8676_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_DJC_MAX_BIGM"),_8676_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioDjcMaxBigm)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioCliqueTableSizeFactor")))
  {
    {
      double _8677_v = _8584_value;
      if (((-1.000000e+00) <= _8677_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_CLIQUE_TABLE_SIZE_FACTOR"),_8677_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCliqueTableSizeFactor)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("simPrecisionScalingNormal")))
  {
    {
      double _8678_v = _8584_value;
      if ((1.000000e+00 <= _8678_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_SIM_PRECISION_SCALING_NORMAL"),_8678_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecisionScalingNormal)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("simPrecisionScalingExtended")))
  {
    {
      double _8679_v = _8584_value;
      if ((1.000000e+00 <= _8679_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_SIM_PRECISION_SCALING_EXTENDED"),_8679_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecisionScalingExtended)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("basisTolX")))
  {
    {
      double _8680_v = _8584_value;
      if ((1.000000e-09 <= _8680_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_BASIS_TOL_X"),_8680_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (basisTolX)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("basisTolS")))
  {
    {
      double _8681_v = _8584_value;
      if ((1.000000e-09 <= _8681_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_BASIS_TOL_S"),_8681_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (basisTolS)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("basisRelTolS")))
  {
    {
      double _8682_v = _8584_value;
      if ((0.000000e+00 <= _8682_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_BASIS_REL_TOL_S"),_8682_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (basisRelTolS)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("presolveTolX")))
  {
    {
      double _8683_v = _8584_value;
      if ((0.000000e+00 <= _8683_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_X"),_8683_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolX)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("presolveTolPrimalInfeasPerturbation")))
  {
    {
      double _8684_v = _8584_value;
      if ((0.000000e+00 <= _8684_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_PRIMAL_INFEAS_PERTURBATION"),_8684_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolPrimalInfeasPerturbation)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("presolveTolS")))
  {
    {
      double _8685_v = _8584_value;
      if ((0.000000e+00 <= _8685_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_S"),_8685_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolS)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("presolveTolAbsLindep")))
  {
    {
      double _8686_v = _8584_value;
      if ((0.000000e+00 <= _8686_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_ABS_LINDEP"),_8686_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolAbsLindep)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("presolveTolRelLindep")))
  {
    {
      double _8687_v = _8584_value;
      if ((0.000000e+00 <= _8687_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_REL_LINDEP"),_8687_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolRelLindep)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("foldingTolEq")))
  {
    {
      double _8688_v = _8584_value;
      if ((0.000000e+00 <= _8688_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_FOLDING_TOL_EQ"),_8688_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (foldingTolEq)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("simplexAbsTolPiv")))
  {
    {
      double _8689_v = _8584_value;
      if ((1.000000e-12 <= _8689_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_SIMPLEX_ABS_TOL_PIV"),_8689_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simplexAbsTolPiv)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioTolFeas")))
  {
    {
      double _8690_v = _8584_value;
      if (((1.000000e-09 <= _8690_v) && (_8690_v <= 1.000000e-03)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_FEAS"),_8690_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolFeas)"));
        }
      }
    }
  }
  {}
  if ((_8583_name == std::string ("mioTolRelDualBoundImprovement")))
  {
    {
      double _8691_v = _8584_value;
      if (((0.000000e+00 <= _8691_v) && (_8691_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8582_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_REL_DUAL_BOUND_IMPROVEMENT"),_8691_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolRelDualBoundImprovement)"));
        }
      }
    }
  }
  else if((_8583_name == std::string ("dataFileName")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (dataFileName)"));
    }
  }
  else if((_8583_name == std::string ("remoteOptserverHost")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (remoteOptserverHost)"));
    }
  }
  else if((_8583_name == std::string ("remoteTlsCertPath")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (remoteTlsCertPath)"));
    }
  }
  else if((_8583_name == std::string ("remoteTlsCert")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (remoteTlsCert)"));
    }
  }
  {}
  throw ::mosek::fusion::ParameterError(std::string ("Unknown parameter"));
}
// End mosek.fusion.Parameters.setParameter

// Begin mosek.fusion.Parameters.setParameter
// Method mosek.fusion.Parameters.setParameter @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3925:0-5141:1
void mosek::fusion::Parameters::setParameter
  ( monty::rc_ptr< ::mosek::fusion::Model > _8692_M,
    const std::string & _8693_name,
    int32_t _8694_value) { mosek::fusion::p_Parameters::setParameter(_8692_M,_8693_name,_8694_value); }
void mosek::fusion::p_Parameters::setParameter(monty::rc_ptr< ::mosek::fusion::Model > _8692_M,const std::string & _8693_name,int32_t _8694_value)
{
  if (false)
  {
    {
    }
  }
  else if((_8693_name == std::string ("autoUpdateSolInfo")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (autoUpdateSolInfo)"));
    }
  }
  else if((_8693_name == std::string ("removeUnusedSolutions")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (removeUnusedSolutions)"));
    }
  }
  {}
  if ((_8693_name == std::string ("numThreads")))
  {
    {
      int32_t _8695_v = _8694_value;
      if (((int)0 <= _8695_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_NUM_THREADS"),_8695_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (numThreads)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mtSpincount")))
  {
    {
      int32_t _8696_v = _8694_value;
      if ((((int)0 <= _8696_v) && (_8696_v <= (int)1000000000)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MT_SPINCOUNT"),_8696_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mtSpincount)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("optimizer")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (optimizer)"));
    }
  }
  else if((_8693_name == std::string ("simPrecision")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecision)"));
    }
  }
  {}
  if ((_8693_name == std::string ("biMaxIterations")))
  {
    {
      int32_t _8697_v = _8694_value;
      if (((int)0 <= _8697_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_BI_MAX_ITERATIONS"),_8697_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biMaxIterations)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("licenseTrhExpiryWrn")))
  {
    {
      int32_t _8698_v = _8694_value;
      if (((int)0 <= _8698_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LICENSE_TRH_EXPIRY_WRN"),_8698_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseTrhExpiryWrn)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("logCutSecondOpt")))
  {
    {
      int32_t _8699_v = _8694_value;
      if (((int)0 <= _8699_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_CUT_SECOND_OPT"),_8699_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logCutSecondOpt)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("logLocalInfo")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logLocalInfo)"));
    }
  }
  {}
  if ((_8693_name == std::string ("logBi")))
  {
    {
      int32_t _8700_v = _8694_value;
      if (((int)0 <= _8700_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_BI"),_8700_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logBi)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("logBiFreq")))
  {
    {
      int32_t _8701_v = _8694_value;
      if (((int)0 <= _8701_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_BI_FREQ"),_8701_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logBiFreq)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("biCleanOptimizer")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biCleanOptimizer)"));
    }
  }
  else if((_8693_name == std::string ("intpntStartingPoint")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntStartingPoint)"));
    }
  }
  else if((_8693_name == std::string ("intpntDiffStep")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntDiffStep)"));
    }
  }
  else if((_8693_name == std::string ("intpntScaling")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntScaling)"));
    }
  }
  else if((_8693_name == std::string ("intpntSolveForm")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntSolveForm)"));
    }
  }
  {}
  if ((_8693_name == std::string ("logIntpnt")))
  {
    {
      int32_t _8702_v = _8694_value;
      if (((int)0 <= _8702_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_INTPNT"),_8702_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logIntpnt)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntMaxIterations")))
  {
    {
      int32_t _8703_v = _8694_value;
      if (((int)0 <= _8703_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_MAX_ITERATIONS"),_8703_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntMaxIterations)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntOffColTrh")))
  {
    {
      int32_t _8704_v = _8694_value;
      if (((int)0 <= _8704_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_OFF_COL_TRH"),_8704_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOffColTrh)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("intpntOrderMethod")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOrderMethod)"));
    }
  }
  {}
  if ((_8693_name == std::string ("intpntOrderGpNumSeeds")))
  {
    {
      int32_t _8705_v = _8694_value;
      if (((int)0 <= _8705_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_ORDER_GP_NUM_SEEDS"),_8705_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOrderGpNumSeeds)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("intpntBasis")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntBasis)"));
    }
  }
  else if((_8693_name == std::string ("biIgnoreMaxIter")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biIgnoreMaxIter)"));
    }
  }
  else if((_8693_name == std::string ("biIgnoreNumError")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biIgnoreNumError)"));
    }
  }
  {}
  if ((_8693_name == std::string ("intpntMaxNumCor")))
  {
    {
      int32_t _8706_v = _8694_value;
      if (((-(int)1) <= _8706_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_MAX_NUM_COR"),_8706_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntMaxNumCor)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("presolveUse")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveUse)"));
    }
  }
  {}
  if ((_8693_name == std::string ("logPresolve")))
  {
    {
      int32_t _8707_v = _8694_value;
      if (((int)0 <= _8707_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_PRESOLVE"),_8707_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logPresolve)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("presolveLindepUse")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepUse)"));
    }
  }
  else if((_8693_name == std::string ("presolveLindepNew")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepNew)"));
    }
  }
  {}
  if ((_8693_name == std::string ("presolveMaxNumPass")))
  {
    {
      int32_t _8708_v = _8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_MAX_NUM_PASS"),_8708_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveMaxNumPass)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("presolveEliminatorMaxNumTries")))
  {
    {
      int32_t _8709_v = _8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_ELIMINATOR_MAX_NUM_TRIES"),_8709_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveEliminatorMaxNumTries)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("presolveEliminatorMaxFill")))
  {
    {
      int32_t _8710_v = _8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_ELIMINATOR_MAX_FILL"),_8710_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveEliminatorMaxFill)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("foldingUse")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (foldingUse)"));
    }
  }
  {}
  if ((_8693_name == std::string ("simPrimalCrash")))
  {
    {
      int32_t _8711_v = _8694_value;
      if (((int)0 <= _8711_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_PRIMAL_CRASH"),_8711_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalCrash)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("logSim")))
  {
    {
      int32_t _8712_v = _8694_value;
      if (((int)0 <= _8712_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_SIM"),_8712_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSim)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("logSimFreq")))
  {
    {
      int32_t _8713_v = _8694_value;
      if (((int)0 <= _8713_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_SIM_FREQ"),_8713_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSimFreq)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("logSimFreqGigaTicks")))
  {
    {
      int32_t _8714_v = _8694_value;
      if (((-(int)1) <= _8714_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_SIM_FREQ_GIGA_TICKS"),_8714_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSimFreqGigaTicks)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("heartbeatSimFreqTicks")))
  {
    {
      int32_t _8715_v = _8694_value;
      if (((-(int)1) <= _8715_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_HEARTBEAT_SIM_FREQ_TICKS"),_8715_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (heartbeatSimFreqTicks)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("simPrimalRestrictSelection")))
  {
    {
      int32_t _8716_v = _8694_value;
      if ((((int)0 <= _8716_v) && (_8716_v <= (int)100)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_PRIMAL_RESTRICT_SELECTION"),_8716_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalRestrictSelection)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("simPrimalSelection")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalSelection)"));
    }
  }
  {}
  if ((_8693_name == std::string ("simDualRestrictSelection")))
  {
    {
      int32_t _8717_v = _8694_value;
      if ((((int)0 <= _8717_v) && (_8717_v <= (int)100)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_DUAL_RESTRICT_SELECTION"),_8717_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualRestrictSelection)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("simDualSelection")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualSelection)"));
    }
  }
  {}
  if ((_8693_name == std::string ("simMaxIterations")))
  {
    {
      int32_t _8718_v = _8694_value;
      if (((int)0 <= _8718_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_MAX_ITERATIONS"),_8718_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simMaxIterations)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("simHotstartLu")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simHotstartLu)"));
    }
  }
  {}
  if ((_8693_name == std::string ("simRefactorFreq")))
  {
    {
      int32_t _8719_v = _8694_value;
      if (((int)0 <= _8719_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_REFACTOR_FREQ"),_8719_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simRefactorFreq)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("simSeed")))
  {
    {
      int32_t _8720_v = _8694_value;
      if ((((int)0 <= _8720_v) && (_8720_v <= (int)32749)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_SEED"),_8720_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSeed)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("mioMode")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMode)"));
    }
  }
  {}
  if ((_8693_name == std::string ("logMio")))
  {
    {
      int32_t _8721_v = _8694_value;
      if (((int)0 <= _8721_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_MIO"),_8721_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logMio)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("logMioFreq")))
  {
    {
      int32_t _8722_v = _8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_MIO_FREQ"),_8722_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logMioFreq)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioMaxNumRelaxs")))
  {
    {
      int32_t _8723_v = _8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_RELAXS"),_8723_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRelaxs)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioMaxNumBranches")))
  {
    {
      int32_t _8724_v = _8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_BRANCHES"),_8724_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumBranches)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioMaxNumRestarts")))
  {
    {
      int32_t _8725_v = _8694_value;
      if (((int)0 <= _8725_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_RESTARTS"),_8725_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRestarts)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioMaxNumRootCutRounds")))
  {
    {
      int32_t _8726_v = _8694_value;
      if (((int)0 <= _8726_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_ROOT_CUT_ROUNDS"),_8726_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRootCutRounds)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioMaxNumSolutions")))
  {
    {
      int32_t _8727_v = _8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_SOLUTIONS"),_8727_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumSolutions)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("mioNodeSelection")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioNodeSelection)"));
    }
  }
  else if((_8693_name == std::string ("mioVarSelection")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioVarSelection)"));
    }
  }
  {}
  if ((_8693_name == std::string ("mioMinRel")))
  {
    {
      int32_t _8728_v = _8694_value;
      if (((int)0 <= _8728_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MIN_REL"),_8728_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMinRel)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioHeuristicLevel")))
  {
    {
      int32_t _8729_v = _8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_HEURISTIC_LEVEL"),_8729_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioHeuristicLevel)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioProbingLevel")))
  {
    {
      int32_t _8730_v = _8694_value;
      if ((((-(int)1) <= _8730_v) && (_8730_v <= (int)3)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_PROBING_LEVEL"),_8730_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioProbingLevel)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioSymmetryLevel")))
  {
    {
      int32_t _8731_v = _8694_value;
      if ((((-(int)1) <= _8731_v) && (_8731_v <= (int)4)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_SYMMETRY_LEVEL"),_8731_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioSymmetryLevel)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioDualRayAnalysisLevel")))
  {
    {
      int32_t _8732_v = _8694_value;
      if ((((-(int)1) <= _8732_v) && (_8732_v <= (int)2)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_DUAL_RAY_ANALYSIS_LEVEL"),_8732_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioDualRayAnalysisLevel)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioConflictAnalysisLevel")))
  {
    {
      int32_t _8733_v = _8694_value;
      if ((((-(int)1) <= _8733_v) && (_8733_v <= (int)2)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CONFLICT_ANALYSIS_LEVEL"),_8733_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioConflictAnalysisLevel)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("mioPresolveAggregatorUse")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioPresolveAggregatorUse)"));
    }
  }
  {}
  if ((_8693_name == std::string ("mioNumericalEmphasisLevel")))
  {
    {
      int32_t _8734_v = _8694_value;
      if ((((int)0 <= _8734_v) && (_8734_v <= (int)2)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_NUMERICAL_EMPHASIS_LEVEL"),_8734_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioNumericalEmphasisLevel)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioMemoryEmphasisLevel")))
  {
    {
      int32_t _8735_v = _8694_value;
      if ((((int)0 <= _8735_v) && (_8735_v <= (int)1)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MEMORY_EMPHASIS_LEVEL"),_8735_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMemoryEmphasisLevel)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioCutSelectionLevel")))
  {
    {
      int32_t _8736_v = _8694_value;
      if ((((-(int)1) <= _8736_v) && (_8736_v <= (int)1)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CUT_SELECTION_LEVEL"),_8736_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutSelectionLevel)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioVbDetectionLevel")))
  {
    {
      int32_t _8737_v = _8694_value;
      if ((((-(int)1) <= _8737_v) && (_8737_v <= (int)2)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_VB_DETECTION_LEVEL"),_8737_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioVbDetectionLevel)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("mioBranchDir")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioBranchDir)"));
    }
  }
  else if((_8693_name == std::string ("mioRootOptimizer")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRootOptimizer)"));
    }
  }
  else if((_8693_name == std::string ("mioNodeOptimizer")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioNodeOptimizer)"));
    }
  }
  else if((_8693_name == std::string ("mioPerspectiveReformulate")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioPerspectiveReformulate)"));
    }
  }
  else if((_8693_name == std::string ("mioPropagateObjectiveConstraint")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioPropagateObjectiveConstraint)"));
    }
  }
  {}
  if ((_8693_name == std::string ("mioSeed")))
  {
    {
      int32_t _8738_v = _8694_value;
      if (((int)0 <= _8738_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_SEED"),_8738_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioSeed)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("mioConicOuterApproximation")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioConicOuterApproximation)"));
    }
  }
  else if((_8693_name == std::string ("mioQcqoReformulationMethod")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioQcqoReformulationMethod)"));
    }
  }
  else if((_8693_name == std::string ("mioDataPermutationMethod")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioDataPermutationMethod)"));
    }
  }
  else if((_8693_name == std::string ("writeMpsFormat")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeMpsFormat)"));
    }
  }
  {}
  if ((_8693_name == std::string ("writeLpLineWidth")))
  {
    {
      int32_t _8739_v = _8694_value;
      if (((int)40 <= _8739_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_WRITE_LP_LINE_WIDTH"),_8739_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeLpLineWidth)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("writeLpFullObj")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeLpFullObj)"));
    }
  }
  else if((_8693_name == std::string ("writeJsonIndentation")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeJsonIndentation)"));
    }
  }
  else if((_8693_name == std::string ("infeasReportAuto")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (infeasReportAuto)"));
    }
  }
  else if((_8693_name == std::string ("licenseWait")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseWait)"));
    }
  }
  else if((_8693_name == std::string ("licenseSuppressExpireWrns")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseSuppressExpireWrns)"));
    }
  }
  {}
  if ((_8693_name == std::string ("licensePauseTime")))
  {
    {
      int32_t _8740_v = _8694_value;
      if ((((int)0 <= _8740_v) && (_8740_v <= (int)1000000)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LICENSE_PAUSE_TIME"),_8740_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licensePauseTime)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("licenseDebug")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseDebug)"));
    }
  }
  {}
  if ((_8693_name == std::string ("log")))
  {
    {
      int32_t _8741_v = _8694_value;
      if (((int)0 <= _8741_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG"),_8741_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (log)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("logExpand")))
  {
    {
      int32_t _8742_v = _8694_value;
      if (((int)0 <= _8742_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_EXPAND"),_8742_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logExpand)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("logFile")))
  {
    {
      int32_t _8743_v = _8694_value;
      if (((int)0 <= _8743_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_FILE"),_8743_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logFile)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("logOrder")))
  {
    {
      int32_t _8744_v = _8694_value;
      if (((int)0 <= _8744_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_ORDER"),_8744_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logOrder)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("simScaling")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simScaling)"));
    }
  }
  else if((_8693_name == std::string ("simScalingMethod")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simScalingMethod)"));
    }
  }
  {}
  if ((_8693_name == std::string ("simPrimalPhaseoneMethod")))
  {
    {
      int32_t _8745_v = _8694_value;
      if ((((int)0 <= _8745_v) && (_8745_v <= (int)10)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_PRIMAL_PHASEONE_METHOD"),_8745_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalPhaseoneMethod)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("simDualPhaseoneMethod")))
  {
    {
      int32_t _8746_v = _8694_value;
      if ((((int)0 <= _8746_v) && (_8746_v <= (int)10)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_DUAL_PHASEONE_METHOD"),_8746_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualPhaseoneMethod)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("simMaxNumSetbacks")))
  {
    {
      int32_t _8747_v = _8694_value;
      if (((int)0 <= _8747_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_MAX_NUM_SETBACKS"),_8747_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simMaxNumSetbacks)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("simHotstart")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simHotstart)"));
    }
  }
  else if((_8693_name == std::string ("simBasisFactorUse")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simBasisFactorUse)"));
    }
  }
  else if((_8693_name == std::string ("simPrecisionBoost")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecisionBoost)"));
    }
  }
  else if((_8693_name == std::string ("simDegen")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDegen)"));
    }
  }
  else if((_8693_name == std::string ("simReformulation")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simReformulation)"));
    }
  }
  else if((_8693_name == std::string ("simExploitDupvec")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simExploitDupvec)"));
    }
  }
  else if((_8693_name == std::string ("simSaveLu")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSaveLu)"));
    }
  }
  else if((_8693_name == std::string ("simNonSingular")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simNonSingular)"));
    }
  }
  {}
  if ((_8693_name == std::string ("simDualCrash")))
  {
    {
      int32_t _8748_v = _8694_value;
      if (((int)0 <= _8748_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_DUAL_CRASH"),_8748_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualCrash)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("ptfWriteTransform")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (ptfWriteTransform)"));
    }
  }
  else if((_8693_name == std::string ("ptfWriteSolutions")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (ptfWriteSolutions)"));
    }
  }
  else if((_8693_name == std::string ("ptfWriteParameters")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (ptfWriteParameters)"));
    }
  }
  else if((_8693_name == std::string ("ptfWriteSinglePsdTerms")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (ptfWriteSinglePsdTerms)"));
    }
  }
  else if((_8693_name == std::string ("mioCutCmir")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutCmir)"));
    }
  }
  else if((_8693_name == std::string ("mioCutClique")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutClique)"));
    }
  }
  else if((_8693_name == std::string ("mioCutImpliedBound")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutImpliedBound)"));
    }
  }
  else if((_8693_name == std::string ("mioCutKnapsackCover")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutKnapsackCover)"));
    }
  }
  else if((_8693_name == std::string ("mioCutGmi")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutGmi)"));
    }
  }
  else if((_8693_name == std::string ("mioCutLipro")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutLipro)"));
    }
  }
  else if((_8693_name == std::string ("mioConstructSol")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioConstructSol)"));
    }
  }
  {}
  if ((_8693_name == std::string ("presolveLindepRelWorkTrh")))
  {
    {
      int32_t _8749_v = _8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_LINDEP_REL_WORK_TRH"),_8749_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepRelWorkTrh)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("presolveLindepAbsWorkTrh")))
  {
    {
      int32_t _8750_v = _8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_LINDEP_ABS_WORK_TRH"),_8750_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepAbsWorkTrh)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("cacheLicense")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (cacheLicense)"));
    }
  }
  else if((_8693_name == std::string ("intpntRegularizationUse")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntRegularizationUse)"));
    }
  }
  else if((_8693_name == std::string ("simSolveForm")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSolveForm)"));
    }
  }
  else if((_8693_name == std::string ("simSwitchOptimizer")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSwitchOptimizer)"));
    }
  }
  else if((_8693_name == std::string ("autoSortABeforeOpt")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (autoSortABeforeOpt)"));
    }
  }
  {}
  if ((_8693_name == std::string ("mioRinsMaxNodes")))
  {
    {
      int32_t _8751_v = _8694_value;
      if (((-(int)1) <= _8751_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_RINS_MAX_NODES"),_8751_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRinsMaxNodes)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioRensMaxNodes")))
  {
    {
      int32_t _8752_v = _8694_value;
      if (((-(int)1) <= _8752_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_RENS_MAX_NODES"),_8752_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRensMaxNodes)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioCrossoverMaxNodes")))
  {
    {
      int32_t _8753_v = _8694_value;
      if (((-(int)1) <= _8753_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CROSSOVER_MAX_NODES"),_8753_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCrossoverMaxNodes)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioOptFaceMaxNodes")))
  {
    {
      int32_t _8754_v = _8694_value;
      if (((-(int)1) <= _8754_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_OPT_FACE_MAX_NODES"),_8754_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioOptFaceMaxNodes)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioFeaspumpLevel")))
  {
    {
      int32_t _8755_v = _8694_value;
      if ((((-(int)1) <= _8755_v) && (_8755_v <= (int)2)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_FEASPUMP_LEVEL"),_8755_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioFeaspumpLevel)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioIndependentBlockLevel")))
  {
    {
      int32_t _8756_v = _8694_value;
      if ((((-(int)1) <= _8756_v) && (_8756_v <= (int)3)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_INDEPENDENT_BLOCK_LEVEL"),_8756_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioIndependentBlockLevel)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("remoteUseCompression")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (remoteUseCompression)"));
    }
  }
  {}
  if ((_8693_name == std::string ("semidefiniteTolApprox")))
  {
    {
      double _8757_v = (double)_8694_value;
      if ((1.000000e-15 <= _8757_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_SEMIDEFINITE_TOL_APPROX"),_8757_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (semidefiniteTolApprox)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("optimizerMaxTime")))
  {
    {
      double _8758_v = (double)_8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_OPTIMIZER_MAX_TIME"),_8758_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (optimizerMaxTime)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("optimizerMaxTicks")))
  {
    {
      double _8759_v = (double)_8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_OPTIMIZER_MAX_TICKS"),_8759_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (optimizerMaxTicks)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("lowerObjCut")))
  {
    {
      double _8760_v = (double)_8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_LOWER_OBJ_CUT"),_8760_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (lowerObjCut)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("upperObjCut")))
  {
    {
      double _8761_v = (double)_8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_UPPER_OBJ_CUT"),_8761_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (upperObjCut)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("upperObjCutFiniteTrh")))
  {
    {
      double _8762_v = (double)_8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_UPPER_OBJ_CUT_FINITE_TRH"),_8762_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (upperObjCutFiniteTrh)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("lowerObjCutFiniteTrh")))
  {
    {
      double _8763_v = (double)_8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_LOWER_OBJ_CUT_FINITE_TRH"),_8763_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (lowerObjCutFiniteTrh)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntTolRelGap")))
  {
    {
      double _8764_v = (double)_8694_value;
      if ((1.000000e-14 <= _8764_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_REL_GAP"),_8764_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolRelGap)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntTolStepSize")))
  {
    {
      double _8765_v = (double)_8694_value;
      if (((0.000000e+00 <= _8765_v) && (_8765_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_STEP_SIZE"),_8765_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolStepSize)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("simLuTolRelPiv")))
  {
    {
      double _8766_v = (double)_8694_value;
      if (((1.000000e-06 <= _8766_v) && (_8766_v <= 9.999990e-01)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_SIM_LU_TOL_REL_PIV"),_8766_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simLuTolRelPiv)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntTolRelStep")))
  {
    {
      double _8767_v = (double)_8694_value;
      if (((1.000000e-04 <= _8767_v) && (_8767_v <= 9.999990e-01)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_REL_STEP"),_8767_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolRelStep)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntTolPath")))
  {
    {
      double _8768_v = (double)_8694_value;
      if (((0.000000e+00 <= _8768_v) && (_8768_v <= 9.999000e-01)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_PATH"),_8768_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolPath)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntTolPfeas")))
  {
    {
      double _8769_v = (double)_8694_value;
      if (((0.000000e+00 <= _8769_v) && (_8769_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_PFEAS"),_8769_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolPfeas)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntTolDfeas")))
  {
    {
      double _8770_v = (double)_8694_value;
      if (((0.000000e+00 <= _8770_v) && (_8770_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_DFEAS"),_8770_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolDfeas)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntTolMuRed")))
  {
    {
      double _8771_v = (double)_8694_value;
      if (((0.000000e+00 <= _8771_v) && (_8771_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_MU_RED"),_8771_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolMuRed)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntTolInfeas")))
  {
    {
      double _8772_v = (double)_8694_value;
      if (((0.000000e+00 <= _8772_v) && (_8772_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_INFEAS"),_8772_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolInfeas)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntCoTolRelGap")))
  {
    {
      double _8773_v = (double)_8694_value;
      if (((0.000000e+00 <= _8773_v) && (_8773_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_REL_GAP"),_8773_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolRelGap)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntCoTolPfeas")))
  {
    {
      double _8774_v = (double)_8694_value;
      if (((0.000000e+00 <= _8774_v) && (_8774_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_PFEAS"),_8774_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolPfeas)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntCoTolDfeas")))
  {
    {
      double _8775_v = (double)_8694_value;
      if (((0.000000e+00 <= _8775_v) && (_8775_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_DFEAS"),_8775_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolDfeas)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntCoTolMuRed")))
  {
    {
      double _8776_v = (double)_8694_value;
      if (((0.000000e+00 <= _8776_v) && (_8776_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_MU_RED"),_8776_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolMuRed)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntCoTolNearRel")))
  {
    {
      double _8777_v = (double)_8694_value;
      if ((1.000000e+00 <= _8777_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_NEAR_REL"),_8777_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolNearRel)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntCoTolInfeas")))
  {
    {
      double _8778_v = (double)_8694_value;
      if (((0.000000e+00 <= _8778_v) && (_8778_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_INFEAS"),_8778_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolInfeas)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntTolPsafe")))
  {
    {
      double _8779_v = (double)_8694_value;
      if ((1.000000e-04 <= _8779_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_PSAFE"),_8779_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolPsafe)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("intpntTolDsafe")))
  {
    {
      double _8780_v = (double)_8694_value;
      if ((1.000000e-04 <= _8780_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_DSAFE"),_8780_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolDsafe)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioMaxTime")))
  {
    {
      double _8781_v = (double)_8694_value;
      if (true)
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_MAX_TIME"),_8781_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxTime)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioRelGapConst")))
  {
    {
      double _8782_v = (double)_8694_value;
      if ((1.000000e-15 <= _8782_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_REL_GAP_CONST"),_8782_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRelGapConst)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioTolRelGap")))
  {
    {
      double _8783_v = (double)_8694_value;
      if ((0.000000e+00 <= _8783_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_REL_GAP"),_8783_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolRelGap)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioTolAbsGap")))
  {
    {
      double _8784_v = (double)_8694_value;
      if ((0.000000e+00 <= _8784_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_ABS_GAP"),_8784_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolAbsGap)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioTolAbsRelaxInt")))
  {
    {
      double _8785_v = (double)_8694_value;
      if ((1.000000e-09 <= _8785_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_ABS_RELAX_INT"),_8785_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolAbsRelaxInt)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioDjcMaxBigm")))
  {
    {
      double _8786_v = (double)_8694_value;
      if ((0.000000e+00 <= _8786_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_DJC_MAX_BIGM"),_8786_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioDjcMaxBigm)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioCliqueTableSizeFactor")))
  {
    {
      double _8787_v = (double)_8694_value;
      if (((-1.000000e+00) <= _8787_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_CLIQUE_TABLE_SIZE_FACTOR"),_8787_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCliqueTableSizeFactor)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("simPrecisionScalingNormal")))
  {
    {
      double _8788_v = (double)_8694_value;
      if ((1.000000e+00 <= _8788_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_SIM_PRECISION_SCALING_NORMAL"),_8788_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecisionScalingNormal)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("simPrecisionScalingExtended")))
  {
    {
      double _8789_v = (double)_8694_value;
      if ((1.000000e+00 <= _8789_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_SIM_PRECISION_SCALING_EXTENDED"),_8789_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecisionScalingExtended)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("basisTolX")))
  {
    {
      double _8790_v = (double)_8694_value;
      if ((1.000000e-09 <= _8790_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_BASIS_TOL_X"),_8790_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (basisTolX)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("basisTolS")))
  {
    {
      double _8791_v = (double)_8694_value;
      if ((1.000000e-09 <= _8791_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_BASIS_TOL_S"),_8791_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (basisTolS)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("basisRelTolS")))
  {
    {
      double _8792_v = (double)_8694_value;
      if ((0.000000e+00 <= _8792_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_BASIS_REL_TOL_S"),_8792_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (basisRelTolS)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("presolveTolX")))
  {
    {
      double _8793_v = (double)_8694_value;
      if ((0.000000e+00 <= _8793_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_X"),_8793_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolX)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("presolveTolPrimalInfeasPerturbation")))
  {
    {
      double _8794_v = (double)_8694_value;
      if ((0.000000e+00 <= _8794_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_PRIMAL_INFEAS_PERTURBATION"),_8794_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolPrimalInfeasPerturbation)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("presolveTolS")))
  {
    {
      double _8795_v = (double)_8694_value;
      if ((0.000000e+00 <= _8795_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_S"),_8795_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolS)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("presolveTolAbsLindep")))
  {
    {
      double _8796_v = (double)_8694_value;
      if ((0.000000e+00 <= _8796_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_ABS_LINDEP"),_8796_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolAbsLindep)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("presolveTolRelLindep")))
  {
    {
      double _8797_v = (double)_8694_value;
      if ((0.000000e+00 <= _8797_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_REL_LINDEP"),_8797_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolRelLindep)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("foldingTolEq")))
  {
    {
      double _8798_v = (double)_8694_value;
      if ((0.000000e+00 <= _8798_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_FOLDING_TOL_EQ"),_8798_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (foldingTolEq)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("simplexAbsTolPiv")))
  {
    {
      double _8799_v = (double)_8694_value;
      if ((1.000000e-12 <= _8799_v))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_SIMPLEX_ABS_TOL_PIV"),_8799_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simplexAbsTolPiv)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioTolFeas")))
  {
    {
      double _8800_v = (double)_8694_value;
      if (((1.000000e-09 <= _8800_v) && (_8800_v <= 1.000000e-03)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_FEAS"),_8800_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolFeas)"));
        }
      }
    }
  }
  {}
  if ((_8693_name == std::string ("mioTolRelDualBoundImprovement")))
  {
    {
      double _8801_v = (double)_8694_value;
      if (((0.000000e+00 <= _8801_v) && (_8801_v <= 1.000000e+00)))
      {
        {
          mosek::fusion::p_Model::_get_impl(_8692_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_REL_DUAL_BOUND_IMPROVEMENT"),_8801_v);
          return;
        }
      }
      else
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolRelDualBoundImprovement)"));
        }
      }
    }
  }
  else if((_8693_name == std::string ("dataFileName")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (dataFileName)"));
    }
  }
  else if((_8693_name == std::string ("remoteOptserverHost")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (remoteOptserverHost)"));
    }
  }
  else if((_8693_name == std::string ("remoteTlsCertPath")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (remoteTlsCertPath)"));
    }
  }
  else if((_8693_name == std::string ("remoteTlsCert")))
  {
    {
      throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (remoteTlsCert)"));
    }
  }
  {}
  throw ::mosek::fusion::ParameterError(std::string ("Unknown parameter"));
}
// End mosek.fusion.Parameters.setParameter

// Begin mosek.fusion.Parameters.setParameter
// Method mosek.fusion.Parameters.setParameter @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1989:0-3923:1
void mosek::fusion::Parameters::setParameter
  ( monty::rc_ptr< ::mosek::fusion::Model > _8802_M,
    const std::string & _8803_name,
    const std::string & _8804_value) { mosek::fusion::p_Parameters::setParameter(_8802_M,_8803_name,_8804_value); }
void mosek::fusion::p_Parameters::setParameter(monty::rc_ptr< ::mosek::fusion::Model > _8802_M,const std::string & _8803_name,const std::string & _8804_value)
{
  if (false)
  {
    {
    }
  }
  {}
  if ((_8803_name == std::string ("autoUpdateSolInfo")))
  {
    {
      int32_t _8805_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8805_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (autoUpdateSolInfo)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_AUTO_UPDATE_SOL_INFO"),_8805_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("removeUnusedSolutions")))
  {
    {
      int32_t _8806_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8806_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (removeUnusedSolutions)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_REMOVE_UNUSED_SOLUTIONS"),_8806_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("numThreads")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2010:4-2018:108 */
      try
      {
        {
          int32_t _8808_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8808_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_NUM_THREADS"),_8808_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (numThreads)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8807_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (numThreads)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mtSpincount")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2022:4-2030:109 */
      try
      {
        {
          int32_t _8810_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((int)0 <= _8810_v) && (_8810_v <= (int)1000000000)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MT_SPINCOUNT"),_8810_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mtSpincount)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8809_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mtSpincount)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("optimizer")))
  {
    {
      int32_t _8811_v = ::mosek::fusion::p_Parameters::string_to_optimizertype_value(_8804_value);
      if ((_8811_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (optimizer)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_OPTIMIZER"),_8811_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simPrecision")))
  {
    {
      int32_t _8812_v = ::mosek::fusion::p_Parameters::string_to_simprecision_value(_8804_value);
      if ((_8812_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecision)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_PRECISION"),_8812_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("biMaxIterations")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2050:4-2058:113 */
      try
      {
        {
          int32_t _8814_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8814_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_BI_MAX_ITERATIONS"),_8814_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biMaxIterations)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8813_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biMaxIterations)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("licenseTrhExpiryWrn")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2062:4-2070:117 */
      try
      {
        {
          int32_t _8816_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8816_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LICENSE_TRH_EXPIRY_WRN"),_8816_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseTrhExpiryWrn)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8815_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseTrhExpiryWrn)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("logCutSecondOpt")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2074:4-2082:113 */
      try
      {
        {
          int32_t _8818_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8818_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_CUT_SECOND_OPT"),_8818_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logCutSecondOpt)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8817_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logCutSecondOpt)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("logLocalInfo")))
  {
    {
      int32_t _8819_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8819_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logLocalInfo)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_LOCAL_INFO"),_8819_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("logBi")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2094:4-2102:103 */
      try
      {
        {
          int32_t _8821_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8821_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_BI"),_8821_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logBi)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8820_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logBi)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("logBiFreq")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2106:4-2114:107 */
      try
      {
        {
          int32_t _8823_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8823_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_BI_FREQ"),_8823_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logBiFreq)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8822_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logBiFreq)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("biCleanOptimizer")))
  {
    {
      int32_t _8824_v = ::mosek::fusion::p_Parameters::string_to_optimizertype_value(_8804_value);
      if ((_8824_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biCleanOptimizer)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_BI_CLEAN_OPTIMIZER"),_8824_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("intpntStartingPoint")))
  {
    {
      int32_t _8825_v = ::mosek::fusion::p_Parameters::string_to_startpointtype_value(_8804_value);
      if ((_8825_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntStartingPoint)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_STARTING_POINT"),_8825_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("intpntDiffStep")))
  {
    {
      int32_t _8826_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8826_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntDiffStep)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_DIFF_STEP"),_8826_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("intpntScaling")))
  {
    {
      int32_t _8827_v = ::mosek::fusion::p_Parameters::string_to_scalingtype_value(_8804_value);
      if ((_8827_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntScaling)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_SCALING"),_8827_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("intpntSolveForm")))
  {
    {
      int32_t _8828_v = ::mosek::fusion::p_Parameters::string_to_solveform_value(_8804_value);
      if ((_8828_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntSolveForm)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_SOLVE_FORM"),_8828_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("logIntpnt")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2158:4-2166:107 */
      try
      {
        {
          int32_t _8830_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8830_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_INTPNT"),_8830_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logIntpnt)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8829_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logIntpnt)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntMaxIterations")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2170:4-2178:117 */
      try
      {
        {
          int32_t _8832_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8832_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_MAX_ITERATIONS"),_8832_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntMaxIterations)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8831_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntMaxIterations)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntOffColTrh")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2182:4-2190:113 */
      try
      {
        {
          int32_t _8834_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8834_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_OFF_COL_TRH"),_8834_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOffColTrh)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8833_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOffColTrh)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntOrderMethod")))
  {
    {
      int32_t _8835_v = ::mosek::fusion::p_Parameters::string_to_orderingtype_value(_8804_value);
      if ((_8835_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOrderMethod)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_ORDER_METHOD"),_8835_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("intpntOrderGpNumSeeds")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2202:4-2210:119 */
      try
      {
        {
          int32_t _8837_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8837_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_ORDER_GP_NUM_SEEDS"),_8837_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOrderGpNumSeeds)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8836_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntOrderGpNumSeeds)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntBasis")))
  {
    {
      int32_t _8838_v = ::mosek::fusion::p_Parameters::string_to_basindtype_value(_8804_value);
      if ((_8838_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntBasis)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_BASIS"),_8838_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("biIgnoreMaxIter")))
  {
    {
      int32_t _8839_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8839_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biIgnoreMaxIter)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_BI_IGNORE_MAX_ITER"),_8839_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("biIgnoreNumError")))
  {
    {
      int32_t _8840_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8840_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (biIgnoreNumError)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_BI_IGNORE_NUM_ERROR"),_8840_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("intpntMaxNumCor")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2238:4-2246:113 */
      try
      {
        {
          int32_t _8842_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((-(int)1) <= _8842_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_MAX_NUM_COR"),_8842_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntMaxNumCor)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8841_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntMaxNumCor)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("presolveUse")))
  {
    {
      int32_t _8843_v = ::mosek::fusion::p_Parameters::string_to_presolvemode_value(_8804_value);
      if ((_8843_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveUse)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_USE"),_8843_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("logPresolve")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2258:4-2266:109 */
      try
      {
        {
          int32_t _8845_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8845_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_PRESOLVE"),_8845_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logPresolve)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8844_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logPresolve)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("presolveLindepUse")))
  {
    {
      int32_t _8846_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8846_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepUse)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_LINDEP_USE"),_8846_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("presolveLindepNew")))
  {
    {
      int32_t _8847_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8847_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepNew)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_LINDEP_NEW"),_8847_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("presolveMaxNumPass")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2286:4-2294:116 */
      try
      {
        {
          int32_t _8849_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_MAX_NUM_PASS"),_8849_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveMaxNumPass)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8848_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveMaxNumPass)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("presolveEliminatorMaxNumTries")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2298:4-2306:127 */
      try
      {
        {
          int32_t _8851_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_ELIMINATOR_MAX_NUM_TRIES"),_8851_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveEliminatorMaxNumTries)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8850_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveEliminatorMaxNumTries)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("presolveEliminatorMaxFill")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2310:4-2318:123 */
      try
      {
        {
          int32_t _8853_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_ELIMINATOR_MAX_FILL"),_8853_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveEliminatorMaxFill)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8852_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveEliminatorMaxFill)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("foldingUse")))
  {
    {
      int32_t _8854_v = ::mosek::fusion::p_Parameters::string_to_foldingmode_value(_8804_value);
      if ((_8854_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (foldingUse)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_FOLDING_USE"),_8854_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simPrimalCrash")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2330:4-2338:112 */
      try
      {
        {
          int32_t _8856_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8856_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_PRIMAL_CRASH"),_8856_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalCrash)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8855_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalCrash)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("logSim")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2342:4-2350:104 */
      try
      {
        {
          int32_t _8858_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8858_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_SIM"),_8858_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSim)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8857_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSim)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("logSimFreq")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2354:4-2362:108 */
      try
      {
        {
          int32_t _8860_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8860_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_SIM_FREQ"),_8860_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSimFreq)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8859_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSimFreq)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("logSimFreqGigaTicks")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2366:4-2374:117 */
      try
      {
        {
          int32_t _8862_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((-(int)1) <= _8862_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_SIM_FREQ_GIGA_TICKS"),_8862_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSimFreqGigaTicks)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8861_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logSimFreqGigaTicks)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("heartbeatSimFreqTicks")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2378:4-2386:119 */
      try
      {
        {
          int32_t _8864_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((-(int)1) <= _8864_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_HEARTBEAT_SIM_FREQ_TICKS"),_8864_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (heartbeatSimFreqTicks)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8863_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (heartbeatSimFreqTicks)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simPrimalRestrictSelection")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2390:4-2398:124 */
      try
      {
        {
          int32_t _8866_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((int)0 <= _8866_v) && (_8866_v <= (int)100)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_PRIMAL_RESTRICT_SELECTION"),_8866_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalRestrictSelection)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8865_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalRestrictSelection)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simPrimalSelection")))
  {
    {
      int32_t _8867_v = ::mosek::fusion::p_Parameters::string_to_simseltype_value(_8804_value);
      if ((_8867_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalSelection)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_PRIMAL_SELECTION"),_8867_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simDualRestrictSelection")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2410:4-2418:122 */
      try
      {
        {
          int32_t _8869_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((int)0 <= _8869_v) && (_8869_v <= (int)100)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_DUAL_RESTRICT_SELECTION"),_8869_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualRestrictSelection)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8868_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualRestrictSelection)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simDualSelection")))
  {
    {
      int32_t _8870_v = ::mosek::fusion::p_Parameters::string_to_simseltype_value(_8804_value);
      if ((_8870_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualSelection)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_DUAL_SELECTION"),_8870_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simMaxIterations")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2430:4-2438:114 */
      try
      {
        {
          int32_t _8872_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8872_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_MAX_ITERATIONS"),_8872_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simMaxIterations)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8871_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simMaxIterations)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simHotstartLu")))
  {
    {
      int32_t _8873_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8873_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simHotstartLu)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_HOTSTART_LU"),_8873_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simRefactorFreq")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2450:4-2458:113 */
      try
      {
        {
          int32_t _8875_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8875_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_REFACTOR_FREQ"),_8875_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simRefactorFreq)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8874_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simRefactorFreq)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simSeed")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2462:4-2470:105 */
      try
      {
        {
          int32_t _8877_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((int)0 <= _8877_v) && (_8877_v <= (int)32749)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_SEED"),_8877_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSeed)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8876_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSeed)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioMode")))
  {
    {
      int32_t _8878_v = ::mosek::fusion::p_Parameters::string_to_miomode_value(_8804_value);
      if ((_8878_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMode)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MODE"),_8878_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("logMio")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2482:4-2490:104 */
      try
      {
        {
          int32_t _8880_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8880_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_MIO"),_8880_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logMio)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8879_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logMio)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("logMioFreq")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2494:4-2502:108 */
      try
      {
        {
          int32_t _8882_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_MIO_FREQ"),_8882_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logMioFreq)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8881_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logMioFreq)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioMaxNumRelaxs")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2506:4-2514:113 */
      try
      {
        {
          int32_t _8884_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_RELAXS"),_8884_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRelaxs)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8883_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRelaxs)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioMaxNumBranches")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2518:4-2526:115 */
      try
      {
        {
          int32_t _8886_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_BRANCHES"),_8886_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumBranches)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8885_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumBranches)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioMaxNumRestarts")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2530:4-2538:115 */
      try
      {
        {
          int32_t _8888_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8888_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_RESTARTS"),_8888_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRestarts)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8887_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRestarts)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioMaxNumRootCutRounds")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2542:4-2550:120 */
      try
      {
        {
          int32_t _8890_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8890_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_ROOT_CUT_ROUNDS"),_8890_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRootCutRounds)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8889_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumRootCutRounds)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioMaxNumSolutions")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2554:4-2562:116 */
      try
      {
        {
          int32_t _8892_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MAX_NUM_SOLUTIONS"),_8892_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumSolutions)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8891_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxNumSolutions)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioNodeSelection")))
  {
    {
      int32_t _8893_v = ::mosek::fusion::p_Parameters::string_to_mionodeseltype_value(_8804_value);
      if ((_8893_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioNodeSelection)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_NODE_SELECTION"),_8893_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioVarSelection")))
  {
    {
      int32_t _8894_v = ::mosek::fusion::p_Parameters::string_to_miovarseltype_value(_8804_value);
      if ((_8894_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioVarSelection)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_VAR_SELECTION"),_8894_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioMinRel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2582:4-2590:107 */
      try
      {
        {
          int32_t _8896_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8896_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MIN_REL"),_8896_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMinRel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8895_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMinRel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioHeuristicLevel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2594:4-2602:115 */
      try
      {
        {
          int32_t _8898_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_HEURISTIC_LEVEL"),_8898_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioHeuristicLevel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8897_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioHeuristicLevel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioProbingLevel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2606:4-2614:113 */
      try
      {
        {
          int32_t _8900_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((-(int)1) <= _8900_v) && (_8900_v <= (int)3)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_PROBING_LEVEL"),_8900_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioProbingLevel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8899_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioProbingLevel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioSymmetryLevel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2618:4-2626:114 */
      try
      {
        {
          int32_t _8902_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((-(int)1) <= _8902_v) && (_8902_v <= (int)4)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_SYMMETRY_LEVEL"),_8902_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioSymmetryLevel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8901_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioSymmetryLevel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioDualRayAnalysisLevel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2630:4-2638:121 */
      try
      {
        {
          int32_t _8904_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((-(int)1) <= _8904_v) && (_8904_v <= (int)2)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_DUAL_RAY_ANALYSIS_LEVEL"),_8904_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioDualRayAnalysisLevel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8903_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioDualRayAnalysisLevel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioConflictAnalysisLevel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2642:4-2650:122 */
      try
      {
        {
          int32_t _8906_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((-(int)1) <= _8906_v) && (_8906_v <= (int)2)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CONFLICT_ANALYSIS_LEVEL"),_8906_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioConflictAnalysisLevel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8905_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioConflictAnalysisLevel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioPresolveAggregatorUse")))
  {
    {
      int32_t _8907_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8907_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioPresolveAggregatorUse)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_PRESOLVE_AGGREGATOR_USE"),_8907_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioNumericalEmphasisLevel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2662:4-2670:123 */
      try
      {
        {
          int32_t _8909_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((int)0 <= _8909_v) && (_8909_v <= (int)2)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_NUMERICAL_EMPHASIS_LEVEL"),_8909_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioNumericalEmphasisLevel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8908_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioNumericalEmphasisLevel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioMemoryEmphasisLevel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2674:4-2682:120 */
      try
      {
        {
          int32_t _8911_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((int)0 <= _8911_v) && (_8911_v <= (int)1)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_MEMORY_EMPHASIS_LEVEL"),_8911_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMemoryEmphasisLevel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8910_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMemoryEmphasisLevel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioCutSelectionLevel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2686:4-2694:118 */
      try
      {
        {
          int32_t _8913_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((-(int)1) <= _8913_v) && (_8913_v <= (int)1)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CUT_SELECTION_LEVEL"),_8913_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutSelectionLevel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8912_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutSelectionLevel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioVbDetectionLevel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2698:4-2706:117 */
      try
      {
        {
          int32_t _8915_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((-(int)1) <= _8915_v) && (_8915_v <= (int)2)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_VB_DETECTION_LEVEL"),_8915_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioVbDetectionLevel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8914_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioVbDetectionLevel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioBranchDir")))
  {
    {
      int32_t _8916_v = ::mosek::fusion::p_Parameters::string_to_branchdir_value(_8804_value);
      if ((_8916_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioBranchDir)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_BRANCH_DIR"),_8916_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioRootOptimizer")))
  {
    {
      int32_t _8917_v = ::mosek::fusion::p_Parameters::string_to_optimizertype_value(_8804_value);
      if ((_8917_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRootOptimizer)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_ROOT_OPTIMIZER"),_8917_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioNodeOptimizer")))
  {
    {
      int32_t _8918_v = ::mosek::fusion::p_Parameters::string_to_optimizertype_value(_8804_value);
      if ((_8918_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioNodeOptimizer)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_NODE_OPTIMIZER"),_8918_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioPerspectiveReformulate")))
  {
    {
      int32_t _8919_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8919_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioPerspectiveReformulate)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_PERSPECTIVE_REFORMULATE"),_8919_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioPropagateObjectiveConstraint")))
  {
    {
      int32_t _8920_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8920_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioPropagateObjectiveConstraint)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_PROPAGATE_OBJECTIVE_CONSTRAINT"),_8920_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioSeed")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2750:4-2758:105 */
      try
      {
        {
          int32_t _8922_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8922_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_SEED"),_8922_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioSeed)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8921_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioSeed)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioConicOuterApproximation")))
  {
    {
      int32_t _8923_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8923_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioConicOuterApproximation)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CONIC_OUTER_APPROXIMATION"),_8923_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioQcqoReformulationMethod")))
  {
    {
      int32_t _8924_v = ::mosek::fusion::p_Parameters::string_to_miqcqoreformmethod_value(_8804_value);
      if ((_8924_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioQcqoReformulationMethod)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_QCQO_REFORMULATION_METHOD"),_8924_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioDataPermutationMethod")))
  {
    {
      int32_t _8925_v = ::mosek::fusion::p_Parameters::string_to_miodatapermmethod_value(_8804_value);
      if ((_8925_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioDataPermutationMethod)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_DATA_PERMUTATION_METHOD"),_8925_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("writeMpsFormat")))
  {
    {
      int32_t _8926_v = ::mosek::fusion::p_Parameters::string_to_mpsformat_value(_8804_value);
      if ((_8926_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeMpsFormat)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_WRITE_MPS_FORMAT"),_8926_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("writeLpLineWidth")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2794:4-2802:114 */
      try
      {
        {
          int32_t _8928_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)40 <= _8928_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_WRITE_LP_LINE_WIDTH"),_8928_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeLpLineWidth)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8927_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeLpLineWidth)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("writeLpFullObj")))
  {
    {
      int32_t _8929_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8929_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeLpFullObj)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_WRITE_LP_FULL_OBJ"),_8929_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("writeJsonIndentation")))
  {
    {
      int32_t _8930_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8930_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (writeJsonIndentation)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_WRITE_JSON_INDENTATION"),_8930_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("infeasReportAuto")))
  {
    {
      int32_t _8931_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8931_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (infeasReportAuto)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_INFEAS_REPORT_AUTO"),_8931_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("licenseWait")))
  {
    {
      int32_t _8932_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8932_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseWait)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LICENSE_WAIT"),_8932_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("licenseSuppressExpireWrns")))
  {
    {
      int32_t _8933_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8933_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseSuppressExpireWrns)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LICENSE_SUPPRESS_EXPIRE_WRNS"),_8933_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("licensePauseTime")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2846:4-2854:114 */
      try
      {
        {
          int32_t _8935_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((int)0 <= _8935_v) && (_8935_v <= (int)1000000)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LICENSE_PAUSE_TIME"),_8935_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licensePauseTime)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8934_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licensePauseTime)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("licenseDebug")))
  {
    {
      int32_t _8936_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8936_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (licenseDebug)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LICENSE_DEBUG"),_8936_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("log")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2866:4-2874:101 */
      try
      {
        {
          int32_t _8938_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8938_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG"),_8938_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (log)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8937_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (log)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("logExpand")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2878:4-2886:107 */
      try
      {
        {
          int32_t _8940_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8940_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_EXPAND"),_8940_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logExpand)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8939_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logExpand)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("logFile")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2890:4-2898:105 */
      try
      {
        {
          int32_t _8942_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8942_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_FILE"),_8942_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logFile)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8941_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logFile)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("logOrder")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2902:4-2910:106 */
      try
      {
        {
          int32_t _8944_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8944_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_LOG_ORDER"),_8944_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logOrder)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8943_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (logOrder)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simScaling")))
  {
    {
      int32_t _8945_v = ::mosek::fusion::p_Parameters::string_to_scalingtype_value(_8804_value);
      if ((_8945_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simScaling)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_SCALING"),_8945_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simScalingMethod")))
  {
    {
      int32_t _8946_v = ::mosek::fusion::p_Parameters::string_to_scalingmethod_value(_8804_value);
      if ((_8946_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simScalingMethod)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_SCALING_METHOD"),_8946_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simPrimalPhaseoneMethod")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2930:4-2938:121 */
      try
      {
        {
          int32_t _8948_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((int)0 <= _8948_v) && (_8948_v <= (int)10)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_PRIMAL_PHASEONE_METHOD"),_8948_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalPhaseoneMethod)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8947_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrimalPhaseoneMethod)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simDualPhaseoneMethod")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2942:4-2950:119 */
      try
      {
        {
          int32_t _8950_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((int)0 <= _8950_v) && (_8950_v <= (int)10)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_DUAL_PHASEONE_METHOD"),_8950_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualPhaseoneMethod)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8949_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualPhaseoneMethod)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simMaxNumSetbacks")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:2954:4-2962:115 */
      try
      {
        {
          int32_t _8952_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8952_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_MAX_NUM_SETBACKS"),_8952_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simMaxNumSetbacks)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8951_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simMaxNumSetbacks)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simHotstart")))
  {
    {
      int32_t _8953_v = ::mosek::fusion::p_Parameters::string_to_simhotstart_value(_8804_value);
      if ((_8953_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simHotstart)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_HOTSTART"),_8953_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simBasisFactorUse")))
  {
    {
      int32_t _8954_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8954_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simBasisFactorUse)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_BASIS_FACTOR_USE"),_8954_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simPrecisionBoost")))
  {
    {
      int32_t _8955_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8955_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecisionBoost)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_PRECISION_BOOST"),_8955_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simDegen")))
  {
    {
      int32_t _8956_v = ::mosek::fusion::p_Parameters::string_to_simdegen_value(_8804_value);
      if ((_8956_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDegen)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_DEGEN"),_8956_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simReformulation")))
  {
    {
      int32_t _8957_v = ::mosek::fusion::p_Parameters::string_to_simreform_value(_8804_value);
      if ((_8957_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simReformulation)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_REFORMULATION"),_8957_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simExploitDupvec")))
  {
    {
      int32_t _8958_v = ::mosek::fusion::p_Parameters::string_to_simdupvec_value(_8804_value);
      if ((_8958_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simExploitDupvec)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_EXPLOIT_DUPVEC"),_8958_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simSaveLu")))
  {
    {
      int32_t _8959_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8959_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSaveLu)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_SAVE_LU"),_8959_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simNonSingular")))
  {
    {
      int32_t _8960_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8960_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simNonSingular)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_NON_SINGULAR"),_8960_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simDualCrash")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3030:4-3038:110 */
      try
      {
        {
          int32_t _8962_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((int)0 <= _8962_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_DUAL_CRASH"),_8962_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualCrash)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8961_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simDualCrash)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("ptfWriteTransform")))
  {
    {
      int32_t _8963_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8963_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (ptfWriteTransform)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_PTF_WRITE_TRANSFORM"),_8963_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("ptfWriteSolutions")))
  {
    {
      int32_t _8964_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8964_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (ptfWriteSolutions)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_PTF_WRITE_SOLUTIONS"),_8964_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("ptfWriteParameters")))
  {
    {
      int32_t _8965_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8965_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (ptfWriteParameters)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_PTF_WRITE_PARAMETERS"),_8965_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("ptfWriteSinglePsdTerms")))
  {
    {
      int32_t _8966_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8966_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (ptfWriteSinglePsdTerms)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_PTF_WRITE_SINGLE_PSD_TERMS"),_8966_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioCutCmir")))
  {
    {
      int32_t _8967_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8967_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutCmir)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CUT_CMIR"),_8967_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioCutClique")))
  {
    {
      int32_t _8968_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8968_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutClique)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CUT_CLIQUE"),_8968_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioCutImpliedBound")))
  {
    {
      int32_t _8969_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8969_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutImpliedBound)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CUT_IMPLIED_BOUND"),_8969_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioCutKnapsackCover")))
  {
    {
      int32_t _8970_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8970_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutKnapsackCover)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CUT_KNAPSACK_COVER"),_8970_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioCutGmi")))
  {
    {
      int32_t _8971_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8971_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutGmi)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CUT_GMI"),_8971_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioCutLipro")))
  {
    {
      int32_t _8972_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8972_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCutLipro)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CUT_LIPRO"),_8972_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioConstructSol")))
  {
    {
      int32_t _8973_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8973_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioConstructSol)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CONSTRUCT_SOL"),_8973_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("presolveLindepRelWorkTrh")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3130:4-3138:122 */
      try
      {
        {
          int32_t _8975_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_LINDEP_REL_WORK_TRH"),_8975_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepRelWorkTrh)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8974_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepRelWorkTrh)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("presolveLindepAbsWorkTrh")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3142:4-3150:122 */
      try
      {
        {
          int32_t _8977_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_PRESOLVE_LINDEP_ABS_WORK_TRH"),_8977_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepAbsWorkTrh)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8976_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveLindepAbsWorkTrh)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("cacheLicense")))
  {
    {
      int32_t _8978_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8978_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (cacheLicense)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_CACHE_LICENSE"),_8978_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("intpntRegularizationUse")))
  {
    {
      int32_t _8979_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8979_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntRegularizationUse)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_INTPNT_REGULARIZATION_USE"),_8979_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simSolveForm")))
  {
    {
      int32_t _8980_v = ::mosek::fusion::p_Parameters::string_to_solveform_value(_8804_value);
      if ((_8980_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSolveForm)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_SOLVE_FORM"),_8980_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("simSwitchOptimizer")))
  {
    {
      int32_t _8981_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8981_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simSwitchOptimizer)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_SIM_SWITCH_OPTIMIZER"),_8981_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("autoSortABeforeOpt")))
  {
    {
      int32_t _8982_v = ::mosek::fusion::p_Parameters::string_to_onoffkey_value(_8804_value);
      if ((_8982_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (autoSortABeforeOpt)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_AUTO_SORT_A_BEFORE_OPT"),_8982_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("mioRinsMaxNodes")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3194:4-3202:113 */
      try
      {
        {
          int32_t _8984_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((-(int)1) <= _8984_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_RINS_MAX_NODES"),_8984_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRinsMaxNodes)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8983_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRinsMaxNodes)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioRensMaxNodes")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3206:4-3214:113 */
      try
      {
        {
          int32_t _8986_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((-(int)1) <= _8986_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_RENS_MAX_NODES"),_8986_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRensMaxNodes)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8985_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRensMaxNodes)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioCrossoverMaxNodes")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3218:4-3226:118 */
      try
      {
        {
          int32_t _8988_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((-(int)1) <= _8988_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_CROSSOVER_MAX_NODES"),_8988_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCrossoverMaxNodes)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8987_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCrossoverMaxNodes)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioOptFaceMaxNodes")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3230:4-3238:116 */
      try
      {
        {
          int32_t _8990_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if (((-(int)1) <= _8990_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_OPT_FACE_MAX_NODES"),_8990_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioOptFaceMaxNodes)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8989_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioOptFaceMaxNodes)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioFeaspumpLevel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3242:4-3250:114 */
      try
      {
        {
          int32_t _8992_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((-(int)1) <= _8992_v) && (_8992_v <= (int)2)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_FEASPUMP_LEVEL"),_8992_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioFeaspumpLevel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8991_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioFeaspumpLevel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioIndependentBlockLevel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3254:4-3262:122 */
      try
      {
        {
          int32_t _8994_v = ::mosek::fusion::Utils::Tools::toInt(_8804_value);
          if ((((-(int)1) <= _8994_v) && (_8994_v <= (int)3)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_MIO_INDEPENDENT_BLOCK_LEVEL"),_8994_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioIndependentBlockLevel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8993_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioIndependentBlockLevel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("remoteUseCompression")))
  {
    {
      int32_t _8995_v = ::mosek::fusion::p_Parameters::string_to_compresstype_value(_8804_value);
      if ((_8995_v < (int)0))
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (remoteUseCompression)"));
        }
      }
      {}
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_IPAR_REMOTE_USE_COMPRESSION"),_8995_v);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("semidefiniteTolApprox")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3274:4-3284:119 */
      try
      {
        {
          double _8997_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((1.000000e-15 <= _8997_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_SEMIDEFINITE_TOL_APPROX"),_8997_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (semidefiniteTolApprox)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8996_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (semidefiniteTolApprox)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("optimizerMaxTime")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3288:4-3298:114 */
      try
      {
        {
          double _8999_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_OPTIMIZER_MAX_TIME"),_8999_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (optimizerMaxTime)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _8998_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (optimizerMaxTime)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("optimizerMaxTicks")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3302:4-3312:115 */
      try
      {
        {
          double _9001_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_OPTIMIZER_MAX_TICKS"),_9001_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (optimizerMaxTicks)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9000_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (optimizerMaxTicks)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("lowerObjCut")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3316:4-3326:109 */
      try
      {
        {
          double _9003_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_LOWER_OBJ_CUT"),_9003_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (lowerObjCut)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9002_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (lowerObjCut)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("upperObjCut")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3330:4-3340:109 */
      try
      {
        {
          double _9005_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_UPPER_OBJ_CUT"),_9005_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (upperObjCut)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9004_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (upperObjCut)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("upperObjCutFiniteTrh")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3344:4-3354:118 */
      try
      {
        {
          double _9007_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_UPPER_OBJ_CUT_FINITE_TRH"),_9007_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (upperObjCutFiniteTrh)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9006_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (upperObjCutFiniteTrh)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("lowerObjCutFiniteTrh")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3358:4-3368:118 */
      try
      {
        {
          double _9009_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_LOWER_OBJ_CUT_FINITE_TRH"),_9009_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (lowerObjCutFiniteTrh)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9008_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (lowerObjCutFiniteTrh)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntTolRelGap")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3372:4-3382:113 */
      try
      {
        {
          double _9011_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((1.000000e-14 <= _9011_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_REL_GAP"),_9011_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolRelGap)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9010_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolRelGap)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntTolStepSize")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3386:4-3396:115 */
      try
      {
        {
          double _9013_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((0.000000e+00 <= _9013_v) && (_9013_v <= 1.000000e+00)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_STEP_SIZE"),_9013_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolStepSize)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9012_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolStepSize)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simLuTolRelPiv")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3400:4-3410:112 */
      try
      {
        {
          double _9015_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((1.000000e-06 <= _9015_v) && (_9015_v <= 9.999990e-01)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_SIM_LU_TOL_REL_PIV"),_9015_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simLuTolRelPiv)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9014_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simLuTolRelPiv)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntTolRelStep")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3414:4-3424:114 */
      try
      {
        {
          double _9017_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((1.000000e-04 <= _9017_v) && (_9017_v <= 9.999990e-01)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_REL_STEP"),_9017_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolRelStep)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9016_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolRelStep)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntTolPath")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3428:4-3438:111 */
      try
      {
        {
          double _9019_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((0.000000e+00 <= _9019_v) && (_9019_v <= 9.999000e-01)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_PATH"),_9019_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolPath)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9018_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolPath)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntTolPfeas")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3442:4-3452:112 */
      try
      {
        {
          double _9021_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((0.000000e+00 <= _9021_v) && (_9021_v <= 1.000000e+00)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_PFEAS"),_9021_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolPfeas)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9020_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolPfeas)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntTolDfeas")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3456:4-3466:112 */
      try
      {
        {
          double _9023_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((0.000000e+00 <= _9023_v) && (_9023_v <= 1.000000e+00)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_DFEAS"),_9023_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolDfeas)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9022_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolDfeas)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntTolMuRed")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3470:4-3480:112 */
      try
      {
        {
          double _9025_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((0.000000e+00 <= _9025_v) && (_9025_v <= 1.000000e+00)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_MU_RED"),_9025_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolMuRed)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9024_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolMuRed)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntTolInfeas")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3484:4-3494:113 */
      try
      {
        {
          double _9027_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((0.000000e+00 <= _9027_v) && (_9027_v <= 1.000000e+00)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_INFEAS"),_9027_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolInfeas)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9026_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolInfeas)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntCoTolRelGap")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3498:4-3508:115 */
      try
      {
        {
          double _9029_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((0.000000e+00 <= _9029_v) && (_9029_v <= 1.000000e+00)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_REL_GAP"),_9029_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolRelGap)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9028_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolRelGap)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntCoTolPfeas")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3512:4-3522:114 */
      try
      {
        {
          double _9031_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((0.000000e+00 <= _9031_v) && (_9031_v <= 1.000000e+00)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_PFEAS"),_9031_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolPfeas)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9030_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolPfeas)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntCoTolDfeas")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3526:4-3536:114 */
      try
      {
        {
          double _9033_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((0.000000e+00 <= _9033_v) && (_9033_v <= 1.000000e+00)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_DFEAS"),_9033_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolDfeas)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9032_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolDfeas)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntCoTolMuRed")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3540:4-3550:114 */
      try
      {
        {
          double _9035_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((0.000000e+00 <= _9035_v) && (_9035_v <= 1.000000e+00)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_MU_RED"),_9035_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolMuRed)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9034_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolMuRed)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntCoTolNearRel")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3554:4-3564:116 */
      try
      {
        {
          double _9037_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((1.000000e+00 <= _9037_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_NEAR_REL"),_9037_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolNearRel)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9036_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolNearRel)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntCoTolInfeas")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3568:4-3578:115 */
      try
      {
        {
          double _9039_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((0.000000e+00 <= _9039_v) && (_9039_v <= 1.000000e+00)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_CO_TOL_INFEAS"),_9039_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolInfeas)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9038_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntCoTolInfeas)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntTolPsafe")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3582:4-3592:112 */
      try
      {
        {
          double _9041_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((1.000000e-04 <= _9041_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_PSAFE"),_9041_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolPsafe)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9040_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolPsafe)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("intpntTolDsafe")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3596:4-3606:112 */
      try
      {
        {
          double _9043_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((1.000000e-04 <= _9043_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_INTPNT_TOL_DSAFE"),_9043_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolDsafe)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9042_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (intpntTolDsafe)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioMaxTime")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3610:4-3620:108 */
      try
      {
        {
          double _9045_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (true)
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_MAX_TIME"),_9045_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxTime)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9044_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioMaxTime)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioRelGapConst")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3624:4-3634:112 */
      try
      {
        {
          double _9047_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((1.000000e-15 <= _9047_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_REL_GAP_CONST"),_9047_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRelGapConst)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9046_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioRelGapConst)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioTolRelGap")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3638:4-3648:110 */
      try
      {
        {
          double _9049_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((0.000000e+00 <= _9049_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_REL_GAP"),_9049_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolRelGap)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9048_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolRelGap)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioTolAbsGap")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3652:4-3662:110 */
      try
      {
        {
          double _9051_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((0.000000e+00 <= _9051_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_ABS_GAP"),_9051_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolAbsGap)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9050_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolAbsGap)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioTolAbsRelaxInt")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3666:4-3676:115 */
      try
      {
        {
          double _9053_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((1.000000e-09 <= _9053_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_ABS_RELAX_INT"),_9053_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolAbsRelaxInt)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9052_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolAbsRelaxInt)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioDjcMaxBigm")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3680:4-3690:111 */
      try
      {
        {
          double _9055_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((0.000000e+00 <= _9055_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_DJC_MAX_BIGM"),_9055_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioDjcMaxBigm)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9054_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioDjcMaxBigm)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioCliqueTableSizeFactor")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3694:4-3704:122 */
      try
      {
        {
          double _9057_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((-1.000000e+00) <= _9057_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_CLIQUE_TABLE_SIZE_FACTOR"),_9057_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCliqueTableSizeFactor)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9056_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioCliqueTableSizeFactor)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simPrecisionScalingNormal")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3708:4-3718:123 */
      try
      {
        {
          double _9059_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((1.000000e+00 <= _9059_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_SIM_PRECISION_SCALING_NORMAL"),_9059_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecisionScalingNormal)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9058_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecisionScalingNormal)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simPrecisionScalingExtended")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3722:4-3732:125 */
      try
      {
        {
          double _9061_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((1.000000e+00 <= _9061_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_SIM_PRECISION_SCALING_EXTENDED"),_9061_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecisionScalingExtended)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9060_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simPrecisionScalingExtended)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("basisTolX")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3736:4-3746:107 */
      try
      {
        {
          double _9063_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((1.000000e-09 <= _9063_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_BASIS_TOL_X"),_9063_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (basisTolX)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9062_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (basisTolX)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("basisTolS")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3750:4-3760:107 */
      try
      {
        {
          double _9065_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((1.000000e-09 <= _9065_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_BASIS_TOL_S"),_9065_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (basisTolS)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9064_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (basisTolS)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("basisRelTolS")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3764:4-3774:110 */
      try
      {
        {
          double _9067_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((0.000000e+00 <= _9067_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_BASIS_REL_TOL_S"),_9067_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (basisRelTolS)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9066_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (basisRelTolS)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("presolveTolX")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3778:4-3788:110 */
      try
      {
        {
          double _9069_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((0.000000e+00 <= _9069_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_X"),_9069_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolX)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9068_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolX)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("presolveTolPrimalInfeasPerturbation")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3792:4-3802:133 */
      try
      {
        {
          double _9071_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((0.000000e+00 <= _9071_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_PRIMAL_INFEAS_PERTURBATION"),_9071_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolPrimalInfeasPerturbation)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9070_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolPrimalInfeasPerturbation)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("presolveTolS")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3806:4-3816:110 */
      try
      {
        {
          double _9073_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((0.000000e+00 <= _9073_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_S"),_9073_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolS)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9072_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolS)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("presolveTolAbsLindep")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3820:4-3830:118 */
      try
      {
        {
          double _9075_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((0.000000e+00 <= _9075_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_ABS_LINDEP"),_9075_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolAbsLindep)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9074_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolAbsLindep)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("presolveTolRelLindep")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3834:4-3844:118 */
      try
      {
        {
          double _9077_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((0.000000e+00 <= _9077_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_PRESOLVE_TOL_REL_LINDEP"),_9077_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolRelLindep)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9076_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (presolveTolRelLindep)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("foldingTolEq")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3848:4-3858:110 */
      try
      {
        {
          double _9079_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((0.000000e+00 <= _9079_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_FOLDING_TOL_EQ"),_9079_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (foldingTolEq)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9078_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (foldingTolEq)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("simplexAbsTolPiv")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3862:4-3872:114 */
      try
      {
        {
          double _9081_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if ((1.000000e-12 <= _9081_v))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_SIMPLEX_ABS_TOL_PIV"),_9081_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simplexAbsTolPiv)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9080_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (simplexAbsTolPiv)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioTolFeas")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3876:4-3886:108 */
      try
      {
        {
          double _9083_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((1.000000e-09 <= _9083_v) && (_9083_v <= 1.000000e-03)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_FEAS"),_9083_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolFeas)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9082_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolFeas)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("mioTolRelDualBoundImprovement")))
  {
    {
      /* Try @ bld/grindsted/final/default/src/fusion/Parameters.mbi:3890:4-3900:127 */
      try
      {
        {
          double _9085_v = ::mosek::fusion::Utils::Tools::toDouble(_8804_value);
          if (((0.000000e+00 <= _9085_v) && (_9085_v <= 1.000000e+00)))
          {
            {
              mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_DPAR_MIO_TOL_REL_DUAL_BOUND_IMPROVEMENT"),_9085_v);
              return;
            }
          }
          else
          {
            {
              throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolRelDualBoundImprovement)"));
            }
          }
        }
      }
      catch (mosek::fusion::ValueConversionError _9084_e)
      {
        {
          throw ::mosek::fusion::ParameterError(std::string ("Invalid value for parameter (mioTolRelDualBoundImprovement)"));
        }
      }
    }
  }
  {}
  if ((_8803_name == std::string ("dataFileName")))
  {
    {
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_SPAR_DATA_FILE_NAME"),_8804_value);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("remoteOptserverHost")))
  {
    {
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_SPAR_REMOTE_OPTSERVER_HOST"),_8804_value);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("remoteTlsCertPath")))
  {
    {
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_SPAR_REMOTE_TLS_CERT_PATH"),_8804_value);
      return;
    }
  }
  {}
  if ((_8803_name == std::string ("remoteTlsCert")))
  {
    {
      mosek::fusion::p_Model::_get_impl(_8802_M.get())->task_put_param(std::string ("MSK_SPAR_REMOTE_TLS_CERT"),_8804_value);
      return;
    }
  }
  {}
  throw ::mosek::fusion::ParameterError(std::string ("Unknown parameter"));
}
// End mosek.fusion.Parameters.setParameter

// Begin mosek.fusion.Parameters.string_to_variabletype_value
// Method mosek.fusion.Parameters.string_to_variabletype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1982:0-1987:1
int32_t mosek::fusion::p_Parameters::string_to_variabletype_value(const std::string & _9086_v)
{
  if ((_9086_v == std::string ("typeCont")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9086_v == std::string ("typeInt")))
  {
    {
      return (int)1;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_variabletype_value

// Begin mosek.fusion.Parameters.string_to_value_value
// Method mosek.fusion.Parameters.string_to_value_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1976:0-1981:1
int32_t mosek::fusion::p_Parameters::string_to_value_value(const std::string & _9087_v)
{
  if ((_9087_v == std::string ("maxStrLen")))
  {
    {
      return (int)1024;
    }
  }
  {}
  if ((_9087_v == std::string ("licenseBufferLength")))
  {
    {
      return (int)21;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_value_value

// Begin mosek.fusion.Parameters.string_to_streamtype_value
// Method mosek.fusion.Parameters.string_to_streamtype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1968:0-1975:1
int32_t mosek::fusion::p_Parameters::string_to_streamtype_value(const std::string & _9088_v)
{
  if ((_9088_v == std::string ("log")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9088_v == std::string ("msg")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9088_v == std::string ("err")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9088_v == std::string ("wrn")))
  {
    {
      return (int)3;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_streamtype_value

// Begin mosek.fusion.Parameters.string_to_startpointtype_value
// Method mosek.fusion.Parameters.string_to_startpointtype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1961:0-1967:1
int32_t mosek::fusion::p_Parameters::string_to_startpointtype_value(const std::string & _9089_v)
{
  if ((_9089_v == std::string ("free")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9089_v == std::string ("guess")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9089_v == std::string ("constant")))
  {
    {
      return (int)2;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_startpointtype_value

// Begin mosek.fusion.Parameters.string_to_stakey_value
// Method mosek.fusion.Parameters.string_to_stakey_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1950:0-1960:1
int32_t mosek::fusion::p_Parameters::string_to_stakey_value(const std::string & _9090_v)
{
  if ((_9090_v == std::string ("unk")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9090_v == std::string ("bas")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9090_v == std::string ("supbas")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9090_v == std::string ("low")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9090_v == std::string ("upr")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9090_v == std::string ("fix")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9090_v == std::string ("inf")))
  {
    {
      return (int)6;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_stakey_value

// Begin mosek.fusion.Parameters.string_to_sparam_value
// Method mosek.fusion.Parameters.string_to_sparam_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1922:0-1949:1
int32_t mosek::fusion::p_Parameters::string_to_sparam_value(const std::string & _9091_v)
{
  if ((_9091_v == std::string ("dataFileName")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9091_v == std::string ("paramReadFileName")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9091_v == std::string ("paramWriteFileName")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9091_v == std::string ("paramCommentSign")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9091_v == std::string ("debugFileName")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9091_v == std::string ("basSolFileName")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9091_v == std::string ("itrSolFileName")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9091_v == std::string ("intSolFileName")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9091_v == std::string ("solFilterXcLow")))
  {
    {
      return (int)18;
    }
  }
  {}
  if ((_9091_v == std::string ("solFilterXcUpr")))
  {
    {
      return (int)19;
    }
  }
  {}
  if ((_9091_v == std::string ("solFilterXxLow")))
  {
    {
      return (int)20;
    }
  }
  {}
  if ((_9091_v == std::string ("solFilterXxUpr")))
  {
    {
      return (int)21;
    }
  }
  {}
  if ((_9091_v == std::string ("readMpsObjName")))
  {
    {
      return (int)10;
    }
  }
  {}
  if ((_9091_v == std::string ("readMpsRanName")))
  {
    {
      return (int)11;
    }
  }
  {}
  if ((_9091_v == std::string ("readMpsRhsName")))
  {
    {
      return (int)12;
    }
  }
  {}
  if ((_9091_v == std::string ("readMpsBouName")))
  {
    {
      return (int)9;
    }
  }
  {}
  if ((_9091_v == std::string ("statName")))
  {
    {
      return (int)23;
    }
  }
  {}
  if ((_9091_v == std::string ("statKey")))
  {
    {
      return (int)22;
    }
  }
  {}
  if ((_9091_v == std::string ("sensitivityResFileName")))
  {
    {
      return (int)17;
    }
  }
  {}
  if ((_9091_v == std::string ("sensitivityFileName")))
  {
    {
      return (int)16;
    }
  }
  {}
  if ((_9091_v == std::string ("mioDebugString")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9091_v == std::string ("remoteOptserverHost")))
  {
    {
      return (int)13;
    }
  }
  {}
  if ((_9091_v == std::string ("remoteTlsCertPath")))
  {
    {
      return (int)15;
    }
  }
  {}
  if ((_9091_v == std::string ("remoteTlsCert")))
  {
    {
      return (int)14;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_sparam_value

// Begin mosek.fusion.Parameters.string_to_solveform_value
// Method mosek.fusion.Parameters.string_to_solveform_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1915:0-1921:1
int32_t mosek::fusion::p_Parameters::string_to_solveform_value(const std::string & _9092_v)
{
  if ((_9092_v == std::string ("free")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9092_v == std::string ("primal")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9092_v == std::string ("dual")))
  {
    {
      return (int)2;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_solveform_value

// Begin mosek.fusion.Parameters.string_to_soltype_value
// Method mosek.fusion.Parameters.string_to_soltype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1908:0-1914:1
int32_t mosek::fusion::p_Parameters::string_to_soltype_value(const std::string & _9093_v)
{
  if ((_9093_v == std::string ("bas")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9093_v == std::string ("itr")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9093_v == std::string ("itg")))
  {
    {
      return (int)2;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_soltype_value

// Begin mosek.fusion.Parameters.string_to_solsta_value
// Method mosek.fusion.Parameters.string_to_solsta_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1894:0-1907:1
int32_t mosek::fusion::p_Parameters::string_to_solsta_value(const std::string & _9094_v)
{
  if ((_9094_v == std::string ("unknown")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9094_v == std::string ("optimal")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9094_v == std::string ("primFeas")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9094_v == std::string ("dualFeas")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9094_v == std::string ("primAndDualFeas")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9094_v == std::string ("primInfeasCer")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9094_v == std::string ("dualInfeasCer")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9094_v == std::string ("primIllposedCer")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9094_v == std::string ("dualIllposedCer")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9094_v == std::string ("integerOptimal")))
  {
    {
      return (int)9;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_solsta_value

// Begin mosek.fusion.Parameters.string_to_solitem_value
// Method mosek.fusion.Parameters.string_to_solitem_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1882:0-1893:1
int32_t mosek::fusion::p_Parameters::string_to_solitem_value(const std::string & _9095_v)
{
  if ((_9095_v == std::string ("xc")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9095_v == std::string ("xx")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9095_v == std::string ("y")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9095_v == std::string ("slc")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9095_v == std::string ("suc")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9095_v == std::string ("slx")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9095_v == std::string ("sux")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9095_v == std::string ("snx")))
  {
    {
      return (int)7;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_solitem_value

// Begin mosek.fusion.Parameters.string_to_simseltype_value
// Method mosek.fusion.Parameters.string_to_simseltype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1872:0-1881:1
int32_t mosek::fusion::p_Parameters::string_to_simseltype_value(const std::string & _9096_v)
{
  if ((_9096_v == std::string ("free")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9096_v == std::string ("full")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9096_v == std::string ("ase")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9096_v == std::string ("devex")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9096_v == std::string ("se")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9096_v == std::string ("partial")))
  {
    {
      return (int)5;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_simseltype_value

// Begin mosek.fusion.Parameters.string_to_sensitivitytype_value
// Method mosek.fusion.Parameters.string_to_sensitivitytype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1867:0-1871:1
int32_t mosek::fusion::p_Parameters::string_to_sensitivitytype_value(const std::string & _9097_v)
{
  if ((_9097_v == std::string ("basis")))
  {
    {
      return (int)0;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_sensitivitytype_value

// Begin mosek.fusion.Parameters.string_to_scalingmethod_value
// Method mosek.fusion.Parameters.string_to_scalingmethod_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1861:0-1866:1
int32_t mosek::fusion::p_Parameters::string_to_scalingmethod_value(const std::string & _9098_v)
{
  if ((_9098_v == std::string ("pow2")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9098_v == std::string ("free")))
  {
    {
      return (int)1;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_scalingmethod_value

// Begin mosek.fusion.Parameters.string_to_scalingtype_value
// Method mosek.fusion.Parameters.string_to_scalingtype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1855:0-1860:1
int32_t mosek::fusion::p_Parameters::string_to_scalingtype_value(const std::string & _9099_v)
{
  if ((_9099_v == std::string ("free")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9099_v == std::string ("none")))
  {
    {
      return (int)1;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_scalingtype_value

// Begin mosek.fusion.Parameters.string_to_rescodetype_value
// Method mosek.fusion.Parameters.string_to_rescodetype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1846:0-1854:1
int32_t mosek::fusion::p_Parameters::string_to_rescodetype_value(const std::string & _9100_v)
{
  if ((_9100_v == std::string ("ok")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9100_v == std::string ("wrn")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9100_v == std::string ("trm")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9100_v == std::string ("err")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9100_v == std::string ("unk")))
  {
    {
      return (int)4;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_rescodetype_value

// Begin mosek.fusion.Parameters.string_to_rescode_value
// Method mosek.fusion.Parameters.string_to_rescode_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1289:0-1845:1
int32_t mosek::fusion::p_Parameters::string_to_rescode_value(const std::string & _9101_v)
{
  if ((_9101_v == std::string ("ok")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnOpenParamFile")))
  {
    {
      return (int)50;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnLargeBound")))
  {
    {
      return (int)51;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnLargeLoBound")))
  {
    {
      return (int)52;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnLargeUpBound")))
  {
    {
      return (int)53;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnLargeConFx")))
  {
    {
      return (int)54;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnLargeCj")))
  {
    {
      return (int)57;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnLargeAij")))
  {
    {
      return (int)62;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnZeroAij")))
  {
    {
      return (int)63;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnNameMaxLen")))
  {
    {
      return (int)65;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnSparMaxLen")))
  {
    {
      return (int)66;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnMpsSplitRhsVector")))
  {
    {
      return (int)70;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnMpsSplitRanVector")))
  {
    {
      return (int)71;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnMpsSplitBouVector")))
  {
    {
      return (int)72;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnLpOldQuadFormat")))
  {
    {
      return (int)80;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnLpDropVariable")))
  {
    {
      return (int)85;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnNzInUprTri")))
  {
    {
      return (int)200;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnDroppedNzQobj")))
  {
    {
      return (int)201;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnIgnoreInteger")))
  {
    {
      return (int)250;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnNoGlobalOptimizer")))
  {
    {
      return (int)251;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnMioInfeasibleFinal")))
  {
    {
      return (int)270;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnSolFilter")))
  {
    {
      return (int)300;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnUndefSolFileName")))
  {
    {
      return (int)350;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnSolFileIgnoredCon")))
  {
    {
      return (int)351;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnSolFileIgnoredVar")))
  {
    {
      return (int)352;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnTooFewBasisVars")))
  {
    {
      return (int)400;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnTooManyBasisVars")))
  {
    {
      return (int)405;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnLicenseExpire")))
  {
    {
      return (int)500;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnLicenseServer")))
  {
    {
      return (int)501;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnEmptyName")))
  {
    {
      return (int)502;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnUsingGenericNames")))
  {
    {
      return (int)503;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnInvalidMpsName")))
  {
    {
      return (int)504;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnInvalidMpsObjName")))
  {
    {
      return (int)505;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnLicenseFeatureExpire")))
  {
    {
      return (int)509;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnParamNameDou")))
  {
    {
      return (int)510;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnParamNameInt")))
  {
    {
      return (int)511;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnParamNameStr")))
  {
    {
      return (int)512;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnParamStrValue")))
  {
    {
      return (int)515;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnParamIgnoredCmio")))
  {
    {
      return (int)516;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnZerosInSparseRow")))
  {
    {
      return (int)705;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnZerosInSparseCol")))
  {
    {
      return (int)710;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnIncompleteLinearDependencyCheck")))
  {
    {
      return (int)800;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnEliminatorSpace")))
  {
    {
      return (int)801;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnPresolveOutofspace")))
  {
    {
      return (int)802;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnPresolvePrimalPerturbations")))
  {
    {
      return (int)803;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnWriteChangedNames")))
  {
    {
      return (int)830;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnWriteDiscardedCfix")))
  {
    {
      return (int)831;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnDuplicateConstraintNames")))
  {
    {
      return (int)850;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnDuplicateVariableNames")))
  {
    {
      return (int)851;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnDuplicateBarvariableNames")))
  {
    {
      return (int)852;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnDuplicateConeNames")))
  {
    {
      return (int)853;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnAnaLargeBounds")))
  {
    {
      return (int)900;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnAnaCZero")))
  {
    {
      return (int)901;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnAnaEmptyCols")))
  {
    {
      return (int)902;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnAnaCloseBounds")))
  {
    {
      return (int)903;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnAnaAlmostIntBounds")))
  {
    {
      return (int)904;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnNoInfeasibilityReportWhenMatrixVariables")))
  {
    {
      return (int)930;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnGetdualIgnoresIntegrality")))
  {
    {
      return (int)940;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnNoDualizer")))
  {
    {
      return (int)950;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnSymMatLarge")))
  {
    {
      return (int)960;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnModifiedDoubleParameter")))
  {
    {
      return (int)970;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnLargeFij")))
  {
    {
      return (int)980;
    }
  }
  {}
  if ((_9101_v == std::string ("wrnPtfUnknownSection")))
  {
    {
      return (int)981;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicense")))
  {
    {
      return (int)1000;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseExpired")))
  {
    {
      return (int)1001;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseVersion")))
  {
    {
      return (int)1002;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseOldServerVersion")))
  {
    {
      return (int)1003;
    }
  }
  {}
  if ((_9101_v == std::string ("errSizeLicense")))
  {
    {
      return (int)1005;
    }
  }
  {}
  if ((_9101_v == std::string ("errProbLicense")))
  {
    {
      return (int)1006;
    }
  }
  {}
  if ((_9101_v == std::string ("errFileLicense")))
  {
    {
      return (int)1007;
    }
  }
  {}
  if ((_9101_v == std::string ("errMissingLicenseFile")))
  {
    {
      return (int)1008;
    }
  }
  {}
  if ((_9101_v == std::string ("errSizeLicenseCon")))
  {
    {
      return (int)1010;
    }
  }
  {}
  if ((_9101_v == std::string ("errSizeLicenseVar")))
  {
    {
      return (int)1011;
    }
  }
  {}
  if ((_9101_v == std::string ("errSizeLicenseIntvar")))
  {
    {
      return (int)1012;
    }
  }
  {}
  if ((_9101_v == std::string ("errOptimizerLicense")))
  {
    {
      return (int)1013;
    }
  }
  {}
  if ((_9101_v == std::string ("errFlexlm")))
  {
    {
      return (int)1014;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseServer")))
  {
    {
      return (int)1015;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseMax")))
  {
    {
      return (int)1016;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseMoseklmDaemon")))
  {
    {
      return (int)1017;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseFeature")))
  {
    {
      return (int)1018;
    }
  }
  {}
  if ((_9101_v == std::string ("errPlatformNotLicensed")))
  {
    {
      return (int)1019;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseCannotAllocate")))
  {
    {
      return (int)1020;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseCannotConnect")))
  {
    {
      return (int)1021;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseInvalidHostid")))
  {
    {
      return (int)1025;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseServerVersion")))
  {
    {
      return (int)1026;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseNoServerSupport")))
  {
    {
      return (int)1027;
    }
  }
  {}
  if ((_9101_v == std::string ("errLicenseNoServerLine")))
  {
    {
      return (int)1028;
    }
  }
  {}
  if ((_9101_v == std::string ("errOlderDll")))
  {
    {
      return (int)1035;
    }
  }
  {}
  if ((_9101_v == std::string ("errNewerDll")))
  {
    {
      return (int)1036;
    }
  }
  {}
  if ((_9101_v == std::string ("errLinkFileDll")))
  {
    {
      return (int)1040;
    }
  }
  {}
  if ((_9101_v == std::string ("errThreadMutexInit")))
  {
    {
      return (int)1045;
    }
  }
  {}
  if ((_9101_v == std::string ("errThreadMutexLock")))
  {
    {
      return (int)1046;
    }
  }
  {}
  if ((_9101_v == std::string ("errThreadMutexUnlock")))
  {
    {
      return (int)1047;
    }
  }
  {}
  if ((_9101_v == std::string ("errThreadCreate")))
  {
    {
      return (int)1048;
    }
  }
  {}
  if ((_9101_v == std::string ("errThreadCondInit")))
  {
    {
      return (int)1049;
    }
  }
  {}
  if ((_9101_v == std::string ("errUnknown")))
  {
    {
      return (int)1050;
    }
  }
  {}
  if ((_9101_v == std::string ("errSpace")))
  {
    {
      return (int)1051;
    }
  }
  {}
  if ((_9101_v == std::string ("errFileOpen")))
  {
    {
      return (int)1052;
    }
  }
  {}
  if ((_9101_v == std::string ("errFileRead")))
  {
    {
      return (int)1053;
    }
  }
  {}
  if ((_9101_v == std::string ("errFileWrite")))
  {
    {
      return (int)1054;
    }
  }
  {}
  if ((_9101_v == std::string ("errDataFileExt")))
  {
    {
      return (int)1055;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidFileName")))
  {
    {
      return (int)1056;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidSolFileName")))
  {
    {
      return (int)1057;
    }
  }
  {}
  if ((_9101_v == std::string ("errEndOfFile")))
  {
    {
      return (int)1059;
    }
  }
  {}
  if ((_9101_v == std::string ("errNullEnv")))
  {
    {
      return (int)1060;
    }
  }
  {}
  if ((_9101_v == std::string ("errNullTask")))
  {
    {
      return (int)1061;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidStream")))
  {
    {
      return (int)1062;
    }
  }
  {}
  if ((_9101_v == std::string ("errNoInitEnv")))
  {
    {
      return (int)1063;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidTask")))
  {
    {
      return (int)1064;
    }
  }
  {}
  if ((_9101_v == std::string ("errNullPointer")))
  {
    {
      return (int)1065;
    }
  }
  {}
  if ((_9101_v == std::string ("errLivingTasks")))
  {
    {
      return (int)1066;
    }
  }
  {}
  if ((_9101_v == std::string ("errReadGzip")))
  {
    {
      return (int)1067;
    }
  }
  {}
  if ((_9101_v == std::string ("errReadZstd")))
  {
    {
      return (int)1068;
    }
  }
  {}
  if ((_9101_v == std::string ("errReadAsync")))
  {
    {
      return (int)1069;
    }
  }
  {}
  if ((_9101_v == std::string ("errBlankName")))
  {
    {
      return (int)1070;
    }
  }
  {}
  if ((_9101_v == std::string ("errDupName")))
  {
    {
      return (int)1071;
    }
  }
  {}
  if ((_9101_v == std::string ("errFormatString")))
  {
    {
      return (int)1072;
    }
  }
  {}
  if ((_9101_v == std::string ("errSparsitySpecification")))
  {
    {
      return (int)1073;
    }
  }
  {}
  if ((_9101_v == std::string ("errMismatchingDimension")))
  {
    {
      return (int)1074;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidObjName")))
  {
    {
      return (int)1075;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidConName")))
  {
    {
      return (int)1076;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidVarName")))
  {
    {
      return (int)1077;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidConeName")))
  {
    {
      return (int)1078;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidBarvarName")))
  {
    {
      return (int)1079;
    }
  }
  {}
  if ((_9101_v == std::string ("errSpaceLeaking")))
  {
    {
      return (int)1080;
    }
  }
  {}
  if ((_9101_v == std::string ("errSpaceNoInfo")))
  {
    {
      return (int)1081;
    }
  }
  {}
  if ((_9101_v == std::string ("errDimensionSpecification")))
  {
    {
      return (int)1082;
    }
  }
  {}
  if ((_9101_v == std::string ("errAxisNameSpecification")))
  {
    {
      return (int)1083;
    }
  }
  {}
  if ((_9101_v == std::string ("errReadPrematureEof")))
  {
    {
      return (int)1089;
    }
  }
  {}
  if ((_9101_v == std::string ("errReadFormat")))
  {
    {
      return (int)1090;
    }
  }
  {}
  if ((_9101_v == std::string ("errWriteLpInvalidVarNames")))
  {
    {
      return (int)1091;
    }
  }
  {}
  if ((_9101_v == std::string ("errWriteLpDuplicateVarNames")))
  {
    {
      return (int)1092;
    }
  }
  {}
  if ((_9101_v == std::string ("errWriteLpInvalidConNames")))
  {
    {
      return (int)1093;
    }
  }
  {}
  if ((_9101_v == std::string ("errWriteLpDuplicateConNames")))
  {
    {
      return (int)1094;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsFile")))
  {
    {
      return (int)1100;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvField")))
  {
    {
      return (int)1101;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvMarker")))
  {
    {
      return (int)1102;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsNullConName")))
  {
    {
      return (int)1103;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsNullVarName")))
  {
    {
      return (int)1104;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsUndefConName")))
  {
    {
      return (int)1105;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsUndefVarName")))
  {
    {
      return (int)1106;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvalidConKey")))
  {
    {
      return (int)1107;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvalidBoundKey")))
  {
    {
      return (int)1108;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvalidSecName")))
  {
    {
      return (int)1109;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsNoObjective")))
  {
    {
      return (int)1110;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsSplittedVar")))
  {
    {
      return (int)1111;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsMulConName")))
  {
    {
      return (int)1112;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsMulQsec")))
  {
    {
      return (int)1113;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsMulQobj")))
  {
    {
      return (int)1114;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvSecOrder")))
  {
    {
      return (int)1115;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsMulCsec")))
  {
    {
      return (int)1116;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsConeType")))
  {
    {
      return (int)1117;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsConeOverlap")))
  {
    {
      return (int)1118;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsConeRepeat")))
  {
    {
      return (int)1119;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsNonSymmetricQ")))
  {
    {
      return (int)1120;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsDuplicateQElement")))
  {
    {
      return (int)1121;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvalidObjsense")))
  {
    {
      return (int)1122;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsTabInField2")))
  {
    {
      return (int)1125;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsTabInField3")))
  {
    {
      return (int)1126;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsTabInField5")))
  {
    {
      return (int)1127;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvalidObjName")))
  {
    {
      return (int)1128;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvalidKey")))
  {
    {
      return (int)1129;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvalidIndicatorConstraint")))
  {
    {
      return (int)1130;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvalidIndicatorVariable")))
  {
    {
      return (int)1131;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvalidIndicatorValue")))
  {
    {
      return (int)1132;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsInvalidIndicatorQuadraticConstraint")))
  {
    {
      return (int)1133;
    }
  }
  {}
  if ((_9101_v == std::string ("errOpfSyntax")))
  {
    {
      return (int)1134;
    }
  }
  {}
  if ((_9101_v == std::string ("errOpfPrematureEof")))
  {
    {
      return (int)1136;
    }
  }
  {}
  if ((_9101_v == std::string ("errOpfMismatchedTag")))
  {
    {
      return (int)1137;
    }
  }
  {}
  if ((_9101_v == std::string ("errOpfDuplicateBound")))
  {
    {
      return (int)1138;
    }
  }
  {}
  if ((_9101_v == std::string ("errOpfDuplicateConstraintName")))
  {
    {
      return (int)1139;
    }
  }
  {}
  if ((_9101_v == std::string ("errOpfInvalidConeType")))
  {
    {
      return (int)1140;
    }
  }
  {}
  if ((_9101_v == std::string ("errOpfIncorrectTagParam")))
  {
    {
      return (int)1141;
    }
  }
  {}
  if ((_9101_v == std::string ("errOpfInvalidTag")))
  {
    {
      return (int)1142;
    }
  }
  {}
  if ((_9101_v == std::string ("errOpfDuplicateConeEntry")))
  {
    {
      return (int)1143;
    }
  }
  {}
  if ((_9101_v == std::string ("errOpfTooLarge")))
  {
    {
      return (int)1144;
    }
  }
  {}
  if ((_9101_v == std::string ("errOpfDualIntegerSolution")))
  {
    {
      return (int)1146;
    }
  }
  {}
  if ((_9101_v == std::string ("errLpEmpty")))
  {
    {
      return (int)1151;
    }
  }
  {}
  if ((_9101_v == std::string ("errWriteMpsInvalidName")))
  {
    {
      return (int)1153;
    }
  }
  {}
  if ((_9101_v == std::string ("errLpInvalidVarName")))
  {
    {
      return (int)1154;
    }
  }
  {}
  if ((_9101_v == std::string ("errWriteOpfInvalidVarName")))
  {
    {
      return (int)1156;
    }
  }
  {}
  if ((_9101_v == std::string ("errLpFileFormat")))
  {
    {
      return (int)1157;
    }
  }
  {}
  if ((_9101_v == std::string ("errLpExpectedNumber")))
  {
    {
      return (int)1158;
    }
  }
  {}
  if ((_9101_v == std::string ("errReadLpMissingEndTag")))
  {
    {
      return (int)1159;
    }
  }
  {}
  if ((_9101_v == std::string ("errLpIndicatorVar")))
  {
    {
      return (int)1160;
    }
  }
  {}
  if ((_9101_v == std::string ("errLpExpectedObjective")))
  {
    {
      return (int)1161;
    }
  }
  {}
  if ((_9101_v == std::string ("errLpExpectedConstraintRelation")))
  {
    {
      return (int)1162;
    }
  }
  {}
  if ((_9101_v == std::string ("errLpAmbiguousConstraintBound")))
  {
    {
      return (int)1163;
    }
  }
  {}
  if ((_9101_v == std::string ("errLpDuplicateSection")))
  {
    {
      return (int)1164;
    }
  }
  {}
  if ((_9101_v == std::string ("errReadLpDelayedRowsNotSupported")))
  {
    {
      return (int)1165;
    }
  }
  {}
  if ((_9101_v == std::string ("errWritingFile")))
  {
    {
      return (int)1166;
    }
  }
  {}
  if ((_9101_v == std::string ("errWriteAsync")))
  {
    {
      return (int)1167;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidNameInSolFile")))
  {
    {
      return (int)1170;
    }
  }
  {}
  if ((_9101_v == std::string ("errJsonSyntax")))
  {
    {
      return (int)1175;
    }
  }
  {}
  if ((_9101_v == std::string ("errJsonString")))
  {
    {
      return (int)1176;
    }
  }
  {}
  if ((_9101_v == std::string ("errJsonNumberOverflow")))
  {
    {
      return (int)1177;
    }
  }
  {}
  if ((_9101_v == std::string ("errJsonFormat")))
  {
    {
      return (int)1178;
    }
  }
  {}
  if ((_9101_v == std::string ("errJsonData")))
  {
    {
      return (int)1179;
    }
  }
  {}
  if ((_9101_v == std::string ("errJsonMissingData")))
  {
    {
      return (int)1180;
    }
  }
  {}
  if ((_9101_v == std::string ("errPtfIncompatibility")))
  {
    {
      return (int)1181;
    }
  }
  {}
  if ((_9101_v == std::string ("errPtfUndefinedItem")))
  {
    {
      return (int)1182;
    }
  }
  {}
  if ((_9101_v == std::string ("errPtfInconsistency")))
  {
    {
      return (int)1183;
    }
  }
  {}
  if ((_9101_v == std::string ("errPtfFormat")))
  {
    {
      return (int)1184;
    }
  }
  {}
  if ((_9101_v == std::string ("errArgumentLenneq")))
  {
    {
      return (int)1197;
    }
  }
  {}
  if ((_9101_v == std::string ("errArgumentType")))
  {
    {
      return (int)1198;
    }
  }
  {}
  if ((_9101_v == std::string ("errNumArguments")))
  {
    {
      return (int)1199;
    }
  }
  {}
  if ((_9101_v == std::string ("errInArgument")))
  {
    {
      return (int)1200;
    }
  }
  {}
  if ((_9101_v == std::string ("errArgumentDimension")))
  {
    {
      return (int)1201;
    }
  }
  {}
  if ((_9101_v == std::string ("errShapeIsTooLarge")))
  {
    {
      return (int)1202;
    }
  }
  {}
  if ((_9101_v == std::string ("errIndexIsTooSmall")))
  {
    {
      return (int)1203;
    }
  }
  {}
  if ((_9101_v == std::string ("errIndexIsTooLarge")))
  {
    {
      return (int)1204;
    }
  }
  {}
  if ((_9101_v == std::string ("errIndexIsNotUnique")))
  {
    {
      return (int)1205;
    }
  }
  {}
  if ((_9101_v == std::string ("errParamName")))
  {
    {
      return (int)1206;
    }
  }
  {}
  if ((_9101_v == std::string ("errParamNameDou")))
  {
    {
      return (int)1207;
    }
  }
  {}
  if ((_9101_v == std::string ("errParamNameInt")))
  {
    {
      return (int)1208;
    }
  }
  {}
  if ((_9101_v == std::string ("errParamNameStr")))
  {
    {
      return (int)1209;
    }
  }
  {}
  if ((_9101_v == std::string ("errParamIndex")))
  {
    {
      return (int)1210;
    }
  }
  {}
  if ((_9101_v == std::string ("errParamIsTooLarge")))
  {
    {
      return (int)1215;
    }
  }
  {}
  if ((_9101_v == std::string ("errParamIsTooSmall")))
  {
    {
      return (int)1216;
    }
  }
  {}
  if ((_9101_v == std::string ("errParamValueStr")))
  {
    {
      return (int)1217;
    }
  }
  {}
  if ((_9101_v == std::string ("errParamType")))
  {
    {
      return (int)1218;
    }
  }
  {}
  if ((_9101_v == std::string ("errInfDouIndex")))
  {
    {
      return (int)1219;
    }
  }
  {}
  if ((_9101_v == std::string ("errInfIntIndex")))
  {
    {
      return (int)1220;
    }
  }
  {}
  if ((_9101_v == std::string ("errIndexArrIsTooSmall")))
  {
    {
      return (int)1221;
    }
  }
  {}
  if ((_9101_v == std::string ("errIndexArrIsTooLarge")))
  {
    {
      return (int)1222;
    }
  }
  {}
  if ((_9101_v == std::string ("errInfLintIndex")))
  {
    {
      return (int)1225;
    }
  }
  {}
  if ((_9101_v == std::string ("errArgIsTooSmall")))
  {
    {
      return (int)1226;
    }
  }
  {}
  if ((_9101_v == std::string ("errArgIsTooLarge")))
  {
    {
      return (int)1227;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidWhichsol")))
  {
    {
      return (int)1228;
    }
  }
  {}
  if ((_9101_v == std::string ("errInfDouName")))
  {
    {
      return (int)1230;
    }
  }
  {}
  if ((_9101_v == std::string ("errInfIntName")))
  {
    {
      return (int)1231;
    }
  }
  {}
  if ((_9101_v == std::string ("errInfType")))
  {
    {
      return (int)1232;
    }
  }
  {}
  if ((_9101_v == std::string ("errInfLintName")))
  {
    {
      return (int)1234;
    }
  }
  {}
  if ((_9101_v == std::string ("errIndex")))
  {
    {
      return (int)1235;
    }
  }
  {}
  if ((_9101_v == std::string ("errWhichsol")))
  {
    {
      return (int)1236;
    }
  }
  {}
  if ((_9101_v == std::string ("errSolitem")))
  {
    {
      return (int)1237;
    }
  }
  {}
  if ((_9101_v == std::string ("errWhichitemNotAllowed")))
  {
    {
      return (int)1238;
    }
  }
  {}
  if ((_9101_v == std::string ("errMaxnumcon")))
  {
    {
      return (int)1240;
    }
  }
  {}
  if ((_9101_v == std::string ("errMaxnumvar")))
  {
    {
      return (int)1241;
    }
  }
  {}
  if ((_9101_v == std::string ("errMaxnumbarvar")))
  {
    {
      return (int)1242;
    }
  }
  {}
  if ((_9101_v == std::string ("errMaxnumqnz")))
  {
    {
      return (int)1243;
    }
  }
  {}
  if ((_9101_v == std::string ("errTooSmallMaxNumNz")))
  {
    {
      return (int)1245;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidIdx")))
  {
    {
      return (int)1246;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidMaxNum")))
  {
    {
      return (int)1247;
    }
  }
  {}
  if ((_9101_v == std::string ("errUnallowedWhichsol")))
  {
    {
      return (int)1248;
    }
  }
  {}
  if ((_9101_v == std::string ("errNumconlim")))
  {
    {
      return (int)1250;
    }
  }
  {}
  if ((_9101_v == std::string ("errNumvarlim")))
  {
    {
      return (int)1251;
    }
  }
  {}
  if ((_9101_v == std::string ("errTooSmallMaxnumanz")))
  {
    {
      return (int)1252;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvAptre")))
  {
    {
      return (int)1253;
    }
  }
  {}
  if ((_9101_v == std::string ("errMulAElement")))
  {
    {
      return (int)1254;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvBk")))
  {
    {
      return (int)1255;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvBkc")))
  {
    {
      return (int)1256;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvBkx")))
  {
    {
      return (int)1257;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvVarType")))
  {
    {
      return (int)1258;
    }
  }
  {}
  if ((_9101_v == std::string ("errSolverProbtype")))
  {
    {
      return (int)1259;
    }
  }
  {}
  if ((_9101_v == std::string ("errObjectiveRange")))
  {
    {
      return (int)1260;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvRescode")))
  {
    {
      return (int)1261;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvIinf")))
  {
    {
      return (int)1262;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvLiinf")))
  {
    {
      return (int)1263;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvDinf")))
  {
    {
      return (int)1264;
    }
  }
  {}
  if ((_9101_v == std::string ("errBasis")))
  {
    {
      return (int)1266;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvSkc")))
  {
    {
      return (int)1267;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvSkx")))
  {
    {
      return (int)1268;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvSkn")))
  {
    {
      return (int)1274;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvSkStr")))
  {
    {
      return (int)1269;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvSk")))
  {
    {
      return (int)1270;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvConeTypeStr")))
  {
    {
      return (int)1271;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvConeType")))
  {
    {
      return (int)1272;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidSurplus")))
  {
    {
      return (int)1275;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvNameItem")))
  {
    {
      return (int)1280;
    }
  }
  {}
  if ((_9101_v == std::string ("errProItem")))
  {
    {
      return (int)1281;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidFormatType")))
  {
    {
      return (int)1283;
    }
  }
  {}
  if ((_9101_v == std::string ("errFirsti")))
  {
    {
      return (int)1285;
    }
  }
  {}
  if ((_9101_v == std::string ("errLasti")))
  {
    {
      return (int)1286;
    }
  }
  {}
  if ((_9101_v == std::string ("errFirstj")))
  {
    {
      return (int)1287;
    }
  }
  {}
  if ((_9101_v == std::string ("errLastj")))
  {
    {
      return (int)1288;
    }
  }
  {}
  if ((_9101_v == std::string ("errMaxLenIsTooSmall")))
  {
    {
      return (int)1289;
    }
  }
  {}
  if ((_9101_v == std::string ("errNonlinearEquality")))
  {
    {
      return (int)1290;
    }
  }
  {}
  if ((_9101_v == std::string ("errNonconvex")))
  {
    {
      return (int)1291;
    }
  }
  {}
  if ((_9101_v == std::string ("errNonlinearRanged")))
  {
    {
      return (int)1292;
    }
  }
  {}
  if ((_9101_v == std::string ("errConQNotPsd")))
  {
    {
      return (int)1293;
    }
  }
  {}
  if ((_9101_v == std::string ("errConQNotNsd")))
  {
    {
      return (int)1294;
    }
  }
  {}
  if ((_9101_v == std::string ("errObjQNotPsd")))
  {
    {
      return (int)1295;
    }
  }
  {}
  if ((_9101_v == std::string ("errObjQNotNsd")))
  {
    {
      return (int)1296;
    }
  }
  {}
  if ((_9101_v == std::string ("errArgumentPermArray")))
  {
    {
      return (int)1299;
    }
  }
  {}
  if ((_9101_v == std::string ("errConeIndex")))
  {
    {
      return (int)1300;
    }
  }
  {}
  if ((_9101_v == std::string ("errConeSize")))
  {
    {
      return (int)1301;
    }
  }
  {}
  if ((_9101_v == std::string ("errConeOverlap")))
  {
    {
      return (int)1302;
    }
  }
  {}
  if ((_9101_v == std::string ("errConeRepVar")))
  {
    {
      return (int)1303;
    }
  }
  {}
  if ((_9101_v == std::string ("errMaxnumcone")))
  {
    {
      return (int)1304;
    }
  }
  {}
  if ((_9101_v == std::string ("errConeType")))
  {
    {
      return (int)1305;
    }
  }
  {}
  if ((_9101_v == std::string ("errConeTypeStr")))
  {
    {
      return (int)1306;
    }
  }
  {}
  if ((_9101_v == std::string ("errConeOverlapAppend")))
  {
    {
      return (int)1307;
    }
  }
  {}
  if ((_9101_v == std::string ("errRemoveConeVariable")))
  {
    {
      return (int)1310;
    }
  }
  {}
  if ((_9101_v == std::string ("errAppendingTooBigCone")))
  {
    {
      return (int)1311;
    }
  }
  {}
  if ((_9101_v == std::string ("errConeParameter")))
  {
    {
      return (int)1320;
    }
  }
  {}
  if ((_9101_v == std::string ("errSolFileInvalidNumber")))
  {
    {
      return (int)1350;
    }
  }
  {}
  if ((_9101_v == std::string ("errHugeC")))
  {
    {
      return (int)1375;
    }
  }
  {}
  if ((_9101_v == std::string ("errHugeAij")))
  {
    {
      return (int)1380;
    }
  }
  {}
  if ((_9101_v == std::string ("errDuplicateAij")))
  {
    {
      return (int)1385;
    }
  }
  {}
  if ((_9101_v == std::string ("errLowerBoundIsANan")))
  {
    {
      return (int)1390;
    }
  }
  {}
  if ((_9101_v == std::string ("errUpperBoundIsANan")))
  {
    {
      return (int)1391;
    }
  }
  {}
  if ((_9101_v == std::string ("errInfiniteBound")))
  {
    {
      return (int)1400;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvQobjSubi")))
  {
    {
      return (int)1401;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvQobjSubj")))
  {
    {
      return (int)1402;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvQobjVal")))
  {
    {
      return (int)1403;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvQconSubk")))
  {
    {
      return (int)1404;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvQconSubi")))
  {
    {
      return (int)1405;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvQconSubj")))
  {
    {
      return (int)1406;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvQconVal")))
  {
    {
      return (int)1407;
    }
  }
  {}
  if ((_9101_v == std::string ("errQconSubiTooSmall")))
  {
    {
      return (int)1408;
    }
  }
  {}
  if ((_9101_v == std::string ("errQconSubiTooLarge")))
  {
    {
      return (int)1409;
    }
  }
  {}
  if ((_9101_v == std::string ("errQobjUpperTriangle")))
  {
    {
      return (int)1415;
    }
  }
  {}
  if ((_9101_v == std::string ("errQconUpperTriangle")))
  {
    {
      return (int)1417;
    }
  }
  {}
  if ((_9101_v == std::string ("errFixedBoundValues")))
  {
    {
      return (int)1420;
    }
  }
  {}
  if ((_9101_v == std::string ("errTooSmallATruncationValue")))
  {
    {
      return (int)1421;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidObjectiveSense")))
  {
    {
      return (int)1445;
    }
  }
  {}
  if ((_9101_v == std::string ("errUndefinedObjectiveSense")))
  {
    {
      return (int)1446;
    }
  }
  {}
  if ((_9101_v == std::string ("errYIsUndefined")))
  {
    {
      return (int)1449;
    }
  }
  {}
  if ((_9101_v == std::string ("errNanInDoubleData")))
  {
    {
      return (int)1450;
    }
  }
  {}
  if ((_9101_v == std::string ("errInfInDoubleData")))
  {
    {
      return (int)1451;
    }
  }
  {}
  if ((_9101_v == std::string ("errNanInBlc")))
  {
    {
      return (int)1461;
    }
  }
  {}
  if ((_9101_v == std::string ("errNanInBuc")))
  {
    {
      return (int)1462;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidCfix")))
  {
    {
      return (int)1469;
    }
  }
  {}
  if ((_9101_v == std::string ("errNanInC")))
  {
    {
      return (int)1470;
    }
  }
  {}
  if ((_9101_v == std::string ("errNanInBlx")))
  {
    {
      return (int)1471;
    }
  }
  {}
  if ((_9101_v == std::string ("errNanInBux")))
  {
    {
      return (int)1472;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidAij")))
  {
    {
      return (int)1473;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidCj")))
  {
    {
      return (int)1474;
    }
  }
  {}
  if ((_9101_v == std::string ("errSymMatInvalid")))
  {
    {
      return (int)1480;
    }
  }
  {}
  if ((_9101_v == std::string ("errSymMatHuge")))
  {
    {
      return (int)1482;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvProblem")))
  {
    {
      return (int)1500;
    }
  }
  {}
  if ((_9101_v == std::string ("errMixedConicAndNl")))
  {
    {
      return (int)1501;
    }
  }
  {}
  if ((_9101_v == std::string ("errGlobalInvConicProblem")))
  {
    {
      return (int)1503;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvOptimizer")))
  {
    {
      return (int)1550;
    }
  }
  {}
  if ((_9101_v == std::string ("errMioNoOptimizer")))
  {
    {
      return (int)1551;
    }
  }
  {}
  if ((_9101_v == std::string ("errNoOptimizerVarType")))
  {
    {
      return (int)1552;
    }
  }
  {}
  if ((_9101_v == std::string ("errFinalSolution")))
  {
    {
      return (int)1560;
    }
  }
  {}
  if ((_9101_v == std::string ("errFirst")))
  {
    {
      return (int)1570;
    }
  }
  {}
  if ((_9101_v == std::string ("errLast")))
  {
    {
      return (int)1571;
    }
  }
  {}
  if ((_9101_v == std::string ("errSliceSize")))
  {
    {
      return (int)1572;
    }
  }
  {}
  if ((_9101_v == std::string ("errNegativeSurplus")))
  {
    {
      return (int)1573;
    }
  }
  {}
  if ((_9101_v == std::string ("errNegativeAppend")))
  {
    {
      return (int)1578;
    }
  }
  {}
  if ((_9101_v == std::string ("errPostsolve")))
  {
    {
      return (int)1580;
    }
  }
  {}
  if ((_9101_v == std::string ("errOverflow")))
  {
    {
      return (int)1590;
    }
  }
  {}
  if ((_9101_v == std::string ("errNoBasisSol")))
  {
    {
      return (int)1600;
    }
  }
  {}
  if ((_9101_v == std::string ("errBasisFactor")))
  {
    {
      return (int)1610;
    }
  }
  {}
  if ((_9101_v == std::string ("errBasisSingular")))
  {
    {
      return (int)1615;
    }
  }
  {}
  if ((_9101_v == std::string ("errFactor")))
  {
    {
      return (int)1650;
    }
  }
  {}
  if ((_9101_v == std::string ("errFeasrepairCannotRelax")))
  {
    {
      return (int)1700;
    }
  }
  {}
  if ((_9101_v == std::string ("errFeasrepairSolvingRelaxed")))
  {
    {
      return (int)1701;
    }
  }
  {}
  if ((_9101_v == std::string ("errFeasrepairInconsistentBound")))
  {
    {
      return (int)1702;
    }
  }
  {}
  if ((_9101_v == std::string ("errRepairInvalidProblem")))
  {
    {
      return (int)1710;
    }
  }
  {}
  if ((_9101_v == std::string ("errRepairOptimizationFailed")))
  {
    {
      return (int)1711;
    }
  }
  {}
  if ((_9101_v == std::string ("errNameMaxLen")))
  {
    {
      return (int)1750;
    }
  }
  {}
  if ((_9101_v == std::string ("errNameIsNull")))
  {
    {
      return (int)1760;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidCompression")))
  {
    {
      return (int)1800;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidIomode")))
  {
    {
      return (int)1801;
    }
  }
  {}
  if ((_9101_v == std::string ("errNoPrimalInfeasCer")))
  {
    {
      return (int)2000;
    }
  }
  {}
  if ((_9101_v == std::string ("errNoDualInfeasCer")))
  {
    {
      return (int)2001;
    }
  }
  {}
  if ((_9101_v == std::string ("errNoSolutionInCallback")))
  {
    {
      return (int)2500;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvMarki")))
  {
    {
      return (int)2501;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvMarkj")))
  {
    {
      return (int)2502;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvNumi")))
  {
    {
      return (int)2503;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvNumj")))
  {
    {
      return (int)2504;
    }
  }
  {}
  if ((_9101_v == std::string ("errTaskIncompatible")))
  {
    {
      return (int)2560;
    }
  }
  {}
  if ((_9101_v == std::string ("errTaskInvalid")))
  {
    {
      return (int)2561;
    }
  }
  {}
  if ((_9101_v == std::string ("errTaskWrite")))
  {
    {
      return (int)2562;
    }
  }
  {}
  if ((_9101_v == std::string ("errReadWrite")))
  {
    {
      return (int)2563;
    }
  }
  {}
  if ((_9101_v == std::string ("errTaskPrematureEof")))
  {
    {
      return (int)2564;
    }
  }
  {}
  if ((_9101_v == std::string ("errLuMaxNumTries")))
  {
    {
      return (int)2800;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidUtf8")))
  {
    {
      return (int)2900;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidWchar")))
  {
    {
      return (int)2901;
    }
  }
  {}
  if ((_9101_v == std::string ("errNoDualForItgSol")))
  {
    {
      return (int)2950;
    }
  }
  {}
  if ((_9101_v == std::string ("errNoSnxForBasSol")))
  {
    {
      return (int)2953;
    }
  }
  {}
  if ((_9101_v == std::string ("errInternal")))
  {
    {
      return (int)3000;
    }
  }
  {}
  if ((_9101_v == std::string ("errApiArrayTooSmall")))
  {
    {
      return (int)3001;
    }
  }
  {}
  if ((_9101_v == std::string ("errApiCbConnect")))
  {
    {
      return (int)3002;
    }
  }
  {}
  if ((_9101_v == std::string ("errApiFatalError")))
  {
    {
      return (int)3005;
    }
  }
  {}
  if ((_9101_v == std::string ("errApiInternal")))
  {
    {
      return (int)3999;
    }
  }
  {}
  if ((_9101_v == std::string ("errSenFormat")))
  {
    {
      return (int)3050;
    }
  }
  {}
  if ((_9101_v == std::string ("errSenUndefName")))
  {
    {
      return (int)3051;
    }
  }
  {}
  if ((_9101_v == std::string ("errSenIndexRange")))
  {
    {
      return (int)3052;
    }
  }
  {}
  if ((_9101_v == std::string ("errSenBoundInvalidUp")))
  {
    {
      return (int)3053;
    }
  }
  {}
  if ((_9101_v == std::string ("errSenBoundInvalidLo")))
  {
    {
      return (int)3054;
    }
  }
  {}
  if ((_9101_v == std::string ("errSenIndexInvalid")))
  {
    {
      return (int)3055;
    }
  }
  {}
  if ((_9101_v == std::string ("errSenInvalidRegexp")))
  {
    {
      return (int)3056;
    }
  }
  {}
  if ((_9101_v == std::string ("errSenSolutionStatus")))
  {
    {
      return (int)3057;
    }
  }
  {}
  if ((_9101_v == std::string ("errSenNumerical")))
  {
    {
      return (int)3058;
    }
  }
  {}
  if ((_9101_v == std::string ("errSenUnhandledProblemType")))
  {
    {
      return (int)3080;
    }
  }
  {}
  if ((_9101_v == std::string ("errUnbStepSize")))
  {
    {
      return (int)3100;
    }
  }
  {}
  if ((_9101_v == std::string ("errIdenticalTasks")))
  {
    {
      return (int)3101;
    }
  }
  {}
  if ((_9101_v == std::string ("errAdInvalidCodelist")))
  {
    {
      return (int)3102;
    }
  }
  {}
  if ((_9101_v == std::string ("errInternalTestFailed")))
  {
    {
      return (int)3500;
    }
  }
  {}
  if ((_9101_v == std::string ("errInt64ToInt32Cast")))
  {
    {
      return (int)3800;
    }
  }
  {}
  if ((_9101_v == std::string ("errInfeasUndefined")))
  {
    {
      return (int)3910;
    }
  }
  {}
  if ((_9101_v == std::string ("errNoBarxForSolution")))
  {
    {
      return (int)3915;
    }
  }
  {}
  if ((_9101_v == std::string ("errNoBarsForSolution")))
  {
    {
      return (int)3916;
    }
  }
  {}
  if ((_9101_v == std::string ("errBarVarDim")))
  {
    {
      return (int)3920;
    }
  }
  {}
  if ((_9101_v == std::string ("errSymMatInvalidRowIndex")))
  {
    {
      return (int)3940;
    }
  }
  {}
  if ((_9101_v == std::string ("errSymMatInvalidColIndex")))
  {
    {
      return (int)3941;
    }
  }
  {}
  if ((_9101_v == std::string ("errSymMatNotLowerTringular")))
  {
    {
      return (int)3942;
    }
  }
  {}
  if ((_9101_v == std::string ("errSymMatInvalidValue")))
  {
    {
      return (int)3943;
    }
  }
  {}
  if ((_9101_v == std::string ("errSymMatDuplicate")))
  {
    {
      return (int)3944;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidSymMatDim")))
  {
    {
      return (int)3950;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidFileFormatForSymMat")))
  {
    {
      return (int)4000;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidFileFormatForCfix")))
  {
    {
      return (int)4001;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidFileFormatForRangedConstraints")))
  {
    {
      return (int)4002;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidFileFormatForFreeConstraints")))
  {
    {
      return (int)4003;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidFileFormatForCones")))
  {
    {
      return (int)4005;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidFileFormatForQuadraticTerms")))
  {
    {
      return (int)4006;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidFileFormatForNonlinear")))
  {
    {
      return (int)4010;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidFileFormatForDisjunctiveConstraints")))
  {
    {
      return (int)4011;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidFileFormatForAffineConicConstraints")))
  {
    {
      return (int)4012;
    }
  }
  {}
  if ((_9101_v == std::string ("errDuplicateConstraintNames")))
  {
    {
      return (int)4500;
    }
  }
  {}
  if ((_9101_v == std::string ("errDuplicateVariableNames")))
  {
    {
      return (int)4501;
    }
  }
  {}
  if ((_9101_v == std::string ("errDuplicateBarvariableNames")))
  {
    {
      return (int)4502;
    }
  }
  {}
  if ((_9101_v == std::string ("errDuplicateConeNames")))
  {
    {
      return (int)4503;
    }
  }
  {}
  if ((_9101_v == std::string ("errDuplicateDomainNames")))
  {
    {
      return (int)4504;
    }
  }
  {}
  if ((_9101_v == std::string ("errDuplicateDjcNames")))
  {
    {
      return (int)4505;
    }
  }
  {}
  if ((_9101_v == std::string ("errNonUniqueArray")))
  {
    {
      return (int)5000;
    }
  }
  {}
  if ((_9101_v == std::string ("errArgumentIsTooSmall")))
  {
    {
      return (int)5004;
    }
  }
  {}
  if ((_9101_v == std::string ("errArgumentIsTooLarge")))
  {
    {
      return (int)5005;
    }
  }
  {}
  if ((_9101_v == std::string ("errMioInternal")))
  {
    {
      return (int)5010;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidProblemType")))
  {
    {
      return (int)6000;
    }
  }
  {}
  if ((_9101_v == std::string ("errUnhandledSolutionStatus")))
  {
    {
      return (int)6010;
    }
  }
  {}
  if ((_9101_v == std::string ("errUpperTriangle")))
  {
    {
      return (int)6020;
    }
  }
  {}
  if ((_9101_v == std::string ("errLauSingularMatrix")))
  {
    {
      return (int)7000;
    }
  }
  {}
  if ((_9101_v == std::string ("errLauNotPositiveDefinite")))
  {
    {
      return (int)7001;
    }
  }
  {}
  if ((_9101_v == std::string ("errLauInvalidLowerTriangularMatrix")))
  {
    {
      return (int)7002;
    }
  }
  {}
  if ((_9101_v == std::string ("errLauUnknown")))
  {
    {
      return (int)7005;
    }
  }
  {}
  if ((_9101_v == std::string ("errLauArgM")))
  {
    {
      return (int)7010;
    }
  }
  {}
  if ((_9101_v == std::string ("errLauArgN")))
  {
    {
      return (int)7011;
    }
  }
  {}
  if ((_9101_v == std::string ("errLauArgK")))
  {
    {
      return (int)7012;
    }
  }
  {}
  if ((_9101_v == std::string ("errLauArgTransa")))
  {
    {
      return (int)7015;
    }
  }
  {}
  if ((_9101_v == std::string ("errLauArgTransb")))
  {
    {
      return (int)7016;
    }
  }
  {}
  if ((_9101_v == std::string ("errLauArgUplo")))
  {
    {
      return (int)7017;
    }
  }
  {}
  if ((_9101_v == std::string ("errLauArgTrans")))
  {
    {
      return (int)7018;
    }
  }
  {}
  if ((_9101_v == std::string ("errLauInvalidSparseSymmetricMatrix")))
  {
    {
      return (int)7019;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfParse")))
  {
    {
      return (int)7100;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfObjSense")))
  {
    {
      return (int)7101;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfNoVariables")))
  {
    {
      return (int)7102;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfTooManyConstraints")))
  {
    {
      return (int)7103;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfTooManyVariables")))
  {
    {
      return (int)7104;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfNoVersionSpecified")))
  {
    {
      return (int)7105;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfSyntax")))
  {
    {
      return (int)7106;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfDuplicateObj")))
  {
    {
      return (int)7107;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfDuplicateCon")))
  {
    {
      return (int)7108;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfDuplicateVar")))
  {
    {
      return (int)7110;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfDuplicateInt")))
  {
    {
      return (int)7111;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidVarType")))
  {
    {
      return (int)7112;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidConType")))
  {
    {
      return (int)7113;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidDomainDimension")))
  {
    {
      return (int)7114;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfDuplicateObjacoord")))
  {
    {
      return (int)7115;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfDuplicateBcoord")))
  {
    {
      return (int)7116;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfDuplicateAcoord")))
  {
    {
      return (int)7117;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfTooFewVariables")))
  {
    {
      return (int)7118;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfTooFewConstraints")))
  {
    {
      return (int)7119;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfTooFewInts")))
  {
    {
      return (int)7120;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfTooManyInts")))
  {
    {
      return (int)7121;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidIntIndex")))
  {
    {
      return (int)7122;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfUnsupported")))
  {
    {
      return (int)7123;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfDuplicatePsdvar")))
  {
    {
      return (int)7124;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidPsdvarDimension")))
  {
    {
      return (int)7125;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfTooFewPsdvar")))
  {
    {
      return (int)7126;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidExpDimension")))
  {
    {
      return (int)7127;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfDuplicatePowCones")))
  {
    {
      return (int)7130;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfDuplicatePowStarCones")))
  {
    {
      return (int)7131;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidPower")))
  {
    {
      return (int)7132;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfPowerConeIsTooLong")))
  {
    {
      return (int)7133;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidPowerConeIndex")))
  {
    {
      return (int)7134;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidPowerStarConeIndex")))
  {
    {
      return (int)7135;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfUnhandledPowerConeType")))
  {
    {
      return (int)7136;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfUnhandledPowerStarConeType")))
  {
    {
      return (int)7137;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfPowerConeMismatch")))
  {
    {
      return (int)7138;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfPowerStarConeMismatch")))
  {
    {
      return (int)7139;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidNumberOfCones")))
  {
    {
      return (int)7140;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidDimensionOfCones")))
  {
    {
      return (int)7141;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidNumObjacoord")))
  {
    {
      return (int)7150;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidNumObjfcoord")))
  {
    {
      return (int)7151;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidNumAcoord")))
  {
    {
      return (int)7152;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidNumBcoord")))
  {
    {
      return (int)7153;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidNumFcoord")))
  {
    {
      return (int)7155;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidNumHcoord")))
  {
    {
      return (int)7156;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidNumDcoord")))
  {
    {
      return (int)7157;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfExpectedAKeyword")))
  {
    {
      return (int)7158;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidNumPsdcon")))
  {
    {
      return (int)7200;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfDuplicatePsdcon")))
  {
    {
      return (int)7201;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidDimensionOfPsdcon")))
  {
    {
      return (int)7202;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidPsdconIndex")))
  {
    {
      return (int)7203;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidPsdconVariableIndex")))
  {
    {
      return (int)7204;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfInvalidPsdconBlockIndex")))
  {
    {
      return (int)7205;
    }
  }
  {}
  if ((_9101_v == std::string ("errCbfUnsupportedChange")))
  {
    {
      return (int)7210;
    }
  }
  {}
  if ((_9101_v == std::string ("errMioInvalidRootOptimizer")))
  {
    {
      return (int)7700;
    }
  }
  {}
  if ((_9101_v == std::string ("errMioInvalidNodeOptimizer")))
  {
    {
      return (int)7701;
    }
  }
  {}
  if ((_9101_v == std::string ("errMpsWriteCplexInvalidConeType")))
  {
    {
      return (int)7750;
    }
  }
  {}
  if ((_9101_v == std::string ("errToconicConstrQNotPsd")))
  {
    {
      return (int)7800;
    }
  }
  {}
  if ((_9101_v == std::string ("errToconicConstraintFx")))
  {
    {
      return (int)7801;
    }
  }
  {}
  if ((_9101_v == std::string ("errToconicConstraintRa")))
  {
    {
      return (int)7802;
    }
  }
  {}
  if ((_9101_v == std::string ("errToconicConstrNotConic")))
  {
    {
      return (int)7803;
    }
  }
  {}
  if ((_9101_v == std::string ("errToconicObjectiveNotPsd")))
  {
    {
      return (int)7804;
    }
  }
  {}
  if ((_9101_v == std::string ("errGetdualNotAvailable")))
  {
    {
      return (int)7820;
    }
  }
  {}
  if ((_9101_v == std::string ("errServerConnect")))
  {
    {
      return (int)8000;
    }
  }
  {}
  if ((_9101_v == std::string ("errServerProtocol")))
  {
    {
      return (int)8001;
    }
  }
  {}
  if ((_9101_v == std::string ("errServerStatus")))
  {
    {
      return (int)8002;
    }
  }
  {}
  if ((_9101_v == std::string ("errServerToken")))
  {
    {
      return (int)8003;
    }
  }
  {}
  if ((_9101_v == std::string ("errServerAddress")))
  {
    {
      return (int)8004;
    }
  }
  {}
  if ((_9101_v == std::string ("errServerCertificate")))
  {
    {
      return (int)8005;
    }
  }
  {}
  if ((_9101_v == std::string ("errServerTlsClient")))
  {
    {
      return (int)8006;
    }
  }
  {}
  if ((_9101_v == std::string ("errServerAccessToken")))
  {
    {
      return (int)8007;
    }
  }
  {}
  if ((_9101_v == std::string ("errServerProblemSize")))
  {
    {
      return (int)8008;
    }
  }
  {}
  if ((_9101_v == std::string ("errServerHardTimeout")))
  {
    {
      return (int)8009;
    }
  }
  {}
  if ((_9101_v == std::string ("errDuplicateIndexInASparseMatrix")))
  {
    {
      return (int)20050;
    }
  }
  {}
  if ((_9101_v == std::string ("errDuplicateIndexInAfeidxList")))
  {
    {
      return (int)20060;
    }
  }
  {}
  if ((_9101_v == std::string ("errDuplicateFij")))
  {
    {
      return (int)20100;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidFij")))
  {
    {
      return (int)20101;
    }
  }
  {}
  if ((_9101_v == std::string ("errHugeFij")))
  {
    {
      return (int)20102;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidG")))
  {
    {
      return (int)20103;
    }
  }
  {}
  if ((_9101_v == std::string ("errInvalidB")))
  {
    {
      return (int)20150;
    }
  }
  {}
  if ((_9101_v == std::string ("errDomainInvalidIndex")))
  {
    {
      return (int)20400;
    }
  }
  {}
  if ((_9101_v == std::string ("errDomainDimension")))
  {
    {
      return (int)20401;
    }
  }
  {}
  if ((_9101_v == std::string ("errDomainDimensionPsd")))
  {
    {
      return (int)20402;
    }
  }
  {}
  if ((_9101_v == std::string ("errNotPowerDomain")))
  {
    {
      return (int)20403;
    }
  }
  {}
  if ((_9101_v == std::string ("errDomainPowerInvalidAlpha")))
  {
    {
      return (int)20404;
    }
  }
  {}
  if ((_9101_v == std::string ("errDomainPowerNegativeAlpha")))
  {
    {
      return (int)20405;
    }
  }
  {}
  if ((_9101_v == std::string ("errDomainPowerNleft")))
  {
    {
      return (int)20406;
    }
  }
  {}
  if ((_9101_v == std::string ("errAfeInvalidIndex")))
  {
    {
      return (int)20500;
    }
  }
  {}
  if ((_9101_v == std::string ("errAccInvalidIndex")))
  {
    {
      return (int)20600;
    }
  }
  {}
  if ((_9101_v == std::string ("errAccInvalidEntryIndex")))
  {
    {
      return (int)20601;
    }
  }
  {}
  if ((_9101_v == std::string ("errAccAfeDomainMismatch")))
  {
    {
      return (int)20602;
    }
  }
  {}
  if ((_9101_v == std::string ("errDjcInvalidIndex")))
  {
    {
      return (int)20700;
    }
  }
  {}
  if ((_9101_v == std::string ("errDjcUnsupportedDomainType")))
  {
    {
      return (int)20701;
    }
  }
  {}
  if ((_9101_v == std::string ("errDjcAfeDomainMismatch")))
  {
    {
      return (int)20702;
    }
  }
  {}
  if ((_9101_v == std::string ("errDjcInvalidTermSize")))
  {
    {
      return (int)20703;
    }
  }
  {}
  if ((_9101_v == std::string ("errDjcDomainTermsizeMismatch")))
  {
    {
      return (int)20704;
    }
  }
  {}
  if ((_9101_v == std::string ("errDjcTotalNumTermsMismatch")))
  {
    {
      return (int)20705;
    }
  }
  {}
  if ((_9101_v == std::string ("errUndefSolution")))
  {
    {
      return (int)22000;
    }
  }
  {}
  if ((_9101_v == std::string ("errNoDoty")))
  {
    {
      return (int)22010;
    }
  }
  {}
  if ((_9101_v == std::string ("trmMaxIterations")))
  {
    {
      return (int)100000;
    }
  }
  {}
  if ((_9101_v == std::string ("trmMaxTime")))
  {
    {
      return (int)100001;
    }
  }
  {}
  if ((_9101_v == std::string ("trmObjectiveRange")))
  {
    {
      return (int)100002;
    }
  }
  {}
  if ((_9101_v == std::string ("trmMioNumRelaxs")))
  {
    {
      return (int)100008;
    }
  }
  {}
  if ((_9101_v == std::string ("trmMioNumBranches")))
  {
    {
      return (int)100009;
    }
  }
  {}
  if ((_9101_v == std::string ("trmNumMaxNumIntSolutions")))
  {
    {
      return (int)100015;
    }
  }
  {}
  if ((_9101_v == std::string ("trmStall")))
  {
    {
      return (int)100006;
    }
  }
  {}
  if ((_9101_v == std::string ("trmUserCallback")))
  {
    {
      return (int)100007;
    }
  }
  {}
  if ((_9101_v == std::string ("trmMaxNumSetbacks")))
  {
    {
      return (int)100020;
    }
  }
  {}
  if ((_9101_v == std::string ("trmNumericalProblem")))
  {
    {
      return (int)100025;
    }
  }
  {}
  if ((_9101_v == std::string ("trmLostRace")))
  {
    {
      return (int)100027;
    }
  }
  {}
  if ((_9101_v == std::string ("trmInternal")))
  {
    {
      return (int)100030;
    }
  }
  {}
  if ((_9101_v == std::string ("trmInternalStop")))
  {
    {
      return (int)100031;
    }
  }
  {}
  if ((_9101_v == std::string ("trmServerMaxTime")))
  {
    {
      return (int)100032;
    }
  }
  {}
  if ((_9101_v == std::string ("trmServerMaxMemory")))
  {
    {
      return (int)100033;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_rescode_value

// Begin mosek.fusion.Parameters.string_to_prosta_value
// Method mosek.fusion.Parameters.string_to_prosta_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1276:0-1288:1
int32_t mosek::fusion::p_Parameters::string_to_prosta_value(const std::string & _9102_v)
{
  if ((_9102_v == std::string ("unknown")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9102_v == std::string ("primAndDualFeas")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9102_v == std::string ("primFeas")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9102_v == std::string ("dualFeas")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9102_v == std::string ("primInfeas")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9102_v == std::string ("dualInfeas")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9102_v == std::string ("primAndDualInfeas")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9102_v == std::string ("illPosed")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9102_v == std::string ("primInfeasOrUnbounded")))
  {
    {
      return (int)8;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_prosta_value

// Begin mosek.fusion.Parameters.string_to_problemtype_value
// Method mosek.fusion.Parameters.string_to_problemtype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1267:0-1275:1
int32_t mosek::fusion::p_Parameters::string_to_problemtype_value(const std::string & _9103_v)
{
  if ((_9103_v == std::string ("lo")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9103_v == std::string ("qo")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9103_v == std::string ("qcqo")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9103_v == std::string ("conic")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9103_v == std::string ("mixed")))
  {
    {
      return (int)4;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_problemtype_value

// Begin mosek.fusion.Parameters.string_to_problemitem_value
// Method mosek.fusion.Parameters.string_to_problemitem_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1260:0-1266:1
int32_t mosek::fusion::p_Parameters::string_to_problemitem_value(const std::string & _9104_v)
{
  if ((_9104_v == std::string ("var")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9104_v == std::string ("con")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9104_v == std::string ("cone")))
  {
    {
      return (int)2;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_problemitem_value

// Begin mosek.fusion.Parameters.string_to_parametertype_value
// Method mosek.fusion.Parameters.string_to_parametertype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1252:0-1259:1
int32_t mosek::fusion::p_Parameters::string_to_parametertype_value(const std::string & _9105_v)
{
  if ((_9105_v == std::string ("invalidType")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9105_v == std::string ("douType")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9105_v == std::string ("intType")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9105_v == std::string ("strType")))
  {
    {
      return (int)3;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_parametertype_value

// Begin mosek.fusion.Parameters.string_to_foldingmode_value
// Method mosek.fusion.Parameters.string_to_foldingmode_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1244:0-1251:1
int32_t mosek::fusion::p_Parameters::string_to_foldingmode_value(const std::string & _9106_v)
{
  if ((_9106_v == std::string ("off")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9106_v == std::string ("free")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9106_v == std::string ("freeUnlessBasic")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9106_v == std::string ("force")))
  {
    {
      return (int)3;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_foldingmode_value

// Begin mosek.fusion.Parameters.string_to_presolvemode_value
// Method mosek.fusion.Parameters.string_to_presolvemode_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1237:0-1243:1
int32_t mosek::fusion::p_Parameters::string_to_presolvemode_value(const std::string & _9107_v)
{
  if ((_9107_v == std::string ("off")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9107_v == std::string ("on")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9107_v == std::string ("free")))
  {
    {
      return (int)2;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_presolvemode_value

// Begin mosek.fusion.Parameters.string_to_orderingtype_value
// Method mosek.fusion.Parameters.string_to_orderingtype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1227:0-1236:1
int32_t mosek::fusion::p_Parameters::string_to_orderingtype_value(const std::string & _9108_v)
{
  if ((_9108_v == std::string ("free")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9108_v == std::string ("appminloc")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9108_v == std::string ("experimental")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9108_v == std::string ("tryGraphpar")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9108_v == std::string ("forceGraphpar")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9108_v == std::string ("none")))
  {
    {
      return (int)5;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_orderingtype_value

// Begin mosek.fusion.Parameters.string_to_optimizertype_value
// Method mosek.fusion.Parameters.string_to_optimizertype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1214:0-1226:1
int32_t mosek::fusion::p_Parameters::string_to_optimizertype_value(const std::string & _9109_v)
{
  if ((_9109_v == std::string ("free")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9109_v == std::string ("intpnt")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9109_v == std::string ("conic")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9109_v == std::string ("primalSimplex")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9109_v == std::string ("dualSimplex")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9109_v == std::string ("newPrimalSimplex")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9109_v == std::string ("newDualSimplex")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9109_v == std::string ("freeSimplex")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9109_v == std::string ("mixedInt")))
  {
    {
      return (int)5;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_optimizertype_value

// Begin mosek.fusion.Parameters.string_to_onoffkey_value
// Method mosek.fusion.Parameters.string_to_onoffkey_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1208:0-1213:1
int32_t mosek::fusion::p_Parameters::string_to_onoffkey_value(const std::string & _9110_v)
{
  if ((_9110_v == std::string ("on")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9110_v == std::string ("off")))
  {
    {
      return (int)0;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_onoffkey_value

// Begin mosek.fusion.Parameters.string_to_objsense_value
// Method mosek.fusion.Parameters.string_to_objsense_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1202:0-1207:1
int32_t mosek::fusion::p_Parameters::string_to_objsense_value(const std::string & _9111_v)
{
  if ((_9111_v == std::string ("minimize")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9111_v == std::string ("maximize")))
  {
    {
      return (int)1;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_objsense_value

// Begin mosek.fusion.Parameters.string_to_mpsformat_value
// Method mosek.fusion.Parameters.string_to_mpsformat_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1194:0-1201:1
int32_t mosek::fusion::p_Parameters::string_to_mpsformat_value(const std::string & _9112_v)
{
  if ((_9112_v == std::string ("strict")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9112_v == std::string ("relaxed")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9112_v == std::string ("free")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9112_v == std::string ("cplex")))
  {
    {
      return (int)3;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_mpsformat_value

// Begin mosek.fusion.Parameters.string_to_miovarseltype_value
// Method mosek.fusion.Parameters.string_to_miovarseltype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1187:0-1193:1
int32_t mosek::fusion::p_Parameters::string_to_miovarseltype_value(const std::string & _9113_v)
{
  if ((_9113_v == std::string ("free")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9113_v == std::string ("pseudocost")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9113_v == std::string ("strong")))
  {
    {
      return (int)2;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_miovarseltype_value

// Begin mosek.fusion.Parameters.string_to_mionodeseltype_value
// Method mosek.fusion.Parameters.string_to_mionodeseltype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1179:0-1186:1
int32_t mosek::fusion::p_Parameters::string_to_mionodeseltype_value(const std::string & _9114_v)
{
  if ((_9114_v == std::string ("free")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9114_v == std::string ("first")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9114_v == std::string ("best")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9114_v == std::string ("pseudo")))
  {
    {
      return (int)3;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_mionodeseltype_value

// Begin mosek.fusion.Parameters.string_to_miomode_value
// Method mosek.fusion.Parameters.string_to_miomode_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1173:0-1178:1
int32_t mosek::fusion::p_Parameters::string_to_miomode_value(const std::string & _9115_v)
{
  if ((_9115_v == std::string ("ignored")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9115_v == std::string ("satisfied")))
  {
    {
      return (int)1;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_miomode_value

// Begin mosek.fusion.Parameters.string_to_miocontsoltype_value
// Method mosek.fusion.Parameters.string_to_miocontsoltype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1165:0-1172:1
int32_t mosek::fusion::p_Parameters::string_to_miocontsoltype_value(const std::string & _9116_v)
{
  if ((_9116_v == std::string ("none")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9116_v == std::string ("root")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9116_v == std::string ("itg")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9116_v == std::string ("itgRel")))
  {
    {
      return (int)3;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_miocontsoltype_value

// Begin mosek.fusion.Parameters.string_to_miodatapermmethod_value
// Method mosek.fusion.Parameters.string_to_miodatapermmethod_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1158:0-1164:1
int32_t mosek::fusion::p_Parameters::string_to_miodatapermmethod_value(const std::string & _9117_v)
{
  if ((_9117_v == std::string ("none")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9117_v == std::string ("cyclicShift")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9117_v == std::string ("random")))
  {
    {
      return (int)2;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_miodatapermmethod_value

// Begin mosek.fusion.Parameters.string_to_miqcqoreformmethod_value
// Method mosek.fusion.Parameters.string_to_miqcqoreformmethod_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1148:0-1157:1
int32_t mosek::fusion::p_Parameters::string_to_miqcqoreformmethod_value(const std::string & _9118_v)
{
  if ((_9118_v == std::string ("free")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9118_v == std::string ("none")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9118_v == std::string ("linearization")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9118_v == std::string ("eigenValMethod")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9118_v == std::string ("diagSdp")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9118_v == std::string ("relaxSdp")))
  {
    {
      return (int)5;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_miqcqoreformmethod_value

// Begin mosek.fusion.Parameters.string_to_branchdir_value
// Method mosek.fusion.Parameters.string_to_branchdir_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:1136:0-1147:1
int32_t mosek::fusion::p_Parameters::string_to_branchdir_value(const std::string & _9119_v)
{
  if ((_9119_v == std::string ("free")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9119_v == std::string ("up")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9119_v == std::string ("down")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9119_v == std::string ("near")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9119_v == std::string ("far")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9119_v == std::string ("rootLp")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9119_v == std::string ("guided")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9119_v == std::string ("pseudocost")))
  {
    {
      return (int)7;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_branchdir_value

// Begin mosek.fusion.Parameters.string_to_iparam_value
// Method mosek.fusion.Parameters.string_to_iparam_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:943:0-1135:1
int32_t mosek::fusion::p_Parameters::string_to_iparam_value(const std::string & _9120_v)
{
  if ((_9120_v == std::string ("autoUpdateSolInfo")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9120_v == std::string ("removeUnusedSolutions")))
  {
    {
      return (int)134;
    }
  }
  {}
  if ((_9120_v == std::string ("intpntHotstart")))
  {
    {
      return (int)19;
    }
  }
  {}
  if ((_9120_v == std::string ("numThreads")))
  {
    {
      return (int)100;
    }
  }
  {}
  if ((_9120_v == std::string ("timingLevel")))
  {
    {
      return (int)167;
    }
  }
  {}
  if ((_9120_v == std::string ("mtSpincount")))
  {
    {
      return (int)98;
    }
  }
  {}
  if ((_9120_v == std::string ("maxNumWarnings")))
  {
    {
      return (int)56;
    }
  }
  {}
  if ((_9120_v == std::string ("optimizer")))
  {
    {
      return (int)110;
    }
  }
  {}
  if ((_9120_v == std::string ("simPrecision")))
  {
    {
      return (int)150;
    }
  }
  {}
  if ((_9120_v == std::string ("biMaxIterations")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9120_v == std::string ("licenseTrhExpiryWrn")))
  {
    {
      return (int)32;
    }
  }
  {}
  if ((_9120_v == std::string ("logIncludeSummary")))
  {
    {
      return (int)42;
    }
  }
  {}
  if ((_9120_v == std::string ("logCutSecondOpt")))
  {
    {
      return (int)38;
    }
  }
  {}
  if ((_9120_v == std::string ("logAnaPro")))
  {
    {
      return (int)35;
    }
  }
  {}
  if ((_9120_v == std::string ("logLocalInfo")))
  {
    {
      return (int)45;
    }
  }
  {}
  if ((_9120_v == std::string ("logBi")))
  {
    {
      return (int)36;
    }
  }
  {}
  if ((_9120_v == std::string ("logBiFreq")))
  {
    {
      return (int)37;
    }
  }
  {}
  if ((_9120_v == std::string ("biCleanOptimizer")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9120_v == std::string ("intpntStartingPoint")))
  {
    {
      return (int)28;
    }
  }
  {}
  if ((_9120_v == std::string ("intpntDiffStep")))
  {
    {
      return (int)18;
    }
  }
  {}
  if ((_9120_v == std::string ("intpntScaling")))
  {
    {
      return (int)26;
    }
  }
  {}
  if ((_9120_v == std::string ("intpntSolveForm")))
  {
    {
      return (int)27;
    }
  }
  {}
  if ((_9120_v == std::string ("logIntpnt")))
  {
    {
      return (int)44;
    }
  }
  {}
  if ((_9120_v == std::string ("intpntMaxIterations")))
  {
    {
      return (int)20;
    }
  }
  {}
  if ((_9120_v == std::string ("intpntOffColTrh")))
  {
    {
      return (int)22;
    }
  }
  {}
  if ((_9120_v == std::string ("intpntOrderMethod")))
  {
    {
      return (int)24;
    }
  }
  {}
  if ((_9120_v == std::string ("intpntOrderGpNumSeeds")))
  {
    {
      return (int)23;
    }
  }
  {}
  if ((_9120_v == std::string ("intpntBasis")))
  {
    {
      return (int)17;
    }
  }
  {}
  if ((_9120_v == std::string ("biIgnoreMaxIter")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9120_v == std::string ("biIgnoreNumError")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9120_v == std::string ("intpntMaxNumCor")))
  {
    {
      return (int)21;
    }
  }
  {}
  if ((_9120_v == std::string ("presolveUse")))
  {
    {
      return (int)121;
    }
  }
  {}
  if ((_9120_v == std::string ("logPresolve")))
  {
    {
      return (int)49;
    }
  }
  {}
  if ((_9120_v == std::string ("presolveLindepUse")))
  {
    {
      return (int)118;
    }
  }
  {}
  if ((_9120_v == std::string ("presolveLindepNew")))
  {
    {
      return (int)116;
    }
  }
  {}
  if ((_9120_v == std::string ("presolveMaxNumPass")))
  {
    {
      return (int)119;
    }
  }
  {}
  if ((_9120_v == std::string ("presolveEliminatorMaxNumTries")))
  {
    {
      return (int)114;
    }
  }
  {}
  if ((_9120_v == std::string ("presolveEliminatorMaxFill")))
  {
    {
      return (int)113;
    }
  }
  {}
  if ((_9120_v == std::string ("presolveMaxNumReductions")))
  {
    {
      return (int)120;
    }
  }
  {}
  if ((_9120_v == std::string ("foldingUse")))
  {
    {
      return (int)11;
    }
  }
  {}
  if ((_9120_v == std::string ("simDetectPwl")))
  {
    {
      return (int)139;
    }
  }
  {}
  if ((_9120_v == std::string ("simPrimalCrash")))
  {
    {
      return (int)152;
    }
  }
  {}
  if ((_9120_v == std::string ("logSim")))
  {
    {
      return (int)52;
    }
  }
  {}
  if ((_9120_v == std::string ("logSimFreq")))
  {
    {
      return (int)53;
    }
  }
  {}
  if ((_9120_v == std::string ("logSimFreqGigaTicks")))
  {
    {
      return (int)54;
    }
  }
  {}
  if ((_9120_v == std::string ("heartbeatSimFreqTicks")))
  {
    {
      return (int)13;
    }
  }
  {}
  if ((_9120_v == std::string ("simPrimalRestrictSelection")))
  {
    {
      return (int)154;
    }
  }
  {}
  if ((_9120_v == std::string ("simPrimalSelection")))
  {
    {
      return (int)155;
    }
  }
  {}
  if ((_9120_v == std::string ("simDualRestrictSelection")))
  {
    {
      return (int)142;
    }
  }
  {}
  if ((_9120_v == std::string ("simDualSelection")))
  {
    {
      return (int)143;
    }
  }
  {}
  if ((_9120_v == std::string ("simMaxIterations")))
  {
    {
      return (int)147;
    }
  }
  {}
  if ((_9120_v == std::string ("simHotstartLu")))
  {
    {
      return (int)146;
    }
  }
  {}
  if ((_9120_v == std::string ("simRefactorFreq")))
  {
    {
      return (int)156;
    }
  }
  {}
  if ((_9120_v == std::string ("simSeed")))
  {
    {
      return (int)161;
    }
  }
  {}
  if ((_9120_v == std::string ("mioMode")))
  {
    {
      return (int)81;
    }
  }
  {}
  if ((_9120_v == std::string ("logMio")))
  {
    {
      return (int)46;
    }
  }
  {}
  if ((_9120_v == std::string ("logMioFreq")))
  {
    {
      return (int)47;
    }
  }
  {}
  if ((_9120_v == std::string ("mioMaxNumRelaxs")))
  {
    {
      return (int)75;
    }
  }
  {}
  if ((_9120_v == std::string ("mioMaxNumBranches")))
  {
    {
      return (int)74;
    }
  }
  {}
  if ((_9120_v == std::string ("mioMaxNumRestarts")))
  {
    {
      return (int)76;
    }
  }
  {}
  if ((_9120_v == std::string ("mioMaxNumRootCutRounds")))
  {
    {
      return (int)77;
    }
  }
  {}
  if ((_9120_v == std::string ("mioMaxNumSolutions")))
  {
    {
      return (int)78;
    }
  }
  {}
  if ((_9120_v == std::string ("mioNodeSelection")))
  {
    {
      return (int)83;
    }
  }
  {}
  if ((_9120_v == std::string ("mioVarSelection")))
  {
    {
      return (int)96;
    }
  }
  {}
  if ((_9120_v == std::string ("mioMinRel")))
  {
    {
      return (int)80;
    }
  }
  {}
  if ((_9120_v == std::string ("mioHeuristicLevel")))
  {
    {
      return (int)72;
    }
  }
  {}
  if ((_9120_v == std::string ("mioProbingLevel")))
  {
    {
      return (int)88;
    }
  }
  {}
  if ((_9120_v == std::string ("mioSymmetryLevel")))
  {
    {
      return (int)95;
    }
  }
  {}
  if ((_9120_v == std::string ("mioDualRayAnalysisLevel")))
  {
    {
      return (int)70;
    }
  }
  {}
  if ((_9120_v == std::string ("mioConflictAnalysisLevel")))
  {
    {
      return (int)58;
    }
  }
  {}
  if ((_9120_v == std::string ("mioPresolveAggregatorUse")))
  {
    {
      return (int)87;
    }
  }
  {}
  if ((_9120_v == std::string ("mioNumericalEmphasisLevel")))
  {
    {
      return (int)84;
    }
  }
  {}
  if ((_9120_v == std::string ("mioMemoryEmphasisLevel")))
  {
    {
      return (int)79;
    }
  }
  {}
  if ((_9120_v == std::string ("mioCutSelectionLevel")))
  {
    {
      return (int)68;
    }
  }
  {}
  if ((_9120_v == std::string ("mioVbDetectionLevel")))
  {
    {
      return (int)97;
    }
  }
  {}
  if ((_9120_v == std::string ("mioBranchDir")))
  {
    {
      return (int)57;
    }
  }
  {}
  if ((_9120_v == std::string ("mioRootOptimizer")))
  {
    {
      return (int)93;
    }
  }
  {}
  if ((_9120_v == std::string ("mioNodeOptimizer")))
  {
    {
      return (int)82;
    }
  }
  {}
  if ((_9120_v == std::string ("mioPerspectiveReformulate")))
  {
    {
      return (int)86;
    }
  }
  {}
  if ((_9120_v == std::string ("mioPropagateObjectiveConstraint")))
  {
    {
      return (int)89;
    }
  }
  {}
  if ((_9120_v == std::string ("mioSeed")))
  {
    {
      return (int)94;
    }
  }
  {}
  if ((_9120_v == std::string ("mioConicOuterApproximation")))
  {
    {
      return (int)59;
    }
  }
  {}
  if ((_9120_v == std::string ("mioQcqoReformulationMethod")))
  {
    {
      return (int)90;
    }
  }
  {}
  if ((_9120_v == std::string ("mioDataPermutationMethod")))
  {
    {
      return (int)69;
    }
  }
  {}
  if ((_9120_v == std::string ("readAsync")))
  {
    {
      return (int)127;
    }
  }
  {}
  if ((_9120_v == std::string ("writeAsync")))
  {
    {
      return (int)168;
    }
  }
  {}
  if ((_9120_v == std::string ("readKeepFreeCon")))
  {
    {
      return (int)129;
    }
  }
  {}
  if ((_9120_v == std::string ("readMpsFormat")))
  {
    {
      return (int)130;
    }
  }
  {}
  if ((_9120_v == std::string ("writeMpsFormat")))
  {
    {
      return (int)182;
    }
  }
  {}
  if ((_9120_v == std::string ("readMpsWidth")))
  {
    {
      return (int)131;
    }
  }
  {}
  if ((_9120_v == std::string ("readDebug")))
  {
    {
      return (int)128;
    }
  }
  {}
  if ((_9120_v == std::string ("writeFreeCon")))
  {
    {
      return (int)173;
    }
  }
  {}
  if ((_9120_v == std::string ("writeGenericNames")))
  {
    {
      return (int)174;
    }
  }
  {}
  if ((_9120_v == std::string ("writeCompression")))
  {
    {
      return (int)172;
    }
  }
  {}
  if ((_9120_v == std::string ("writeMpsInt")))
  {
    {
      return (int)183;
    }
  }
  {}
  if ((_9120_v == std::string ("writeLpLineWidth")))
  {
    {
      return (int)181;
    }
  }
  {}
  if ((_9120_v == std::string ("writeLpFullObj")))
  {
    {
      return (int)180;
    }
  }
  {}
  if ((_9120_v == std::string ("writeJsonIndentation")))
  {
    {
      return (int)179;
    }
  }
  {}
  if ((_9120_v == std::string ("writeSolIgnoreInvalidNames")))
  {
    {
      return (int)187;
    }
  }
  {}
  if ((_9120_v == std::string ("writeSolHead")))
  {
    {
      return (int)186;
    }
  }
  {}
  if ((_9120_v == std::string ("writeSolConstraints")))
  {
    {
      return (int)185;
    }
  }
  {}
  if ((_9120_v == std::string ("writeSolVariables")))
  {
    {
      return (int)188;
    }
  }
  {}
  if ((_9120_v == std::string ("writeSolBarvariables")))
  {
    {
      return (int)184;
    }
  }
  {}
  if ((_9120_v == std::string ("writeBasHead")))
  {
    {
      return (int)170;
    }
  }
  {}
  if ((_9120_v == std::string ("writeBasConstraints")))
  {
    {
      return (int)169;
    }
  }
  {}
  if ((_9120_v == std::string ("writeBasVariables")))
  {
    {
      return (int)171;
    }
  }
  {}
  if ((_9120_v == std::string ("writeIntHead")))
  {
    {
      return (int)177;
    }
  }
  {}
  if ((_9120_v == std::string ("writeIntConstraints")))
  {
    {
      return (int)176;
    }
  }
  {}
  if ((_9120_v == std::string ("writeIntVariables")))
  {
    {
      return (int)178;
    }
  }
  {}
  if ((_9120_v == std::string ("solReadNameWidth")))
  {
    {
      return (int)165;
    }
  }
  {}
  if ((_9120_v == std::string ("solReadWidth")))
  {
    {
      return (int)166;
    }
  }
  {}
  if ((_9120_v == std::string ("infeasReportAuto")))
  {
    {
      return (int)15;
    }
  }
  {}
  if ((_9120_v == std::string ("infeasReportLevel")))
  {
    {
      return (int)16;
    }
  }
  {}
  if ((_9120_v == std::string ("infeasGenericNames")))
  {
    {
      return (int)14;
    }
  }
  {}
  if ((_9120_v == std::string ("logInfeasAna")))
  {
    {
      return (int)43;
    }
  }
  {}
  if ((_9120_v == std::string ("licenseWait")))
  {
    {
      return (int)33;
    }
  }
  {}
  if ((_9120_v == std::string ("licenseSuppressExpireWrns")))
  {
    {
      return (int)31;
    }
  }
  {}
  if ((_9120_v == std::string ("licensePauseTime")))
  {
    {
      return (int)30;
    }
  }
  {}
  if ((_9120_v == std::string ("licenseDebug")))
  {
    {
      return (int)29;
    }
  }
  {}
  if ((_9120_v == std::string ("solFilterKeepBasic")))
  {
    {
      return (int)164;
    }
  }
  {}
  if ((_9120_v == std::string ("log")))
  {
    {
      return (int)34;
    }
  }
  {}
  if ((_9120_v == std::string ("logExpand")))
  {
    {
      return (int)39;
    }
  }
  {}
  if ((_9120_v == std::string ("logFile")))
  {
    {
      return (int)41;
    }
  }
  {}
  if ((_9120_v == std::string ("logOrder")))
  {
    {
      return (int)48;
    }
  }
  {}
  if ((_9120_v == std::string ("logSensitivity")))
  {
    {
      return (int)50;
    }
  }
  {}
  if ((_9120_v == std::string ("logSensitivityOpt")))
  {
    {
      return (int)51;
    }
  }
  {}
  if ((_9120_v == std::string ("readTaskIgnoreParam")))
  {
    {
      return (int)132;
    }
  }
  {}
  if ((_9120_v == std::string ("paramReadCaseName")))
  {
    {
      return (int)111;
    }
  }
  {}
  if ((_9120_v == std::string ("paramReadIgnError")))
  {
    {
      return (int)112;
    }
  }
  {}
  if ((_9120_v == std::string ("simScaling")))
  {
    {
      return (int)159;
    }
  }
  {}
  if ((_9120_v == std::string ("simScalingMethod")))
  {
    {
      return (int)160;
    }
  }
  {}
  if ((_9120_v == std::string ("simPrimalPhaseoneMethod")))
  {
    {
      return (int)153;
    }
  }
  {}
  if ((_9120_v == std::string ("simDualPhaseoneMethod")))
  {
    {
      return (int)141;
    }
  }
  {}
  if ((_9120_v == std::string ("simMaxNumSetbacks")))
  {
    {
      return (int)148;
    }
  }
  {}
  if ((_9120_v == std::string ("simHotstart")))
  {
    {
      return (int)145;
    }
  }
  {}
  if ((_9120_v == std::string ("simBasisFactorUse")))
  {
    {
      return (int)137;
    }
  }
  {}
  if ((_9120_v == std::string ("simPrecisionBoost")))
  {
    {
      return (int)151;
    }
  }
  {}
  if ((_9120_v == std::string ("simDegen")))
  {
    {
      return (int)138;
    }
  }
  {}
  if ((_9120_v == std::string ("simReformulation")))
  {
    {
      return (int)157;
    }
  }
  {}
  if ((_9120_v == std::string ("simExploitDupvec")))
  {
    {
      return (int)144;
    }
  }
  {}
  if ((_9120_v == std::string ("simSaveLu")))
  {
    {
      return (int)158;
    }
  }
  {}
  if ((_9120_v == std::string ("simNonSingular")))
  {
    {
      return (int)149;
    }
  }
  {}
  if ((_9120_v == std::string ("simDualCrash")))
  {
    {
      return (int)140;
    }
  }
  {}
  if ((_9120_v == std::string ("logStorage")))
  {
    {
      return (int)55;
    }
  }
  {}
  if ((_9120_v == std::string ("opfWriteLineLength")))
  {
    {
      return (int)103;
    }
  }
  {}
  if ((_9120_v == std::string ("opfWriteHints")))
  {
    {
      return (int)102;
    }
  }
  {}
  if ((_9120_v == std::string ("opfWriteParameters")))
  {
    {
      return (int)104;
    }
  }
  {}
  if ((_9120_v == std::string ("opfWriteProblem")))
  {
    {
      return (int)105;
    }
  }
  {}
  if ((_9120_v == std::string ("opfWriteHeader")))
  {
    {
      return (int)101;
    }
  }
  {}
  if ((_9120_v == std::string ("opfWriteSolutions")))
  {
    {
      return (int)109;
    }
  }
  {}
  if ((_9120_v == std::string ("opfWriteSolBas")))
  {
    {
      return (int)106;
    }
  }
  {}
  if ((_9120_v == std::string ("opfWriteSolItg")))
  {
    {
      return (int)107;
    }
  }
  {}
  if ((_9120_v == std::string ("opfWriteSolItr")))
  {
    {
      return (int)108;
    }
  }
  {}
  if ((_9120_v == std::string ("ptfWriteTransform")))
  {
    {
      return (int)126;
    }
  }
  {}
  if ((_9120_v == std::string ("ptfWriteSolutions")))
  {
    {
      return (int)125;
    }
  }
  {}
  if ((_9120_v == std::string ("ptfWriteParameters")))
  {
    {
      return (int)123;
    }
  }
  {}
  if ((_9120_v == std::string ("ptfWriteSinglePsdTerms")))
  {
    {
      return (int)124;
    }
  }
  {}
  if ((_9120_v == std::string ("primalRepairOptimizer")))
  {
    {
      return (int)122;
    }
  }
  {}
  if ((_9120_v == std::string ("mioCutCmir")))
  {
    {
      return (int)63;
    }
  }
  {}
  if ((_9120_v == std::string ("mioCutClique")))
  {
    {
      return (int)62;
    }
  }
  {}
  if ((_9120_v == std::string ("mioCutImpliedBound")))
  {
    {
      return (int)65;
    }
  }
  {}
  if ((_9120_v == std::string ("mioCutKnapsackCover")))
  {
    {
      return (int)66;
    }
  }
  {}
  if ((_9120_v == std::string ("mioCutGmi")))
  {
    {
      return (int)64;
    }
  }
  {}
  if ((_9120_v == std::string ("mioCutLipro")))
  {
    {
      return (int)67;
    }
  }
  {}
  if ((_9120_v == std::string ("sensitivityType")))
  {
    {
      return (int)136;
    }
  }
  {}
  if ((_9120_v == std::string ("mioConstructSol")))
  {
    {
      return (int)60;
    }
  }
  {}
  if ((_9120_v == std::string ("presolveLindepRelWorkTrh")))
  {
    {
      return (int)117;
    }
  }
  {}
  if ((_9120_v == std::string ("presolveLindepAbsWorkTrh")))
  {
    {
      return (int)115;
    }
  }
  {}
  if ((_9120_v == std::string ("sensitivityAll")))
  {
    {
      return (int)135;
    }
  }
  {}
  if ((_9120_v == std::string ("logFeasRepair")))
  {
    {
      return (int)40;
    }
  }
  {}
  if ((_9120_v == std::string ("cacheLicense")))
  {
    {
      return (int)9;
    }
  }
  {}
  if ((_9120_v == std::string ("intpntRegularizationUse")))
  {
    {
      return (int)25;
    }
  }
  {}
  if ((_9120_v == std::string ("simSolveForm")))
  {
    {
      return (int)162;
    }
  }
  {}
  if ((_9120_v == std::string ("simSwitchOptimizer")))
  {
    {
      return (int)163;
    }
  }
  {}
  if ((_9120_v == std::string ("writeIgnoreIncompatibleItems")))
  {
    {
      return (int)175;
    }
  }
  {}
  if ((_9120_v == std::string ("autoSortABeforeOpt")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9120_v == std::string ("anaSolBasis")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9120_v == std::string ("anaSolPrintViolated")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9120_v == std::string ("basisSolveUsePlusOne")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9120_v == std::string ("compressStatfile")))
  {
    {
      return (int)10;
    }
  }
  {}
  if ((_9120_v == std::string ("mioRinsMaxNodes")))
  {
    {
      return (int)92;
    }
  }
  {}
  if ((_9120_v == std::string ("mioRensMaxNodes")))
  {
    {
      return (int)91;
    }
  }
  {}
  if ((_9120_v == std::string ("mioCrossoverMaxNodes")))
  {
    {
      return (int)61;
    }
  }
  {}
  if ((_9120_v == std::string ("mioOptFaceMaxNodes")))
  {
    {
      return (int)85;
    }
  }
  {}
  if ((_9120_v == std::string ("mioFeaspumpLevel")))
  {
    {
      return (int)71;
    }
  }
  {}
  if ((_9120_v == std::string ("mioIndependentBlockLevel")))
  {
    {
      return (int)73;
    }
  }
  {}
  if ((_9120_v == std::string ("ng")))
  {
    {
      return (int)99;
    }
  }
  {}
  if ((_9120_v == std::string ("remoteUseCompression")))
  {
    {
      return (int)133;
    }
  }
  {}
  if ((_9120_v == std::string ("getdualConvertLmis")))
  {
    {
      return (int)12;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_iparam_value

// Begin mosek.fusion.Parameters.string_to_iomode_value
// Method mosek.fusion.Parameters.string_to_iomode_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:936:0-942:1
int32_t mosek::fusion::p_Parameters::string_to_iomode_value(const std::string & _9121_v)
{
  if ((_9121_v == std::string ("read")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9121_v == std::string ("write")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9121_v == std::string ("readwrite")))
  {
    {
      return (int)2;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_iomode_value

// Begin mosek.fusion.Parameters.string_to_internal_iinf_value
// Method mosek.fusion.Parameters.string_to_internal_iinf_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:785:0-935:1
int32_t mosek::fusion::p_Parameters::string_to_internal_iinf_value(const std::string & _9122_v)
{
  if ((_9122_v == std::string ("versionMajor")))
  {
    {
      return (int)144;
    }
  }
  {}
  if ((_9122_v == std::string ("versionMinor")))
  {
    {
      return (int)145;
    }
  }
  {}
  if ((_9122_v == std::string ("versionRevision")))
  {
    {
      return (int)146;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveLindepWork")))
  {
    {
      return (int)79;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveLindepPivots")))
  {
    {
      return (int)77;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveLindepSkipped")))
  {
    {
      return (int)78;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumPrimalLinDepAttempts")))
  {
    {
      return (int)85;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumPrimalLinDepSuccessAttempts")))
  {
    {
      return (int)86;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumDualLinDepAttempts")))
  {
    {
      return (int)81;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumDualLinDepSuccessAttempts")))
  {
    {
      return (int)82;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveOutofspace")))
  {
    {
      return (int)104;
    }
  }
  {}
  if ((_9122_v == std::string ("optObjectiveSense")))
  {
    {
      return (int)49;
    }
  }
  {}
  if ((_9122_v == std::string ("optimizer")))
  {
    {
      return (int)50;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFirRefIter")))
  {
    {
      return (int)28;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumRefSteps")))
  {
    {
      return (int)33;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorSchurNumDup")))
  {
    {
      return (int)26;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorSchurNumBlk")))
  {
    {
      return (int)25;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorSchurMinBlkDim")))
  {
    {
      return (int)24;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorSchurMaxBlkDim")))
  {
    {
      return (int)23;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorSchurNumSingular")))
  {
    {
      return (int)27;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorDim")))
  {
    {
      return (int)13;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorLDim")))
  {
    {
      return (int)14;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorOrderMlLNumDense")))
  {
    {
      return (int)22;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorOrderMlLMaxHeight")))
  {
    {
      return (int)21;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorOrderGpLMaxHeight")))
  {
    {
      return (int)20;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorNumDenseA")))
  {
    {
      return (int)16;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorNumDenseADup")))
  {
    {
      return (int)17;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorNumDenseW")))
  {
    {
      return (int)18;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumcon")))
  {
    {
      return (int)40;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumvar")))
  {
    {
      return (int)47;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumbarvar")))
  {
    {
      return (int)34;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumblo")))
  {
    {
      return (int)37;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumbup")))
  {
    {
      return (int)39;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumbfr")))
  {
    {
      return (int)35;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumbfx")))
  {
    {
      return (int)36;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumcone")))
  {
    {
      return (int)41;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumconevar")))
  {
    {
      return (int)42;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumbndcone")))
  {
    {
      return (int)38;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumrqcones")))
  {
    {
      return (int)46;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumqcones")))
  {
    {
      return (int)45;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumpexpcones")))
  {
    {
      return (int)43;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntNumppowcones")))
  {
    {
      return (int)44;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntMinconedim")))
  {
    {
      return (int)32;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntMaxconedim")))
  {
    {
      return (int)31;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntMaxbarvardim")))
  {
    {
      return (int)30;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumcon")))
  {
    {
      return (int)93;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumcfr")))
  {
    {
      return (int)89;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumcfx")))
  {
    {
      return (int)90;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumclo")))
  {
    {
      return (int)91;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumcup")))
  {
    {
      return (int)95;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumcra")))
  {
    {
      return (int)94;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumcnl")))
  {
    {
      return (int)92;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumvar")))
  {
    {
      return (int)97;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumvfr")))
  {
    {
      return (int)98;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumvfx")))
  {
    {
      return (int)99;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumvlo")))
  {
    {
      return (int)100;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumvup")))
  {
    {
      return (int)103;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumvra")))
  {
    {
      return (int)102;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumvnl")))
  {
    {
      return (int)101;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumnza")))
  {
    {
      return (int)96;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumcon")))
  {
    {
      return (int)60;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumcfr")))
  {
    {
      return (int)56;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumcfx")))
  {
    {
      return (int)57;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumclo")))
  {
    {
      return (int)58;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumcup")))
  {
    {
      return (int)62;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumcra")))
  {
    {
      return (int)61;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumcnl")))
  {
    {
      return (int)59;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumvar")))
  {
    {
      return (int)64;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumvfr")))
  {
    {
      return (int)65;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumvfx")))
  {
    {
      return (int)66;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumvlo")))
  {
    {
      return (int)67;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumvup")))
  {
    {
      return (int)70;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumvra")))
  {
    {
      return (int)69;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumvnl")))
  {
    {
      return (int)68;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveFnumnza")))
  {
    {
      return (int)63;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumElimns")))
  {
    {
      return (int)84;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveEliNumTries")))
  {
    {
      return (int)55;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveEliNumFreedCon")))
  {
    {
      return (int)53;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveEliNumFreedConTotal")))
  {
    {
      return (int)54;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveLindepNumTries")))
  {
    {
      return (int)75;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumPrimalLinDeps")))
  {
    {
      return (int)87;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumDualLinDeps")))
  {
    {
      return (int)83;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveForceConNum")))
  {
    {
      return (int)71;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveForceConNumVar")))
  {
    {
      return (int)72;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveForceVarNum")))
  {
    {
      return (int)73;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveForceVarNumCon")))
  {
    {
      return (int)74;
    }
  }
  {}
  if ((_9122_v == std::string ("presolvePivOnConNum")))
  {
    {
      return (int)105;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumDouBlocks")))
  {
    {
      return (int)80;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveNumSimplifiedDouBlocks")))
  {
    {
      return (int)88;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveSizeSimplifiedDouBlocks")))
  {
    {
      return (int)106;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveAccNumDupVarInNrmtwo")))
  {
    {
      return (int)52;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveAccNumDoubletonChainInNrmtwo")))
  {
    {
      return (int)51;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorNum")))
  {
    {
      return (int)15;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntFactorNumSolve")))
  {
    {
      return (int)19;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexPrimalHotstartNumBasics")))
  {
    {
      return (int)134;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexPrimalHotstartBasisRank")))
  {
    {
      return (int)133;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexDualHotstartNumBasics")))
  {
    {
      return (int)128;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexDualHotstartBasisRank")))
  {
    {
      return (int)127;
    }
  }
  {}
  if ((_9122_v == std::string ("intpntGpOrderEmployed")))
  {
    {
      return (int)29;
    }
  }
  {}
  if ((_9122_v == std::string ("numLuFactorizations")))
  {
    {
      return (int)48;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexPwlNumPotential")))
  {
    {
      return (int)140;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexPwlNumUsed")))
  {
    {
      return (int)141;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexPwlNumVariables")))
  {
    {
      return (int)142;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexPwlMinNumBreakpoints")))
  {
    {
      return (int)139;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexPwlMaxNumBreakpoints")))
  {
    {
      return (int)137;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexPwlMaxNz")))
  {
    {
      return (int)138;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexPwlNzReduction")))
  {
    {
      return (int)143;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexNumSetbacks")))
  {
    {
      return (int)131;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexPrimalNumSetbacks")))
  {
    {
      return (int)135;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexDualNumSetbacks")))
  {
    {
      return (int)129;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexPrimalFeasNa")))
  {
    {
      return (int)132;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexDualFeasNa")))
  {
    {
      return (int)126;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexPrimalObjNa")))
  {
    {
      return (int)136;
    }
  }
  {}
  if ((_9122_v == std::string ("simplexDualObjNa")))
  {
    {
      return (int)130;
    }
  }
  {}
  if ((_9122_v == std::string ("simNumPrimalBoundswaps")))
  {
    {
      return (int)125;
    }
  }
  {}
  if ((_9122_v == std::string ("simNumDualBoundswaps")))
  {
    {
      return (int)123;
    }
  }
  {}
  if ((_9122_v == std::string ("simNumDualIntegerPivots")))
  {
    {
      return (int)124;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyNumRow")))
  {
    {
      return (int)117;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyNumVar")))
  {
    {
      return (int)118;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyPNumNullRow")))
  {
    {
      return (int)119;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyPNumSingletonCol")))
  {
    {
      return (int)120;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyCrashL11NumRow")))
  {
    {
      return (int)107;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyCrashL22NumRow")))
  {
    {
      return (int)108;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyCrashL33NumRow")))
  {
    {
      return (int)110;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyCrashL33NumCol")))
  {
    {
      return (int)109;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyCrashSingularity")))
  {
    {
      return (int)111;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyPrimalNumBypass")))
  {
    {
      return (int)122;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyPrimalInitNumSuperBasics")))
  {
    {
      return (int)121;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyDualNumBypass")))
  {
    {
      return (int)116;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyDualInitNumSuperBasics")))
  {
    {
      return (int)115;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyDualInitNumBasisRowSingletons")))
  {
    {
      return (int)113;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyDualInitNumBasisColSingletons")))
  {
    {
      return (int)112;
    }
  }
  {}
  if ((_9122_v == std::string ("purifyDualInitNumSuperBasicRowSingletons")))
  {
    {
      return (int)114;
    }
  }
  {}
  if ((_9122_v == std::string ("biPrimalInfo")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9122_v == std::string ("biDualInfo")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9122_v == std::string ("biPrimalFeasInfo")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9122_v == std::string ("biDualFeasInfo")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9122_v == std::string ("presolveLindepNumTruncTries")))
  {
    {
      return (int)76;
    }
  }
  {}
  if ((_9122_v == std::string ("foldingNumvarBefore")))
  {
    {
      return (int)11;
    }
  }
  {}
  if ((_9122_v == std::string ("foldingNumvarAfter")))
  {
    {
      return (int)10;
    }
  }
  {}
  if ((_9122_v == std::string ("foldingNumconBefore")))
  {
    {
      return (int)9;
    }
  }
  {}
  if ((_9122_v == std::string ("foldingNumconAfter")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9122_v == std::string ("foldingStatus")))
  {
    {
      return (int)12;
    }
  }
  {}
  if ((_9122_v == std::string ("foldingBiPrimalFeasInfoIsValid")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9122_v == std::string ("foldingBiPrimalObjInfoIsValid")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9122_v == std::string ("foldingBiDualFeasInfoIsValid")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9122_v == std::string ("foldingBiDualObjInfoIsValid")))
  {
    {
      return (int)5;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_internal_iinf_value

// Begin mosek.fusion.Parameters.string_to_internal_dinf_value
// Method mosek.fusion.Parameters.string_to_internal_dinf_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:678:0-784:1
int32_t mosek::fusion::p_Parameters::string_to_internal_dinf_value(const std::string & _9123_v)
{
  if ((_9123_v == std::string ("sensitivityPrimalTime")))
  {
    {
      return (int)97;
    }
  }
  {}
  if ((_9123_v == std::string ("sensitivityDualTime")))
  {
    {
      return (int)96;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntGfeas")))
  {
    {
      return (int)72;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntMu")))
  {
    {
      return (int)79;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntInitIterTime")))
  {
    {
      return (int)74;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorTime")))
  {
    {
      return (int)70;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntInitSearchTime")))
  {
    {
      return (int)75;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFormSearchTime")))
  {
    {
      return (int)71;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntCorrectorTime")))
  {
    {
      return (int)17;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntUpdateTime")))
  {
    {
      return (int)84;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSetupTime")))
  {
    {
      return (int)63;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSchurTime")))
  {
    {
      return (int)56;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorHatSchurTime")))
  {
    {
      return (int)53;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorHatSchurPushTime")))
  {
    {
      return (int)52;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorHatSchurPullTime")))
  {
    {
      return (int)50;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurTime")))
  {
    {
      return (int)22;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurDeTabTime")))
  {
    {
      return (int)18;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurSpTabTime")))
  {
    {
      return (int)21;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSparseLTime")))
  {
    {
      return (int)67;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSparseLUpdateLastTime")))
  {
    {
      return (int)69;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSparseLFactorLastTime")))
  {
    {
      return (int)65;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseLTime")))
  {
    {
      return (int)45;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseTime")))
  {
    {
      return (int)46;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseDotaTime")))
  {
    {
      return (int)33;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseDotaSolveTime")))
  {
    {
      return (int)32;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseDotatdotaTime")))
  {
    {
      return (int)35;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseDotlInitTime")))
  {
    {
      return (int)42;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseDotlFactorTime")))
  {
    {
      return (int)41;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurUpdateTime")))
  {
    {
      return (int)30;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurUpdateCompressedETime")))
  {
    {
      return (int)23;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurUpdateSparseTime")))
  {
    {
      return (int)29;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurUpdateSparseSyr2kTime")))
  {
    {
      return (int)28;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurUpdateSparseDotTime")))
  {
    {
      return (int)27;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurUpdateDenseTime")))
  {
    {
      return (int)26;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurUpdateDenseSyr2kTime")))
  {
    {
      return (int)25;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurUpdateDenseDotTime")))
  {
    {
      return (int)24;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurPushTime")))
  {
    {
      return (int)20;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntIterNonCorrectorFlops")))
  {
    {
      return (int)76;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntIterOneCorrectorFlops")))
  {
    {
      return (int)77;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntSolveTime")))
  {
    {
      return (int)83;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntIterRefTime")))
  {
    {
      return (int)78;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntSolveSparseLTime")))
  {
    {
      return (int)82;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntSolveDenseLTime")))
  {
    {
      return (int)81;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSetupFlops")))
  {
    {
      return (int)58;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSetupHatSchurFlops")))
  {
    {
      return (int)61;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSchurFlops")))
  {
    {
      return (int)55;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorHatSchurFlops")))
  {
    {
      return (int)48;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorHatSchurPushFlops")))
  {
    {
      return (int)51;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorHatSchurPullFlops")))
  {
    {
      return (int)49;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorBarSchurFlops")))
  {
    {
      return (int)19;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSparseLFlops")))
  {
    {
      return (int)66;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorMlOrderSparseLFlops")))
  {
    {
      return (int)54;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorGpOrderSparseLFlops")))
  {
    {
      return (int)47;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSparseLUpdateLastFlops")))
  {
    {
      return (int)68;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSparseLFactorLastFlops")))
  {
    {
      return (int)64;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseLFlops")))
  {
    {
      return (int)44;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseFlops")))
  {
    {
      return (int)43;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseDotaFlops")))
  {
    {
      return (int)31;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseDotatdotaFlops")))
  {
    {
      return (int)34;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseDotlFactor_initFlops")))
  {
    {
      return (int)39;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseDotlFactorFlops")))
  {
    {
      return (int)40;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseDotl11FactorFlops")))
  {
    {
      return (int)36;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseDotl21FactorFlops")))
  {
    {
      return (int)37;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorDenseDotl22FactorFlops")))
  {
    {
      return (int)38;
    }
  }
  {}
  if ((_9123_v == std::string ("presolvePrimalLinDepTime")))
  {
    {
      return (int)91;
    }
  }
  {}
  if ((_9123_v == std::string ("presolveDualLinDepTime")))
  {
    {
      return (int)87;
    }
  }
  {}
  if ((_9123_v == std::string ("presolveAcoltTime")))
  {
    {
      return (int)85;
    }
  }
  {}
  if ((_9123_v == std::string ("presolveSetupTime")))
  {
    {
      return (int)92;
    }
  }
  {}
  if ((_9123_v == std::string ("presolveCheckproTime")))
  {
    {
      return (int)86;
    }
  }
  {}
  if ((_9123_v == std::string ("presolveDupconTime")))
  {
    {
      return (int)88;
    }
  }
  {}
  if ((_9123_v == std::string ("presolveDupvarTime")))
  {
    {
      return (int)89;
    }
  }
  {}
  if ((_9123_v == std::string ("presolveFinalTime")))
  {
    {
      return (int)90;
    }
  }
  {}
  if ((_9123_v == std::string ("presolveSubDomvarTime")))
  {
    {
      return (int)93;
    }
  }
  {}
  if ((_9123_v == std::string ("presolveSubRelaxTime")))
  {
    {
      return (int)94;
    }
  }
  {}
  if ((_9123_v == std::string ("primalSimplexInftime")))
  {
    {
      return (int)95;
    }
  }
  {}
  if ((_9123_v == std::string ("dualSimplexInftime")))
  {
    {
      return (int)10;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntGpOrderSavedFlops")))
  {
    {
      return (int)73;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSetupDetectDenseTime")))
  {
    {
      return (int)57;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSetupMlOrderTime")))
  {
    {
      return (int)62;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSetupGpOrderTime")))
  {
    {
      return (int)60;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntFactorSetupGpOrderPostTime")))
  {
    {
      return (int)59;
    }
  }
  {}
  if ((_9123_v == std::string ("biInitTime")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9123_v == std::string ("biFactorTime")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9123_v == std::string ("biFactorWork")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9123_v == std::string ("biPrimalDone")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9123_v == std::string ("biDualDone")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9123_v == std::string ("simplexBasiscondition")))
  {
    {
      return (int)98;
    }
  }
  {}
  if ((_9123_v == std::string ("simplexPrimalObj")))
  {
    {
      return (int)102;
    }
  }
  {}
  if ((_9123_v == std::string ("simplexPrimalFeas")))
  {
    {
      return (int)101;
    }
  }
  {}
  if ((_9123_v == std::string ("simplexDualObj")))
  {
    {
      return (int)100;
    }
  }
  {}
  if ((_9123_v == std::string ("simplexDualFeas")))
  {
    {
      return (int)99;
    }
  }
  {}
  if ((_9123_v == std::string ("biInitialBasisCond")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9123_v == std::string ("biPrimalObj")))
  {
    {
      return (int)9;
    }
  }
  {}
  if ((_9123_v == std::string ("biDualObj")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9123_v == std::string ("biPrimalFeas")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9123_v == std::string ("biDualFeas")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9123_v == std::string ("intpntPurifyTime")))
  {
    {
      return (int)80;
    }
  }
  {}
  if ((_9123_v == std::string ("foldingUniqueNzRatio")))
  {
    {
      return (int)16;
    }
  }
  {}
  if ((_9123_v == std::string ("foldingBiCrashTime")))
  {
    {
      return (int)11;
    }
  }
  {}
  if ((_9123_v == std::string ("foldingBiOptimizerPrimalFeas")))
  {
    {
      return (int)14;
    }
  }
  {}
  if ((_9123_v == std::string ("foldingBiOptimizerPrimalObj")))
  {
    {
      return (int)15;
    }
  }
  {}
  if ((_9123_v == std::string ("foldingBiOptimizerDualFeas")))
  {
    {
      return (int)12;
    }
  }
  {}
  if ((_9123_v == std::string ("foldingBiOptimizerDualObj")))
  {
    {
      return (int)13;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_internal_dinf_value

// Begin mosek.fusion.Parameters.string_to_inftype_value
// Method mosek.fusion.Parameters.string_to_inftype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:671:0-677:1
int32_t mosek::fusion::p_Parameters::string_to_inftype_value(const std::string & _9124_v)
{
  if ((_9124_v == std::string ("douType")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9124_v == std::string ("intType")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9124_v == std::string ("lintType")))
  {
    {
      return (int)2;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_inftype_value

// Begin mosek.fusion.Parameters.string_to_iinfitem_value
// Method mosek.fusion.Parameters.string_to_iinfitem_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:530:0-670:1
int32_t mosek::fusion::p_Parameters::string_to_iinfitem_value(const std::string & _9125_v)
{
  if ((_9125_v == std::string ("anaProNumCon")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumConLo")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumConUp")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumConRa")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumConEq")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumConFr")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumVar")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumVarLo")))
  {
    {
      return (int)12;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumVarUp")))
  {
    {
      return (int)14;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumVarRa")))
  {
    {
      return (int)13;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumVarEq")))
  {
    {
      return (int)9;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumVarFr")))
  {
    {
      return (int)10;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumVarCont")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumVarBin")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9125_v == std::string ("anaProNumVarInt")))
  {
    {
      return (int)11;
    }
  }
  {}
  if ((_9125_v == std::string ("optimizeResponse")))
  {
    {
      return (int)106;
    }
  }
  {}
  if ((_9125_v == std::string ("presolveNumPrimalPerturbations")))
  {
    {
      return (int)107;
    }
  }
  {}
  if ((_9125_v == std::string ("intpntIter")))
  {
    {
      return (int)17;
    }
  }
  {}
  if ((_9125_v == std::string ("intpntFactorDimDense")))
  {
    {
      return (int)16;
    }
  }
  {}
  if ((_9125_v == std::string ("intpntSolveDual")))
  {
    {
      return (int)19;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNodeDepth")))
  {
    {
      return (int)41;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumvar")))
  {
    {
      return (int)81;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumbin")))
  {
    {
      return (int)65;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumint")))
  {
    {
      return (int)75;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumcont")))
  {
    {
      return (int)70;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumcon")))
  {
    {
      return (int)67;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumcone")))
  {
    {
      return (int)68;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumqcones")))
  {
    {
      return (int)79;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumrqcones")))
  {
    {
      return (int)80;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumpexpcones")))
  {
    {
      return (int)77;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumdexpcones")))
  {
    {
      return (int)72;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumppowcones")))
  {
    {
      return (int)78;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumdpowcones")))
  {
    {
      return (int)74;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumconevar")))
  {
    {
      return (int)69;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumbinconevar")))
  {
    {
      return (int)66;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumintconevar")))
  {
    {
      return (int)76;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumcontconevar")))
  {
    {
      return (int)71;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumdjc")))
  {
    {
      return (int)73;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumvar")))
  {
    {
      return (int)99;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumbin")))
  {
    {
      return (int)83;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumint")))
  {
    {
      return (int)93;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumcont")))
  {
    {
      return (int)88;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumcon")))
  {
    {
      return (int)85;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumcone")))
  {
    {
      return (int)86;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumqcones")))
  {
    {
      return (int)97;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumrqcones")))
  {
    {
      return (int)98;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumpexpcones")))
  {
    {
      return (int)95;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumdexpcones")))
  {
    {
      return (int)90;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumppowcones")))
  {
    {
      return (int)96;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumdpowcones")))
  {
    {
      return (int)92;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumconevar")))
  {
    {
      return (int)87;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumbinconevar")))
  {
    {
      return (int)84;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumintconevar")))
  {
    {
      return (int)94;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumcontconevar")))
  {
    {
      return (int)89;
    }
  }
  {}
  if ((_9125_v == std::string ("mioPresolvedNumdjc")))
  {
    {
      return (int)91;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumvar")))
  {
    {
      return (int)39;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumbin")))
  {
    {
      return (int)23;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumint")))
  {
    {
      return (int)33;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumcont")))
  {
    {
      return (int)28;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumcon")))
  {
    {
      return (int)25;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumcone")))
  {
    {
      return (int)26;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumqcones")))
  {
    {
      return (int)37;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumrqcones")))
  {
    {
      return (int)38;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumpexpcones")))
  {
    {
      return (int)35;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumdexpcones")))
  {
    {
      return (int)30;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumppowcones")))
  {
    {
      return (int)36;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumdpowcones")))
  {
    {
      return (int)32;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumconevar")))
  {
    {
      return (int)27;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumbinconevar")))
  {
    {
      return (int)24;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumintconevar")))
  {
    {
      return (int)34;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumcontconevar")))
  {
    {
      return (int)29;
    }
  }
  {}
  if ((_9125_v == std::string ("mioFinalNumdjc")))
  {
    {
      return (int)31;
    }
  }
  {}
  if ((_9125_v == std::string ("mioCliqueTableSize")))
  {
    {
      return (int)21;
    }
  }
  {}
  if ((_9125_v == std::string ("mioConstructSolution")))
  {
    {
      return (int)22;
    }
  }
  {}
  if ((_9125_v == std::string ("mioInitialFeasibleSolution")))
  {
    {
      return (int)40;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumIntSolutions")))
  {
    {
      return (int)47;
    }
  }
  {}
  if ((_9125_v == std::string ("mioObjBoundDefined")))
  {
    {
      return (int)82;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumActiveNodes")))
  {
    {
      return (int)42;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumRelax")))
  {
    {
      return (int)48;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSolvedNodes")))
  {
    {
      return (int)64;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumBranch")))
  {
    {
      return (int)46;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumRestarts")))
  {
    {
      return (int)50;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumRootCutRounds")))
  {
    {
      return (int)51;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumActiveRootCuts")))
  {
    {
      return (int)43;
    }
  }
  {}
  if ((_9125_v == std::string ("mioTotalNumSelectedCuts")))
  {
    {
      return (int)101;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSelectedCmirCuts")))
  {
    {
      return (int)53;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSelectedCliqueCuts")))
  {
    {
      return (int)52;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSelectedImpliedBoundCuts")))
  {
    {
      return (int)55;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSelectedKnapsackCoverCuts")))
  {
    {
      return (int)56;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSelectedGomoryCuts")))
  {
    {
      return (int)54;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSelectedLiproCuts")))
  {
    {
      return (int)57;
    }
  }
  {}
  if ((_9125_v == std::string ("mioTotalNumSeparatedCuts")))
  {
    {
      return (int)102;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSeparatedCmirCuts")))
  {
    {
      return (int)59;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSeparatedCliqueCuts")))
  {
    {
      return (int)58;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSeparatedImpliedBoundCuts")))
  {
    {
      return (int)61;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSeparatedKnapsackCoverCuts")))
  {
    {
      return (int)62;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSeparatedGomoryCuts")))
  {
    {
      return (int)60;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumSeparatedLiproCuts")))
  {
    {
      return (int)63;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumRepeatedPresolve")))
  {
    {
      return (int)49;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumBlocksSolvedInPresolve")))
  {
    {
      return (int)45;
    }
  }
  {}
  if ((_9125_v == std::string ("mioNumBlocksSolvedInBb")))
  {
    {
      return (int)44;
    }
  }
  {}
  if ((_9125_v == std::string ("mioUserObjCut")))
  {
    {
      return (int)103;
    }
  }
  {}
  if ((_9125_v == std::string ("mioRelgapSatisfied")))
  {
    {
      return (int)100;
    }
  }
  {}
  if ((_9125_v == std::string ("mioAbsgapSatisfied")))
  {
    {
      return (int)20;
    }
  }
  {}
  if ((_9125_v == std::string ("foldingApplied")))
  {
    {
      return (int)15;
    }
  }
  {}
  if ((_9125_v == std::string ("rdProtype")))
  {
    {
      return (int)116;
    }
  }
  {}
  if ((_9125_v == std::string ("rdNumcon")))
  {
    {
      return (int)111;
    }
  }
  {}
  if ((_9125_v == std::string ("rdNumvar")))
  {
    {
      return (int)115;
    }
  }
  {}
  if ((_9125_v == std::string ("rdNumbarvar")))
  {
    {
      return (int)110;
    }
  }
  {}
  if ((_9125_v == std::string ("rdNumintvar")))
  {
    {
      return (int)113;
    }
  }
  {}
  if ((_9125_v == std::string ("rdNumq")))
  {
    {
      return (int)114;
    }
  }
  {}
  if ((_9125_v == std::string ("simDualDegIter")))
  {
    {
      return (int)117;
    }
  }
  {}
  if ((_9125_v == std::string ("simDualInfIter")))
  {
    {
      return (int)120;
    }
  }
  {}
  if ((_9125_v == std::string ("simDualHotstartLu")))
  {
    {
      return (int)119;
    }
  }
  {}
  if ((_9125_v == std::string ("simPrimalIter")))
  {
    {
      return (int)128;
    }
  }
  {}
  if ((_9125_v == std::string ("simDualIter")))
  {
    {
      return (int)121;
    }
  }
  {}
  if ((_9125_v == std::string ("intpntNumThreads")))
  {
    {
      return (int)18;
    }
  }
  {}
  if ((_9125_v == std::string ("simPrimalInfIter")))
  {
    {
      return (int)127;
    }
  }
  {}
  if ((_9125_v == std::string ("simPrimalDegIter")))
  {
    {
      return (int)124;
    }
  }
  {}
  if ((_9125_v == std::string ("simPrimalHotstart")))
  {
    {
      return (int)125;
    }
  }
  {}
  if ((_9125_v == std::string ("simPrimalHotstartLu")))
  {
    {
      return (int)126;
    }
  }
  {}
  if ((_9125_v == std::string ("simDualHotstart")))
  {
    {
      return (int)118;
    }
  }
  {}
  if ((_9125_v == std::string ("solItrProsta")))
  {
    {
      return (int)134;
    }
  }
  {}
  if ((_9125_v == std::string ("solItrSolsta")))
  {
    {
      return (int)135;
    }
  }
  {}
  if ((_9125_v == std::string ("solBasProsta")))
  {
    {
      return (int)130;
    }
  }
  {}
  if ((_9125_v == std::string ("solBasSolsta")))
  {
    {
      return (int)131;
    }
  }
  {}
  if ((_9125_v == std::string ("solItgProsta")))
  {
    {
      return (int)132;
    }
  }
  {}
  if ((_9125_v == std::string ("solItgSolsta")))
  {
    {
      return (int)133;
    }
  }
  {}
  if ((_9125_v == std::string ("simNumcon")))
  {
    {
      return (int)122;
    }
  }
  {}
  if ((_9125_v == std::string ("simNumvar")))
  {
    {
      return (int)123;
    }
  }
  {}
  if ((_9125_v == std::string ("optNumcon")))
  {
    {
      return (int)104;
    }
  }
  {}
  if ((_9125_v == std::string ("optNumvar")))
  {
    {
      return (int)105;
    }
  }
  {}
  if ((_9125_v == std::string ("stoNumARealloc")))
  {
    {
      return (int)136;
    }
  }
  {}
  if ((_9125_v == std::string ("rdNumcone")))
  {
    {
      return (int)112;
    }
  }
  {}
  if ((_9125_v == std::string ("simSolveDual")))
  {
    {
      return (int)129;
    }
  }
  {}
  if ((_9125_v == std::string ("purifyPrimalSuccess")))
  {
    {
      return (int)109;
    }
  }
  {}
  if ((_9125_v == std::string ("purifyDualSuccess")))
  {
    {
      return (int)108;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_iinfitem_value

// Begin mosek.fusion.Parameters.string_to_internal_liinf_value
// Method mosek.fusion.Parameters.string_to_internal_liinf_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:495:0-529:1
int32_t mosek::fusion::p_Parameters::string_to_internal_liinf_value(const std::string & _9126_v)
{
  if ((_9126_v == std::string ("intpntLenbarvar")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9126_v == std::string ("presolveStackSize")))
  {
    {
      return (int)9;
    }
  }
  {}
  if ((_9126_v == std::string ("intpntFactorNumNzBefore")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9126_v == std::string ("intpntFactorNumNzAfter")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9126_v == std::string ("intpntFactorGpOrderSavedNzs")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexPrimalIter")))
  {
    {
      return (int)28;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexDualIter")))
  {
    {
      return (int)10;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexDualpurifyIter")))
  {
    {
      return (int)12;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexTicks")))
  {
    {
      return (int)30;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexPrimalTicks")))
  {
    {
      return (int)29;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexDualTicks")))
  {
    {
      return (int)11;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumGradfreeze")))
  {
    {
      return (int)20;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumMovelock")))
  {
    {
      return (int)21;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumDualIllposedCer")))
  {
    {
      return (int)16;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumCand")))
  {
    {
      return (int)15;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumProgressStall")))
  {
    {
      return (int)24;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumRejectStepvalue")))
  {
    {
      return (int)26;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumRejectPivot")))
  {
    {
      return (int)25;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumSingularBases")))
  {
    {
      return (int)27;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumFatalFeasibilityLoss")))
  {
    {
      return (int)17;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumFatalGradientStall")))
  {
    {
      return (int)18;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumFatalPurificationStall")))
  {
    {
      return (int)19;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumPrematureGradscoreweightsInit")))
  {
    {
      return (int)23;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexNumPrecisionBoost")))
  {
    {
      return (int)22;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexLuFactorTicks")))
  {
    {
      return (int)13;
    }
  }
  {}
  if ((_9126_v == std::string ("simplexLuSolveTicks")))
  {
    {
      return (int)14;
    }
  }
  {}
  if ((_9126_v == std::string ("foldingTicks")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9126_v == std::string ("foldingNnzBefore")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9126_v == std::string ("foldingNnzAfter")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9126_v == std::string ("foldingNnzTouched")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9126_v == std::string ("foldingBiUnfoldIter")))
  {
    {
      return (int)0;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_internal_liinf_value

// Begin mosek.fusion.Parameters.string_to_liinfitem_value
// Method mosek.fusion.Parameters.string_to_liinfitem_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:469:0-494:1
int32_t mosek::fusion::p_Parameters::string_to_liinfitem_value(const std::string & _9127_v)
{
  if ((_9127_v == std::string ("anaProScalarizedConstraintMatrixNumRows")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9127_v == std::string ("anaProScalarizedConstraintMatrixNumColumns")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9127_v == std::string ("anaProScalarizedConstraintMatrixNumNz")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9127_v == std::string ("mioAnz")))
  {
    {
      return (int)10;
    }
  }
  {}
  if ((_9127_v == std::string ("mioPresolvedAnz")))
  {
    {
      return (int)15;
    }
  }
  {}
  if ((_9127_v == std::string ("mioFinalAnz")))
  {
    {
      return (int)11;
    }
  }
  {}
  if ((_9127_v == std::string ("mioSimplexIter")))
  {
    {
      return (int)16;
    }
  }
  {}
  if ((_9127_v == std::string ("mioIntpntIter")))
  {
    {
      return (int)12;
    }
  }
  {}
  if ((_9127_v == std::string ("mioNumPrimIllposedCer")))
  {
    {
      return (int)14;
    }
  }
  {}
  if ((_9127_v == std::string ("mioNumDualIllposedCer")))
  {
    {
      return (int)13;
    }
  }
  {}
  if ((_9127_v == std::string ("biPrimalIter")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9127_v == std::string ("biDualIter")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9127_v == std::string ("biCleanIter")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9127_v == std::string ("intpntFactorNumNz")))
  {
    {
      return (int)9;
    }
  }
  {}
  if ((_9127_v == std::string ("foldingBiPrimalIter")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9127_v == std::string ("foldingBiDualIter")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9127_v == std::string ("foldingBiOptimizerIter")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9127_v == std::string ("rdNumacc")))
  {
    {
      return (int)17;
    }
  }
  {}
  if ((_9127_v == std::string ("rdNumdjc")))
  {
    {
      return (int)19;
    }
  }
  {}
  if ((_9127_v == std::string ("rdNumanz")))
  {
    {
      return (int)18;
    }
  }
  {}
  if ((_9127_v == std::string ("rdNumqnz")))
  {
    {
      return (int)20;
    }
  }
  {}
  if ((_9127_v == std::string ("simplexIter")))
  {
    {
      return (int)21;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_liinfitem_value

// Begin mosek.fusion.Parameters.string_to_dparam_value
// Method mosek.fusion.Parameters.string_to_dparam_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:401:0-468:1
int32_t mosek::fusion::p_Parameters::string_to_dparam_value(const std::string & _9128_v)
{
  if ((_9128_v == std::string ("dataTolCjLarge")))
  {
    {
      return (int)12;
    }
  }
  {}
  if ((_9128_v == std::string ("dataTolCHuge")))
  {
    {
      return (int)11;
    }
  }
  {}
  if ((_9128_v == std::string ("dataTolAijLarge")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9128_v == std::string ("dataTolAijHuge")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9128_v == std::string ("dataSymMatTol")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9128_v == std::string ("dataSymMatTolLarge")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9128_v == std::string ("dataSymMatTolHuge")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9128_v == std::string ("dataTolBoundInf")))
  {
    {
      return (int)9;
    }
  }
  {}
  if ((_9128_v == std::string ("dataTolBoundWrn")))
  {
    {
      return (int)10;
    }
  }
  {}
  if ((_9128_v == std::string ("dataTolQij")))
  {
    {
      return (int)13;
    }
  }
  {}
  if ((_9128_v == std::string ("dataTolX")))
  {
    {
      return (int)14;
    }
  }
  {}
  if ((_9128_v == std::string ("semidefiniteTolApprox")))
  {
    {
      return (int)57;
    }
  }
  {}
  if ((_9128_v == std::string ("optimizerMaxTime")))
  {
    {
      return (int)50;
    }
  }
  {}
  if ((_9128_v == std::string ("optimizerMaxTicks")))
  {
    {
      return (int)49;
    }
  }
  {}
  if ((_9128_v == std::string ("lowerObjCut")))
  {
    {
      return (int)38;
    }
  }
  {}
  if ((_9128_v == std::string ("upperObjCut")))
  {
    {
      return (int)62;
    }
  }
  {}
  if ((_9128_v == std::string ("upperObjCutFiniteTrh")))
  {
    {
      return (int)63;
    }
  }
  {}
  if ((_9128_v == std::string ("lowerObjCutFiniteTrh")))
  {
    {
      return (int)39;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntTolRelGap")))
  {
    {
      return (int)35;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntTolStepSize")))
  {
    {
      return (int)37;
    }
  }
  {}
  if ((_9128_v == std::string ("simLuTolRelPiv")))
  {
    {
      return (int)58;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntTolRelStep")))
  {
    {
      return (int)36;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntTolPath")))
  {
    {
      return (int)32;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntTolPfeas")))
  {
    {
      return (int)33;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntTolDfeas")))
  {
    {
      return (int)28;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntTolMuRed")))
  {
    {
      return (int)31;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntTolInfeas")))
  {
    {
      return (int)30;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntCoTolRelGap")))
  {
    {
      return (int)21;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntCoTolPfeas")))
  {
    {
      return (int)20;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntCoTolDfeas")))
  {
    {
      return (int)16;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntCoTolMuRed")))
  {
    {
      return (int)18;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntCoTolNearRel")))
  {
    {
      return (int)19;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntCoTolInfeas")))
  {
    {
      return (int)17;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntQoTolRelGap")))
  {
    {
      return (int)27;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntQoTolPfeas")))
  {
    {
      return (int)26;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntQoTolDfeas")))
  {
    {
      return (int)22;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntQoTolMuRed")))
  {
    {
      return (int)24;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntQoTolNearRel")))
  {
    {
      return (int)25;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntQoTolInfeas")))
  {
    {
      return (int)23;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntTolPsafe")))
  {
    {
      return (int)34;
    }
  }
  {}
  if ((_9128_v == std::string ("intpntTolDsafe")))
  {
    {
      return (int)29;
    }
  }
  {}
  if ((_9128_v == std::string ("mioMaxTime")))
  {
    {
      return (int)42;
    }
  }
  {}
  if ((_9128_v == std::string ("mioRelGapConst")))
  {
    {
      return (int)43;
    }
  }
  {}
  if ((_9128_v == std::string ("mioTolRelGap")))
  {
    {
      return (int)48;
    }
  }
  {}
  if ((_9128_v == std::string ("mioTolAbsGap")))
  {
    {
      return (int)44;
    }
  }
  {}
  if ((_9128_v == std::string ("mioTolAbsRelaxInt")))
  {
    {
      return (int)45;
    }
  }
  {}
  if ((_9128_v == std::string ("mioDjcMaxBigm")))
  {
    {
      return (int)41;
    }
  }
  {}
  if ((_9128_v == std::string ("mioCliqueTableSizeFactor")))
  {
    {
      return (int)40;
    }
  }
  {}
  if ((_9128_v == std::string ("simPrecisionScalingNormal")))
  {
    {
      return (int)60;
    }
  }
  {}
  if ((_9128_v == std::string ("simPrecisionScalingExtended")))
  {
    {
      return (int)59;
    }
  }
  {}
  if ((_9128_v == std::string ("basisTolX")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9128_v == std::string ("basisTolS")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9128_v == std::string ("basisRelTolS")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9128_v == std::string ("presolveTolX")))
  {
    {
      return (int)55;
    }
  }
  {}
  if ((_9128_v == std::string ("presolveTolPrimalInfeasPerturbation")))
  {
    {
      return (int)52;
    }
  }
  {}
  if ((_9128_v == std::string ("presolveTolS")))
  {
    {
      return (int)54;
    }
  }
  {}
  if ((_9128_v == std::string ("presolveTolAbsLindep")))
  {
    {
      return (int)51;
    }
  }
  {}
  if ((_9128_v == std::string ("presolveTolRelLindep")))
  {
    {
      return (int)53;
    }
  }
  {}
  if ((_9128_v == std::string ("foldingTolEq")))
  {
    {
      return (int)15;
    }
  }
  {}
  if ((_9128_v == std::string ("simplexAbsTolPiv")))
  {
    {
      return (int)61;
    }
  }
  {}
  if ((_9128_v == std::string ("mioTolFeas")))
  {
    {
      return (int)46;
    }
  }
  {}
  if ((_9128_v == std::string ("anaSolInfeasTol")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9128_v == std::string ("qcqoReformulateRelDropTol")))
  {
    {
      return (int)56;
    }
  }
  {}
  if ((_9128_v == std::string ("mioTolRelDualBoundImprovement")))
  {
    {
      return (int)47;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_dparam_value

// Begin mosek.fusion.Parameters.string_to_feature_value
// Method mosek.fusion.Parameters.string_to_feature_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:395:0-400:1
int32_t mosek::fusion::p_Parameters::string_to_feature_value(const std::string & _9129_v)
{
  if ((_9129_v == std::string ("pts")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9129_v == std::string ("pton")))
  {
    {
      return (int)1;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_feature_value

// Begin mosek.fusion.Parameters.string_to_dinfitem_value
// Method mosek.fusion.Parameters.string_to_dinfitem_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:275:0-394:1
int32_t mosek::fusion::p_Parameters::string_to_dinfitem_value(const std::string & _9130_v)
{
  if ((_9130_v == std::string ("anaProScalarizedConstraintMatrixDensity")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9130_v == std::string ("biTime")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9130_v == std::string ("biPrimalTime")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9130_v == std::string ("biDualTime")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9130_v == std::string ("biCleanTime")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9130_v == std::string ("foldingBiUnfoldInitializeTime")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9130_v == std::string ("foldingBiUnfoldPrimalTime")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9130_v == std::string ("foldingBiUnfoldDualTime")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9130_v == std::string ("foldingBiOptimizeTime")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9130_v == std::string ("foldingBiUnfoldTime")))
  {
    {
      return (int)9;
    }
  }
  {}
  if ((_9130_v == std::string ("intpntTime")))
  {
    {
      return (int)19;
    }
  }
  {}
  if ((_9130_v == std::string ("intpntOrderTime")))
  {
    {
      return (int)16;
    }
  }
  {}
  if ((_9130_v == std::string ("intpntPrimalObj")))
  {
    {
      return (int)18;
    }
  }
  {}
  if ((_9130_v == std::string ("intpntDualObj")))
  {
    {
      return (int)13;
    }
  }
  {}
  if ((_9130_v == std::string ("intpntPrimalFeas")))
  {
    {
      return (int)17;
    }
  }
  {}
  if ((_9130_v == std::string ("intpntDualFeas")))
  {
    {
      return (int)12;
    }
  }
  {}
  if ((_9130_v == std::string ("intpntOptStatus")))
  {
    {
      return (int)15;
    }
  }
  {}
  if ((_9130_v == std::string ("simTime")))
  {
    {
      return (int)66;
    }
  }
  {}
  if ((_9130_v == std::string ("simPrimalTime")))
  {
    {
      return (int)65;
    }
  }
  {}
  if ((_9130_v == std::string ("simDualTime")))
  {
    {
      return (int)62;
    }
  }
  {}
  if ((_9130_v == std::string ("simObj")))
  {
    {
      return (int)64;
    }
  }
  {}
  if ((_9130_v == std::string ("simFeas")))
  {
    {
      return (int)63;
    }
  }
  {}
  if ((_9130_v == std::string ("mioTime")))
  {
    {
      return (int)47;
    }
  }
  {}
  if ((_9130_v == std::string ("mioRootPresolveTime")))
  {
    {
      return (int)43;
    }
  }
  {}
  if ((_9130_v == std::string ("mioRootOptimizerTime")))
  {
    {
      return (int)42;
    }
  }
  {}
  if ((_9130_v == std::string ("mioRootTime")))
  {
    {
      return (int)44;
    }
  }
  {}
  if ((_9130_v == std::string ("toConicTime")))
  {
    {
      return (int)114;
    }
  }
  {}
  if ((_9130_v == std::string ("mioConstructSolutionObj")))
  {
    {
      return (int)24;
    }
  }
  {}
  if ((_9130_v == std::string ("mioInitialFeasibleSolutionObj")))
  {
    {
      return (int)30;
    }
  }
  {}
  if ((_9130_v == std::string ("mioObjInt")))
  {
    {
      return (int)37;
    }
  }
  {}
  if ((_9130_v == std::string ("mioObjBound")))
  {
    {
      return (int)36;
    }
  }
  {}
  if ((_9130_v == std::string ("mioObjRelGap")))
  {
    {
      return (int)38;
    }
  }
  {}
  if ((_9130_v == std::string ("mioObjAbsGap")))
  {
    {
      return (int)35;
    }
  }
  {}
  if ((_9130_v == std::string ("mioUserObjCut")))
  {
    {
      return (int)48;
    }
  }
  {}
  if ((_9130_v == std::string ("mioCmirSeparationTime")))
  {
    {
      return (int)23;
    }
  }
  {}
  if ((_9130_v == std::string ("mioCliqueSeparationTime")))
  {
    {
      return (int)21;
    }
  }
  {}
  if ((_9130_v == std::string ("mioKnapsackCoverSeparationTime")))
  {
    {
      return (int)32;
    }
  }
  {}
  if ((_9130_v == std::string ("mioGmiSeparationTime")))
  {
    {
      return (int)27;
    }
  }
  {}
  if ((_9130_v == std::string ("mioImpliedBoundSeparationTime")))
  {
    {
      return (int)29;
    }
  }
  {}
  if ((_9130_v == std::string ("mioLiproSeparationTime")))
  {
    {
      return (int)34;
    }
  }
  {}
  if ((_9130_v == std::string ("mioRootCutSeparationTime")))
  {
    {
      return (int)41;
    }
  }
  {}
  if ((_9130_v == std::string ("mioCmirSelectionTime")))
  {
    {
      return (int)22;
    }
  }
  {}
  if ((_9130_v == std::string ("mioCliqueSelectionTime")))
  {
    {
      return (int)20;
    }
  }
  {}
  if ((_9130_v == std::string ("mioKnapsackCoverSelectionTime")))
  {
    {
      return (int)31;
    }
  }
  {}
  if ((_9130_v == std::string ("mioGmiSelectionTime")))
  {
    {
      return (int)26;
    }
  }
  {}
  if ((_9130_v == std::string ("mioImpliedBoundSelectionTime")))
  {
    {
      return (int)28;
    }
  }
  {}
  if ((_9130_v == std::string ("mioLiproSelectionTime")))
  {
    {
      return (int)33;
    }
  }
  {}
  if ((_9130_v == std::string ("mioRootCutSelectionTime")))
  {
    {
      return (int)40;
    }
  }
  {}
  if ((_9130_v == std::string ("mioProbingTime")))
  {
    {
      return (int)39;
    }
  }
  {}
  if ((_9130_v == std::string ("mioSymmetryDetectionTime")))
  {
    {
      return (int)45;
    }
  }
  {}
  if ((_9130_v == std::string ("optimizerTime")))
  {
    {
      return (int)50;
    }
  }
  {}
  if ((_9130_v == std::string ("optimizerTicks")))
  {
    {
      return (int)49;
    }
  }
  {}
  if ((_9130_v == std::string ("presolveTime")))
  {
    {
      return (int)53;
    }
  }
  {}
  if ((_9130_v == std::string ("mioSymmetryFactor")))
  {
    {
      return (int)46;
    }
  }
  {}
  if ((_9130_v == std::string ("mioDualBoundAfterPresolve")))
  {
    {
      return (int)25;
    }
  }
  {}
  if ((_9130_v == std::string ("presolveEliTime")))
  {
    {
      return (int)51;
    }
  }
  {}
  if ((_9130_v == std::string ("presolveLindepTime")))
  {
    {
      return (int)52;
    }
  }
  {}
  if ((_9130_v == std::string ("foldingTime")))
  {
    {
      return (int)11;
    }
  }
  {}
  if ((_9130_v == std::string ("foldingFactor")))
  {
    {
      return (int)10;
    }
  }
  {}
  if ((_9130_v == std::string ("readDataTime")))
  {
    {
      return (int)60;
    }
  }
  {}
  if ((_9130_v == std::string ("writeDataTime")))
  {
    {
      return (int)115;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrPrimalObj")))
  {
    {
      return (int)108;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrPviolcon")))
  {
    {
      return (int)111;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrPviolvar")))
  {
    {
      return (int)113;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrPviolbarvar")))
  {
    {
      return (int)110;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrPviolcones")))
  {
    {
      return (int)112;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrPviolacc")))
  {
    {
      return (int)109;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrDualObj")))
  {
    {
      return (int)92;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrDviolcon")))
  {
    {
      return (int)95;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrDviolvar")))
  {
    {
      return (int)97;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrDviolbarvar")))
  {
    {
      return (int)94;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrDviolcones")))
  {
    {
      return (int)96;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrDviolacc")))
  {
    {
      return (int)93;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrNrmXc")))
  {
    {
      return (int)105;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrNrmXx")))
  {
    {
      return (int)106;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrNrmBarx")))
  {
    {
      return (int)99;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrNrmY")))
  {
    {
      return (int)107;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrNrmSlc")))
  {
    {
      return (int)100;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrNrmSuc")))
  {
    {
      return (int)103;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrNrmSlx")))
  {
    {
      return (int)101;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrNrmSux")))
  {
    {
      return (int)104;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrNrmSnx")))
  {
    {
      return (int)102;
    }
  }
  {}
  if ((_9130_v == std::string ("solItrNrmBars")))
  {
    {
      return (int)98;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasPrimalObj")))
  {
    {
      return (int)78;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasPviolcon")))
  {
    {
      return (int)79;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasPviolvar")))
  {
    {
      return (int)80;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasDualObj")))
  {
    {
      return (int)67;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasDviolcon")))
  {
    {
      return (int)68;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasDviolvar")))
  {
    {
      return (int)69;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasNrmXc")))
  {
    {
      return (int)75;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasNrmXx")))
  {
    {
      return (int)76;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasNrmBarx")))
  {
    {
      return (int)70;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasNrmY")))
  {
    {
      return (int)77;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasNrmSlc")))
  {
    {
      return (int)71;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasNrmSuc")))
  {
    {
      return (int)73;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasNrmSlx")))
  {
    {
      return (int)72;
    }
  }
  {}
  if ((_9130_v == std::string ("solBasNrmSux")))
  {
    {
      return (int)74;
    }
  }
  {}
  if ((_9130_v == std::string ("solItgPrimalObj")))
  {
    {
      return (int)84;
    }
  }
  {}
  if ((_9130_v == std::string ("solItgPviolcon")))
  {
    {
      return (int)87;
    }
  }
  {}
  if ((_9130_v == std::string ("solItgPviolvar")))
  {
    {
      return (int)91;
    }
  }
  {}
  if ((_9130_v == std::string ("solItgPviolbarvar")))
  {
    {
      return (int)86;
    }
  }
  {}
  if ((_9130_v == std::string ("solItgPviolcones")))
  {
    {
      return (int)88;
    }
  }
  {}
  if ((_9130_v == std::string ("solItgPviolacc")))
  {
    {
      return (int)85;
    }
  }
  {}
  if ((_9130_v == std::string ("solItgPviolitg")))
  {
    {
      return (int)90;
    }
  }
  {}
  if ((_9130_v == std::string ("solItgPvioldjc")))
  {
    {
      return (int)89;
    }
  }
  {}
  if ((_9130_v == std::string ("solItgNrmXc")))
  {
    {
      return (int)82;
    }
  }
  {}
  if ((_9130_v == std::string ("solItgNrmXx")))
  {
    {
      return (int)83;
    }
  }
  {}
  if ((_9130_v == std::string ("solItgNrmBarx")))
  {
    {
      return (int)81;
    }
  }
  {}
  if ((_9130_v == std::string ("presolveTotalPrimalPerturbation")))
  {
    {
      return (int)54;
    }
  }
  {}
  if ((_9130_v == std::string ("intpntFactorNumFlops")))
  {
    {
      return (int)14;
    }
  }
  {}
  if ((_9130_v == std::string ("qcqoReformulateTime")))
  {
    {
      return (int)57;
    }
  }
  {}
  if ((_9130_v == std::string ("qcqoReformulateMaxPerturbation")))
  {
    {
      return (int)56;
    }
  }
  {}
  if ((_9130_v == std::string ("qcqoReformulateWorstCholeskyDiagScaling")))
  {
    {
      return (int)59;
    }
  }
  {}
  if ((_9130_v == std::string ("qcqoReformulateWorstCholeskyColumnScaling")))
  {
    {
      return (int)58;
    }
  }
  {}
  if ((_9130_v == std::string ("primalRepairPenaltyObj")))
  {
    {
      return (int)55;
    }
  }
  {}
  if ((_9130_v == std::string ("remoteTime")))
  {
    {
      return (int)61;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_dinfitem_value

// Begin mosek.fusion.Parameters.string_to_solformat_value
// Method mosek.fusion.Parameters.string_to_solformat_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:267:0-274:1
int32_t mosek::fusion::p_Parameters::string_to_solformat_value(const std::string & _9131_v)
{
  if ((_9131_v == std::string ("extension")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9131_v == std::string ("b")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9131_v == std::string ("task")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9131_v == std::string ("jsonTask")))
  {
    {
      return (int)3;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_solformat_value

// Begin mosek.fusion.Parameters.string_to_dataformat_value
// Method mosek.fusion.Parameters.string_to_dataformat_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:254:0-266:1
int32_t mosek::fusion::p_Parameters::string_to_dataformat_value(const std::string & _9132_v)
{
  if ((_9132_v == std::string ("extension")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9132_v == std::string ("mps")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9132_v == std::string ("lp")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9132_v == std::string ("op")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9132_v == std::string ("freeMps")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9132_v == std::string ("task")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9132_v == std::string ("ptf")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9132_v == std::string ("cb")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9132_v == std::string ("jsonTask")))
  {
    {
      return (int)8;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_dataformat_value

// Begin mosek.fusion.Parameters.string_to_symmattype_value
// Method mosek.fusion.Parameters.string_to_symmattype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:249:0-253:1
int32_t mosek::fusion::p_Parameters::string_to_symmattype_value(const std::string & _9133_v)
{
  if ((_9133_v == std::string ("sparse")))
  {
    {
      return (int)0;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_symmattype_value

// Begin mosek.fusion.Parameters.string_to_nametype_value
// Method mosek.fusion.Parameters.string_to_nametype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:242:0-248:1
int32_t mosek::fusion::p_Parameters::string_to_nametype_value(const std::string & _9134_v)
{
  if ((_9134_v == std::string ("gen")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9134_v == std::string ("mps")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9134_v == std::string ("lp")))
  {
    {
      return (int)2;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_nametype_value

// Begin mosek.fusion.Parameters.string_to_domaintype_value
// Method mosek.fusion.Parameters.string_to_domaintype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:225:0-241:1
int32_t mosek::fusion::p_Parameters::string_to_domaintype_value(const std::string & _9135_v)
{
  if ((_9135_v == std::string ("r")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9135_v == std::string ("rzero")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9135_v == std::string ("rplus")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9135_v == std::string ("rminus")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9135_v == std::string ("quadraticCone")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9135_v == std::string ("rquadraticCone")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9135_v == std::string ("primalExpCone")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9135_v == std::string ("dualExpCone")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9135_v == std::string ("primalPowerCone")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9135_v == std::string ("dualPowerCone")))
  {
    {
      return (int)9;
    }
  }
  {}
  if ((_9135_v == std::string ("primalGeoMeanCone")))
  {
    {
      return (int)10;
    }
  }
  {}
  if ((_9135_v == std::string ("dualGeoMeanCone")))
  {
    {
      return (int)11;
    }
  }
  {}
  if ((_9135_v == std::string ("svecPsdCone")))
  {
    {
      return (int)12;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_domaintype_value

// Begin mosek.fusion.Parameters.string_to_conetype_value
// Method mosek.fusion.Parameters.string_to_conetype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:214:0-224:1
int32_t mosek::fusion::p_Parameters::string_to_conetype_value(const std::string & _9136_v)
{
  if ((_9136_v == std::string ("quad")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9136_v == std::string ("rquad")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9136_v == std::string ("pexp")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9136_v == std::string ("dexp")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9136_v == std::string ("ppow")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9136_v == std::string ("dpow")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9136_v == std::string ("zero")))
  {
    {
      return (int)6;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_conetype_value

// Begin mosek.fusion.Parameters.string_to_compresstype_value
// Method mosek.fusion.Parameters.string_to_compresstype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:206:0-213:1
int32_t mosek::fusion::p_Parameters::string_to_compresstype_value(const std::string & _9137_v)
{
  if ((_9137_v == std::string ("none")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9137_v == std::string ("free")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9137_v == std::string ("gzip")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9137_v == std::string ("zstd")))
  {
    {
      return (int)3;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_compresstype_value

// Begin mosek.fusion.Parameters.string_to_callbackcode_value
// Method mosek.fusion.Parameters.string_to_callbackcode_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:94:0-205:1
int32_t mosek::fusion::p_Parameters::string_to_callbackcode_value(const std::string & _9138_v)
{
  if ((_9138_v == std::string ("beginRootCutgen")))
  {
    {
      return (int)29;
    }
  }
  {}
  if ((_9138_v == std::string ("imRootCutgen")))
  {
    {
      return (int)88;
    }
  }
  {}
  if ((_9138_v == std::string ("endRootCutgen")))
  {
    {
      return (int)66;
    }
  }
  {}
  if ((_9138_v == std::string ("beginSolveRootRelax")))
  {
    {
      return (int)31;
    }
  }
  {}
  if ((_9138_v == std::string ("endSolveRootRelax")))
  {
    {
      return (int)69;
    }
  }
  {}
  if ((_9138_v == std::string ("beginOptimizer")))
  {
    {
      return (int)19;
    }
  }
  {}
  if ((_9138_v == std::string ("endOptimizer")))
  {
    {
      return (int)56;
    }
  }
  {}
  if ((_9138_v == std::string ("beginFolding")))
  {
    {
      return (int)7;
    }
  }
  {}
  if ((_9138_v == std::string ("endFolding")))
  {
    {
      return (int)44;
    }
  }
  {}
  if ((_9138_v == std::string ("beginFoldingBi")))
  {
    {
      return (int)8;
    }
  }
  {}
  if ((_9138_v == std::string ("beginFoldingBiInitialize")))
  {
    {
      return (int)10;
    }
  }
  {}
  if ((_9138_v == std::string ("endFoldingBiInitialize")))
  {
    {
      return (int)47;
    }
  }
  {}
  if ((_9138_v == std::string ("beginFoldingBiPrimal")))
  {
    {
      return (int)12;
    }
  }
  {}
  if ((_9138_v == std::string ("foldingBiPrimal")))
  {
    {
      return (int)74;
    }
  }
  {}
  if ((_9138_v == std::string ("endFoldingBiPrimal")))
  {
    {
      return (int)49;
    }
  }
  {}
  if ((_9138_v == std::string ("beginFoldingBiDual")))
  {
    {
      return (int)9;
    }
  }
  {}
  if ((_9138_v == std::string ("foldingBiDual")))
  {
    {
      return (int)72;
    }
  }
  {}
  if ((_9138_v == std::string ("endFoldingBiDual")))
  {
    {
      return (int)46;
    }
  }
  {}
  if ((_9138_v == std::string ("beginFoldingBiOptimizer")))
  {
    {
      return (int)11;
    }
  }
  {}
  if ((_9138_v == std::string ("foldingBiOptimizer")))
  {
    {
      return (int)73;
    }
  }
  {}
  if ((_9138_v == std::string ("endFoldingBiOptimizer")))
  {
    {
      return (int)48;
    }
  }
  {}
  if ((_9138_v == std::string ("endFoldingBi")))
  {
    {
      return (int)45;
    }
  }
  {}
  if ((_9138_v == std::string ("beginPresolve")))
  {
    {
      return (int)20;
    }
  }
  {}
  if ((_9138_v == std::string ("updatePresolve")))
  {
    {
      return (int)102;
    }
  }
  {}
  if ((_9138_v == std::string ("endPresolve")))
  {
    {
      return (int)57;
    }
  }
  {}
  if ((_9138_v == std::string ("beginIntpnt")))
  {
    {
      return (int)15;
    }
  }
  {}
  if ((_9138_v == std::string ("intpnt")))
  {
    {
      return (int)90;
    }
  }
  {}
  if ((_9138_v == std::string ("endIntpnt")))
  {
    {
      return (int)52;
    }
  }
  {}
  if ((_9138_v == std::string ("beginConic")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9138_v == std::string ("conic")))
  {
    {
      return (int)34;
    }
  }
  {}
  if ((_9138_v == std::string ("endConic")))
  {
    {
      return (int)38;
    }
  }
  {}
  if ((_9138_v == std::string ("primalSimplex")))
  {
    {
      return (int)93;
    }
  }
  {}
  if ((_9138_v == std::string ("dualSimplex")))
  {
    {
      return (int)36;
    }
  }
  {}
  if ((_9138_v == std::string ("beginBi")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9138_v == std::string ("endBi")))
  {
    {
      return (int)37;
    }
  }
  {}
  if ((_9138_v == std::string ("beginInitializeBi")))
  {
    {
      return (int)14;
    }
  }
  {}
  if ((_9138_v == std::string ("endInitializeBi")))
  {
    {
      return (int)51;
    }
  }
  {}
  if ((_9138_v == std::string ("beginPrimalBi")))
  {
    {
      return (int)21;
    }
  }
  {}
  if ((_9138_v == std::string ("updatePrimalBi")))
  {
    {
      return (int)103;
    }
  }
  {}
  if ((_9138_v == std::string ("endPrimalBi")))
  {
    {
      return (int)58;
    }
  }
  {}
  if ((_9138_v == std::string ("beginDualBi")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9138_v == std::string ("updateDualBi")))
  {
    {
      return (int)99;
    }
  }
  {}
  if ((_9138_v == std::string ("endDualBi")))
  {
    {
      return (int)39;
    }
  }
  {}
  if ((_9138_v == std::string ("beginOptimizeBi")))
  {
    {
      return (int)18;
    }
  }
  {}
  if ((_9138_v == std::string ("optimizeBi")))
  {
    {
      return (int)92;
    }
  }
  {}
  if ((_9138_v == std::string ("endOptimizeBi")))
  {
    {
      return (int)55;
    }
  }
  {}
  if ((_9138_v == std::string ("beginPrimalSimplexBi")))
  {
    {
      return (int)26;
    }
  }
  {}
  if ((_9138_v == std::string ("updatePrimalSimplexBi")))
  {
    {
      return (int)105;
    }
  }
  {}
  if ((_9138_v == std::string ("endPrimalSimplexBi")))
  {
    {
      return (int)63;
    }
  }
  {}
  if ((_9138_v == std::string ("beginDualSimplexBi")))
  {
    {
      return (int)6;
    }
  }
  {}
  if ((_9138_v == std::string ("updateDualSimplexBi")))
  {
    {
      return (int)101;
    }
  }
  {}
  if ((_9138_v == std::string ("endDualSimplexBi")))
  {
    {
      return (int)43;
    }
  }
  {}
  if ((_9138_v == std::string ("endSimplexBi")))
  {
    {
      return (int)68;
    }
  }
  {}
  if ((_9138_v == std::string ("beginMio")))
  {
    {
      return (int)17;
    }
  }
  {}
  if ((_9138_v == std::string ("imMio")))
  {
    {
      return (int)80;
    }
  }
  {}
  if ((_9138_v == std::string ("newIntMio")))
  {
    {
      return (int)91;
    }
  }
  {}
  if ((_9138_v == std::string ("endMio")))
  {
    {
      return (int)54;
    }
  }
  {}
  if ((_9138_v == std::string ("restartMio")))
  {
    {
      return (int)97;
    }
  }
  {}
  if ((_9138_v == std::string ("decompMio")))
  {
    {
      return (int)35;
    }
  }
  {}
  if ((_9138_v == std::string ("beginSimplex")))
  {
    {
      return (int)30;
    }
  }
  {}
  if ((_9138_v == std::string ("imSimplex")))
  {
    {
      return (int)89;
    }
  }
  {}
  if ((_9138_v == std::string ("updateSimplex")))
  {
    {
      return (int)106;
    }
  }
  {}
  if ((_9138_v == std::string ("beginDualSimplex")))
  {
    {
      return (int)5;
    }
  }
  {}
  if ((_9138_v == std::string ("imDualSimplex")))
  {
    {
      return (int)77;
    }
  }
  {}
  if ((_9138_v == std::string ("updateDualSimplex")))
  {
    {
      return (int)100;
    }
  }
  {}
  if ((_9138_v == std::string ("endDualSimplex")))
  {
    {
      return (int)42;
    }
  }
  {}
  if ((_9138_v == std::string ("beginPrimalSimplex")))
  {
    {
      return (int)25;
    }
  }
  {}
  if ((_9138_v == std::string ("imPrimalSimplex")))
  {
    {
      return (int)86;
    }
  }
  {}
  if ((_9138_v == std::string ("updatePrimalSimplex")))
  {
    {
      return (int)104;
    }
  }
  {}
  if ((_9138_v == std::string ("endPrimalSimplex")))
  {
    {
      return (int)62;
    }
  }
  {}
  if ((_9138_v == std::string ("endSimplex")))
  {
    {
      return (int)67;
    }
  }
  {}
  if ((_9138_v == std::string ("beginInfeasAna")))
  {
    {
      return (int)13;
    }
  }
  {}
  if ((_9138_v == std::string ("endInfeasAna")))
  {
    {
      return (int)50;
    }
  }
  {}
  if ((_9138_v == std::string ("imPrimalSensivity")))
  {
    {
      return (int)85;
    }
  }
  {}
  if ((_9138_v == std::string ("imDualSensivity")))
  {
    {
      return (int)76;
    }
  }
  {}
  if ((_9138_v == std::string ("imMioIntpnt")))
  {
    {
      return (int)82;
    }
  }
  {}
  if ((_9138_v == std::string ("imMioPrimalSimplex")))
  {
    {
      return (int)83;
    }
  }
  {}
  if ((_9138_v == std::string ("imMioDualSimplex")))
  {
    {
      return (int)81;
    }
  }
  {}
  if ((_9138_v == std::string ("beginPrimalSetupBi")))
  {
    {
      return (int)24;
    }
  }
  {}
  if ((_9138_v == std::string ("endPrimalSetupBi")))
  {
    {
      return (int)61;
    }
  }
  {}
  if ((_9138_v == std::string ("beginDualSetupBi")))
  {
    {
      return (int)4;
    }
  }
  {}
  if ((_9138_v == std::string ("endDualSetupBi")))
  {
    {
      return (int)41;
    }
  }
  {}
  if ((_9138_v == std::string ("beginPrimalSensitivity")))
  {
    {
      return (int)23;
    }
  }
  {}
  if ((_9138_v == std::string ("endPrimalSensitivity")))
  {
    {
      return (int)60;
    }
  }
  {}
  if ((_9138_v == std::string ("beginDualSensitivity")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9138_v == std::string ("endDualSensitivity")))
  {
    {
      return (int)40;
    }
  }
  {}
  if ((_9138_v == std::string ("beginLicenseWait")))
  {
    {
      return (int)16;
    }
  }
  {}
  if ((_9138_v == std::string ("endLicenseWait")))
  {
    {
      return (int)53;
    }
  }
  {}
  if ((_9138_v == std::string ("imLicenseWait")))
  {
    {
      return (int)78;
    }
  }
  {}
  if ((_9138_v == std::string ("beginQcqoReformulate")))
  {
    {
      return (int)27;
    }
  }
  {}
  if ((_9138_v == std::string ("qoReformulate")))
  {
    {
      return (int)94;
    }
  }
  {}
  if ((_9138_v == std::string ("endQcqoReformulate")))
  {
    {
      return (int)64;
    }
  }
  {}
  if ((_9138_v == std::string ("beginToConic")))
  {
    {
      return (int)32;
    }
  }
  {}
  if ((_9138_v == std::string ("endToConic")))
  {
    {
      return (int)70;
    }
  }
  {}
  if ((_9138_v == std::string ("beginPrimalRepair")))
  {
    {
      return (int)22;
    }
  }
  {}
  if ((_9138_v == std::string ("endPrimalRepair")))
  {
    {
      return (int)59;
    }
  }
  {}
  if ((_9138_v == std::string ("beginRead")))
  {
    {
      return (int)28;
    }
  }
  {}
  if ((_9138_v == std::string ("imRead")))
  {
    {
      return (int)87;
    }
  }
  {}
  if ((_9138_v == std::string ("endRead")))
  {
    {
      return (int)65;
    }
  }
  {}
  if ((_9138_v == std::string ("beginWrite")))
  {
    {
      return (int)33;
    }
  }
  {}
  if ((_9138_v == std::string ("endWrite")))
  {
    {
      return (int)71;
    }
  }
  {}
  if ((_9138_v == std::string ("readOpfSection")))
  {
    {
      return (int)96;
    }
  }
  {}
  if ((_9138_v == std::string ("imLu")))
  {
    {
      return (int)79;
    }
  }
  {}
  if ((_9138_v == std::string ("imOrder")))
  {
    {
      return (int)84;
    }
  }
  {}
  if ((_9138_v == std::string ("readOpf")))
  {
    {
      return (int)95;
    }
  }
  {}
  if ((_9138_v == std::string ("writeOpf")))
  {
    {
      return (int)107;
    }
  }
  {}
  if ((_9138_v == std::string ("solvingRemote")))
  {
    {
      return (int)98;
    }
  }
  {}
  if ((_9138_v == std::string ("heartbeat")))
  {
    {
      return (int)75;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_callbackcode_value

// Begin mosek.fusion.Parameters.string_to_intpnthotstart_value
// Method mosek.fusion.Parameters.string_to_intpnthotstart_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:86:0-93:1
int32_t mosek::fusion::p_Parameters::string_to_intpnthotstart_value(const std::string & _9139_v)
{
  if ((_9139_v == std::string ("none")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9139_v == std::string ("primal")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9139_v == std::string ("dual")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9139_v == std::string ("primalDual")))
  {
    {
      return (int)3;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_intpnthotstart_value

// Begin mosek.fusion.Parameters.string_to_simhotstart_value
// Method mosek.fusion.Parameters.string_to_simhotstart_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:79:0-85:1
int32_t mosek::fusion::p_Parameters::string_to_simhotstart_value(const std::string & _9140_v)
{
  if ((_9140_v == std::string ("none")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9140_v == std::string ("free")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9140_v == std::string ("statusKeys")))
  {
    {
      return (int)2;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_simhotstart_value

// Begin mosek.fusion.Parameters.string_to_simdupvec_value
// Method mosek.fusion.Parameters.string_to_simdupvec_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:72:0-78:1
int32_t mosek::fusion::p_Parameters::string_to_simdupvec_value(const std::string & _9141_v)
{
  if ((_9141_v == std::string ("on")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9141_v == std::string ("off")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9141_v == std::string ("free")))
  {
    {
      return (int)2;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_simdupvec_value

// Begin mosek.fusion.Parameters.string_to_simreform_value
// Method mosek.fusion.Parameters.string_to_simreform_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:64:0-71:1
int32_t mosek::fusion::p_Parameters::string_to_simreform_value(const std::string & _9142_v)
{
  if ((_9142_v == std::string ("on")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9142_v == std::string ("off")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9142_v == std::string ("free")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9142_v == std::string ("aggressive")))
  {
    {
      return (int)3;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_simreform_value

// Begin mosek.fusion.Parameters.string_to_uplo_value
// Method mosek.fusion.Parameters.string_to_uplo_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:58:0-63:1
int32_t mosek::fusion::p_Parameters::string_to_uplo_value(const std::string & _9143_v)
{
  if ((_9143_v == std::string ("lo")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9143_v == std::string ("up")))
  {
    {
      return (int)1;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_uplo_value

// Begin mosek.fusion.Parameters.string_to_transpose_value
// Method mosek.fusion.Parameters.string_to_transpose_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:52:0-57:1
int32_t mosek::fusion::p_Parameters::string_to_transpose_value(const std::string & _9144_v)
{
  if ((_9144_v == std::string ("no")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9144_v == std::string ("yes")))
  {
    {
      return (int)1;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_transpose_value

// Begin mosek.fusion.Parameters.string_to_simdegen_value
// Method mosek.fusion.Parameters.string_to_simdegen_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:43:0-51:1
int32_t mosek::fusion::p_Parameters::string_to_simdegen_value(const std::string & _9145_v)
{
  if ((_9145_v == std::string ("none")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9145_v == std::string ("free")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9145_v == std::string ("aggressive")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9145_v == std::string ("moderate")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9145_v == std::string ("minimum")))
  {
    {
      return (int)4;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_simdegen_value

// Begin mosek.fusion.Parameters.string_to_simprecision_value
// Method mosek.fusion.Parameters.string_to_simprecision_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:37:0-42:1
int32_t mosek::fusion::p_Parameters::string_to_simprecision_value(const std::string & _9146_v)
{
  if ((_9146_v == std::string ("normal")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9146_v == std::string ("extended")))
  {
    {
      return (int)1;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_simprecision_value

// Begin mosek.fusion.Parameters.string_to_mark_value
// Method mosek.fusion.Parameters.string_to_mark_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:31:0-36:1
int32_t mosek::fusion::p_Parameters::string_to_mark_value(const std::string & _9147_v)
{
  if ((_9147_v == std::string ("lo")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9147_v == std::string ("up")))
  {
    {
      return (int)1;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_mark_value

// Begin mosek.fusion.Parameters.string_to_boundkey_value
// Method mosek.fusion.Parameters.string_to_boundkey_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:22:0-30:1
int32_t mosek::fusion::p_Parameters::string_to_boundkey_value(const std::string & _9148_v)
{
  if ((_9148_v == std::string ("lo")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9148_v == std::string ("up")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9148_v == std::string ("fx")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9148_v == std::string ("fr")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9148_v == std::string ("ra")))
  {
    {
      return (int)4;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_boundkey_value

// Begin mosek.fusion.Parameters.string_to_basindtype_value
// Method mosek.fusion.Parameters.string_to_basindtype_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:13:0-21:1
int32_t mosek::fusion::p_Parameters::string_to_basindtype_value(const std::string & _9149_v)
{
  if ((_9149_v == std::string ("never")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9149_v == std::string ("always")))
  {
    {
      return (int)1;
    }
  }
  {}
  if ((_9149_v == std::string ("noError")))
  {
    {
      return (int)2;
    }
  }
  {}
  if ((_9149_v == std::string ("ifFeasible")))
  {
    {
      return (int)3;
    }
  }
  {}
  if ((_9149_v == std::string ("reservered")))
  {
    {
      return (int)4;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_basindtype_value

// Begin mosek.fusion.Parameters.string_to_language_value
// Method mosek.fusion.Parameters.string_to_language_value @ bld/grindsted/final/default/src/fusion/Parameters.mbi:7:0-12:1
int32_t mosek::fusion::p_Parameters::string_to_language_value(const std::string & _9150_v)
{
  if ((_9150_v == std::string ("eng")))
  {
    {
      return (int)0;
    }
  }
  {}
  if ((_9150_v == std::string ("dan")))
  {
    {
      return (int)1;
    }
  }
  {}
  return (-(int)1);
}
// End mosek.fusion.Parameters.string_to_language_value

void mosek::fusion::p_Parameters::destroy()
{
}
void mosek::fusion::Parameters::destroy() { mosek::fusion::p_Parameters::_get_impl(this)->destroy(); }
// } class Parameters
