List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions
casadi::Ma27Interface Class Reference

'ma27' plugin for Linsol More...

#include <ma27_interface.hpp>

Detailed Description

Interface to the sparse direct linear solver MA27 Works for symmetric indefinite systems Partly adopted from qpOASES 3.2

Author
Joel Andersson
Date
2016

Extra doc: https://github.com/casadi/casadi/wiki/L_229

Definition at line 117 of file ma27_interface.hpp.

Inheritance diagram for casadi::Ma27Interface:
Inheritance graph
[legend]
Collaboration diagram for casadi::Ma27Interface:
Collaboration graph
[legend]

Public Types

typedef LinsolInternal *(* Creator) (const std::string &name, const Sparsity &sp)
 
using weak_ref_type = WeakRefInternal
 
typedef int(* RegFcn) (Plugin *plugin)
 

Public Member Functions

 Ma27Interface (const std::string &name, const Sparsity &sp)
 
 ~Ma27Interface () override
 
void init (const Dict &opts) override
 Initialize. More...
 
void * alloc_mem () const override
 Create memory block. More...
 
int init_mem (void *mem) const override
 Initalize memory block. More...
 
void free_mem (void *mem) const override
 Free memory block. More...
 
int nfact (void *mem, const double *A) const override
 Numeric factorization. More...
 
casadi_int neig (void *mem, const double *A) const override
 Number of negative eigenvalues. More...
 
casadi_int rank (void *mem, const double *A) const override
 Matrix rank. More...
 
int solve (void *mem, const double *A, double *x, casadi_int nrhs, bool tr) const override
 
const char * plugin_name () const override
 
std::string class_name () const override
 Readable name of the internal class. More...
 
void disp (std::ostream &stream, bool more) const override
 Display object. More...
 
virtual void disp_more (std::ostream &stream) const
 Print more. More...
 
virtual void linsol_eval_sx (const SXElem **arg, SXElem **res, casadi_int *iw, SXElem *w, void *mem, bool tr, casadi_int nrhs) const
 Evaluate SX, possibly transposed. More...
 
virtual int sfact (void *mem, const double *A) const
 
virtual void generate (CodeGenerator &g, const std::string &A, const std::string &x, casadi_int nrhs, bool tr) const
 Generate C code. More...
 
casadi_int nrow () const
 Get sparsity pattern. More...
 
casadi_int ncol () const
 
const casadi_int * colind () const
 
const casadi_int * row () const
 
casadi_int nnz () const
 
void serialize_type (SerializingStream &s) const override
 Serialize type information. More...
 
void serialize_body (SerializingStream &s) const override
 Serialize an object without type information. More...
 
void construct (const Dict &opts)
 Construct. More...
 
virtual Dict generate_options (const std::string &target) const
 Reconstruct options dict. More...
 
void print_options (std::ostream &stream) const
 Print list of options. More...
 
void print_option (const std::string &name, std::ostream &stream) const
 Print all information there is to know about a certain option. More...
 
bool has_option (const std::string &option_name) const
 Does a particular option exist. More...
 
virtual void change_option (const std::string &option_name, const GenericType &option_value)
 Change option after object creation for debugging. More...
 
virtual void finalize ()
 Finalize the object creation. More...
 
int checkout () const
 Checkout a memory object. More...
 
void release (int mem) const
 Release a memory object. More...
 
void * memory (int ind) const
 Memory objects. More...
 
bool has_memory (int ind) const
 Check for existance of memory object. More...
 
virtual void check_mem_count (casadi_int n) const
 Check for validatity of memory object count. More...
 
virtual Dict get_stats (void *mem) const
 Get all statistics. More...
 
void clear_mem ()
 Clear all memory (called from destructor) More...
 
void print (const char *fmt,...) const
 C-style formatted printing during evaluation. More...
 
void sprint (char *buf, size_t buf_sz, const char *fmt,...) const
 C-style formatted printing to string. More...
 
void format_time (char *buffer, double time) const
 Format time in a fixed width 8 format. More...
 
void print_time (const std::map< std::string, FStats > &fstats) const
 Print timing statistics. More...
 
void serialize (SerializingStream &s) const
 Serialize an object. More...
 
virtual std::string serialize_base_function () const
 String used to identify the immediate FunctionInternal subclass. More...
 
casadi_int getCount () const
 Get the reference count. More...
 
std::string debug_repr (const SharedObjectInternal *) const
 
GenericWeakRef< SharedObject, SharedObjectInternal > * weak ()
 Get a weak reference to the object. More...
 

Static Public Member Functions

static LinsolInternalcreator (const std::string &name, const Sparsity &sp)
 Create a new Linsol. More...
 
static ProtoFunctiondeserialize (DeserializingStream &s)
 Deserialize with type disambiguation. More...
 
static bool has_plugin (const std::string &pname, bool verbose=false)
 Check if a plugin is available or can be loaded. More...
 
static const Optionsplugin_options (const std::string &pname)
 Get the plugin options. More...
 
static Deserialize plugin_deserialize (const std::string &pname)
 Get the plugin deserialize_map. More...
 
static Plugin pluginFromRegFcn (RegFcn regfcn)
 Instantiate a Plugin struct from a factory function. More...
 
static Plugin load_plugin (const std::string &pname, bool register_plugin=true, bool needs_lock=true)
 Load a plugin dynamically. More...
 
static handle_t load_library (const std::string &libname, std::string &resultpath, bool global)
 Load a library dynamically. More...
 
static void registerPlugin (const Plugin &plugin, bool needs_lock=true)
 Register an integrator in the factory. More...
 
static void registerPlugin (RegFcn regfcn, bool needs_lock=true)
 Register an integrator in the factory. More...
 
static Plugin & getPlugin (const std::string &pname)
 Load and get the creator function. More...
 
static LinsolInternalinstantiate (const std::string &fname, const std::string &pname, Problem problem)
 

Public Attributes

Sparsity sp_
 
std::string name_
 Name. More...
 
bool verbose_
 Verbose printout. More...
 
bool print_time_
 
bool record_time_
 
bool regularity_check_
 Errors are thrown when NaN is produced. More...
 
bool error_on_fail_
 Throw an exception on failure? More...
 

Static Public Attributes

static const std::string meta_doc
 A documentation string. More...
 
static std::map< std::string, Plugin > solvers_
 Collection of solvers. More...
 
static const std::string infix_ = "linsol"
 Infix. More...
 

Protected Member Functions

 Ma27Interface (DeserializingStream &s)
 Deserializing constructor. More...
 
void initSingleton ()
 
void destroySingleton ()
 
shared_from_this ()
 Get a shared object from the current internal object. More...
 
const B shared_from_this () const
 Get a shared object from the current internal object. More...
 
static const Options options_
 Options. More...
 
virtual const Optionsget_options () const
 Options. More...
 

Member Typedef Documentation

◆ Creator

typedef LinsolInternal*(* casadi::LinsolInternal::Creator) (const std::string &name, const Sparsity &sp)
inherited

Definition at line 121 of file linsol_internal.hpp.

◆ RegFcn

typedef int(* casadi::PluginInterface< LinsolInternal >::RegFcn) (Plugin *plugin)
inherited

Definition at line 73 of file plugin_interface.hpp.

◆ weak_ref_type

Definition at line 152 of file shared_object.hpp.

Constructor & Destructor Documentation

◆ Ma27Interface() [1/2]

casadi::Ma27Interface::Ma27Interface ( const std::string &  name,
const Sparsity sp 
)

Definition at line 49 of file ma27_interface.cpp.

50  : LinsolInternal(name, sp) {
51  }
LinsolInternal(const std::string &name, const Sparsity &sp)
Constructor.

◆ ~Ma27Interface()

casadi::Ma27Interface::~Ma27Interface ( )
override

Definition at line 53 of file ma27_interface.cpp.

53  {
54  clear_mem();
55  }
void clear_mem()
Clear all memory (called from destructor)

References casadi::ProtoFunction::clear_mem().

◆ Ma27Interface() [2/2]

casadi::Ma27Interface::Ma27Interface ( DeserializingStream s)
inlineexplicitprotected

Definition at line 169 of file ma27_interface.hpp.

169 : LinsolInternal(s) {}

Member Function Documentation

◆ alloc_mem()

void* casadi::Ma27Interface::alloc_mem ( ) const
inlineoverridevirtual

Reimplemented from casadi::LinsolInternal.

Definition at line 135 of file ma27_interface.hpp.

135 { return new Ma27Memory();}

◆ change_option()

void casadi::ProtoFunction::change_option ( const std::string &  option_name,
const GenericType option_value 
)
virtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_jk

Reimplemented in casadi::MXFunction, casadi::FunctionInternal, and casadi::FmuFunction.

Definition at line 924 of file function_internal.cpp.

925  {
926  if (option_name == "verbose") {
927  verbose_ = option_value;
928  } else if (option_name == "regularity_check") {
929  regularity_check_ = option_value;
930  } else {
931  // Failure
932  casadi_error("Option '" + option_name + "' cannot be changed");
933  }
934  }
bool regularity_check_
Errors are thrown when NaN is produced.
bool verbose_
Verbose printout.

References casadi::ProtoFunction::regularity_check_, and casadi::ProtoFunction::verbose_.

Referenced by casadi::FunctionInternal::change_option().

◆ check_mem_count()

virtual void casadi::ProtoFunction::check_mem_count ( casadi_int  n) const
inlinevirtualinherited

Purpose if to allow more helpful error messages

Extra doc: https://github.com/casadi/casadi/wiki/L_2b7

Reimplemented in casadi::FmuFunction.

Definition at line 179 of file function_internal.hpp.

179 { }

Referenced by casadi::ProtoFunction::checkout().

◆ checkout()

int casadi::ProtoFunction::checkout ( ) const
inherited

Definition at line 3585 of file function_internal.cpp.

3585  {
3586 #ifdef CASADI_WITH_THREAD
3587  std::lock_guard<std::mutex> lock(mtx_);
3588 #endif //CASADI_WITH_THREAD
3589  if (unused_.empty()) {
3590  check_mem_count(mem_.size()+1);
3591  // Allocate a new memory object
3592  void* m = alloc_mem();
3593  mem_.push_back(m);
3594  if (init_mem(m)) {
3595  casadi_error("Failed to create or initialize memory object");
3596  }
3597  return static_cast<int>(mem_.size()) - 1;
3598  } else {
3599  // Use an unused memory object
3600  int m = unused_.top();
3601  unused_.pop();
3602  return m;
3603  }
3604  }
virtual int init_mem(void *mem) const
Initalize memory block.
virtual void * alloc_mem() const
Create memory block.
virtual void check_mem_count(casadi_int n) const
Check for validatity of memory object count.

References casadi::ProtoFunction::alloc_mem(), casadi::ProtoFunction::check_mem_count(), and casadi::ProtoFunction::init_mem().

Referenced by casadi::ProtoFunction::finalize(), casadi::FunctionBuffer::FunctionBuffer(), and casadi::Sqpmethod::init_mem().

◆ class_name()

std::string casadi::Ma27Interface::class_name ( ) const
inlineoverridevirtual

Implements casadi::SharedObjectInternal.

Definition at line 162 of file ma27_interface.hpp.

162 { return "Ma27Interface";}

◆ clear_mem()

void casadi::ProtoFunction::clear_mem ( )
inherited

Extra doc: https://github.com/casadi/casadi/wiki/L_jq

Definition at line 3473 of file function_internal.cpp.

3473  {
3474  for (auto&& i : mem_) {
3475  if (i!=nullptr) free_mem(i);
3476  }
3477  mem_.clear();
3478  }
virtual void free_mem(void *mem) const
Free memory block.

References casadi::ProtoFunction::free_mem().

Referenced by casadi::AlpaqaInterface::~AlpaqaInterface(), casadi::AmplInterface::~AmplInterface(), casadi::BlazingSplineFunction::~BlazingSplineFunction(), casadi::Blocksqp::~Blocksqp(), casadi::BonminInterface::~BonminInterface(), casadi::BSplineInterpolant::~BSplineInterpolant(), casadi::CallbackInternal::~CallbackInternal(), casadi::CbcInterface::~CbcInterface(), casadi::ClarabelInterface::~ClarabelInterface(), casadi::ClpInterface::~ClpInterface(), casadi::CplexInterface::~CplexInterface(), casadi::CsparseInterface::~CsparseInterface(), casadi::CvodesInterface::~CvodesInterface(), casadi::DaqpInterface::~DaqpInterface(), casadi::External::~External(), casadi::FastNewton::~FastNewton(), casadi::FatropConicInterface::~FatropConicInterface(), casadi::FatropInterface::~FatropInterface(), casadi::Feasiblesqpmethod::~Feasiblesqpmethod(), casadi::FiniteDiff::~FiniteDiff(), casadi::FixedStepIntegrator::~FixedStepIntegrator(), casadi::FmuFunction::~FmuFunction(), casadi::GurobiInterface::~GurobiInterface(), casadi::HighsInterface::~HighsInterface(), casadi::HpipmInterface::~HpipmInterface(), casadi::HpmpcInterface::~HpmpcInterface(), casadi::IdasInterface::~IdasInterface(), casadi::ImplicitToNlp::~ImplicitToNlp(), casadi::IpoptInterface::~IpoptInterface(), casadi::Ipqp::~Ipqp(), casadi::JitFunction::~JitFunction(), casadi::KinsolInterface::~KinsolInterface(), casadi::KnitroInterface::~KnitroInterface(), casadi::LapackLu::~LapackLu(), casadi::LapackQr::~LapackQr(), casadi::LinearInterpolant::~LinearInterpolant(), casadi::LinearInterpolantJac::~LinearInterpolantJac(), casadi::LinsolLdl::~LinsolLdl(), casadi::LinsolQr::~LinsolQr(), casadi::LinsolTridiag::~LinsolTridiag(), casadi::Lsqr::~Lsqr(), ~Ma27Interface(), casadi::MadnlpInterface::~MadnlpInterface(), casadi::Map::~Map(), casadi::MapSum::~MapSum(), casadi::MumpsInterface::~MumpsInterface(), casadi::MXFunction::~MXFunction(), casadi::Newton::~Newton(), casadi::Nlpsol::~Nlpsol(), casadi::OmpMap::~OmpMap(), casadi::OoqpInterface::~OoqpInterface(), casadi::OsqpInterface::~OsqpInterface(), casadi::ProxqpInterface::~ProxqpInterface(), casadi::QpoasesInterface::~QpoasesInterface(), casadi::QpToNlp::~QpToNlp(), casadi::Qrqp::~Qrqp(), casadi::Qrsqp::~Qrsqp(), casadi::Scpgen::~Scpgen(), casadi::SLEQPInterface::~SLEQPInterface(), casadi::SlicotDple::~SlicotDple(), casadi::SlicotExpm::~SlicotExpm(), casadi::SnoptInterface::~SnoptInterface(), casadi::Sqpmethod::~Sqpmethod(), casadi::SuperscsInterface::~SuperscsInterface(), casadi::Switch::~Switch(), casadi::SXFunction::~SXFunction(), casadi::SymbolicQr::~SymbolicQr(), casadi::ThreadMap::~ThreadMap(), and casadi::WorhpInterface::~WorhpInterface().

◆ colind()

const casadi_int* casadi::LinsolInternal::colind ( ) const
inlineinherited

Definition at line 142 of file linsol_internal.hpp.

142 { return sp_.colind();}
const casadi_int * colind() const
Get a reference to the colindex of all column element (see class description)
Definition: sparsity.cpp:168

Referenced by casadi::CsparseInterface::init_mem(), casadi::MumpsInterface::init_mem(), nfact(), and casadi::MumpsInterface::nfact().

◆ construct()

void casadi::ProtoFunction::construct ( const Dict opts)
inherited

Prepares the function for evaluation

Extra doc: https://github.com/casadi/casadi/wiki/L_jf

Definition at line 137 of file function_internal.cpp.

137  {
138  // Sanitize dictionary is needed
139  if (!Options::is_sane(opts)) {
140  // Call recursively
141  return construct(Options::sanitize(opts));
142  }
143 
144  // Make sure all options exist
145  get_options().check(opts);
146 
147  // Initialize the class hierarchy
148  try {
149  init(opts);
150  } catch(std::exception& e) {
151  casadi_error("Error calling " + class_name() + "::init for '" + name_ + "':\n"
152  + std::string(e.what()));
153  }
154 
155  // Revisit class hierarchy in reverse order
156  try {
157  finalize();
158  } catch(std::exception& e) {
159  casadi_error("Error calling " + class_name() + "::finalize for '" + name_ + "':\n"
160  + std::string(e.what()));
161  }
162  }
void construct(const Dict &opts)
Construct.
virtual const Options & get_options() const
Options.
virtual void init(const Dict &opts)
Initialize.
virtual void finalize()
Finalize the object creation.
virtual std::string class_name() const =0
Readable name of the internal class.
static bool is_sane(const Dict &opts)
Is the dictionary sane.
Definition: options.cpp:169
static Dict sanitize(const Dict &opts, bool top_level=true)
Sanitize a options dictionary.
Definition: options.cpp:173
void check(const Dict &opts) const
Check if options exist.
Definition: options.cpp:240

References casadi::Options::check(), casadi::SharedObjectInternal::class_name(), casadi::ProtoFunction::finalize(), casadi::ProtoFunction::get_options(), casadi::ProtoFunction::init(), casadi::Options::is_sane(), casadi::ProtoFunction::name_, and casadi::Options::sanitize().

Referenced by casadi::Function::create(), casadi::FmuFunction::factory(), casadi::FmuFunction::get_forward(), casadi::FmuFunction::get_jacobian(), casadi::LinearInterpolant::get_jacobian(), and casadi::FmuFunction::get_reverse().

◆ creator()

static LinsolInternal* casadi::Ma27Interface::creator ( const std::string &  name,
const Sparsity sp 
)
inlinestatic

Definition at line 124 of file ma27_interface.hpp.

124  {
125  return new Ma27Interface(name, sp);
126  }
Ma27Interface(const std::string &name, const Sparsity &sp)

Referenced by casadi::casadi_register_linsol_ma27().

◆ debug_repr()

std::string casadi::GenericSharedInternal< SharedObject , SharedObjectInternal >::debug_repr ( const Internal *  i) const
inherited

Definition at line 62 of file generic_shared_internal.hpp.

162  {
163  // Note: i != this because of something something multiple inheritance
164  return str( (casadi_int)(i)) + "/" + static_cast<const Internal*>(this)->class_name();
165  }
std::string str(const T &v)
String representation, any type.

◆ deserialize()

static ProtoFunction* casadi::Ma27Interface::deserialize ( DeserializingStream s)
inlinestatic

Definition at line 165 of file ma27_interface.hpp.

165 { return new Ma27Interface(s); }

Referenced by casadi::casadi_register_linsol_ma27().

◆ destroySingleton()

void casadi::GenericSharedInternal< SharedObject , SharedObjectInternal >::destroySingleton ( )
inlineprotectedinherited

Called in the destructor of singletons

Definition at line 77 of file generic_shared_internal.hpp.

77  {
78  static_cast<Internal*>(this)->count--;
79  }

◆ disp()

void casadi::LinsolInternal::disp ( std::ostream &  stream,
bool  more 
) const
overridevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_e4

Implements casadi::SharedObjectInternal.

Definition at line 43 of file linsol_internal.cpp.

43  {
44  stream << "Linear solver " << class_name();
45  if (more) {
46  stream << std::endl;
47  disp_more(stream);
48  }
49  }
virtual void disp_more(std::ostream &stream) const
Print more.

References casadi::SharedObjectInternal::class_name(), and casadi::LinsolInternal::disp_more().

◆ disp_more()

virtual void casadi::LinsolInternal::disp_more ( std::ostream &  stream) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_e5

Definition at line 65 of file linsol_internal.hpp.

65 {}

Referenced by casadi::LinsolInternal::disp().

◆ finalize()

void casadi::ProtoFunction::finalize ( )
virtualinherited

This function, which visits the class hierarchy in reverse order is run after init() has been completed.

Extra doc: https://github.com/casadi/casadi/wiki/L_jm

Reimplemented in casadi::LinsolQr, casadi::OracleFunction, casadi::FunctionInternal, and casadi::CallbackInternal.

Definition at line 725 of file function_internal.cpp.

725  {
726  // Create memory object
727  int mem = checkout();
728  casadi_assert_dev(mem==0);
729  }
int checkout() const
Checkout a memory object.

References casadi::ProtoFunction::checkout().

Referenced by casadi::ProtoFunction::construct(), casadi::Linsol::deserialize(), casadi::FunctionInternal::finalize(), and casadi::LinsolQr::finalize().

◆ format_time()

void casadi::ProtoFunction::format_time ( char *  buffer,
double  time 
) const
inherited

Extra doc: https://github.com/casadi/casadi/wiki/L_jt

Definition at line 3772 of file function_internal.cpp.

3772  {
3773  // Always of width 8
3774  casadi_assert_dev(time>=0);
3775  double log_time = log10(time);
3776  int magn = static_cast<int>(floor(log_time));
3777  int iprefix = static_cast<int>(floor(log_time/3));
3778  if (iprefix<-4) {
3779  sprint(buffer, 10, " 0");
3780  return;
3781  }
3782  if (iprefix>=5) {
3783  sprint(buffer, 10, " inf");
3784  return;
3785  }
3786  char prefixes[] = "TGMk munp";
3787  char prefix = prefixes[4-iprefix];
3788 
3789  int rem = magn-3*iprefix;
3790  double time_normalized = time/pow(10, 3*iprefix);
3791 
3792  if (rem==0) {
3793  sprint(buffer, 10, " %1.2f%cs", time_normalized, prefix);
3794  } else if (rem==1) {
3795  sprint(buffer, 10, " %2.2f%cs", time_normalized, prefix);
3796  } else {
3797  sprint(buffer, 10, "%3.2f%cs", time_normalized, prefix);
3798  }
3799  }
void sprint(char *buf, size_t buf_sz, const char *fmt,...) const
C-style formatted printing to string.

References casadi::ProtoFunction::sprint().

Referenced by casadi::ProtoFunction::print_time().

◆ free_mem()

void casadi::Ma27Interface::free_mem ( void *  mem) const
inlineoverridevirtual

Reimplemented from casadi::LinsolInternal.

Definition at line 141 of file ma27_interface.hpp.

141 { delete static_cast<Ma27Memory*>(mem);}

◆ generate()

void casadi::LinsolInternal::generate ( CodeGenerator g,
const std::string &  A,
const std::string &  x,
casadi_int  nrhs,
bool  tr 
) const
virtualinherited

Reimplemented in casadi::Lsqr, casadi::LinsolTridiag, casadi::LinsolQr, and casadi::LinsolLdl.

Definition at line 110 of file linsol_internal.cpp.

111  {
112  g << "#error " << class_name() << " does not support code generation\n";
113  }

References casadi::SharedObjectInternal::class_name().

◆ generate_options()

Dict casadi::ProtoFunction::generate_options ( const std::string &  target) const
virtualinherited

Reimplemented in casadi::SXFunction, casadi::MXFunction, and casadi::FunctionInternal.

Definition at line 372 of file function_internal.cpp.

372  {
373  Dict opts;
374  opts["verbose"] = verbose_;
375  opts["print_time"] = print_time_;
376  opts["record_time"] = record_time_;
377  opts["regularity_check"] = regularity_check_;
378  opts["error_on_fail"] = error_on_fail_;
379  return opts;
380  }
bool error_on_fail_
Throw an exception on failure?
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.

References casadi::ProtoFunction::error_on_fail_, casadi::ProtoFunction::print_time_, casadi::ProtoFunction::record_time_, casadi::ProtoFunction::regularity_check_, and casadi::ProtoFunction::verbose_.

Referenced by casadi::FunctionInternal::generate_options().

◆ get_options()

virtual const Options& casadi::ProtoFunction::get_options ( ) const
inlinevirtualinherited

Extra doc: https://github.com/casadi/casadi/wiki/L_jg

Reimplemented in casadi::SymbolicQr, casadi::Sqpmethod, casadi::Scpgen, casadi::Qrsqp, casadi::Qrqp, casadi::QpToNlp, casadi::Newton, casadi::LinsolQr, casadi::LinsolLdl, casadi::LinearInterpolant, casadi::Ipqp, casadi::ImplicitToNlp, casadi::Feasiblesqpmethod, casadi::FastNewton, casadi::Collocation, casadi::BSplineInterpolant, casadi::WorhpInterface, casadi::SuperscsInterface, casadi::SundialsInterface, casadi::KinsolInterface, casadi::IdasInterface, casadi::CvodesInterface, casadi::SnoptInterface, casadi::SlicotDple, casadi::SLEQPInterface, casadi::QpoasesInterface, casadi::ProxqpInterface, casadi::OsqpInterface, casadi::OoqpInterface, casadi::MumpsInterface, casadi::MadnlpInterface, casadi::LapackQr, casadi::LapackLu, casadi::KnitroInterface, casadi::IpoptInterface, casadi::HpmpcInterface, casadi::HpipmInterface, casadi::HighsInterface, casadi::GurobiInterface, casadi::FatropInterface, casadi::FatropConicInterface, casadi::DaqpInterface, casadi::CplexInterface, casadi::ClpInterface, casadi::ClarabelInterface, casadi::CbcInterface, casadi::BonminInterface, casadi::Blocksqp, casadi::AmplInterface, casadi::AlpaqaInterface, casadi::SXFunction, casadi::Rootfinder, casadi::OracleFunction, casadi::Nlpsol, casadi::MXFunction, casadi::JitFunction, casadi::Interpolant, casadi::ImplicitFixedStepIntegrator, casadi::FixedStepIntegrator, casadi::Integrator, casadi::FunctionInternal, casadi::FmuFunction, casadi::FiniteDiff, casadi::Expm, casadi::Dple, casadi::Conic, and casadi::BlazingSplineFunction.

Definition at line 118 of file function_internal.hpp.

118 { return options_;}
static const Options options_
Options.

Referenced by casadi::ProtoFunction::construct(), casadi::ProtoFunction::has_option(), casadi::ProtoFunction::print_option(), and casadi::ProtoFunction::print_options().

◆ get_stats()

Dict casadi::ProtoFunction::get_stats ( void *  mem) const
virtualinherited

◆ getCount()

Definition at line 60 of file generic_shared_internal.hpp.

186  {
187  return static_cast<const Internal*>(this)->count;
188  }

◆ getPlugin()

PluginInterface< LinsolInternal >::Plugin & casadi::PluginInterface< LinsolInternal >::getPlugin ( const std::string &  pname)
staticinherited

Definition at line 102 of file plugin_interface.hpp.

291  {
292 
293 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
294  std::lock_guard<std::mutex> lock(Derived::mutex_solvers_);
295 #endif // CASADI_WITH_THREADSAFE_SYMBOLICS
296 
297  // Check if the solver has been loaded
298  auto it=Derived::solvers_.find(pname);
299 
300  // Load the solver if needed
301  if (it==Derived::solvers_.end()) {
302  load_plugin(pname, true, false);
303  it=Derived::solvers_.find(pname);
304  }
305  casadi_assert_dev(it!=Derived::solvers_.end());
306  return it->second;
307  }
static Plugin load_plugin(const std::string &pname, bool register_plugin=true, bool needs_lock=true)
Load a plugin dynamically.

◆ has_memory()

bool casadi::ProtoFunction::has_memory ( int  ind) const
inherited

Definition at line 3581 of file function_internal.cpp.

3581  {
3582  return ind<mem_.size();
3583  }

◆ has_option()

bool casadi::ProtoFunction::has_option ( const std::string &  option_name) const
inherited

Extra doc: https://github.com/casadi/casadi/wiki/L_jj

Definition at line 920 of file function_internal.cpp.

920  {
921  return get_options().find(option_name) != 0;
922  }
const Options::Entry * find(const std::string &name) const
Definition: options.cpp:32

References casadi::Options::find(), and casadi::ProtoFunction::get_options().

◆ has_plugin()

bool casadi::PluginInterface< LinsolInternal >::has_plugin ( const std::string &  pname,
bool  verbose = false 
)
staticinherited

Definition at line 76 of file plugin_interface.hpp.

131  {
132 
133 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
134  std::lock_guard<std::mutex> lock(Derived::mutex_solvers_);
135 #endif // CASADI_WITH_THREADSAFE_SYMBOLICS
136 
137  // Quick return if available
138  if (Derived::solvers_.find(pname) != Derived::solvers_.end()) {
139  return true;
140  }
141 
142  // Try loading the plugin
143  try {
144  (void)load_plugin(pname, false, false);
145  return true;
146  } catch (CasadiException& ex) {
147  if (verbose) {
148  casadi_warning(ex.what());
149  }
150  return false;
151  }
152  }
std::vector< casadi_int > find(const std::vector< T > &v)
find nonzeros

◆ init()

void casadi::Ma27Interface::init ( const Dict opts)
overridevirtual

Reimplemented from casadi::LinsolInternal.

Definition at line 57 of file ma27_interface.cpp.

57  {
58  // Call the init method of the base class
60 
61  }
void init(const Dict &opts) override
Initialize.

References casadi::LinsolInternal::init().

◆ init_mem()

int casadi::Ma27Interface::init_mem ( void *  mem) const
overridevirtual

Reimplemented from casadi::LinsolInternal.

Definition at line 63 of file ma27_interface.cpp.

63  {
64  if (LinsolInternal::init_mem(mem)) return 1;
65  auto m = static_cast<Ma27Memory*>(mem);
66 
67  // Set default options for MA27
68  ma27id_(m->icntl, m->cntl);
69  m->icntl[0] = 0; // Suppress error messages
70  m->icntl[1] = 0; // Suppress diagnostic messages
71  m->cntl[0] = 1e-8; // Set pivot tolerance
72 
73  // Dynamically resized work vectors
74  casadi_int N = this->ncol();
75  casadi_int nnz = this->nnz();
76  double liw_factor = 2;
77  m->iw.resize(ceil(liw_factor * (2*nnz+3*N+1)));
78  double la_factor = 2;
79  m->nz.resize(ceil(la_factor * nnz));
80  m->irn.resize(nnz);
81  m->jcn.resize(nnz);
82  m->iw1.resize(2*N);
83  m->ikeep.resize(3*N);
84  return 0;
85  }
casadi_int nnz() const
casadi_int ncol() const
int init_mem(void *mem) const override
Initalize memory block.

References casadi::LinsolInternal::init_mem(), casadi::LinsolInternal::ncol(), and casadi::LinsolInternal::nnz().

◆ initSingleton()

void casadi::GenericSharedInternal< SharedObject , SharedObjectInternal >::initSingleton ( )
inlineprotectedinherited

Called in the constructor of singletons to avoid that the counter reaches zero

Definition at line 71 of file generic_shared_internal.hpp.

71  {
72  casadi_assert_dev(static_cast<Internal*>(this)->count==0);
73  static_cast<Internal*>(this)->count++;
74  }

◆ instantiate()

LinsolInternal * casadi::PluginInterface< LinsolInternal >::instantiate ( const std::string &  fname,
const std::string &  pname,
Problem  problem 
)
staticinherited

Definition at line 106 of file plugin_interface.hpp.

313  {
314 
315  // Assert the plugin exists (needed for adaptors)
316  if (!has_plugin(pname, true)) {
317  casadi_error("Plugin '" + pname + "' is not found.");
318  }
319  return getPlugin(pname).creator(fname, problem);
320  }
static bool has_plugin(const std::string &pname, bool verbose=false)
Check if a plugin is available or can be loaded.
static Plugin & getPlugin(const std::string &pname)
Load and get the creator function.

◆ linsol_eval_sx()

void casadi::LinsolInternal::linsol_eval_sx ( const SXElem **  arg,
SXElem **  res,
casadi_int *  iw,
SXElem w,
void *  mem,
bool  tr,
casadi_int  nrhs 
) const
virtualinherited

Reimplemented in casadi::SymbolicQr.

Definition at line 63 of file linsol_internal.cpp.

64  {
65  casadi_error("eval_sx not defined for " + class_name());
66  }

References casadi::SharedObjectInternal::class_name().

◆ load_library()

handle_t casadi::PluginInterface< LinsolInternal >::load_library ( const std::string &  libname,
std::string &  resultpath,
bool  global 
)
staticinherited

Definition at line 92 of file plugin_interface.hpp.

184  {
185 
186 #ifndef WITH_DL
187  casadi_error("WITH_DL option needed for dynamic loading");
188 #else // WITH_DL
189 
190  // Get the name of the shared library
191  std::string lib = SHARED_LIBRARY_PREFIX + libname + SHARED_LIBRARY_SUFFIX;
192 
193  // Build up search paths;
194  std::vector<std::string> search_paths = get_search_paths();
195  return open_shared_library(lib, search_paths, resultpath,
196  "PluginInterface::load_plugin", global);
197 
198 #endif // WITH_DL
199  }
std::vector< std::string > get_search_paths()
Definition: casadi_os.cpp:49

◆ load_plugin()

PluginInterface< LinsolInternal >::Plugin casadi::PluginInterface< LinsolInternal >::load_plugin ( const std::string &  pname,
bool  register_plugin = true,
bool  needs_lock = true 
)
staticinherited

Definition at line 88 of file plugin_interface.hpp.

204  {
205 
206 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
207  casadi::conditional_lock_guard<std::mutex> lock(Derived::mutex_solvers_, needs_lock);
208 #endif // CASADI_WITH_THREADSAFE_SYMBOLICS
209 
210  // Issue warning and quick return if already loaded
211  if (Derived::solvers_.find(pname) != Derived::solvers_.end()) {
212  casadi_warning("PluginInterface: Solver " + pname + " is already in use. Ignored.");
213  return Plugin();
214  }
215 
216  // Logger singletons are lazily instantiated on first uout()/uerr() calls
217  // This instantation may lead to a data race with potential instatiations in plugin
218  // To be safe, trigger instantatin before any plugin loading
219  uout();
220  uerr();
221 
222 #ifndef WITH_DL
223  casadi_error("WITH_DL option needed for dynamic loading");
224 #else // WITH_DL
225  // Retrieve the registration function
226  RegFcn reg;
227 
228  // Load the dll
229  std::string regName = "casadi_register_" + Derived::infix_ + "_" + pname;
230 
231  std::string searchpath;
232  handle_t handle = load_library("casadi_" + Derived::infix_ + "_" + pname, searchpath,
233  false);
234 
235 #ifdef _WIN32
236 
237 #if __GNUC__
238 #pragma GCC diagnostic push
239 #pragma GCC diagnostic ignored "-Wcast-function-type"
240 #endif
241  reg = reinterpret_cast<RegFcn>(GetProcAddress(handle, TEXT(regName.c_str())));
242 #if __GNUC__
243 #pragma GCC diagnostic pop
244 #endif
245 
246 #else // _WIN32
247  // Reset error
248  dlerror();
249 
250  // Load creator
251  reg = reinterpret_cast<RegFcn>(dlsym(handle, regName.c_str()));
252 #endif // _WIN32
253  casadi_assert(reg!=nullptr,
254  "PluginInterface::load_plugin: no \"" + regName + "\" found in " + searchpath + ".");
255 
256  // Create a temporary struct
257  Plugin plugin = pluginFromRegFcn(reg);
258  // Register the plugin
259  if (register_plugin) {
260  registerPlugin(plugin, false);
261  }
262 
263  return plugin;
264 
265 #endif // WITH_DL
266  }
static handle_t load_library(const std::string &libname, std::string &resultpath, bool global)
Load a library dynamically.
static Plugin pluginFromRegFcn(RegFcn regfcn)
Instantiate a Plugin struct from a factory function.
static void registerPlugin(const Plugin &plugin, bool needs_lock=true)
Register an integrator in the factory.
std::ostream & uerr()
std::ostream & uout()

◆ memory()

void * casadi::ProtoFunction::memory ( int  ind) const
inherited

Definition at line 3574 of file function_internal.cpp.

3574  {
3575 #ifdef CASADI_WITH_THREAD
3576  std::lock_guard<std::mutex> lock(mtx_);
3577 #endif //CASADI_WITH_THREAD
3578  return mem_.at(ind);
3579  }

Referenced by casadi::FunctionInternal::call_gen(), casadi::FunctionInternal::get_jac_sparsity_gen(), casadi::FunctionInternal::get_jac_sparsity_hierarchical(), casadi::Sqpmethod::solve_ela_QP(), and casadi::Sqpmethod::solve_QP().

◆ ncol()

casadi_int casadi::LinsolInternal::ncol ( ) const
inlineinherited

◆ neig()

casadi_int casadi::Ma27Interface::neig ( void *  mem,
const double *  A 
) const
overridevirtual

Reimplemented from casadi::LinsolInternal.

Definition at line 164 of file ma27_interface.cpp.

164  {
165  auto m = static_cast<Ma27Memory*>(mem);
166  casadi_assert_dev(m->is_nfact);
167  return m->neig;
168  }

◆ nfact()

int casadi::Ma27Interface::nfact ( void *  mem,
const double *  A 
) const
overridevirtual

Reimplemented from casadi::LinsolInternal.

Definition at line 87 of file ma27_interface.cpp.

87  {
88  auto m = static_cast<Ma27Memory*>(mem);
89  casadi_assert_dev(A!=nullptr);
90 
91  // Get sparsity
92  const casadi_int ncol = this->ncol();
93  const casadi_int* colind = this->colind();
94  const casadi_int* row = this->row();
95 
96  // Get actual nonzeros
97  int nnz=0;
98  for (casadi_int cc=0; cc<ncol; ++cc) {
99  for (casadi_int el=colind[cc]; el<colind[cc+1]; ++el) {
100  casadi_int rr=row[el];
101  if (rr>cc) continue; // only upper triangular part
102  if (A[el]!=0) {
103  m->nz[nnz] = A[el];
104  m->irn[nnz] = rr+1;
105  m->jcn[nnz] = cc+1;
106  nnz++;
107  }
108  }
109  }
110  m->nnz = nnz;
111 
112  // Order of the matrix
113  int N = this->ncol();
114 
115  // Symbolic factorization (MA27AD)
116  int LIW = m->iw.size();
117  int iflag = 0;
118  int info[20];
119  double ops;
120  ma27ad_(&N, &nnz, get_ptr(m->irn), get_ptr(m->jcn), &m->iw[0], &LIW,
121  get_ptr(m->ikeep), get_ptr(m->iw1), &m->nsteps, &iflag, m->icntl, m->cntl,
122  info, &ops);
123  iflag = info[0]; // Information flag
124  casadi_int ierror = info[1]; // Error flag
125  //casadi_int nrlnec = info[4]; // recommended value for la
126  casadi_int nirnec = info[5]; // recommended value for liw
127  casadi_assert(iflag==0,
128  "ma27ad_ returns iflag = " + str(iflag) + " with ierror = " + str(ierror));
129 
130  // Allocate more memory?
131  double la_init_factor = 20.0; // This could be an option.
132  casadi_int la_min = ceil(la_init_factor * nirnec);
133  if (la_min > m->nz.size()) m->nz.resize(la_min);
134  double liw_init_factor = 5.0; // This could be an option.
135  casadi_int liw_min = ceil(liw_init_factor * nirnec);
136  if (liw_min > m->iw.size()) m->iw.resize(liw_min);
137 
138  // Numerical factorization (MA27BD)
139  int LA = m->nz.size();
140  LIW = m->iw.size();
141  ma27bd_(&N, &nnz, get_ptr(m->irn), get_ptr(m->jcn), get_ptr(m->nz),
142  &LA, get_ptr(m->iw), &LIW, get_ptr(m->ikeep), &m->nsteps,
143  &m->maxfrt, get_ptr(m->iw1), m->icntl, m->cntl, info);
144  iflag = info[0]; // Information flag
145  ierror = info[1]; // Error flag
146  m->neig = info[14]; // Number of negative eigenvalues
147  if (iflag == 3) {
148  m->rank = info[1];
149  } else if (iflag == -5) {
150  //DJ: I think this is more severe. Can this actually happen?
151  m->rank = -1;
152  } else if (iflag != 0) {
153  casadi_error("ma2bd_ returns iflag = " + str(iflag)
154  + " with ierror = " + str(ierror));
155  } else {
156  m->rank = N;
157  }
158 
159  // Real work array
160  if (m->w.size() < m->maxfrt) m->w.resize(m->maxfrt);
161  return 0;
162  }
const casadi_int * colind() const
const casadi_int * row() const
T * get_ptr(std::vector< T > &v)
Get a pointer to the data contained in the vector.

References casadi::LinsolInternal::colind(), casadi::get_ptr(), casadi::LinsolInternal::ncol(), casadi::LinsolInternal::nnz(), casadi::LinsolInternal::row(), and casadi::str().

◆ nnz()

casadi_int casadi::LinsolInternal::nnz ( ) const
inlineinherited

◆ nrow()

casadi_int casadi::LinsolInternal::nrow ( ) const
inlineinherited

◆ plugin_deserialize()

Deserialize casadi::PluginInterface< LinsolInternal >::plugin_deserialize ( const std::string &  pname)
staticinherited

Definition at line 82 of file plugin_interface.hpp.

162  {
163  Deserialize m = getPlugin(pname).deserialize;
164  casadi_assert(m, "Plugin \"" + pname + "\" does not support deserialize");
165  return m;
166  }
ProtoFunction *(* Deserialize)(DeserializingStream &)

◆ plugin_name()

const char* casadi::Ma27Interface::plugin_name ( ) const
inlineoverridevirtual

Implements casadi::LinsolInternal.

Definition at line 159 of file ma27_interface.hpp.

159 { return "ma27";}

◆ plugin_options()

const Options & casadi::PluginInterface< LinsolInternal >::plugin_options ( const std::string &  pname)
staticinherited

Definition at line 79 of file plugin_interface.hpp.

155  {
156  const Options *op = getPlugin(pname).options;
157  casadi_assert(op!=nullptr, "Plugin \"" + pname + "\" does not support options");
158  return *op;
159  }

◆ pluginFromRegFcn()

PluginInterface< LinsolInternal >::Plugin casadi::PluginInterface< LinsolInternal >::pluginFromRegFcn ( RegFcn  regfcn)
staticinherited

Definition at line 85 of file plugin_interface.hpp.

170  {
171  // Create a temporary struct
172  Plugin plugin;
173 
174  // Set the fields
175  int flag = regfcn(&plugin);
176  casadi_assert(flag==0, "Registration of plugin failed.");
177 
178  return plugin;
179  }

◆ print()

void casadi::ProtoFunction::print ( const char *  fmt,
  ... 
) const
inherited

Extra doc: https://github.com/casadi/casadi/wiki/L_jr

Definition at line 3813 of file function_internal.cpp.

3813  {
3814  // Variable number of arguments
3815  va_list args;
3816  va_start(args, fmt);
3817  // Static & dynamic buffers
3818  char buf[256];
3819  size_t buf_sz = sizeof(buf);
3820  char* buf_dyn = nullptr;
3821  // Try to print with a small buffer
3822  casadi_int n = vsnprintf(buf, buf_sz, fmt, args);
3823  // Need a larger buffer?
3824  if (n>static_cast<casadi_int>(buf_sz)) {
3825  buf_sz = static_cast<size_t>(n+1);
3826  buf_dyn = new char[buf_sz];
3827  n = vsnprintf(buf_dyn, buf_sz, fmt, args);
3828  }
3829  // Print buffer content
3830  if (n>=0) uout() << (buf_dyn ? buf_dyn : buf) << std::flush;
3831  // Cleanup
3832  delete[] buf_dyn;
3833  va_end(args);
3834  // Throw error if failure
3835  casadi_assert(n>=0, "Print failure while processing '" + std::string(fmt) + "'");
3836  }

References casadi::uout().

Referenced by casadi::Feasiblesqpmethod::anderson_acc_step_update(), casadi::Nlpsol::callback(), casadi::Blocksqp::convertHessian(), casadi::FmuFunction::eval_task(), casadi::Feasiblesqpmethod::feasibility_iterations(), casadi::Blocksqp::feasibilityRestorationPhase(), casadi::Blocksqp::fullstep(), casadi::Blocksqp::init(), casadi::Feasiblesqpmethod::init(), casadi::Ipqp::init(), casadi::Qrqp::init(), casadi::Qrsqp::init(), casadi::Sqpmethod::init(), casadi::LinsolQr::nfact(), casadi::Feasiblesqpmethod::print_iteration(), casadi::Qrsqp::print_iteration(), casadi::Sqpmethod::print_iteration(), casadi::SundialsInterface::print_stats(), casadi::ProtoFunction::print_time(), casadi::Blocksqp::printInfo(), casadi::Blocksqp::printProgress(), casadi::Blocksqp::run(), casadi::Blocksqp::solve(), casadi::Feasiblesqpmethod::solve(), casadi::Qrsqp::solve(), casadi::Sqpmethod::solve(), casadi::Sqpmethod::solve_ela_QP(), casadi::Feasiblesqpmethod::solve_LP(), casadi::Feasiblesqpmethod::solve_QP(), casadi::Qrsqp::solve_QP(), casadi::Sqpmethod::solve_QP(), and casadi::Blocksqp::solveQP().

◆ print_option()

void casadi::ProtoFunction::print_option ( const std::string &  name,
std::ostream &  stream 
) const
inherited

Extra doc: https://github.com/casadi/casadi/wiki/L_ji

Definition at line 916 of file function_internal.cpp.

916  {
917  get_options().print_one(name, stream);
918  }
void print_one(const std::string &name, std::ostream &stream) const
Print all information there is to know about a certain option.
Definition: options.cpp:274

References casadi::ProtoFunction::get_options(), and casadi::Options::print_one().

◆ print_options()

void casadi::ProtoFunction::print_options ( std::ostream &  stream) const
inherited

Extra doc: https://github.com/casadi/casadi/wiki/L_jh

Definition at line 912 of file function_internal.cpp.

912  {
913  get_options().print_all(stream);
914  }
void print_all(std::ostream &stream) const
Print list of options.
Definition: options.cpp:268

References casadi::ProtoFunction::get_options(), and casadi::Options::print_all().

◆ print_time()

void casadi::ProtoFunction::print_time ( const std::map< std::string, FStats > &  fstats) const
inherited

Extra doc: https://github.com/casadi/casadi/wiki/L_ju

Definition at line 3733 of file function_internal.cpp.

3733  {
3734  if (!print_time_) return;
3735  // Length of the name being printed
3736  size_t name_len=0;
3737  for (auto &&s : fstats) {
3738  name_len = std::max(s.first.size(), name_len);
3739  }
3740  name_len = std::max(name_.size(), name_len);
3741 
3742  // Print name with a given length. Format: "%NNs "
3743  char namefmt[10];
3744  sprint(namefmt, sizeof(namefmt), "%%%ds ", static_cast<casadi_int>(name_len));
3745 
3746  // Print header
3747  print(namefmt, name_.c_str());
3748 
3749  print(" : %8s %10s %8s %10s %9s\n", "t_proc", "(avg)", "t_wall", "(avg)", "n_eval");
3750 
3751 
3752  char buffer_proc[10];
3753  char buffer_wall[10];
3754  char buffer_proc_avg[10];
3755  char buffer_wall_avg[10];
3756 
3757  // Print keys
3758  for (const auto &s : fstats) {
3759  if (s.second.n_call!=0) {
3760  print(namefmt, s.first.c_str());
3761  format_time(buffer_proc, s.second.t_proc);
3762  format_time(buffer_wall, s.second.t_wall);
3763  format_time(buffer_proc_avg, s.second.t_proc/s.second.n_call);
3764  format_time(buffer_wall_avg, s.second.t_wall/s.second.n_call);
3765  print(" | %s (%s) %s (%s) %9d\n",
3766  buffer_proc, buffer_proc_avg,
3767  buffer_wall, buffer_wall_avg, s.second.n_call);
3768  }
3769  }
3770  }
void print(const char *fmt,...) const
C-style formatted printing during evaluation.
void format_time(char *buffer, double time) const
Format time in a fixed width 8 format.

References casadi::ProtoFunction::format_time(), casadi::ProtoFunction::name_, casadi::ProtoFunction::print(), casadi::ProtoFunction::print_time_, and casadi::ProtoFunction::sprint().

Referenced by casadi::FunctionInternal::eval_gen().

◆ rank()

casadi_int casadi::Ma27Interface::rank ( void *  mem,
const double *  A 
) const
overridevirtual

Reimplemented from casadi::LinsolInternal.

Definition at line 170 of file ma27_interface.cpp.

170  {
171  auto m = static_cast<Ma27Memory*>(mem);
172  casadi_assert_dev(m->is_nfact);
173  return m->rank;
174  }

◆ registerPlugin() [1/2]

void casadi::PluginInterface< LinsolInternal >::registerPlugin ( const Plugin &  plugin,
bool  needs_lock = true 
)
staticinherited

Definition at line 96 of file plugin_interface.hpp.

274  {
275 
276 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
277  casadi::conditional_lock_guard<std::mutex> lock(Derived::mutex_solvers_, needs_lock);
278 #endif // CASADI_WITH_THREADSAFE_SYMBOLICS
279 
280  // Check if the solver name is in use
281  typename std::map<std::string, Plugin>::iterator it=Derived::solvers_.find(plugin.name);
282  casadi_assert(it==Derived::solvers_.end(),
283  "Solver " + str(plugin.name) + " is already in use");
284 
285  // Add to list of solvers
286  Derived::solvers_[plugin.name] = plugin;
287  }

◆ registerPlugin() [2/2]

void casadi::PluginInterface< LinsolInternal >::registerPlugin ( RegFcn  regfcn,
bool  needs_lock = true 
)
staticinherited

Definition at line 99 of file plugin_interface.hpp.

269  {
270  registerPlugin(pluginFromRegFcn(regfcn), needs_lock);
271  }

◆ release()

void casadi::ProtoFunction::release ( int  mem) const
inherited

Definition at line 3606 of file function_internal.cpp.

3606  {
3607 #ifdef CASADI_WITH_THREAD
3608  std::lock_guard<std::mutex> lock(mtx_);
3609 #endif //CASADI_WITH_THREAD
3610  unused_.push(mem);
3611  }

◆ row()

const casadi_int* casadi::LinsolInternal::row ( ) const
inlineinherited

Definition at line 143 of file linsol_internal.hpp.

143 { return sp_.row();}
const casadi_int * row() const
Get a reference to row-vector,.
Definition: sparsity.cpp:164

Referenced by casadi::CsparseInterface::init_mem(), casadi::MumpsInterface::init_mem(), nfact(), and casadi::MumpsInterface::nfact().

◆ serialize()

void casadi::ProtoFunction::serialize ( SerializingStream s) const
inherited

Extra doc: https://github.com/casadi/casadi/wiki/L_jv

Definition at line 4090 of file function_internal.cpp.

4090  {
4091  serialize_type(s);
4092  serialize_body(s);
4093  }
virtual void serialize_type(SerializingStream &s) const
Serialize type information.
virtual void serialize_body(SerializingStream &s) const
Serialize an object without type information.

References casadi::ProtoFunction::serialize_body(), and casadi::ProtoFunction::serialize_type().

◆ serialize_base_function()

virtual std::string casadi::ProtoFunction::serialize_base_function ( ) const
inlinevirtualinherited

◆ serialize_body()

void casadi::LinsolInternal::serialize_body ( SerializingStream s) const
overridevirtualinherited

◆ serialize_type()

void casadi::LinsolInternal::serialize_type ( SerializingStream s) const
overridevirtualinherited

◆ sfact()

virtual int casadi::LinsolInternal::sfact ( void *  mem,
const double *  A 
) const
inlinevirtualinherited

◆ shared_from_this() [1/2]

B casadi::GenericSharedInternal< SharedObject , SharedObjectInternal >::shared_from_this ( )
inlineprotectedinherited

Definition at line 83 of file generic_shared_internal.hpp.

83  {
84  casadi_assert_dev(B::test_cast(static_cast<Internal*>(this)));
85  B ret;
86  ret.own(static_cast<Internal*>(this));
87  return ret;
88  }

◆ shared_from_this() [2/2]

const B casadi::GenericSharedInternal< SharedObject , SharedObjectInternal >::shared_from_this ( ) const
inlineprotectedinherited

Definition at line 92 of file generic_shared_internal.hpp.

92  {
93  casadi_assert_dev(B::test_cast(static_cast<const Internal*>(this)));
94  B ret;
95  ret.own(const_cast<Internal*>(static_cast<const Internal*>(this)));
96  return ret;
97  }

◆ solve()

int casadi::Ma27Interface::solve ( void *  mem,
const double *  A,
double *  x,
casadi_int  nrhs,
bool  tr 
) const
overridevirtual

Reimplemented from casadi::LinsolInternal.

Definition at line 176 of file ma27_interface.cpp.

176  {
177  auto m = static_cast<Ma27Memory*>(mem);
178 
179  // Solve for each right-hand-side
180  int N = this->ncol();
181  int LA = m->nz.size();
182  int LIW = m->iw.size();
183  for (casadi_int k=0; k<nrhs; ++k) {
184  ma27cd_(&N, get_ptr(m->nz), &LA, get_ptr(m->iw), &LIW, get_ptr(m->w),
185  &m->maxfrt, x, get_ptr(m->iw1), &m->nsteps, m->icntl, m->cntl);
186  x += N;
187  }
188  return 0;
189  }

References casadi::get_ptr(), and casadi::LinsolInternal::ncol().

◆ sprint()

void casadi::ProtoFunction::sprint ( char *  buf,
size_t  buf_sz,
const char *  fmt,
  ... 
) const
inherited

Extra doc: https://github.com/casadi/casadi/wiki/L_js

Definition at line 3801 of file function_internal.cpp.

3801  {
3802  // Variable number of arguments
3803  va_list args;
3804  va_start(args, fmt);
3805  // Print to buffer
3806  casadi_int n = vsnprintf(buf, buf_sz, fmt, args);
3807  // Cleanup
3808  va_end(args);
3809  // Throw error if failure
3810  casadi_assert(n>=0 && n<buf_sz, "Print failure while processing '" + std::string(fmt) + "'");
3811  }

Referenced by casadi::ProtoFunction::format_time(), and casadi::ProtoFunction::print_time().

◆ weak()

Extra doc: https://github.com/casadi/casadi/wiki/L_1ai

Definition at line 67 of file generic_shared_internal.hpp.

191  {
192  if (weak_ref_==nullptr) {
193  weak_ref_ = new GenericWeakRef<Shared, Internal>(static_cast<Internal*>(this));
194  }
195  return weak_ref_;
196  }

Member Data Documentation

◆ error_on_fail_

bool casadi::ProtoFunction::error_on_fail_
inherited

◆ infix_

const std::string casadi::LinsolInternal::infix_ = "linsol"
staticinherited

Definition at line 134 of file linsol_internal.hpp.

◆ meta_doc

const std::string casadi::Ma27Interface::meta_doc
static
Initial value:
=
"\n"
"\n"
"\n"
"Interface to the sparse direct linear solver MA27 Works for symmetric\n"
" indefinite systems Partly adopted from qpOASES 3.2 \n"
"Joel Andersson \n"
"\n"
"Extra doc: https://github.com/casadi/casadi/wiki/L_229 \n"
"\n"
"\n"

Definition at line 156 of file ma27_interface.hpp.

Referenced by casadi::casadi_register_linsol_ma27().

◆ name_

std::string casadi::ProtoFunction::name_
inherited

Definition at line 246 of file function_internal.hpp.

Referenced by casadi::MXFunction::ad_forward(), casadi::SXFunction::ad_forward(), casadi::MXFunction::ad_reverse(), casadi::SXFunction::ad_reverse(), casadi::Integrator::augmented_dae(), casadi::OracleFunction::calc_function(), casadi::FunctionInternal::call_forward(), casadi::FunctionInternal::call_reverse(), casadi::FunctionInternal::codegen_body(), casadi::External::codegen_body(), casadi::External::codegen_checkout(), casadi::External::codegen_declarations(), casadi::MXFunction::codegen_declarations(), casadi::SXFunction::codegen_declarations(), casadi::External::codegen_decref(), casadi::External::codegen_incref(), casadi::FunctionInternal::codegen_meta(), casadi::FunctionInternal::codegen_name(), casadi::External::codegen_release(), casadi::FunctionInternal::codegen_sparsities(), casadi::ProtoFunction::construct(), casadi::OracleFunction::create_function(), casadi::FunctionInternal::definition(), casadi::FunctionInternal::eval(), casadi::MXFunction::eval(), casadi::SXFunction::eval(), casadi::FunctionInternal::eval_mx(), casadi::MXFunction::eval_mx(), casadi::SXFunction::eval_mx(), casadi::SXFunction::eval_sx(), casadi::FmuFunction::factory(), casadi::FunctionInternal::finalize(), casadi::FunctionInternal::forward(), casadi::FunctionInternal::FunctionInternal(), casadi::Integrator::get_forward(), casadi::Integrator::get_forward_dae(), casadi::Map::get_function(), casadi::MapSum::get_function(), casadi::OracleFunction::get_function(), casadi::GenericExternal::get_jac_sparsity(), casadi::BlazingSplineFunction::get_jacobian(), casadi::FunctionInternal::get_n_in(), casadi::External::get_n_in(), casadi::FunctionInternal::get_n_out(), casadi::External::get_n_out(), casadi::FunctionInternal::get_name_in(), casadi::External::get_name_in(), casadi::FunctionInternal::get_name_out(), casadi::External::get_name_out(), casadi::FunctionInternal::get_partition(), casadi::Integrator::get_reverse(), casadi::FunctionInternal::get_sparsity_in(), casadi::GenericExternal::get_sparsity_in(), casadi::FunctionInternal::get_sparsity_out(), casadi::GenericExternal::get_sparsity_out(), casadi::FunctionInternal::get_stats(), casadi::External::has_forward(), casadi::GenericExternal::has_jac_sparsity(), casadi::External::has_jacobian(), casadi::External::has_reverse(), casadi::External::init(), casadi::FunctionInternal::init(), casadi::MXFunction::init(), casadi::SXFunction::init(), casadi::CvodesInterface::init(), casadi::IdasInterface::init(), casadi::External::init_external(), casadi::GenericExternal::init_external(), casadi::FunctionInternal::jac_is_symm(), casadi::FunctionInternal::jacobian(), casadi::FunctionInternal::map(), casadi::OracleFunction::monitored(), casadi::MXFunction::print_arg(), casadi::FunctionInternal::print_in(), casadi::FunctionInternal::print_out(), casadi::MXFunction::print_res(), casadi::ProtoFunction::print_time(), casadi::ProtoFunction::ProtoFunction(), casadi::CvodesInterface::reset(), casadi::IdasInterface::reset(), casadi::IdasInterface::resetB(), casadi::FunctionInternal::reverse(), casadi::ProtoFunction::serialize_body(), casadi::GurobiInterface::solve(), casadi::SnoptInterface::solve(), casadi::Integrator::sp_forward(), casadi::Integrator::sp_reverse(), casadi::FunctionInternal::wrap(), and casadi::FunctionInternal::wrap_as_needed().

◆ options_

const Options casadi::ProtoFunction::options_
staticinherited
Initial value:
= {{},
{{"verbose",
"Verbose evaluation -- for debugging"}},
{"print_time",
"print information about execution time. Implies record_time."}},
{"record_time",
"record information about execution time, for retrieval with stats()."}},
{"regularity_check",
"Throw exceptions when NaN or Inf appears during evaluation"}},
{"error_on_fail",
"Throw exceptions when function evaluation fails (default true)."}}
}
}

Extra doc: https://github.com/casadi/casadi/wiki/L_jg

Definition at line 117 of file function_internal.hpp.

Referenced by casadi::casadi_register_linsol_csparse(), casadi::casadi_register_linsol_lsqr(), casadi::casadi_register_linsol_ma27(), and casadi::casadi_register_linsol_tridiag().

◆ print_time_

bool casadi::ProtoFunction::print_time_
inherited

◆ record_time_

bool casadi::ProtoFunction::record_time_
inherited

◆ regularity_check_

bool casadi::ProtoFunction::regularity_check_
inherited

◆ solvers_

std::map< std::string, LinsolInternal::Plugin > casadi::LinsolInternal::solvers_
staticinherited

Definition at line 127 of file linsol_internal.hpp.

◆ sp_

Sparsity casadi::LinsolInternal::sp_
inherited

◆ verbose_

bool casadi::ProtoFunction::verbose_
inherited

Definition at line 249 of file function_internal.hpp.

Referenced by casadi::MXFunction::ad_forward(), casadi::SXFunction::ad_forward(), casadi::MXFunction::ad_reverse(), casadi::SXFunction::ad_reverse(), casadi::Integrator::advance(), casadi::ProtoFunction::change_option(), casadi::BSplineInterpolant::construct_graph(), casadi::OracleFunction::create_function(), casadi::FmuFunction::eval(), casadi::Integrator::eval(), casadi::MXFunction::eval(), casadi::SXFunction::eval(), casadi::MXFunction::eval_mx(), casadi::SXFunction::eval_mx(), casadi::SXFunction::eval_sx(), casadi::FmuFunction::factory(), casadi::FunctionInternal::finalize(), casadi::KinsolInterface::func(), casadi::ProtoFunction::generate_options(), casadi::FmuFunction::get_forward(), casadi::Integrator::get_forward(), casadi::Integrator::get_forward_dae(), casadi::FunctionInternal::get_jac_sparsity_gen(), casadi::FunctionInternal::get_jac_sparsity_hierarchical(), casadi::FunctionInternal::get_jac_sparsity_hierarchical_symm(), casadi::FmuFunction::get_jacobian(), casadi::FunctionInternal::get_partition(), casadi::FmuFunction::get_reverse(), casadi::Integrator::get_reverse(), casadi::ProtoFunction::init(), casadi::FiniteDiff::init(), casadi::FmuFunction::init(), casadi::FunctionInternal::init(), casadi::MXFunction::init(), casadi::SXFunction::init(), casadi::Blocksqp::init(), casadi::FatropConicInterface::init(), casadi::FatropInterface::init(), casadi::HpipmInterface::init(), casadi::HpmpcInterface::init(), casadi::IpoptInterface::init(), casadi::MadnlpInterface::init(), casadi::CvodesInterface::init(), casadi::IdasInterface::init(), casadi::Feasiblesqpmethod::init(), casadi::Scpgen::init(), casadi::Sqpmethod::init(), casadi::IpoptInterface::init_mem(), casadi::IdasInterface::init_mem(), casadi::SXFunction::instructions_sx(), casadi::BonminInterface::intermediate_callback(), casadi::OracleFunction::jit_dependencies(), casadi::CsparseInterface::nfact(), casadi::LapackLu::nfact(), casadi::LapackQr::nfact(), casadi::LinsolQr::nfact(), casadi::Integrator::predict_events(), casadi::ProtoFunction::ProtoFunction(), casadi::CvodesInterface::reset(), casadi::IdasInterface::reset(), casadi::IdasInterface::resetB(), casadi::ProtoFunction::serialize_body(), casadi::CbcInterface::solve(), casadi::ClpInterface::solve(), casadi::CplexInterface::solve(), casadi::GurobiInterface::solve(), casadi::HpipmInterface::solve(), casadi::QpoasesInterface::solve(), casadi::Ipqp::solve(), casadi::Qrqp::solve(), casadi::AlpaqaInterface::solve(), casadi::AmplInterface::solve(), casadi::SnoptInterface::solve(), casadi::KinsolInterface::solve(), casadi::WorhpInterface::solve(), casadi::Newton::solve(), casadi::Qrsqp::solve(), casadi::Scpgen::solve(), casadi::Sqpmethod::solve(), casadi::Sqpmethod::solve_ela_QP(), casadi::Feasiblesqpmethod::solve_LP(), casadi::Feasiblesqpmethod::solve_QP(), casadi::Qrsqp::solve_QP(), casadi::Sqpmethod::solve_QP(), casadi::Integrator::sp_forward(), casadi::Integrator::sp_reverse(), and casadi::Integrator::trigger_event().


The documentation for this class was generated from the following files: