Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
casadi Namespace Reference

The casadi namespace. More...

Namespaces

 IndexReduction
 

Classes

class  Archiver
 Archiver interface. More...
 
class  Assertion
 Assertion. More...
 
class  Bilin
 Calculate quadratic form. More...
 
class  BinaryMX
 Represents any binary operation that involves two matrices. More...
 
class  BinarySX
 Represents a basic binary operation on two SXElem nodes. More...
 
class  BlazingSplineFunction
 
class  BSplineCommon
 BSpline Node. More...
 
class  BSpline
 
class  BSplineParametric
 
struct  UnaryOperation
 
struct  BinaryOperation
 
struct  BinaryOperationE
 
struct  DerBinaryOperation
 Calculate function and derivative. More...
 
struct  BinaryOperationSS
 Perform a binary operation on two scalars. More...
 
struct  BinaryOperationVV
 Perform a binary operation on two vectors. More...
 
struct  BinaryOperationVS
 Perform a binary operation on a vector and a scalar. More...
 
struct  BinaryOperationSV
 Perform a binary operation on a scalar and a vector. More...
 
struct  SmoothChecker
 
struct  SmoothChecker< OP_LT >
 
struct  SmoothChecker< OP_LE >
 
struct  SmoothChecker< OP_FLOOR >
 
struct  SmoothChecker< OP_CEIL >
 
struct  SmoothChecker< OP_FMOD >
 
struct  SmoothChecker< OP_REMAINDER >
 
struct  SmoothChecker< OP_EQ >
 
struct  SmoothChecker< OP_NE >
 
struct  SmoothChecker< OP_SIGN >
 
struct  SmoothChecker< OP_COPYSIGN >
 
struct  SmoothChecker< OP_NOT >
 
struct  SmoothChecker< OP_AND >
 
struct  SmoothChecker< OP_OR >
 
struct  SmoothChecker< OP_IF_ELSE_ZERO >
 
struct  F0XChecker
 
struct  F0XChecker< OP_ASSIGN >
 
struct  F0XChecker< OP_MUL >
 
struct  F0XChecker< OP_DIV >
 
struct  F0XChecker< OP_NEG >
 
struct  F0XChecker< OP_SQRT >
 
struct  F0XChecker< OP_SQ >
 
struct  F0XChecker< OP_TWICE >
 
struct  F0XChecker< OP_SIN >
 
struct  F0XChecker< OP_TAN >
 
struct  F0XChecker< OP_ATAN >
 
struct  F0XChecker< OP_ASIN >
 
struct  F0XChecker< OP_FLOOR >
 
struct  F0XChecker< OP_CEIL >
 
struct  F0XChecker< OP_FMOD >
 
struct  F0XChecker< OP_REMAINDER >
 
struct  F0XChecker< OP_FABS >
 
struct  F0XChecker< OP_SIGN >
 
struct  F0XChecker< OP_COPYSIGN >
 
struct  F0XChecker< OP_ERF >
 
struct  F0XChecker< OP_SINH >
 
struct  F0XChecker< OP_TANH >
 
struct  F0XChecker< OP_ASINH >
 
struct  F0XChecker< OP_ATANH >
 
struct  F0XChecker< OP_ERFINV >
 
struct  F0XChecker< OP_AND >
 
struct  F0XChecker< OP_IF_ELSE_ZERO >
 
struct  F0XChecker< OP_LOG1P >
 
struct  F0XChecker< OP_EXPM1 >
 
struct  FX0Checker
 
struct  FX0Checker< OP_MUL >
 
struct  FX0Checker< OP_AND >
 
struct  FX0Checker< OP_IF_ELSE_ZERO >
 
struct  F00Checker
 
struct  F00Checker< OP_ADD >
 
struct  F00Checker< OP_SUB >
 
struct  F00Checker< OP_FMIN >
 
struct  F00Checker< OP_FMAX >
 
struct  F00Checker< OP_AND >
 
struct  F00Checker< OP_OR >
 
struct  F00Checker< OP_COPYSIGN >
 
struct  F00Checker< OP_LT >
 
struct  F00Checker< OP_HYPOT >
 
struct  CommChecker
 
struct  CommChecker< OP_ADD >
 
struct  CommChecker< OP_MUL >
 
struct  CommChecker< OP_EQ >
 
struct  CommChecker< OP_NE >
 
struct  CommChecker< OP_AND >
 
struct  CommChecker< OP_OR >
 
struct  CommChecker< OP_HYPOT >
 
struct  NonnegativeChecker
 
struct  NonnegativeChecker< OP_SQRT >
 
struct  NonnegativeChecker< OP_SQ >
 
struct  NonnegativeChecker< OP_EXP >
 
struct  NonnegativeChecker< OP_LT >
 
struct  NonnegativeChecker< OP_LE >
 
struct  NonnegativeChecker< OP_EQ >
 
struct  NonnegativeChecker< OP_NE >
 
struct  NonnegativeChecker< OP_NOT >
 
struct  NonnegativeChecker< OP_AND >
 
struct  NonnegativeChecker< OP_OR >
 
struct  NonnegativeChecker< OP_HYPOT >
 
struct  NargChecker
 
struct  NargChecker< OP_ADD >
 
struct  NargChecker< OP_SUB >
 
struct  NargChecker< OP_MUL >
 
struct  NargChecker< OP_DIV >
 
struct  NargChecker< OP_POW >
 
struct  NargChecker< OP_CONSTPOW >
 
struct  NargChecker< OP_EQ >
 
struct  NargChecker< OP_NE >
 
struct  NargChecker< OP_AND >
 
struct  NargChecker< OP_OR >
 
struct  NargChecker< OP_FMIN >
 
struct  NargChecker< OP_FMAX >
 
struct  NargChecker< OP_PRINTME >
 
struct  NargChecker< OP_ATAN2 >
 
struct  NargChecker< OP_IF_ELSE_ZERO >
 
struct  NargChecker< OP_FMOD >
 
struct  NargChecker< OP_REMAINDER >
 
struct  NargChecker< OP_COPYSIGN >
 
struct  NargChecker< OP_CONST >
 
struct  NargChecker< OP_PARAMETER >
 
struct  NargChecker< OP_INPUT >
 
struct  NargChecker< OP_HYPOT >
 
struct  UnaryOperation< OP_ASSIGN >
 Simple assignment. More...
 
struct  BinaryOperation< OP_ADD >
 Addition. More...
 
struct  BinaryOperation< OP_SUB >
 Subtraction. More...
 
struct  BinaryOperation< OP_MUL >
 Multiplication. More...
 
struct  BinaryOperation< OP_DIV >
 Division. More...
 
struct  UnaryOperation< OP_NEG >
 Negation. More...
 
struct  UnaryOperation< OP_EXP >
 Natural exponent. More...
 
struct  UnaryOperation< OP_LOG >
 Natural logarithm. More...
 
struct  BinaryOperation< OP_POW >
 Power, defined only for x>=0. More...
 
struct  BinaryOperation< OP_CONSTPOW >
 Power, defined only for y constant. More...
 
struct  UnaryOperation< OP_SQRT >
 Square root. More...
 
struct  UnaryOperation< OP_SQ >
 Square. More...
 
struct  UnaryOperation< OP_TWICE >
 Times two. More...
 
struct  UnaryOperation< OP_SIN >
 Sine. More...
 
struct  UnaryOperation< OP_COS >
 Cosine. More...
 
struct  UnaryOperation< OP_TAN >
 Tangent. More...
 
struct  UnaryOperation< OP_ASIN >
 Arcus sine. More...
 
struct  UnaryOperation< OP_ACOS >
 Arcus cosine. More...
 
struct  UnaryOperation< OP_ATAN >
 Arcus tangent. More...
 
struct  BinaryOperation< OP_LT >
 Less than. More...
 
struct  BinaryOperation< OP_LE >
 Less or equal to. More...
 
struct  UnaryOperation< OP_FLOOR >
 Floor function. More...
 
struct  UnaryOperation< OP_CEIL >
 Ceil function. More...
 
struct  BinaryOperation< OP_FMOD >
 Remainder of division. More...
 
struct  BinaryOperation< OP_REMAINDER >
 Remainder of division. More...
 
struct  BinaryOperation< OP_EQ >
 Equal to. More...
 
struct  BinaryOperation< OP_NE >
 Not equal to. More...
 
struct  UnaryOperation< OP_NOT >
 Logical not. More...
 
struct  BinaryOperation< OP_AND >
 Logical and. More...
 
struct  BinaryOperation< OP_OR >
 Logical or. More...
 
struct  UnaryOperation< OP_ERF >
 Error function. More...
 
struct  UnaryOperation< OP_FABS >
 Absolute value. More...
 
struct  UnaryOperation< OP_SIGN >
 Sign. More...
 
struct  BinaryOperation< OP_COPYSIGN >
 Copysign. More...
 
struct  BinaryOperation< OP_FMIN >
 Minimum. More...
 
struct  BinaryOperation< OP_FMAX >
 Maximum. More...
 
struct  UnaryOperation< OP_INV >
 Element-wise inverse. More...
 
struct  UnaryOperation< OP_SINH >
 Hyperbolic sine. More...
 
struct  UnaryOperation< OP_COSH >
 Hyperbolic cosine. More...
 
struct  UnaryOperation< OP_TANH >
 Hyperbolic tangent. More...
 
struct  UnaryOperation< OP_ASINH >
 Inverse hyperbolic sine. More...
 
struct  UnaryOperation< OP_ACOSH >
 Inverse hyperbolic cosine. More...
 
struct  UnaryOperation< OP_ATANH >
 Inverse hyperbolic tangent. More...
 
struct  UnaryOperation< OP_ERFINV >
 Inverse of error function. More...
 
struct  UnaryOperation< OP_LOG1P >
 log1p(x) = log(1+x) More...
 
struct  UnaryOperation< OP_EXPM1 >
 expm1(x) = exp(x)-1 More...
 
struct  BinaryOperation< OP_PRINTME >
 Identity operator with the side effect of printing. More...
 
struct  BinaryOperation< OP_ATAN2 >
 Arctan2. More...
 
struct  BinaryOperation< OP_IF_ELSE_ZERO >
 Conditional assignment. More...
 
struct  BinaryOperation< OP_LIFT >
 Inverse of error function. More...
 
struct  BinaryOperation< OP_HYPOT >
 hypot(x,y) = sqrt(x^2+y^2) More...
 
struct  casadi_math
 Easy access to all the functions for a particular type. More...
 
struct  casadi_math< casadi_int >
 Specialize the class so that it can be used with integer type. More...
 
class  CallSX
 
class  Callback
 Callback function functionality. More...
 
class  CallbackInternal
 
class  Call
 
class  Matrix
 Sparse matrix class. SX and DM are specializations. More...
 
class  conditional_lock_guard
 
struct  enum_traits
 Helper class: Specify number of entries in an enum. More...
 
class  Find
 Finds the first nonzero element in a vector. More...
 
class  InterruptHandler
 Takes care of user interrupts (Ctrl+C) More...
 
class  casadi_limits
 casadi_limits class More...
 
class  Logger
 Keeps track of logging output to screen and/or files. More...
 
class  Low
 Lows the first nonzero element in a vector. More...
 
class  CasadiMeta
 Collects global CasADi meta information. More...
 
class  scoped_checkout
 
struct  sortCompare
 
class  CodeGenerator
 Helper class for C code generation. More...
 
class  Concat
 Concatenation: Join multiple expressions stacking the nonzeros. More...
 
class  Horzcat
 Horizontal concatenation. More...
 
class  Vertcat
 Vertical concatenation of vectors. More...
 
class  Diagcat
 Diagonal concatenation of matrices. More...
 
struct  ConicMemory
 
class  Conic
 Internal class. More...
 
class  ConstantMX
 Represents an MX that is only composed of a constant. More...
 
class  ConstantDM
 A constant given as a DM. More...
 
class  ConstantFile
 A constant to be read from a file. More...
 
class  ConstantPool
 A constant to be managed by a pool. More...
 
class  ZeroByZero
 A zero-by-zero matrix. More...
 
struct  RuntimeConst
 Constant known at runtime. More...
 
struct  CompiletimeConst
 
class  Constant
 A constant with all entries identical. More...
 
class  ConstantSX
 Represents a constant SX. More...
 
class  RealtypeSX
 DERIVED CLASSES. More...
 
class  IntegerSX
 Represents a constant integer SX. More...
 
class  ZeroSX
 Represents a zero SX. More...
 
class  OneSX
 Represents a one SX. More...
 
class  MinusOneSX
 Represents a minus one SX. More...
 
class  InfSX
 Represents an infinity SX. More...
 
class  MinusInfSX
 Represents a minus infinity SX. More...
 
class  NanSX
 Represents a not-a-number SX. More...
 
class  Convexify
 Convexify a symmetric matrix. More...
 
class  DaeBuilder
 A symbolic representation of a differential-algebraic equations model. More...
 
struct  Variable
 Holds expressions and meta-data corresponding to a physical quantity evolving in time. More...
 
class  DaeBuilderInternal
 
class  Determinant
 Matrix determinant. More...
 
class  Dot
 Matrix dot. More...
 
class  Dple
 Internal class. More...
 
class  Einstein
 An MX atomic for an Einstein product,. More...
 
class  CasadiException
 Casadi exception class. More...
 
class  KeyboardInterruptException
 
class  Expm
 Internal class. More...
 
class  External
 
class  GenericExternal
 
struct  Block
 
struct  HBlock
 
class  Factory
 
class  Filesystem
 Filesystem interface. More...
 
class  FiniteDiff
 
class  ForwardDiff
 
class  BackwardDiff
 
class  CentralDiff
 
class  Smoothing
 
class  Fmu
 Interface to binary FMU. More...
 
class  Fmu2
 Interface to a binary FMU, adhering to FMI version 2.0. More...
 
class  Fmu3
 Interface to a binary FMU, adhering to FMI version 2.0. More...
 
struct  FmuMemory
 
struct  InputStruct
 
struct  OutputStruct
 
class  FmuFunction
 
struct  EventMemory
 
class  FmuInternal
 Interface to binary FMU. More...
 
class  Function
 Function object. More...
 
class  FunctionBuffer
 Class to achieve minimal overhead function evaluations. More...
 
struct  ProtoFunctionMemory
 Function memory with temporary work vectors. More...
 
struct  FunctionMemory
 Function memory with temporary work vectors. More...
 
class  ProtoFunction
 Base class for FunctionInternal and LinsolInternal. More...
 
class  FunctionInternal
 Internal class for Function. More...
 
struct  GenericExpressionCommon
 Empty Base. More...
 
class  GenericExpression
 Expression interface. More...
 
struct  GenericMatrixCommon
 Empty Base. More...
 
class  GenericMatrix
 Matrix base class. More...
 
class  GenericWeakRef
 
class  GenericSharedInternal
 
class  GenericWeakRefInternal
 
class  GenericShared
 
class  WeakCache
 
class  GenericType
 Generic data type, can hold different types such as bool, casadi_int, std::string etc. More...
 
class  GenericTypeBase
 
class  GenericTypeInternal
 
class  GetNonzeros
 Get nonzeros of a matrix. More...
 
class  GetNonzerosVector
 
class  GetNonzerosSlice
 
class  GetNonzerosSlice2
 
class  GetNonzerosParam
 Get nonzeros of a matrix, parametrically. More...
 
class  GetNonzerosParamVector
 
class  GetNonzerosSliceParam
 
class  GetNonzerosParamSlice
 
class  GetNonzerosParamParam
 
class  GlobalOptions
 Collects global CasADi options. More...
 
class  Importer
 Importer. More...
 
class  ImporterInternal
 Importer internal class. More...
 
class  DllLibrary
 Dynamically linked library. More...
 
struct  enum_traits< DynIn >
 
struct  enum_traits< DynOut >
 
struct  enum_traits< EventIn >
 
struct  enum_traits< EventOut >
 
struct  IntegratorMemory
 Integrator memory. More...
 
struct  SpForwardMem
 Memory struct, forward sparsity pattern propagation. More...
 
struct  SpReverseMem
 Memory struct, backward sparsity pattern propagation. More...
 
class  Integrator
 Internal storage for integrator related data. More...
 
struct  FixedStepMemory
 
class  FixedStepIntegrator
 
class  ImplicitFixedStepIntegrator
 
class  Interpolant
 
class  Inverse
 Matrix inverse. More...
 
class  IOInstruction
 An input or output instruction. More...
 
class  Input
 Input instruction. More...
 
class  Output
 Input instruction. More...
 
class  JitFunction
 
class  Linsol
 Linear solver. More...
 
struct  LinsolMemory
 
class  LinsolInternal
 
class  LogSumExp
 Calculate logsumexp update. More...
 
class  Map
 
class  OmpMap
 
class  ThreadMap
 
class  MapSum
 
struct  MatrixCommon
 Empty Base. More...
 
class  MMin
 Matrix minimum. More...
 
class  MMax
 Matrix maximum. More...
 
class  Monitor
 Monitor. More...
 
class  MultipleOutput
 
class  OutputNode
 
class  Multiplication
 An MX atomic for matrix-matrix product,. More...
 
class  DenseMultiplication
 An MX atomic for matrix-matrix product,. More...
 
struct  ConvexifyData
 
class  MX
 MX - Matrix expression. More...
 
struct  MXAlgEl
 An element of the algorithm, namely an MX node. More...
 
class  MXFunction
 Internal node class for MXFunction. More...
 
class  MXNode
 Node class for MX objects. More...
 
class  NlpBuilder
 A symbolic NLP representation. More...
 
class  NlImporter
 
struct  NlpsolMemory
 Integrator memory. More...
 
class  Nlpsol
 NLP solver storage class. More...
 
class  NonZeros
 Access to a set of nonzeros. More...
 
class  Norm
 Matrix and vector norms. More...
 
class  NormF
 Represents a Frobenius norm. More...
 
class  Norm2
 Represents a 2-norm (spectral norm) More...
 
class  Norm1
 1-norm More...
 
class  NormInf
 Represents an infinity-norm operation on a MX. More...
 
struct  Options
 Options metadata for a class. More...
 
class  Opti
 A simplified interface for NLP modeling/solving. More...
 
struct  IndexAbstraction
 
struct  MetaCon
 
struct  MetaVar
 
class  OptiCallback
 
class  OptiAdvanced
 
class  OptiSol
 A simplified interface for NLP modeling/solving. More...
 
class  null_ptr_on_copy
 Pointer that gets set to null when copied. More...
 
class  OptiNode
 A simplified interface for NLP modeling/solving. More...
 
class  OracleCallback
 
struct  LocalOracleMemory
 Function memory with temporary work vectors. More...
 
struct  OracleMemory
 Function memory. More...
 
class  OracleFunction
 Base class for functions that perform calculation with an oracle. More...
 
class  SharedSXElem
 
class  WeakRefSXElem
 
class  OutputSX
 
class  PluginInterface
 Interface for accessing input and output data structures. More...
 
class  Polynomial
 Helper class for differentiating and integrating polynomials. More...
 
struct  PrintableCommon
 Empty Base. More...
 
class  Printable
 Base class for objects that have a natural string representation. More...
 
class  Project
 Change the sparsity of an expression. More...
 
class  Densify
 Densify. More...
 
class  Sparsify
 Densify. More...
 
class  Rank1
 Calculate rank1 update. More...
 
class  HorzRepmat
 Horizontal repmat. More...
 
class  HorzRepsum
 Horizontal repsum. More...
 
class  Reshape
 Reshape an expression. More...
 
class  Resource
 RAII class for reading from a zip file. More...
 
class  ResourceInternal
 RAII class base for reading from resources. More...
 
class  DirResource
 
class  ZipResource
 RAII class for reading from a zip file. More...
 
class  ZipMemResource
 RAII class for reading from a zip held in memory. More...
 
struct  RootfinderMemory
 Integrator memory. More...
 
class  Rootfinder
 Internal class. More...
 
struct  casadi_newton_mem
 
class  SerializerBase
 
class  DeserializerBase
 
class  StringSerializer
 
class  FileSerializer
 
class  StringDeserializer
 
class  FileDeserializer
 
class  UniversalNodeOwner
 
class  DeserializingStream
 Helper class for Serialization. More...
 
class  SerializingStream
 Helper class for Serialization. More...
 
class  SetNonzeros
 Assign or add entries to a matrix. More...
 
class  SetNonzerosVector
 Add the nonzeros of a matrix to another matrix. More...
 
class  SetNonzerosSlice
 
class  SetNonzerosSlice2
 
class  SetNonzerosParam
 Assign or add entries to a matrix, parametrically. More...
 
class  SetNonzerosParamVector
 Add the nonzeros of a matrix to another matrix, parametrically. More...
 
class  SetNonzerosParamSlice
 
class  SetNonzerosSliceParam
 
class  SetNonzerosParamParam
 
class  SharedObject
 GenericShared implements a reference counting framework similar for efficient and. More...
 
class  WeakRef
 Weak reference type. More...
 
class  SharedObjectInternal
 
class  WeakRefInternal
 
class  Slice
 Class representing a Slice. More...
 
class  Solve
 An MX atomic for linear solver solution: x = r * A^-1 or x = r * A^-T. More...
 
class  LinsolCall
 Linear solve operation with a linear solver instance. More...
 
class  TriuSolve
 Linear solve with an upper triangular matrix. More...
 
class  TrilSolve
 Linear solve with an upper triangular matrix. More...
 
class  SolveUnity
 Linear solve with unity diagonal added. More...
 
class  TriuSolveUnity
 Linear solve with an upper triangular matrix, unity diagonal. More...
 
class  TrilSolveUnity
 Linear solve with an upper triangular matrix. More...
 
struct  SparsityStruct
 Compact representation of a sparsity pattern. More...
 
class  Sparsity
 General sparsity class. More...
 
class  SparsityCast
 
struct  SparsityInterfaceCommon
 Empty Base. More...
 
class  SparsityInterface
 Sparsity interface class. More...
 
class  SparsityInternal
 
class  Split
 Split: Split into multiple expressions splitting the nonzeros. More...
 
class  Horzsplit
 Horizontal split, x -> x0, x1, ... More...
 
class  Diagsplit
 Diag split, x -> x0, x1, ... More...
 
class  Vertsplit
 Vertical split of vectors, x -> x0, x1, ... More...
 
class  SubAssign
 Reference to a submatrix. More...
 
class  SubMatrix
 
class  SubIndex
 
class  SubRef
 Reference to a submatrix. More...
 
class  Switch
 
class  SXElem
 The basic scalar symbolic class of CasADi. More...
 
class  casadi_limits< SXElem >
 
struct  ScalarAtomic
 An atomic operation for the SXElem virtual machine. More...
 
class  SXFunction
 Internal node class for SXFunction. More...
 
class  SXNode
 Internal node class for SX. More...
 
class  SymbolicMX
 Represents a symbolic MX. More...
 
class  SymbolicSX
 Represents a scalar symbolic expression. More...
 
class  FStats
 
class  ScopedTiming
 
class  Transpose
 Matrix transpose. More...
 
class  DenseTranspose
 Matrix transpose (dense) More...
 
class  UnaryMX
 Represents a general unary operation on an MX. More...
 
class  UnarySX
 Represents a basic unary operation on an SXElem node. More...
 
class  XFunction
 Internal node class for the base class of SXFunction and MXFunction. More...
 
class  XmlFile
 XML parser. More...
 
class  XmlFileInternal
 
struct  XmlNode
 
struct  AlpaqaMemory
 
class  AlpaqaInterface
 
class  AlpaqaProblem
 
struct  AmplInterfaceMemory
 
class  AmplInterface
 'ampl' plugin for Nlpsol More...
 
struct  BlocksqpMemory
 
class  Blocksqp
 'blocksqp' plugin for Nlpsol More...
 
struct  BonminMemory
 
class  BonminInterface
 'bonmin' plugin for Nlpsol More...
 
class  BonminUserClass
 
struct  CbcMemory
 
class  CbcInterface
 'cbc' plugin for Conic More...
 
class  ClangCompiler
 'clang' plugin for Importer More...
 
struct  ClarabelMemory
 
class  ClarabelInterface
 'clarabel' plugin for Conic More...
 
struct  ClpMemory
 
class  ClpInterface
 'clp' plugin for Conic More...
 
struct  CplexMemory
 
class  CplexInterface
 'cplex' plugin for Conic More...
 
struct  CsparseCholMemory
 
class  CSparseCholeskyInterface
 'csparsecholesky' plugin for Linsol More...
 
struct  CsparseMemory
 
class  CsparseInterface
 'csparse' plugin for Linsol More...
 
struct  DaqpMemory
 
class  DaqpInterface
 'daqp' plugin for Conic More...
 
struct  FatropConicMemory
 
class  FatropConicInterface
 'fatrop' plugin for Conic More...
 
struct  FatropMemory
 
class  FatropInterface
 'fatrop' plugin for Nlpsol More...
 
class  Ghc
 'ghc' plugin for Filesystem More...
 
struct  GurobiMemory
 
class  GurobiInterface
 'gurobi' plugin for Conic More...
 
struct  HighsMemory
 
class  HighsInterface
 'highs' plugin for Conic More...
 
struct  HpipmMemory
 
class  HpipmInterface
 'hpipm' plugin for Conic More...
 
struct  HpmpcMemory
 
class  HpmpcInterface
 'hpmpc' plugin for Conic More...
 
struct  Ma27Memory
 
class  Ma27Interface
 'ma27' plugin for Linsol More...
 
struct  IpoptMemory
 
class  IpoptInterface
 'ipopt' plugin for Nlpsol More...
 
class  IpoptUserClass
 
struct  KnitroMemory
 
class  KnitroInterface
 'knitro' plugin for Nlpsol More...
 
struct  LapackLuMemory
 
class  LapackLu
 'lapacklu' plugin for Linsol More...
 
struct  LapackQrMemory
 
class  LapackQr
 'lapackqr' plugin for Linsol More...
 
class  Libzip
 'libzip' plugin for Archiver More...
 
struct  MadnlpMemory
 
class  MadnlpInterface
 'madnlp' plugin for Nlpsol More...
 
struct  MumpsMemory
 
class  MumpsInterface
 'mumps' plugin for Linsol More...
 
struct  OoqpMemory
 
class  OoqpInterface
 'ooqp' plugin for Conic More...
 
struct  OsqpMemory
 
class  OsqpInterface
 'osqp' plugin for Conic More...
 
struct  ProxqpMemory
 
class  ProxqpInterface
 'proxqp' plugin for Conic More...
 
struct  QpoasesMemory
 
class  QpoasesInterface
 'qpoases' plugin for Conic More...
 
struct  SLEQPMemory
 
class  SLEQPInterface
 
struct  SlicotDpleMemory
 
class  SlicotDple
 'slicot' plugin for Dple More...
 
struct  SlicotExpmMemory
 
class  SlicotExpm
 'slicot' plugin for Expm More...
 
struct  SnoptMemory
 
class  SnoptInterface
 'snopt' plugin for Nlpsol More...
 
class  SqicInterface
 'sqic' plugin for Conic More...
 
struct  CvodesMemory
 
class  CvodesInterface
 'cvodes' plugin for Integrator More...
 
struct  IdasMemory
 
class  IdasInterface
 'idas' plugin for Integrator More...
 
struct  KinsolMemory
 
class  KinsolInterface
 'kinsol' plugin for Rootfinder More...
 
struct  SundialsMemory
 
class  SundialsInterface
 
struct  SuperscsMemory
 
class  SuperscsInterface
 'superscs' plugin for Conic More...
 
class  TinyXmlInterface
 'tinyxml' plugin for XmlFile More...
 
struct  WorhpMemory
 
class  WorhpInterface
 'worhp' plugin for Nlpsol More...
 
class  BSplineInterpolant
 'bspline' plugin for Interpolant More...
 
class  Collocation
 'collocation' plugin for Integrator More...
 
struct  FastNewtonMemory
 
class  FastNewton
 'fast_newton' plugin for Rootfinder More...
 
struct  FeasiblesqpmethodMemory
 
class  Feasiblesqpmethod
 'feasiblesqpmethod' plugin for Nlpsol More...
 
struct  ImplicitToNlpMemory
 
class  ImplicitToNlp
 'nlp' plugin for Rootfinder More...
 
struct  IpqpMemory
 
class  Ipqp
 'ipqp' plugin for Conic More...
 
class  LinearInterpolant
 'linear' plugin for Interpolant Implements a multilinear interpolant: For 1D, the interpolating polynomial will be linear. For 2D, the interpolating polynomial will be bilinear, etc. More...
 
class  LinearInterpolantJac
 
struct  LinsolLdlMemory
 
class  LinsolLdl
 'ldl' plugin for Linsol More...
 
struct  LinsolQrMemory
 
class  LinsolQr
 'qr' plugin for Linsol More...
 
struct  LinsolTridiagMemory
 
class  LinsolTridiag
 'tridiag' plugin for Linsol More...
 
struct  LsqrMemory
 Memory for SymbolicQR
More...
 
class  Lsqr
 'symbolicqr' plugin for Linsol More...
 
struct  NewtonMemory
 
class  Newton
 'newton' plugin for Rootfinder More...
 
struct  QpToNlpMemory
 
class  QpToNlp
 'nlpsol' plugin for Conic More...
 
struct  QrqpMemory
 
class  Qrqp
 'qrqp' plugin for Conic More...
 
struct  QrsqpMemory
 
class  Qrsqp
 'qrsqp' plugin for Nlpsol More...
 
class  RungeKutta
 'rk' plugin for Integrator More...
 
struct  ScpgenMemory
 
class  Scpgen
 'scpgen' plugin for Nlpsol More...
 
class  ShellCompiler
 'shell' plugin for Importer More...
 
struct  SqpmethodMemory
 
class  Sqpmethod
 'sqpmethod' plugin for Nlpsol More...
 
struct  SymbolicQrMemory
 Memory for SymbolicQR
More...
 
class  SymbolicQr
 'symbolicqr' plugin for Linsol More...
 

Typedefs

typedef unsigned long long bvec_t
 
typedef Matrix< double > DM
 
typedef std::vector< DMDMVector
 
typedef std::vector< DMVectorDMVectorVector
 
typedef std::map< std::string, DMDMDict
 
typedef GenericTypeInternal< OT_STRING, std::string > StringType
 
typedef GenericTypeInternal< OT_DOUBLE, double > DoubleType
 
typedef GenericTypeInternal< OT_INT, casadi_int > IntType
 
typedef GenericTypeInternal< OT_BOOL, bool > BoolType
 
typedef GenericTypeInternal< OT_DOUBLEVECTOR, std::vector< double > > DoubleVectorType
 
typedef GenericTypeInternal< OT_DOUBLEVECTORVECTOR, std::vector< std::vector< double > > > DoubleVectorVectorType
 
typedef GenericTypeInternal< OT_INTVECTOR, std::vector< casadi_int > > IntVectorType
 
typedef GenericTypeInternal< OT_INTVECTORVECTOR, std::vector< std::vector< casadi_int > > > IntVectorVectorType
 
typedef GenericTypeInternal< OT_STRINGVECTOR, std::vector< std::string > > StringVectorType
 
typedef GenericTypeInternal< OT_STRINGVECTORVECTOR, std::vector< std::vector< std::string > > > StringVectorVectorType
 
typedef GenericTypeInternal< OT_FUNCTION, FunctionFunctionType
 
typedef GenericTypeInternal< OT_FUNCTIONVECTOR, std::vector< Function > > FunctionVectorType
 
typedef GenericTypeInternal< OT_DICT, DictDictType
 
typedef GenericTypeInternal< OT_DICTVECTOR, std::vector< Dict > > DictVectorType
 
typedef GenericTypeInternal< OT_VECTORVECTOR, std::vector< std::vector< GenericType > > > VectorVectorType
 
typedef GenericTypeInternal< OT_VECTOR, std::vector< GenericType > > VectorType
 
typedef GenericTypeInternal< OT_VOIDPTR, void * > VoidPointerType
 
typedef GenericType::Dict Dict
 C++ equivalent of Python's dict or MATLAB's struct. More...
 
typedef Matrix< casadi_int > IM
 
typedef DM native_DM
 
typedef GenericWeakRefInternal< SharedSXElem, OutputSXWeakRefInternalSXElem
 
typedef ProtoFunction *(* Deserialize) (DeserializingStream &)
 
typedef void(* external_print_callback_t) (const char *s)
 
typedef const char *(* external_transform_t) (char api_version, const char *casadi_version, const char *in, external_print_callback_t cb_stdout, external_print_callback_t cb_stderr)
 
typedef SXSXPtr
 
typedef std::vector< SXPtrSXPtrV
 
typedef int(* config_t) (int, const char **)
 Function pointer types for the C API. More...
 
typedef void(* signal_t) (void)
 Function pointer types for the C API. More...
 
typedef casadi_int(* getint_t) (void)
 Function pointer types for the C API. More...
 
typedef double(* default_t) (casadi_int i)
 Function pointer types for the C API. More...
 
typedef const char *(* name_t) (casadi_int i)
 Function pointer types for the C API. More...
 
typedef const casadi_int *(* sparsity_t) (casadi_int i)
 Function pointer types for the C API. More...
 
typedef int(* diff_t) (casadi_int i)
 Function pointer types for the C API. More...
 
typedef int(* casadi_checkout_t) (void)
 Function pointer types for the C API. More...
 
typedef void(* casadi_release_t) (int)
 Function pointer types for the C API. More...
 
typedef int(* work_t) (casadi_int *sz_arg, casadi_int *sz_res, casadi_int *sz_iw, casadi_int *sz_w)
 Function pointer types for the C API. More...
 
typedef int(* eval_t) (const double **arg, double **res, casadi_int *iw, double *w, int)
 Function pointer types for the C API. More...
 
typedef std::vector< std::string > StringVector
 
typedef std::vector< MXMXVector
 
typedef std::initializer_list< MXMXIList
 
typedef std::vector< MXVectorMXVectorVector
 
typedef std::map< std::string, MXMXDict
 
typedef std::map< std::string, SparsitySpDict
 
typedef Matrix< SXElemSX
 
typedef std::vector< SXSXVector
 
typedef std::initializer_list< SXSXIList
 
typedef std::vector< SXVectorSXVectorVector
 
typedef std::map< std::string, SXSXDict
 

Enumerations

enum  Operation {
  OP_ASSIGN , OP_ADD , OP_SUB , OP_MUL ,
  OP_DIV , OP_NEG , OP_EXP , OP_LOG ,
  OP_POW , OP_CONSTPOW , OP_SQRT , OP_SQ ,
  OP_TWICE , OP_SIN , OP_COS , OP_TAN ,
  OP_ASIN , OP_ACOS , OP_ATAN , OP_LT ,
  OP_LE , OP_EQ , OP_NE , OP_NOT ,
  OP_AND , OP_OR , OP_FLOOR , OP_CEIL ,
  OP_FMOD , OP_FABS , OP_SIGN , OP_COPYSIGN ,
  OP_IF_ELSE_ZERO , OP_ERF , OP_FMIN , OP_FMAX ,
  OP_INV , OP_SINH , OP_COSH , OP_TANH ,
  OP_ASINH , OP_ACOSH , OP_ATANH , OP_ATAN2 ,
  OP_CONST , OP_INPUT , OP_OUTPUT , OP_PARAMETER ,
  OP_CALL , OP_FIND , OP_LOW , OP_MAP ,
  OP_MTIMES , OP_SOLVE , OP_TRANSPOSE , OP_DETERMINANT ,
  OP_INVERSE , OP_DOT , OP_BILIN , OP_RANK1 ,
  OP_HORZCAT , OP_VERTCAT , OP_DIAGCAT , OP_HORZSPLIT ,
  OP_VERTSPLIT , OP_DIAGSPLIT , OP_RESHAPE , OP_SUBREF ,
  OP_SUBASSIGN , OP_GETNONZEROS , OP_GETNONZEROS_PARAM , OP_ADDNONZEROS ,
  OP_ADDNONZEROS_PARAM , OP_SETNONZEROS , OP_SETNONZEROS_PARAM , OP_PROJECT ,
  OP_ASSERTION , OP_MONITOR , OP_NORM2 , OP_NORM1 ,
  OP_NORMINF , OP_NORMF , OP_MMIN , OP_MMAX ,
  OP_HORZREPMAT , OP_HORZREPSUM , OP_ERFINV , OP_PRINTME ,
  OP_LIFT , OP_EINSTEIN , OP_BSPLINE , OP_CONVEXIFY ,
  OP_SPARSITY_CAST , OP_LOG1P , OP_EXPM1 , OP_HYPOT ,
  OP_LOGSUMEXP , OP_REMAINDER
}
 Enum for quick access to any node. More...
 
enum  UnifiedReturnStatus {
  SOLVER_RET_SUCCESS , SOLVER_RET_UNKNOWN , SOLVER_RET_LIMITED , SOLVER_RET_NAN ,
  SOLVER_RET_INFEASIBLE , SOLVER_RET_EXCEPTION
}
 
enum  ConicInput {
  CONIC_H , CONIC_G , CONIC_A , CONIC_LBA ,
  CONIC_UBA , CONIC_LBX , CONIC_UBX , CONIC_X0 ,
  CONIC_LAM_X0 , CONIC_LAM_A0 , CONIC_Q , CONIC_P ,
  CONIC_NUM_IN
}
 Input arguments of a QP problem. More...
 
enum  ConicOutput {
  CONIC_X , CONIC_COST , CONIC_LAM_A , CONIC_LAM_X ,
  CONIC_NUM_OUT
}
 Output arguments of an QP Solver. More...
 
enum class  TypeFmi2 {
  REAL , INTEGER , BOOLEAN , STRING ,
  ENUM , NUMEL
}
 Variable type (FMI 2) More...
 
enum class  Type {
  FLOAT32 , FLOAT64 , INT8 , UINT8 ,
  INT16 , UINT16 , INT32 , UINT32 ,
  INT64 , UINT64 , BOOLEAN , STRING ,
  BINARY , ENUMERATION , CLOCK , NUMEL
}
 Variable type (FMI 3) More...
 
enum class  Causality {
  PARAMETER , CALCULATED_PARAMETER , INPUT , OUTPUT ,
  LOCAL , INDEPENDENT , NUMEL
}
 Causality: FMI 2.0 specification, section 2.2.7 or FMI 3.0 specification, section 2.4.7.4. More...
 
enum class  Variability {
  CONSTANT , FIXED , TUNABLE , DISCRETE ,
  CONTINUOUS , NUMEL
}
 Variability: FMI 2.0 specification, section 2.2.7 or FMI 3.0 specification, section 2.4.7.4. More...
 
enum class  Category {
  T , C , P , D ,
  W , U , X , Z ,
  Q , CALCULATED , NUMEL
}
 
enum class  OutputCategory {
  ODE , ALG , QUAD , ZERO ,
  DDEF , WDEF , Y , NUMEL
}
 
enum class  Initial {
  EXACT , APPROX , CALCULATED , NA ,
  NUMEL
}
 Initial: FMI 2.0 specification, section 2.2.7 or FMI 3.0 specification, section 2.4.7.5. More...
 
enum class  Attribute {
  MIN , MAX , NOMINAL , START ,
  VALUE , STRINGVALUE , NUMEL
}
 
enum class  DependenciesKind {
  DEPENDENT , CONSTANT , FIXED , TUNABLE ,
  DISCRETE , NUMEL
}
 
enum  DpleInput { DPLE_A , DPLE_V , DPLE_NUM_IN }
 Input arguments of a dple solver [dpleIn]. More...
 
enum  DpleOutput { DPLE_P , DPLE_NUM_OUT }
 Output arguments of a dple solver [dpleOut]. More...
 
enum class  FdMode {
  FORWARD , BACKWARD , CENTRAL , SMOOTHING ,
  NUMEL
}
 Variable type. More...
 
enum class  FmuApi { FMI2 , FMI3 , NUMEL }
 Which C API. More...
 
enum class  Parallelization { SERIAL , OPENMP , THREAD , NUMEL }
 Type of parallelization. More...
 
enum class  InputType {
  REG , FWD , ADJ , OUT ,
  ADJ_OUT
}
 
enum class  OutputType {
  REG , FWD , ADJ , JAC ,
  JAC_TRANS , JAC_ADJ_OUT , JAC_REG_ADJ , HESS
}
 
enum  TypeID {
  OT_NULL , OT_BOOL , OT_INT , OT_DOUBLE ,
  OT_STRING , OT_INTVECTOR , OT_INTVECTORVECTOR , OT_BOOLVECTOR ,
  OT_DOUBLEVECTOR , OT_DOUBLEVECTORVECTOR , OT_STRINGVECTOR , OT_DICT ,
  OT_FUNCTION , OT_FUNCTIONVECTOR , OT_VOIDPTR , OT_UNKNOWN ,
  OT_STRINGVECTORVECTOR , OT_DICTVECTOR , OT_VECTORVECTOR , OT_VECTOR
}
 Types of options. More...
 
enum  CollocationPoints { LEGENDRE , RADAU }
 
enum  DynIn {
  DYN_T , DYN_X , DYN_Z , DYN_P ,
  DYN_U , DYN_NUM_IN
}
 Inputs of the symbolic representation of the DAE. More...
 
enum  DynOut {
  DYN_ODE , DYN_ALG , DYN_QUAD , DYN_ZERO ,
  DYN_NUM_OUT
}
 Outputs of the symbolic representation of the DAE. More...
 
enum  EventIn {
  EVENT_INDEX , EVENT_T , EVENT_X , EVENT_Z ,
  EVENT_P , EVENT_U , EVENT_NUM_IN
}
 Inputs of an event transition function. More...
 
enum  EventOut { EVENT_POST_X , EVENT_POST_Z , EVENT_NUM_OUT }
 Outputs of an event transition function. More...
 
enum  IntegratorInput {
  INTEGRATOR_X0 , INTEGRATOR_Z0 , INTEGRATOR_P , INTEGRATOR_U ,
  INTEGRATOR_ADJ_XF , INTEGRATOR_ADJ_ZF , INTEGRATOR_ADJ_QF , INTEGRATOR_NUM_IN
}
 Input arguments of an integrator. More...
 
enum  IntegratorOutput {
  INTEGRATOR_XF , INTEGRATOR_ZF , INTEGRATOR_QF , INTEGRATOR_ADJ_X0 ,
  INTEGRATOR_ADJ_Z0 , INTEGRATOR_ADJ_P , INTEGRATOR_ADJ_U , INTEGRATOR_NUM_OUT
}
 Output arguments of an integrator. More...
 
enum  StepIn {
  STEP_T , STEP_H , STEP_X0 , STEP_V0 ,
  STEP_P , STEP_U , STEP_NUM_IN
}
 Input arguments of a forward stepping function. More...
 
enum  StepOut { STEP_XF , STEP_VF , STEP_QF , STEP_NUM_OUT }
 Output arguments of a forward stepping function. More...
 
enum  BStepIn {
  BSTEP_T , BSTEP_H , BSTEP_X0 , BSTEP_V0 ,
  BSTEP_P , BSTEP_U , BSTEP_OUT_XF , BSTEP_OUT_VF ,
  BSTEP_OUT_QF , BSTEP_ADJ_XF , BSTEP_ADJ_VF , BSTEP_ADJ_QF ,
  BSTEP_NUM_IN
}
 Input arguments of a backward stepping function. More...
 
enum  BStepOut {
  BSTEP_ADJ_T , BSTEP_ADJ_H , BSTEP_ADJ_X0 , BSTEP_ADJ_V0 ,
  BSTEP_ADJ_P , BSTEP_ADJ_U , BSTEP_NUM_OUT
}
 Output arguments of a backward stepping function. More...
 
enum  NLPInput { NL_X , NL_P , NL_NUM_IN }
 Input arguments of an NLP function. More...
 
enum  NLPOutput { NL_F , NL_G , NL_NUM_OUT }
 Output arguments of an NLP function. More...
 
enum  NlpsolInput {
  NLPSOL_X0 , NLPSOL_P , NLPSOL_LBX , NLPSOL_UBX ,
  NLPSOL_LBG , NLPSOL_UBG , NLPSOL_LAM_X0 , NLPSOL_LAM_G0 ,
  NLPSOL_NUM_IN
}
 Input arguments of an NLP Solver. More...
 
enum  NlpsolOutput {
  NLPSOL_X , NLPSOL_F , NLPSOL_G , NLPSOL_LAM_X ,
  NLPSOL_LAM_G , NLPSOL_LAM_P , NLPSOL_NUM_OUT
}
 Output arguments of an NLP Solver. More...
 
enum  ConstraintType {
  OPTI_GENERIC_EQUALITY , OPTI_GENERIC_INEQUALITY , OPTI_EQUALITY , OPTI_INEQUALITY ,
  OPTI_DOUBLE_INEQUALITY , OPTI_PSD , OPTI_UNKNOWN
}
 
enum  VariableType { OPTI_VAR , OPTI_PAR , OPTI_DUAL_G }
 
enum  DomainType { OPTI_DOMAIN_REAL , OPTI_DOMAIN_INTEGER }
 
enum  RfpIn { RFP_X , RFP_P , RFP_NUM_IN }
 Inputs of the symbolic representation of the rootfinding problem. More...
 
enum  RfpOut { RFP_G , RFP_NUM_OUT }
 Inputs of the symbolic representation of the rootfinding problem. More...
 
enum  RootfinderInput { ROOTFINDER_X0 , ROOTFINDER_P , ROOTFINDER_NUM_IN }
 Input arguments of a rootfinder. More...
 
enum  RootfinderOutput { ROOTFINDER_X , ROOTFINDER_NUM_OUT }
 Output arguments of a rootfinder. More...
 

Functions

bool has_archiver (const std::string &name)
 Check if a particular plugin is available. More...
 
void load_archiver (const std::string &name)
 Explicitly load a plugin dynamically. More...
 
std::string doc_archiver (const std::string &name)
 Get the documentation string for a plugin. More...
 
Function blazing_spline (const std::string &name, const std::vector< std::vector< double > > &knots, const Dict &opts=Dict())
 Construct a specialized parametric BSpline. More...
 
void get_boor (const MX &x, const MX &knots, casadi_int degree, casadi_int lookup_mode, MX &start, MX &boor)
 
MX do_inline (const MX &x, const std::vector< std::vector< double > > &knots, const MX &coeffs, casadi_int m, const std::vector< casadi_int > &degree, const std::vector< casadi_int > &lookup_mode)
 
template<typename T >
twice (const T &x)
 
template<typename T >
sq (const T &x)
 
template<template< casadi_int > class F, typename T >
operation_getter (casadi_int op)
 
template<template< casadi_int > class F>
bool operation_checker (casadi_int op)
 
template<typename T >
std::string str (const T &v)
 String representation, any type. More...
 
template<typename T >
std::string str (const T &v, bool more)
 String representation, CasADi type. More...
 
template<typename T >
std::string str (const std::vector< T > &v, bool more=false)
 String representation of vector. More...
 
template<typename T >
std::string str (const std::set< T > &v, bool more=false)
 String representation of set. More...
 
template<typename T1 , typename T2 >
std::string str (const std::pair< T1, T2 > &p, bool more=false)
 String representation of pair. More...
 
template<typename T1 , typename T2 >
std::string str (const std::map< T1, T2 > &p, bool more=false)
 String representation of a map. More...
 
template<typename T2 >
std::string str (const std::map< std::string, T2 > &p, bool more=false)
 String representation of a dictionary. More...
 
template<typename T , size_t N>
std::string str (const std::array< T, N > &p, bool more=false)
 String representation of an array. More...
 
std::vector< std::string > strvec ()
 Create a list of strings from VA_ARGS, no argument. More...
 
template<typename T1 >
std::vector< std::string > strvec (const T1 &t1)
 Create a list of strings from VA_ARGS, one argument. More...
 
template<typename T1 , typename T2 >
std::vector< std::string > strvec (const T1 &t1, const T2 &t2)
 Create a list of strings from VA_ARGS, two arguments. More...
 
template<typename T1 , typename T2 , typename T3 >
std::vector< std::string > strvec (const T1 &t1, const T2 &t2, const T3 &t3)
 Create a list of strings from VA_ARGS, three arguments. More...
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
std::vector< std::string > strvec (const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
 Create a list of strings from VA_ARGS, four arguments. More...
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
std::vector< std::string > strvec (const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5)
 Create a list of strings from VA_ARGS, five arguments. More...
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
std::vector< std::string > strvec (const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6)
 Create a list of strings from VA_ARGS, six arguments. More...
 
std::string fmtstr (const std::string &fmt, const std::vector< std::string > &args)
 Create a string from a formatted string. More...
 
template<typename T >
bool has_enum (const std::string &s)
 Helper function: Check if enum exists. More...
 
template<typename T >
to_enum (const std::string &s, const std::string &s_def="")
 Helper function: Convert string to enum. More...
 
template<typename T >
std::vector< std::string > enum_names ()
 Helper function: Get all fields. More...
 
template<class T >
bool is_zero (const T &x)
 
std::ostream & uout ()
 
std::ostream & uerr ()
 
int to_int (casadi_int rhs)
 
std::vector< int > to_int (const std::vector< casadi_int > &rhs)
 
std::vector< std::vector< int > > to_int (const std::vector< std::vector< casadi_int > > &rhs)
 
bool all (const std::vector< bool > &v)
 Check if all arguments are true. More...
 
bool any (const std::vector< bool > &v)
 Check if any arguments are true. More...
 
bool is_range (const std::vector< casadi_int > &v, casadi_int start, casadi_int stop, casadi_int step=1)
 Check if a vector matches a range. More...
 
std::vector< casadi_int > range (casadi_int start, casadi_int stop, casadi_int step=1, casadi_int len=std::numeric_limits< casadi_int >::max())
 Range function. More...
 
bool is_equally_spaced (const std::vector< double > &v)
 
std::vector< casadi_int > range (casadi_int stop)
 Range function. More...
 
std::vector< casadi_int > complement (const std::vector< casadi_int > &v, casadi_int size)
 Returns the list of all i in [0, size[ not found in supplied list. More...
 
std::vector< casadi_int > lookupvector (const std::vector< casadi_int > &v, casadi_int size)
 Returns a vector for quickly looking up entries of supplied list. More...
 
std::vector< casadi_int > lookupvector (const std::vector< casadi_int > &v)
 
bool is_permutation (const std::vector< casadi_int > &order)
 Does the list represent a permutation? More...
 
std::vector< casadi_int > invert_permutation (const std::vector< casadi_int > &a)
 inverse a permutation vector More...
 
std::vector< casadi_int > tensor_permute_mapping (const std::vector< casadi_int > &dims, const std::vector< casadi_int > &order)
 Computes a mapping for a (dense) tensor permutation. More...
 
bvec_tget_bvec_t (std::vector< double > &v)
 
const bvec_tget_bvec_t (const std::vector< double > &v)
 Get an pointer of sets of booleans from a double vector. More...
 
std::string join (const std::vector< std::string > &l, const std::string &delim)
 
bool startswith (const std::string &s, const std::string &p)
 Checks if s starts with p. More...
 
CASADI_EXPORT std::string replace (const std::string &s, const std::string &p, const std::string &r)
 Replace all occurences of p with r in s. More...
 
std::string temporary_file (const std::string &prefix, const std::string &suffix)
 
std::vector< bool > boolvec_not (const std::vector< bool > &v)
 Invert all entries. More...
 
std::vector< bool > boolvec_and (const std::vector< bool > &lhs, const std::vector< bool > &rhs)
 And operation on boolean vector. More...
 
std::vector< bool > boolvec_or (const std::vector< bool > &lhs, const std::vector< bool > &rhs)
 Or operation on boolean vector. More...
 
std::vector< casadi_int > boolvec_to_index (const std::vector< bool > &v)
 
void normalized_setup (std::istream &stream)
 
void normalized_setup (std::ostream &stream)
 
std::string str_bvec (bvec_t v)
 
bvec_t bvec_or (const bvec_t *arg, casadi_int n)
 Bit-wise or operation on bvec_t array. More...
 
template<typename T , typename S >
std::vector< T > vector_static_cast (const std::vector< S > &rhs)
 
template<typename T >
std::vector< T > vector_slice (const std::vector< T > &v, const std::vector< casadi_int > &i)
 Slicing vector. More...
 
template<typename T >
std::vector< T > vector_select (const std::vector< T > &v, const std::vector< bool > &s, bool invert=false)
 Select subset of vector. More...
 
template<typename T >
std::vector< T > vector_tail (const std::vector< T > &v)
 Return all but the first element of a vector. More...
 
template<typename T >
std::vector< T > vector_init (const std::vector< T > &v)
 Return all but the last element of a vector. More...
 
template<typename T >
std::vector< T > reverse (const std::vector< T > &v)
 Reverse a list. More...
 
template<typename T >
std::vector< T > join (const std::vector< T > &a, const std::vector< T > &b)
 Join two lists. More...
 
template<typename T >
std::vector< T > join (const std::vector< T > &a, const std::vector< T > &b, const std::vector< T > &c)
 Join three lists. More...
 
template<typename T >
std::vector< T > permute (const std::vector< T > &a, const std::vector< casadi_int > &order)
 permute a list More...
 
template<typename T >
std::vector< casadi_int > find (const std::vector< T > &v)
 find nonzeros More...
 
template<typename T >
bool in_range (const std::vector< T > &v, casadi_int upper)
 Check if for each element of v holds: v_i < upper. More...
 
template<typename T >
bool in_range (const std::vector< T > &v, casadi_int lower, casadi_int upper)
 Check if for each element of v holds: lower <= v_i < upper. More...
 
template<class T , class S >
void flatten_nested_vector (const std::vector< std::vector< T > > &nested, std::vector< S > &flat)
 Flatten a nested std::vector tot a single flattened vector. More...
 
template<class T , class S , class I >
void flatten_nested_vector (const std::vector< std::vector< T > > &nested, std::vector< S > &flat, std::vector< I > &indices)
 Flatten a nested std::vector tot a single flattened vector. More...
 
template<class T >
std::vector< T > applymap (T(*f)(const T &), const std::vector< T > &comp)
 
template<class T >
void applymap (void(*f)(T &), std::vector< T > &comp)
 
template<typename T >
bool is_increasing (const std::vector< T > &v)
 Check if the vector is strictly increasing. More...
 
template<typename T >
bool is_decreasing (const std::vector< T > &v)
 Check if the vector is strictly decreasing. More...
 
template<typename T >
bool is_nonincreasing (const std::vector< T > &v)
 Check if the vector is non-increasing. More...
 
template<typename T >
bool is_nondecreasing (const std::vector< T > &v)
 Check if the vector is non-decreasing. More...
 
template<typename T >
bool is_monotone (const std::vector< T > &v)
 Check if the vector is monotone. More...
 
template<typename T >
bool is_strictly_monotone (const std::vector< T > &v)
 Check if the vector is strictly monotone. More...
 
template<typename T >
bool has_negative (const std::vector< T > &v)
 Check if the vector has negative entries. More...
 
template<typename T >
void write_matlab (std::ostream &stream, const std::vector< T > &v)
 Print vector, matlab style. More...
 
template<typename T >
void write_matlab (std::ostream &stream, const std::vector< std::vector< T > > &v)
 Print matrix, matlab style. More...
 
template<typename T >
void read_matlab (std::istream &stream, std::vector< T > &v)
 Read vector, matlab style. More...
 
template<typename T >
void read_matlab (std::ifstream &file, std::vector< std::vector< T > > &v)
 Read matrix, matlab style. More...
 
template<typename T , typename F , typename L >
void linspace (std::vector< T > &v, const F &first, const L &last)
 Matlab's linspace. More...
 
template<typename T >
bvec_tget_bvec_t (std::vector< T > &v)
 Get an pointer of sets of booleans from a double vector. More...
 
template<typename T >
const bvec_tget_bvec_t (const std::vector< T > &v)
 Get an pointer of sets of booleans from a double vector. More...
 
template<typename T >
T * get_ptr (std::vector< T > &v)
 Get a pointer to the data contained in the vector. More...
 
template<typename T >
const T * get_ptr (const std::vector< T > &v)
 Get a pointer to the data contained in the vector. More...
 
template<typename T >
void sort (const std::vector< T > &values, std::vector< T > &sorted_values, std::vector< casadi_int > &indices, bool invert_indices=false)
 Sort the data in a vector. More...
 
template<typename T >
product (const std::vector< T > &values)
 product More...
 
template<typename T >
sum (const std::vector< T > &values)
 sum More...
 
template<typename T >
std::vector< T > cumsum (const std::vector< T > &values)
 cumulative sum More...
 
template<typename T >
std::vector< T > diff (const std::vector< T > &values)
 diff More...
 
template<typename T >
std::vector< T > cumsum0 (const std::vector< T > &values)
 cumulative sum, starting with zero More...
 
template<typename T >
bool is_regular (const std::vector< T > &v)
 Checks if array does not contain NaN or Inf. More...
 
void normalized_out (std::ostream &stream, double val)
 
int normalized_in (std::istream &stream, double &ret)
 
template<class S , class D >
void copy_vector (const std::vector< S > &s, std::vector< D > &d)
 
template<class S , class D >
void assign_vector (const std::vector< S > &s, std::vector< D > &d)
 
template<class S , class D >
void copy_vector (const S *s, std::vector< D > &d)
 
template<class S , class D >
void init_vector (std::vector< S > &d, const std::vector< D > &s)
 
template<typename T >
bool isUnique (const std::vector< T > &v)
 
template<typename T >
dot (const std::vector< T > &a, const std::vector< T > &b)
 
template<typename T >
norm_inf (const std::vector< T > &x)
 
template<typename T >
norm_1 (const std::vector< T > &x)
 
template<typename T >
norm_2 (const std::vector< T > &x)
 
char pathsep ()
 
std::string filesep ()
 
std::vector< std::string > get_search_paths ()
 
bool has_conic (const std::string &name)
 Check if a particular plugin is available. More...
 
void load_conic (const std::string &name)
 Explicitly load a plugin dynamically. More...
 
std::string doc_conic (const std::string &name)
 Get the documentation string for a plugin. More...
 
Function conic (const std::string &name, const std::string &solver, const SpDict &qp, const Dict &opts)
 
void conic_debug (const Function &f, const std::string &filename)
 
void conic_debug (const Function &f, std::ostream &file)
 
std::vector< std::string > conic_in ()
 Get input scheme of QP solvers. More...
 
std::vector< std::string > conic_out ()
 Get QP solver output scheme of QP solvers. More...
 
std::string conic_in (casadi_int ind)
 Get QP solver input scheme name by index. More...
 
std::string conic_out (casadi_int ind)
 Get output scheme name by index. More...
 
casadi_int conic_n_in ()
 Get the number of QP solver inputs. More...
 
casadi_int conic_n_out ()
 Get the number of QP solver outputs. More...
 
template<typename M >
Function qpsol_nlp (const std::string &name, const std::string &solver, const std::map< std::string, M > &qp, const Dict &opts)
 
Function qpsol (const std::string &name, const std::string &solver, const SXDict &qp, const Dict &opts)
 
Function qpsol (const std::string &name, const std::string &solver, const MXDict &qp, const Dict &opts)
 
std::vector< std::string > conic_options (const std::string &name)
 Get all options for a plugin. More...
 
std::string conic_option_type (const std::string &name, const std::string &op)
 Get type info for a particular option. More...
 
std::string conic_option_info (const std::string &name, const std::string &op)
 Get documentation for a particular option. More...
 
SXNodeConstantSX_deserialize (DeserializingStream &s)
 
std::string strategy_to_string (casadi_convexify_strategy_t s)
 
bool is_input_category (Category cat)
 
bool is_acyclic (Category cat)
 
OutputCategory dependent_definition (Category cat)
 
std::vector< Categoryinput_categories ()
 
std::vector< OutputCategoryoutput_categories ()
 
Category input_category (OutputCategory cat)
 
template<typename T >
std::vector< T > read_list (const XmlNode &n)
 
bool has_dple (const std::string &name)
 Check if a particular plugin is available. More...
 
void load_dple (const std::string &name)
 Explicitly load a plugin dynamically. More...
 
std::string doc_dple (const std::string &name)
 Get the documentation string for a plugin. More...
 
MX dplesol (const MX &A, const MX &V, const std::string &solver, const Dict &opts)
 
CASADI_EXPORT MXVector dplesol (const MXVector &A, const MXVector &V, const std::string &solver, const Dict &opts)
 
CASADI_EXPORT DMVector dplesol (const DMVector &A, const DMVector &V, const std::string &solver, const Dict &opts)
 
Function dplesol (const std::string &name, const std::string &solver, const SpDict &st, const Dict &opts)
 
std::vector< std::string > dple_in ()
 Get input scheme of DPLE solvers. More...
 
std::vector< std::string > dple_out ()
 Get output scheme of DPLE solvers. More...
 
std::string dple_in (casadi_int ind)
 Get DPLE input scheme name by index. More...
 
std::string dple_out (casadi_int ind)
 Get DPLE output scheme name by index. More...
 
casadi_int dple_n_in ()
 Get the number of QP solver inputs. More...
 
casadi_int dple_n_out ()
 Get the number of QP solver outputs. More...
 
std::string trim_path (const std::string &full_path)
 
std::ostream & message_prefix (std::ostream &stream)
 
bool has_expm (const std::string &name)
 Check if a particular plugin is available. More...
 
void load_expm (const std::string &name)
 Explicitly load a plugin dynamically. More...
 
std::string doc_expm (const std::string &name)
 Get the documentation string for a plugin. More...
 
Function expmsol (const std::string &name, const std::string &solver, const Sparsity &A, const Dict &opts)
 
casadi_int expm_n_in ()
 Get the number of expm solver inputs. More...
 
casadi_int expm_n_out ()
 Get the number of expm solver outputs. More...
 
Function external (const std::string &name, const Importer &li, const Dict &opts=Dict())
 Load a just-in-time compiled external function. More...
 
Function external (const std::string &name, const Dict &opts=Dict())
 Load an external function from a shared library. More...
 
Function external (const std::string &name, const std::string &bin_name, const Dict &opts=Dict())
 Load an external function from a shared library. More...
 
bool has_filesystem (const std::string &name)
 Check if a particular plugin is available. More...
 
void load_filesystem (const std::string &name)
 Explicitly load a plugin dynamically. More...
 
std::string doc_filesystem (const std::string &name)
 Get the documentation string for a plugin. More...
 
std::string to_string (FdMode v)
 Convert to string. More...
 
casadi_int n_fd_points (FdMode v)
 Length of FD stencil, including unperturbed input. More...
 
casadi_int fd_offset (FdMode v)
 Offset for FD stencil, i.e. index of unperturbed input. More...
 
template<typename T1 >
CASADI_EXPORT void finite_diff (FdMode v, const T1 **yk, T1 *J, T1 h, casadi_int n_y, T1 smoothing)
 Calculate FD estimate. More...
 
std::string to_string (FmuApi v)
 Convert to string. More...
 
std::string to_string (Parallelization v)
 Convert to string. More...
 
bool has_prefix (const std::string &s)
 
std::string pop_prefix (const std::string &s, std::string *rem)
 
void CASADI_EXPORT _function_buffer_eval (void *raw)
 
void bvec_toggle (bvec_t *s, casadi_int begin, casadi_int end, casadi_int j)
 
void bvec_clear (bvec_t *s, casadi_int begin, casadi_int end)
 
void bvec_or (const bvec_t *s, bvec_t &r, casadi_int begin, casadi_int end)
 
void assert_read (std::istream &stream, const std::string &s)
 
template<typename T >
std::vector< std::pair< std::string, T > > zip (const std::vector< std::string > &id, const std::vector< T > &mat)
 
template<typename M >
replace_mat (const M &arg, const Sparsity &inp, casadi_int npar)
 
double index_interp1d (const std::vector< double > &x, double xq, bool equidistant)
 
template<class B , class S >
shared_cast (S &A)
 Typecast a shared object to a base class to a shared object to a derived class,. More...
 
template<class B , class S >
const B shared_cast (const S &A)
 Typecast a shared object to a base class to a shared object to a derived class,. More...
 
template<class A >
getcopy (const A &a, std::map< typename A::base_type *, typename A::internal_base_type > &already_copied)
 
Dict combine (const Dict &first, const Dict &second, bool recurse=false)
 Combine two dicts. First has priority. More...
 
void update_dict (Dict &target, const Dict &source, bool recurse=false)
 Update the target dictionary in place with source elements. More...
 
void update_dict (Dict &target, const std::string &key, const GenericType &value, bool recurse)
 
template<class T >
get_from_dict (const std::map< std::string, T > &d, const std::string &key, const T &default_value)
 
template<class T >
get_from_dict (const Dict &d, const std::string &key, const T &default_value)
 
template<class T >
Dict extract_from_dict (const Dict &d, const std::string &key, T &value)
 
template<class T >
void extract_from_dict_inplace (Dict &d, const std::string &key, T &value)
 
bool CASADI_EXPORT is_slice (const IM &x, bool ind1=false)
 Is the IM a Slice. More...
 
Slice CASADI_EXPORT to_slice (const IM &x, bool ind1=false)
 Convert IM to Slice. More...
 
template<typename T >
text2type (const std::string &text)
 Convert to a type. More...
 
template<typename T >
std::vector< T > text2vector (const std::string &text)
 Get entry as a vector. More...
 
template<typename T >
std::set< T > text2set (const std::string &text)
 Get entry as a set. More...
 
template<typename RealT >
std::vector< RealT > collocation_pointsGen (casadi_int order, const std::string &scheme)
 
Function simpleRK (Function f, casadi_int N=10, casadi_int order=4)
 Construct an explicit Runge-Kutta integrator. More...
 
void collocation_interpolators (const std::vector< double > &tau, std::vector< std::vector< double > > &C, std::vector< double > &D)
 Obtain collocation interpolating matrices. More...
 
void collocation_coeff (const std::vector< double > &tau, DM &C, DM &D, DM &B)
 Obtain collocation interpolating matrices. More...
 
Function simpleIRK (Function f, casadi_int N=10, casadi_int order=4, const std::string &scheme="radau", const std::string &solver="newton", const Dict &solver_options=Dict())
 Construct an implicit Runge-Kutta integrator using a collocation scheme. More...
 
Function simpleIntegrator (Function f, const std::string &integrator="cvodes", const Dict &integrator_options=Dict())
 Simplified wrapper for the Integrator class. More...
 
std::vector< casadi_int > invert_lookup (const std::vector< casadi_int > &lookup)
 
template<class X >
std::map< std::string, X > add_defaults (const std::map< std::string, X > &in, const std::vector< std::string > &keys)
 
std::vector< casadi_int > get_orders (const std::vector< casadi_int > &map)
 
std::vector< casadi_int > get_inverse (const std::vector< casadi_int > &map)
 
std::vector< casadi_int > path (const std::vector< casadi_int > &map, casadi_int i_start)
 
template<class X >
const std::map< std::string, X > reduce_index_gen (const std::map< std::string, X > &dae, Dict &stats, const Dict &opts)
 
template<class X >
std::map< std::string, X > map_semi_expl (const std::map< std::string, X > &dae, const std::map< std::string, X > &dae_red, Function &state_to_orig, Function &phi)
 
template<class X >
Function init_gen (const std::map< std::string, X > &dae, const std::map< std::string, X > &dae_red, const std::string &init_solver, const DMDict &init_strength, const Dict &init_solver_options)
 
bool has_integrator (const std::string &name)
 Check if a particular plugin is available. More...
 
void load_integrator (const std::string &name)
 Explicitly load a plugin dynamically. More...
 
std::string doc_integrator (const std::string &name)
 Get the documentation string for a plugin. More...
 
Function integrator (const std::string &name, const std::string &solver, const SXDict &dae, const Dict &opts)
 
Function integrator (const std::string &name, const std::string &solver, const MXDict &dae, const Dict &opts)
 
Function integrator (const std::string &name, const std::string &solver, const Function &dae, const Dict &opts)
 
Function integrator (const std::string &name, const std::string &solver, const SXDict &dae, double t0, const std::vector< double > &tout, const Dict &opts)
 
Function integrator (const std::string &name, const std::string &solver, const MXDict &dae, double t0, const std::vector< double > &tout, const Dict &opts)
 
Function integrator (const std::string &name, const std::string &solver, const Function &dae, double t0, const std::vector< double > &tout, const Dict &opts)
 
Function integrator (const std::string &name, const std::string &solver, const SXDict &dae, double t0, double tf, const Dict &opts)
 
Function integrator (const std::string &name, const std::string &solver, const MXDict &dae, double t0, double tf, const Dict &opts)
 
Function integrator (const std::string &name, const std::string &solver, const Function &dae, double t0, double tf, const Dict &opts)
 
std::vector< std::string > integrator_in ()
 Get input scheme of integrators. More...
 
std::vector< std::string > integrator_out ()
 Get integrator output scheme of integrators. More...
 
std::string integrator_in (casadi_int ind)
 Get integrator input scheme name by index. More...
 
std::string integrator_out (casadi_int ind)
 Get output scheme name by index. More...
 
casadi_int integrator_n_in ()
 Get the number of integrator inputs. More...
 
casadi_int integrator_n_out ()
 Get the number of integrator outputs. More...
 
std::vector< std::string > dyn_in ()
 Get input scheme of a DAE function. More...
 
std::vector< std::string > dyn_out ()
 Get output scheme of a DAE function. More...
 
std::string dyn_in (casadi_int ind)
 Get input scheme of a DAE function by index. More...
 
std::string dyn_out (casadi_int ind)
 Get output scheme of a DAE function by index. More...
 
casadi_int dyn_n_in ()
 Get the number of inputs for a DAE function. More...
 
casadi_int dyn_n_out ()
 Get the number of outputs for a DAE function. More...
 
std::vector< std::string > event_in ()
 Get input scheme of an event transition function. More...
 
std::vector< std::string > event_out ()
 Get output scheme of an event transition functions. More...
 
bool has_interpolant (const std::string &name)
 Check if a particular plugin is available. More...
 
void load_interpolant (const std::string &name)
 Explicitly load a plugin dynamically. More...
 
std::string doc_interpolant (const std::string &name)
 Get the documentation string for a plugin. More...
 
Function interpolant (const std::string &name, const std::string &solver, const std::vector< std::vector< double > > &grid, const std::vector< double > &values, const Dict &opts)
 
Function interpolant (const std::string &name, const std::string &solver, const std::vector< casadi_int > &grid_dims, const std::vector< double > &values, const Dict &opts=Dict())
 Parametric variant of interpolant. More...
 
Function interpolant (const std::string &name, const std::string &solver, const std::vector< std::vector< double > > &grid, casadi_int m=1, const Dict &opts=Dict())
 Parametric variant of interpolant. More...
 
Function interpolant (const std::string &name, const std::string &solver, const std::vector< casadi_int > &grid_dims, casadi_int m=1, const Dict &opts=Dict())
 Parametric variant of interpolant. More...
 
bool has_linsol (const std::string &name)
 Check if a particular plugin is available. More...
 
void load_linsol (const std::string &name)
 Explicitly load a plugin dynamically. More...
 
std::string doc_linsol (const std::string &name)
 Get the documentation string for a plugin. More...
 
void ThreadsWork (const Function &f, casadi_int i, const double **arg, double **res, casadi_int *iw, double *w, casadi_int ind, int &ret)
 
template<typename T1 >
void casadi_add (casadi_int n, const T1 *x, T1 *y)
 
template<>
void casadi_add (casadi_int n, const bvec_t *x, bvec_t *y)
 
bool has_empty (const std::vector< MX > &x, bool both=false)
 
std::vector< MXtrim_empty (const std::vector< MX > &x, bool both=false)
 
MX register_symbol (const MX &node, std::map< MXNode *, MX > &symbol_map, std::vector< MX > &symbol_v, std::vector< MX > &parametric_v, bool extract_trivial, casadi_int v_offset, const std::string &v_prefix, const std::string &v_suffix)
 
MX interpn_G (casadi_int i, const MX &v, const std::vector< MX > &xis, const std::vector< MX > &L, const std::vector< MX > &Lp, const std::vector< casadi_int > &strides, const Slice &I, const MX &offset=0)
 
template<class T >
void detect_simple_bounds_gen (const T &x, const T &p, const T &g, const T &lbg, const T &ubg, std::vector< casadi_int > &gi, T &lbx, T &ubx, Function &lam_forward, Function &lam_backward)
 
void detect_simple_bounds (const SX &xX, const SX &p, const SX &g, const SX &lbg, const SX &ubg, std::vector< casadi_int > &gi, SX &lbx, SX &ubx, Function &lam_forward, Function &lam_backward)
 Detect simple bounds from general constraints. More...
 
void detect_simple_bounds (const MX &x, const MX &p, const MX &g, const MX &lbg, const MX &ubg, std::vector< casadi_int > &gi, MX &lbx, MX &ubx, Function &lam_forward, Function &lam_backward)
 
template<class T >
void check_sos (casadi_int nx, const std::vector< std::vector< T > > &groups, std::vector< std::vector< double > > &weights, std::vector< casadi_int > &types)
 Check sos structure and generate defaults. More...
 
bool has_nlpsol (const std::string &name)
 Check if a particular plugin is available. More...
 
void load_nlpsol (const std::string &name)
 Explicitly load a plugin dynamically. More...
 
std::string doc_nlpsol (const std::string &name)
 Get the documentation string for a plugin. More...
 
template<class X >
Function construct_nlpsol (const std::string &name, const std::string &solver, const std::map< std::string, X > &nlp, const Dict &opts)
 
Function nlpsol (const std::string &name, const std::string &solver, const SXDict &nlp, const Dict &opts)
 
Function nlpsol (const std::string &name, const std::string &solver, const MXDict &nlp, const Dict &opts)
 
Function nlpsol (const std::string &name, const std::string &solver, const NlpBuilder &nl, const Dict &opts)
 
Function nlpsol (const std::string &name, const std::string &solver, const std::string &fname, const Dict &opts)
 
Function nlpsol (const std::string &name, const std::string &solver, const Importer &compiler, const Dict &opts)
 
Function nlpsol (const std::string &name, const std::string &solver, const Function &nlp, const Dict &opts)
 
std::vector< std::string > nlpsol_in ()
 Get input scheme of NLP solvers. More...
 
std::vector< std::string > nlpsol_out ()
 Get NLP solver output scheme of NLP solvers. More...
 
std::string nlpsol_in (casadi_int ind)
 Get NLP solver input scheme name by index. More...
 
std::string nlpsol_out (casadi_int ind)
 Get output scheme name by index. More...
 
casadi_int nlpsol_n_in ()
 Number of NLP solver inputs. More...
 
casadi_int nlpsol_n_out ()
 Number of NLP solver outputs. More...
 
int detect_bounds_callback (const double **arg, double **res, casadi_int *iw, double *w, void *callback_data)
 
std::vector< std::string > nlpsol_options (const std::string &name)
 Get all options for a plugin. More...
 
std::string nlpsol_option_type (const std::string &name, const std::string &op)
 Get type info for a particular option. More...
 
std::string nlpsol_option_info (const std::string &name, const std::string &op)
 Get documentation for a particular option. More...
 
bool override_num (const std::map< casadi_int, MX > &temp, std::vector< DM > &num, casadi_int i)
 
template<typename T1 >
int calc_function (const OracleCallback *cb, casadi_oracle_data< T1 > *d)
 
template<typename T >
check_exposed (T t)
 
static bvec_t Orring (bvec_t x, bvec_t y)
 
std::vector< std::string > rootfinder_in ()
 Get rootfinder input scheme. More...
 
std::vector< std::string > rootfinder_out ()
 Get rootfinder output scheme. More...
 
std::string rootfinder_in (casadi_int ind)
 Get rootfinder input scheme name by index. More...
 
std::string rootfinder_out (casadi_int ind)
 Get rootfinder output scheme name by index. More...
 
casadi_int rootfinder_n_in ()
 Number of rootfinder inputs. More...
 
casadi_int rootfinder_n_out ()
 Number of rootfinder outputs. More...
 
std::vector< std::string > rootfinder_options (const std::string &name)
 Get all options for a plugin. More...
 
std::string rootfinder_option_type (const std::string &name, const std::string &op)
 Get type info for a particular option. More...
 
std::string rootfinder_option_info (const std::string &name, const std::string &op)
 Get documentation for a particular option. More...
 
bool has_rootfinder (const std::string &name)
 Check if a particular plugin is available. More...
 
void load_rootfinder (const std::string &name)
 Explicitly load a plugin dynamically. More...
 
std::string doc_rootfinder (const std::string &name)
 Get the documentation string for a plugin. More...
 
Function rootfinder (const std::string &name, const std::string &solver, const SXDict &rfp, const Dict &opts)
 
Function rootfinder (const std::string &name, const std::string &solver, const MXDict &rfp, const Dict &opts)
 
Function rootfinder (const std::string &name, const std::string &solver, const Function &f, const Dict &opts)
 
template<typename T1 >
void casadi_copy (const T1 *x, casadi_int n, T1 *y)
 COPY: y <-x. More...
 
template<typename T1 >
void casadi_swap (casadi_int n, T1 *x, casadi_int inc_x, T1 *y, casadi_int inc_y)
 SWAP: x <-> y. More...
 
template<typename T1 >
void casadi_project (const T1 *x, const casadi_int *sp_x, T1 *y, const casadi_int *sp_y, T1 *w)
 Sparse copy: y <- x, w work vector (length >= number of rows) More...
 
template<typename T1 , typename T2 >
void casadi_densify (const T1 *x, const casadi_int *sp_x, T2 *y, casadi_int tr)
 Convert sparse to dense. More...
 
template<typename T1 , typename T2 >
void casadi_sparsify (const T1 *x, T2 *y, const casadi_int *sp_y, casadi_int tr)
 Convert dense to sparse. More...
 
template<typename T1 >
void casadi_scal (casadi_int n, T1 alpha, T1 *x)
 SCAL: x <- alpha*x. More...
 
template<typename T1 >
void casadi_axpy (casadi_int n, T1 alpha, const T1 *x, T1 *y)
 AXPY: y <- a*x + y. More...
 
template<typename T1 >
T1 casadi_dot (casadi_int n, const T1 *x, const T1 *y)
 Inner product. More...
 
template<typename T1 >
T1 casadi_max_viol (casadi_int n, const T1 *x, const T1 *lb, const T1 *ub)
 Largest bound violation. More...
 
template<typename T1 >
T1 casadi_sum_viol (casadi_int n, const T1 *x, const T1 *lb, const T1 *ub)
 Sum of bound violations. More...
 
template<typename T1 >
casadi_int casadi_iamax (casadi_int n, const T1 *x, casadi_int inc_x)
 IAMAX: index corresponding to the entry with the largest absolute value. More...
 
template<typename T1 >
void casadi_clear (T1 *x, casadi_int n)
 CLEAR: x <- 0. More...
 
template<typename T1 >
void casadi_fill (T1 *x, casadi_int n, T1 alpha)
 FILL: x <- alpha. More...
 
template<typename T1 >
void casadi_mtimes (const T1 *x, const casadi_int *sp_x, const T1 *y, const casadi_int *sp_y, T1 *z, const casadi_int *sp_z, T1 *w, casadi_int tr)
 Sparse matrix-matrix multiplication: z <- z + x*y. More...
 
template<typename T1 >
void casadi_mv (const T1 *x, const casadi_int *sp_x, const T1 *y, T1 *z, casadi_int tr)
 Sparse matrix-vector multiplication: z <- z + x*y. More...
 
template<typename T1 >
void casadi_triusolve (const casadi_int *sp_a, const T1 *nz_a, T1 *x, int tr, int unity, casadi_int nrhs)
 Linear solve, upper triangular matrix, optionally transposed or unity diagonal (1 - R) More...
 
template<typename T1 >
void casadi_trilsolve (const casadi_int *sp_a, const T1 *nz_a, T1 *x, int tr, int unity, casadi_int nrhs)
 Linear solve, lower triangular matrix, optionally transposed or unity diagonal (1 - L) More...
 
template<typename T1 >
void casadi_trans (const T1 *x, const casadi_int *sp_x, T1 *y, const casadi_int *sp_y, casadi_int *tmp)
 TRANS: y <- trans(x) , w work vector (length >= rows x) More...
 
template<typename T1 >
T1 casadi_norm_1 (casadi_int n, const T1 *x)
 NORM_1: ||x||_1 -> return. More...
 
template<typename T1 >
T1 casadi_norm_2 (casadi_int n, const T1 *x)
 NORM_2: ||x||_2 -> return. More...
 
template<typename T1 >
T1 casadi_norm_inf (casadi_int n, const T1 *x)
 
template<typename T1 >
T1 casadi_norm_inf_mul (const T1 *x, const casadi_int *sp_x, const T1 *y, const casadi_int *sp_y, T1 *dwork, casadi_int *iwork)
 
template<typename T1 >
T1 casadi_bilin (const T1 *A, const casadi_int *sp_A, const T1 *x, const T1 *y)
 
template<typename T1 >
void casadi_kron (const T1 *a, const casadi_int *sp_a, const T1 *b, const casadi_int *sp_b, T1 *r)
 
template<typename T1 >
void casadi_rank1 (T1 *A, const casadi_int *sp_A, T1 alpha, const T1 *x)
 Adds a multiple alpha/2 of the outer product mul(x, trans(x)) to A. More...
 
template<typename T1 >
void casadi_getu (const T1 *x, const casadi_int *sp_x, T1 *v)
 Get the nonzeros for the upper triangular half. More...
 
template<typename T1 >
T1 casadi_polyval (const T1 *p, casadi_int n, T1 x)
 Evaluate a polynomial. More...
 
casadi_int casadi_flip (casadi_int *corner, casadi_int ndim)
 
template<typename T1 >
casadi_int casadi_low (T1 x, const T1 *grid, casadi_int ng, casadi_int lookup_mode)
 
template<typename T1 >
void casadi_interpn_weights (casadi_int ndim, const T1 *grid, const casadi_int *offset, const T1 *x, T1 *alpha, casadi_int *index)
 
template<typename T1 >
T1 casadi_interpn_interpolate (casadi_int ndim, const casadi_int *offset, const T1 *values, const T1 *alpha, const casadi_int *index, const casadi_int *corner, T1 *coeff)
 
template<typename T1 >
T1 casadi_interpn (casadi_int ndim, const T1 *grid, const casadi_int *offset, const T1 *values, const T1 *x, casadi_int *iw, T1 *w)
 
template<typename T1 >
void casadi_interpn_grad (T1 *grad, casadi_int ndim, const T1 *grid, const casadi_int *offset, const T1 *values, const T1 *x, casadi_int *iw, T1 *w)
 
template<typename T1 >
void casadi_de_boor (T1 x, const T1 *knots, casadi_int n_knots, casadi_int degree, T1 *boor)
 
template<typename T1 >
void casadi_nd_boor_eval (T1 *ret, casadi_int n_dims, const T1 *knots, const casadi_int *offset, const casadi_int *degree, const casadi_int *strides, const T1 *c, casadi_int m, const T1 *x, const casadi_int *lookup_mode, casadi_int *iw, T1 *w)
 
template<typename T1 >
T1 casadi_mmax (const T1 *x, casadi_int n, T1 is_dense)
 
template<typename T1 >
T1 casadi_mmin (const T1 *x, casadi_int n, casadi_int is_dense)
 
template<typename T1 >
T1 casadi_vfmax (const T1 *x, casadi_int n, T1 r)
 
template<typename T1 >
T1 casadi_vfmin (const T1 *x, casadi_int n, T1 r)
 
void casadi_fill_casadi_int (casadi_int *x, casadi_int n, casadi_int alpha)
 
void casadi_clear_casadi_int (casadi_int *x, casadi_int n)
 
template<typename T1 >
void casadi_bound_consistency (casadi_int n, T1 *x, T1 *lam, const T1 *lbx, const T1 *ubx)
 
template<typename T1 >
T1 casadi_logsumexp (const T1 *x, casadi_int n)
 
template<typename T1 >
int casadi_newton (const casadi_newton_mem< T1 > *m)
 
template<typename T >
casadi_int einstein_process (const T &A, const T &B, const T &C, const std::vector< casadi_int > &dim_a, const std::vector< casadi_int > &dim_b, const std::vector< casadi_int > &dim_c, const std::vector< casadi_int > &a, const std::vector< casadi_int > &b, const std::vector< casadi_int > &c, std::vector< casadi_int > &iter_dims, std::vector< casadi_int > &strides_a, std::vector< casadi_int > &strides_b, std::vector< casadi_int > &strides_c)
 
template<typename T >
void Contraction (const T &a, const T &b, T &r)
 
template<>
void Contraction (const bvec_t &a, const bvec_t &b, bvec_t &r)
 
template<typename T >
void einstein_eval (casadi_int n_iter, const std::vector< casadi_int > &iter_dims, const std::vector< casadi_int > &strides_a, const std::vector< casadi_int > &strides_b, const std::vector< casadi_int > &strides_c, const T *a_in, const T *b_in, T *c_in)
 
Slice CASADI_EXPORT to_slice (const std::vector< casadi_int > &v, bool ind1=false)
 Construct from an index vector (requires is_slice(v) to be true) More...
 
bool CASADI_EXPORT is_slice (const std::vector< casadi_int > &v, bool ind1=false)
 Check if an index vector can be represented more efficiently as a slice. More...
 
bool CASADI_EXPORT is_slice2 (const std::vector< casadi_int > &v)
 Check if an index vector can be represented more efficiently as two nested slices. More...
 
std::pair< Slice, Slice > CASADI_EXPORT to_slice2 (const std::vector< casadi_int > &v)
 Construct nested slices from an index vector (requires is_slice2(v) to be true) More...
 
std::size_t hash_sparsity (casadi_int nrow, casadi_int ncol, const std::vector< casadi_int > &colind, const std::vector< casadi_int > &row)
 Hash a sparsity pattern. More...
 
std::size_t hash_sparsity (casadi_int nrow, casadi_int ncol, const casadi_int *colind, const casadi_int *row)
 
template<typename T >
size_t hash_value (T v)
 Hash value of an integer. More...
 
template<typename T >
void hash_combine (std::size_t &seed, T v)
 Generate a hash value incrementally (function taken from boost) More...
 
template<typename T >
void hash_combine (std::size_t &seed, const T *v, std::size_t sz)
 Generate a hash value incrementally, array. More...
 
template<typename T >
void hash_combine (std::size_t &seed, const std::vector< T > &v)
 Generate a hash value incrementally (function taken from boost) More...
 
template<>
size_t hash_value (std::string v)
 
template<>
std::string matrixName< SXElem > ()
 
SXElem register_symbol (const SXElem &node, std::map< SXNode *, SXElem > &symbol_map, std::vector< SXElem > &symbol_v, std::vector< SXElem > &parametric_v, bool extract_trivial, casadi_int v_offset, const std::string &v_prefix, const std::string &v_suffix)
 
SX mtaylor_recursive (const SX &ex, const SX &x, const SX &a, casadi_int order, const std::vector< casadi_int > &order_contributions, const SXElem &current_dx=casadi_limits< SXElem >::one, double current_denom=1, casadi_int current_order=1)
 
void callback_stdout (const char *s)
 
void callback_stderr (const char *s)
 
Function external_transform (const std::string &name, const std::string &op, const Function &f, const Dict &opts=Dict())
 Apply a transformation defined externally. More...
 
template<typename MatType >
Sparsity _jacobian_sparsity (const MatType &expr, const MatType &var)
 
template<typename MatType >
std::vector< bool > _which_depends (const MatType &expr, const MatType &var, casadi_int order, bool tr)
 
std::ostream & operator<< (std::ostream &stream, const XmlNode &node)
 
int CASADI_NLPSOL_ALPAQA_EXPORT casadi_register_nlpsol_alpaqa (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_ALPAQA_EXPORT casadi_load_nlpsol_alpaqa ()
 
template<typename T1 , typename T2 >
void copy (const T1 *x, casadi_int n, T2 *y)
 
int CASADI_NLPSOL_AMPL_EXPORT casadi_register_nlpsol_ampl (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_AMPL_EXPORT casadi_load_nlpsol_ampl ()
 
int CASADI_NLPSOL_BLOCKSQP_EXPORT casadi_register_nlpsol_blocksqp (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_BLOCKSQP_EXPORT casadi_load_nlpsol_blocksqp ()
 
int CASADI_NLPSOL_BONMIN_EXPORT casadi_register_nlpsol_bonmin (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_BONMIN_EXPORT casadi_load_nlpsol_bonmin ()
 
const char * return_status_string (Bonmin::TMINLP::SolverReturn status)
 
std::string to_str (const CoinError &e)
 
std::string to_str (TNLPSolver::UnsolvedError &e)
 
int CASADI_CONIC_CBC_EXPORT casadi_register_conic_cbc (Conic::Plugin *plugin)
 
void CASADI_CONIC_CBC_EXPORT casadi_load_conic_cbc ()
 
std::string return_status_string (int status)
 
std::string return_secondary_status_string (int status)
 
int CASADI_IMPORTER_CLANG_EXPORT casadi_register_importer_clang (ImporterInternal::Plugin *plugin)
 
void CASADI_IMPORTER_CLANG_EXPORT casadi_load_importer_clang ()
 
int CASADI_CONIC_CLARABEL_EXPORT casadi_register_conic_clarabel (Conic::Plugin *plugin)
 
void CASADI_CONIC_CLARABEL_EXPORT casadi_load_conic_clarabel ()
 
void codegen_local (CodeGenerator &g, const std::string &name, const std::vector< int > &v)
 
int CASADI_CONIC_CLP_EXPORT casadi_register_conic_clp (Conic::Plugin *plugin)
 
void CASADI_CONIC_CLP_EXPORT casadi_load_conic_clp ()
 
int CASADI_CONIC_CPLEX_EXPORT casadi_register_conic_cplex (Conic::Plugin *plugin)
 
void CASADI_CONIC_CPLEX_EXPORT casadi_load_conic_cplex ()
 
int param_by_name (CPXENVptr env, const std::string &name)
 
int CASADI_LINSOL_CSPARSE_EXPORT casadi_register_linsol_csparse (LinsolInternal::Plugin *plugin)
 
void CASADI_LINSOL_CSPARSE_EXPORT casadi_load_linsol_csparse ()
 
int CASADI_CONIC_DAQP_EXPORT casadi_register_conic_daqp (Conic::Plugin *plugin)
 
void CASADI_CONIC_DAQP_EXPORT casadi_load_conic_daqp ()
 
int CASADI_CONIC_FATROP_EXPORT casadi_register_conic_fatrop (Conic::Plugin *plugin)
 
void CASADI_CONIC_FATROP_EXPORT casadi_load_conic_fatrop ()
 
std::vector< casadi_int > fatrop_blocks_pack (const std::vector< casadi_ocp_block > &blocks)
 
fatrop_int get_nx (const fatrop_int k, void *user_data)
 
fatrop_int get_nu (const fatrop_int k, void *user_data)
 
fatrop_int get_ng (const fatrop_int k, void *user_data)
 
fatrop_int get_n_stage_params (const fatrop_int k, void *user_data)
 
fatrop_int get_n_global_params (void *user_data)
 
fatrop_int get_default_stage_params (double *stage_params, const fatrop_int k, void *user_data)
 
fatrop_int get_default_global_params (double *global_params, void *user_data)
 
fatrop_int get_ng_ineq (const fatrop_int k, void *user_data)
 
fatrop_int get_horizon_length (void *user_data)
 
fatrop_int eval_BAbt (const double *states_kp1, const double *inputs_k, const double *states_k, const double *stage_params_k, const double *global_params, MAT *res, const fatrop_int k, void *user_data)
 
fatrop_int eval_Ggt (const double *inputs_k, const double *states_k, const double *stage_params_k, const double *global_params, MAT *res, const fatrop_int k, void *user_data)
 
fatrop_int eval_Ggt_ineq (const double *inputs_k, const double *states_k, const double *stage_params_k, const double *global_params, MAT *res, const fatrop_int k, void *user_data)
 
fatrop_int eval_RSQrqt (const double *objective_scale, const double *inputs_k, const double *states_k, const double *lam_dyn_k, const double *lam_eq_k, const double *lam_eq_ineq_k, const double *stage_params_k, const double *global_params, MAT *res, const fatrop_int k, void *user_data)
 
fatrop_int eval_b (const double *states_kp1, const double *inputs_k, const double *states_k, const double *stage_params_k, const double *global_params, double *res, const fatrop_int k, void *user_data)
 
fatrop_int eval_g (const double *states_k, const double *inputs_k, const double *stage_params_k, const double *global_params, double *res, const fatrop_int k, void *user_data)
 
fatrop_int eval_gineq (const double *states_k, const double *inputs_k, const double *stage_params_k, const double *global_params, double *res, const fatrop_int k, void *user_data)
 
fatrop_int eval_rq (const double *objective_scale, const double *inputs_k, const double *states_k, const double *stage_params_k, const double *global_params, double *res, const fatrop_int k, void *user_data)
 
fatrop_int eval_L (const double *objective_scale, const double *inputs_k, const double *states_k, const double *stage_params_k, const double *global_params, double *res, const fatrop_int k, void *user_data)
 
fatrop_int get_bounds (double *lower, double *upper, const fatrop_int k, void *user_data)
 
fatrop_int get_initial_xk (double *xk, const fatrop_int k, void *user_data)
 
fatrop_int get_initial_uk (double *uk, const fatrop_int k, void *user_data)
 
void dummy_signal (void *user_data)
 
fatrop_int full_eval_lag_hess (double objective_scale, const double *primal_data, const double *lam_data, const double *stageparams_p, const double *globalparams_p, MAT *RSQrqt_p, const FatropOcpCDims *s, void *user_data)
 
fatrop_int full_eval_constr_jac (const double *primal_data, const double *stageparams_p, const double *globalparams_p, MAT *BAbt_p, MAT *Ggt_p, MAT *Ggt_ineq_p, const FatropOcpCDims *s, void *user_data)
 
fatrop_int full_eval_contr_viol (const double *primal_data, const double *stageparams_p, const double *globalparams_p, double *cv_p, const FatropOcpCDims *s, void *user_data)
 
fatrop_int full_eval_obj_grad (double objective_scale, const double *primal_data, const double *stageparams_p, const double *globalparams_p, double *grad_p, const FatropOcpCDims *s, void *user_data)
 
fatrop_int full_eval_obj (double objective_scale, const double *primal_data, const double *stageparams_p, const double *globalparams_p, double *res, const FatropOcpCDims *s, void *user_data)
 
int CASADI_NLPSOL_FATROP_EXPORT casadi_register_nlpsol_fatrop (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_FATROP_EXPORT casadi_load_nlpsol_fatrop ()
 
void report_issue (casadi_int i, const std::string &msg)
 
void codegen_unpack_block (CodeGenerator &g, const std::string &name, const std::vector< casadi_ocp_block > &blocks)
 
void unpack_block (const std::vector< casadi_int > &p, std::vector< casadi_ocp_block > &blocks)
 
bool is_directory (const std::string &path)
 
bool create_directories (const std::string &path)
 
std::vector< std::string > iterate_directory_names (const std::string &path)
 
bool remove (const std::string &path)
 
casadi_int remove_all (const std::string &path)
 
std::string filename (const std::string &path)
 
std::string absolute (const std::string &path)
 
std::string parent_path (const std::string &path)
 
bool has_parent_path (const std::string &path)
 
int CASADI_FILESYSTEM_GHC_EXPORT casadi_register_filesystem_ghc (Filesystem::Plugin *plugin)
 
void CASADI_FILESYSTEM_GHC_EXPORT casadi_load_filesystem_ghc ()
 
int CASADI_CONIC_GUROBI_EXPORT casadi_register_conic_gurobi (Conic::Plugin *plugin)
 
void CASADI_CONIC_GUROBI_EXPORT casadi_load_conic_gurobi ()
 
const char * return_status_string (casadi_int status)
 
int CASADI_CONIC_HIGHS_EXPORT casadi_register_conic_highs (Conic::Plugin *plugin)
 
void CASADI_CONIC_HIGHS_EXPORT casadi_load_conic_highs ()
 
int CASADI_CONIC_HPIPM_EXPORT casadi_register_conic_hpipm (Conic::Plugin *plugin)
 
void CASADI_CONIC_HPIPM_EXPORT casadi_load_conic_hpipm ()
 
std::vector< casadi_int > hpipm_blocks_pack (const std::vector< casadi_hpipm_block > &blocks)
 
void codegen_unpack_block (CodeGenerator &g, const std::string &name, const std::vector< casadi_hpipm_block > &blocks)
 
int CASADI_CONIC_HPMPC_EXPORT casadi_register_conic_hpmpc (Conic::Plugin *plugin)
 
void CASADI_CONIC_HPMPC_EXPORT casadi_load_conic_hpmpc ()
 
int CASADI_LINSOL_MA27_EXPORT casadi_register_linsol_ma27 (LinsolInternal::Plugin *plugin)
 
void CASADI_LINSOL_MA27_EXPORT casadi_load_linsol_ma27 ()
 
int CASADI_NLPSOL_IPOPT_EXPORT casadi_register_nlpsol_ipopt (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_IPOPT_EXPORT casadi_load_nlpsol_ipopt ()
 
const char * return_status_string (Ipopt::ApplicationReturnStatus status)
 
int CASADI_NLPSOL_KNITRO_EXPORT casadi_register_nlpsol_knitro (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_KNITRO_EXPORT casadi_load_nlpsol_knitro ()
 
int casadi_KN_puts (const char *const str, void *const userParams)
 
int CASADI_LINSOL_LAPACKLU_EXPORT casadi_register_linsol_lapacklu (LinsolInternal::Plugin *plugin)
 
void CASADI_LINSOL_LAPACKLU_EXPORT casadi_load_linsol_lapacklu ()
 
int CASADI_LINSOL_LAPACKQR_EXPORT casadi_register_linsol_lapackqr (LinsolInternal::Plugin *plugin)
 
void CASADI_LINSOL_LAPACKQR_EXPORT casadi_load_linsol_lapackqr ()
 
bool extract_zip_internal (zip_t *za, const std::string &output_dir)
 
bool extract_zip_from_stringstream (std::stringstream &src, const std::string &output_dir)
 
bool extract_zip_from_path (const std::string &zip_path, const std::string &output_dir)
 
bool add_file_to_zip (zip_t *archive, const std::string &file_path, const std::string &archive_name)
 
void add_directory_recursive (zip_t *archive, const std::string &base_dir, const std::string &current_dir, const std::string &rel_prefix)
 
bool zip_to_stream (const std::string &dir, std::ostream &output)
 
bool zip_to_path (const std::string &dir_path, const std::string &zip_path)
 
bool zip_to_path2 (const std::string &dir_path, const std::string &zip_path)
 
int CASADI_ARCHIVER_LIBZIP_EXPORT casadi_register_archiver_libzip (Archiver::Plugin *plugin)
 
void CASADI_ARCHIVER_LIBZIP_EXPORT casadi_load_archiver_libzip ()
 
int CASADI_NLPSOL_MADNLP_EXPORT casadi_register_nlpsol_madnlp (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_MADNLP_EXPORT casadi_load_nlpsol_madnlp ()
 
void casadi_madnlp_sparsity (const casadi_int *sp, madnlp_int *coord_i, madnlp_int *coord_j)
 
int CASADI_LINSOL_MUMPS_EXPORT casadi_register_linsol_mumps (LinsolInternal::Plugin *plugin)
 
void CASADI_LINSOL_MUMPS_EXPORT casadi_load_linsol_mumps ()
 
int CASADI_CONIC_OOQP_EXPORT casadi_register_conic_ooqp (Conic::Plugin *plugin)
 
void CASADI_CONIC_OOQP_EXPORT casadi_load_conic_ooqp ()
 
int CASADI_CONIC_OSQP_EXPORT casadi_register_conic_osqp (Conic::Plugin *plugin)
 
void CASADI_CONIC_OSQP_EXPORT casadi_load_conic_osqp ()
 
int CASADI_CONIC_PROXQP_EXPORT casadi_register_conic_proxqp (Conic::Plugin *plugin)
 
void CASADI_CONIC_PROXQP_EXPORT casadi_load_conic_proxqp ()
 
int CASADI_CONIC_QPOASES_EXPORT casadi_register_conic_qpoases (Conic::Plugin *plugin)
 
void CASADI_CONIC_QPOASES_EXPORT casadi_load_conic_qpoases ()
 
static SLEQP_RETCODE casadi_func_set (SleqpFunc *func, SleqpVec *value, SLEQP_VALUE_REASON reason, bool *reject, void *func_data)
 
static SLEQP_RETCODE casadi_func_nonzeros (SleqpFunc *func, int *obj_grad_nnz, int *cons_val_nnz, int *cons_jac_nnz, int *hess_prod_nnz, void *func_data)
 
static SLEQP_RETCODE casadi_func_obj_val (SleqpFunc *func, double *obj_val, void *func_data)
 
static SLEQP_RETCODE casadi_func_obj_grad (SleqpFunc *func, SleqpVec *obj_grad, void *func_data)
 
static SLEQP_RETCODE casadi_func_cons_val (SleqpFunc *func, SleqpVec *cons_val, void *func_data)
 
static SLEQP_RETCODE casadi_func_cons_jac (SleqpFunc *func, SleqpMat *cons_jac, void *func_data)
 
static SLEQP_RETCODE casadi_func_hess_prod (SleqpFunc *func, const SleqpVec *direction, const SleqpVec *cons_duals, SleqpVec *product, void *func_data)
 
static SLEQP_RETCODE casadi_func_free (void *func_data)
 
void casadi_sleqp_func_create (SleqpFunc **star, int num_vars, int num_cons, SLEQPMemory *m)
 
std::string log_level_name (SLEQP_LOG_LEVEL level)
 
static void casadi_log_output (SLEQP_LOG_LEVEL level, time_t time, const char *message)
 
int CASADI_NLPSOL_SLEQP_EXPORT casadi_register_nlpsol_sleqp (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_SLEQP_EXPORT casadi_load_nlpsol_sleqp ()
 
static std::string status_string (SLEQP_STATUS status)
 
UnifiedReturnStatus map_status (SLEQP_STATUS status)
 
static SLEQP_RETCODE accepted_iterate (SleqpSolver *solver, SleqpIterate *iterate, void *data)
 
int CASADI_DPLE_SLICOT_EXPORT casadi_register_dple_slicot (Dple::Plugin *plugin)
 
void CASADI_DPLE_SLICOT_EXPORT casadi_load_dple_slicot ()
 
void slicot_periodic_schur (casadi_int n, casadi_int K, const double *a, double *t, double *z, double *dwork, double *eig_real, double *eig_imag, double num_zero)
 
int CASADI_EXPM_SLICOT_EXPORT casadi_register_expm_slicot (Expm::Plugin *plugin)
 
void CASADI_EXPM_SLICOT_EXPORT casadi_load_expm_slicot ()
 
void dense_kron_stride (casadi_int n, casadi_int m, const double *A, const double *B, double *C, casadi_int strideA, casadi_int strideB, casadi_int strideC)
 
void dense_mul_nt_stride (casadi_int n, casadi_int m, casadi_int l, const double *A, const double *B, double *C, casadi_int strideA, casadi_int strideB, casadi_int strideC)
 
void dense_mul_nt (casadi_int n, casadi_int m, casadi_int l, const double *A, const double *B, double *C)
 
void dense_mul_nn_stride (casadi_int n, casadi_int m, casadi_int l, const double *A, const double *B, double *C, casadi_int strideA, casadi_int strideB, casadi_int strideC)
 
void dense_copy_stride (casadi_int n, casadi_int m, const double *A, double *B, casadi_int strideA, casadi_int strideB)
 
void dense_copy_t_stride (casadi_int n, casadi_int m, const double *A, double *B, casadi_int strideA, casadi_int strideB)
 
void dense_mul_nn (casadi_int n, casadi_int m, casadi_int l, const double *A, const double *B, double *C)
 
void dense_mul_nn2 (casadi_int n, casadi_int m, casadi_int l, const double *A, const double *B, double *C)
 
void dense_mul_tn (casadi_int n, casadi_int m, casadi_int l, const double *A, const double *B, double *C)
 
int slicot_mb03vd (int n, int p, int ilo, int ihi, double *a, int lda1, int lda2, double *tau, int ldtau, double *dwork)
 
int slicot_mb03vy (int n, int p, int ilo, int ihi, double *a, int lda1, int lda2, const double *tau, int ldtau, double *dwork, int ldwork)
 
int slicot_mb03wd (char job, char compz, int n, int p, int ilo, int ihi, int iloz, int ihiz, double *h, int ldh1, int ldh2, double *z, int ldz1, int ldz2, double *wr, double *wi, double *dwork, int ldwork)
 
int slicot_mb05nd (int n, double delta, const double *a, int lda, double *ex, int ldex, double *exint, int ldexin, double tol, int *iwork, double *dwork, int ldwork)
 
int CASADI_NLPSOL_SNOPT_EXPORT casadi_register_nlpsol_snopt (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_SNOPT_EXPORT casadi_load_nlpsol_snopt ()
 
int CASADI_CONIC_SQIC_EXPORT casadi_register_conic_sqic (Conic::Plugin *plugin)
 
void CASADI_CONIC_SQIC_EXPORT casadi_load_conic_sqic ()
 
int CASADI_INTEGRATOR_CVODES_EXPORT casadi_register_integrator_cvodes (Integrator::Plugin *plugin)
 
void CASADI_INTEGRATOR_CVODES_EXPORT casadi_load_integrator_cvodes ()
 
int CASADI_INTEGRATOR_IDAS_EXPORT casadi_register_integrator_idas (Integrator::Plugin *plugin)
 
void CASADI_INTEGRATOR_IDAS_EXPORT casadi_load_integrator_idas ()
 
template<typename T1 >
void casadi_copy_block (const T1 *x, const casadi_int *sp_x, T1 *y, const casadi_int *sp_y, casadi_int r_begin, casadi_int c_begin, T1 *w)
 
int CASADI_ROOTFINDER_KINSOL_EXPORT casadi_register_rootfinder_kinsol (Rootfinder::Plugin *plugin)
 
void CASADI_ROOTFINDER_KINSOL_EXPORT casadi_load_rootfinder_kinsol ()
 
bool is_regular (N_Vector v)
 
int CASADI_CONIC_SUPERSCS_EXPORT casadi_register_conic_superscs (Conic::Plugin *plugin)
 
void CASADI_CONIC_SUPERSCS_EXPORT casadi_load_conic_superscs ()
 
int CASADI_XMLFILE_TINYXML_EXPORT casadi_register_xmlfile_tinyxml (XmlFileInternal::Plugin *plugin)
 
void CASADI_XMLFILE_TINYXML_EXPORT casadi_load_xmlfile_tinyxml ()
 
int CASADI_NLPSOL_WORHP_EXPORT casadi_register_nlpsol_worhp (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_WORHP_EXPORT casadi_load_nlpsol_worhp ()
 
void worhp_disp (int mode, const char message[])
 
int CASADI_INTERPOLANT_BSPLINE_EXPORT casadi_register_interpolant_bspline (Interpolant::Plugin *plugin)
 
void CASADI_INTERPOLANT_BSPLINE_EXPORT casadi_load_interpolant_bspline ()
 
int CASADI_INTEGRATOR_COLLOCATION_EXPORT casadi_register_integrator_collocation (Integrator::Plugin *plugin)
 
void CASADI_INTEGRATOR_COLLOCATION_EXPORT casadi_load_integrator_collocation ()
 
int CASADI_ROOTFINDER_FAST_NEWTON_EXPORT casadi_register_rootfinder_fast_newton (Rootfinder::Plugin *plugin)
 
void CASADI_ROOTFINDER_FAST_NEWTON_EXPORT casadi_load_rootfinder_fast_newton ()
 
std::string return_code (casadi_int status)
 
int CASADI_NLPSOL_FEASIBLESQPMETHOD_EXPORT casadi_register_nlpsol_feasiblesqpmethod (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_FEASIBLESQPMETHOD_EXPORT casadi_load_nlpsol_feasiblesqpmethod ()
 
int CASADI_ROOTFINDER_NLPSOL_EXPORT casadi_register_rootfinder_nlpsol (Rootfinder::Plugin *plugin)
 
void CASADI_ROOTFINDER_NLPSOL_EXPORT casadi_load_rootfinder_nlpsol ()
 
int CASADI_CONIC_IPQP_EXPORT casadi_register_conic_ipqp (Conic::Plugin *plugin)
 
void CASADI_CONIC_IPQP_EXPORT casadi_load_conic_ipqp ()
 
void print_vec (const std::string &str, const double *v, casadi_int n)
 
int CASADI_INTERPOLANT_LINEAR_EXPORT casadi_register_interpolant_linear (Interpolant::Plugin *plugin)
 
void CASADI_INTERPOLANT_LINEAR_EXPORT casadi_load_interpolant_linear ()
 
int CASADI_LINSOL_LDL_EXPORT casadi_register_linsol_ldl (LinsolInternal::Plugin *plugin)
 
void CASADI_LINSOL_LDL_EXPORT casadi_load_linsol_ldl ()
 
int CASADI_LINSOL_QR_EXPORT casadi_register_linsol_qr (LinsolInternal::Plugin *plugin)
 
void CASADI_LINSOL_QR_EXPORT casadi_load_linsol_qr ()
 
int CASADI_LINSOL_TRIDIAG_EXPORT casadi_register_linsol_tridiag (LinsolInternal::Plugin *plugin)
 
void CASADI_LINSOL_TRIDIAG_EXPORT casadi_load_linsol_tridiag ()
 
int CASADI_LINSOL_LSQR_EXPORT casadi_register_linsol_lsqr (LinsolInternal::Plugin *plugin)
 
void CASADI_LINSOL_LSQR_EXPORT casadi_load_linsol_lsqr ()
 
int CASADI_ROOTFINDER_NEWTON_EXPORT casadi_register_rootfinder_newton (Rootfinder::Plugin *plugin)
 
void CASADI_ROOTFINDER_NEWTON_EXPORT casadi_load_rootfinder_newton ()
 
int CASADI_CONIC_NLPSOL_EXPORT casadi_register_conic_nlpsol (Conic::Plugin *plugin)
 
void CASADI_CONIC_NLPSOL_EXPORT casadi_load_conic_nlpsol ()
 
int CASADI_CONIC_QRQP_EXPORT casadi_register_conic_qrqp (Conic::Plugin *plugin)
 
void CASADI_CONIC_QRQP_EXPORT casadi_load_conic_qrqp ()
 
int CASADI_NLPSOL_QRSQP_EXPORT casadi_register_nlpsol_qrsqp (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_QRSQP_EXPORT casadi_load_nlpsol_qrsqp ()
 
int CASADI_INTEGRATOR_RK_EXPORT casadi_register_integrator_rk (Integrator::Plugin *plugin)
 
void CASADI_INTEGRATOR_RK_EXPORT casadi_load_integrator_rk ()
 
int CASADI_NLPSOL_SCPGEN_EXPORT casadi_register_nlpsol_scpgen (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_SCPGEN_EXPORT casadi_load_nlpsol_scpgen ()
 
int CASADI_IMPORTER_SHELL_EXPORT casadi_register_importer_shell (ImporterInternal::Plugin *plugin)
 
void CASADI_IMPORTER_SHELL_EXPORT casadi_load_importer_shell ()
 
int CASADI_NLPSOL_SQPMETHOD_EXPORT casadi_register_nlpsol_sqpmethod (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_SQPMETHOD_EXPORT casadi_load_nlpsol_sqpmethod ()
 
int CASADI_LINSOL_SYMBOLICQR_EXPORT casadi_register_linsol_symbolicqr (LinsolInternal::Plugin *plugin)
 
void CASADI_LINSOL_SYMBOLICQR_EXPORT casadi_load_linsol_symbolicqr ()
 
double sign (double x)
 Sign function, note that sign(nan) == nan. More...
 
double simplify (double x)
 
double constpow (double x, double y)
 
double printme (double x, double y)
 
bool is_equal (double x, double y, casadi_int depth=0)
 
casadi_int casadi_max (casadi_int x, casadi_int y)
 
casadi_int casadi_min (casadi_int x, casadi_int y)
 
double if_else_zero (double x, double y)
 Conditional assignment. More...
 
double if_else (double x, double y, double z)
 
double erfinv (double x) throw ()
 
Type from_fmi2 (TypeFmi2 v)
 
TypeFmi2 to_fmi2 (Type v)
 
std::string to_string (TypeFmi2 v)
 
std::string to_string (Type v)
 
std::string to_string (Causality v)
 
std::string to_string (Variability v)
 
std::string to_string (Initial v)
 
CASADI_EXPORT std::string to_string (Attribute v)
 
CASADI_EXPORT std::string to_string (DependenciesKind v)
 
std::string to_string (Category v)
 
std::string to_string (OutputCategory v)
 
std::string description (Category v)
 
std::vector< double > collocation_points (casadi_int order, const std::string &scheme="radau")
 Obtain collocation points of specific order and scheme. More...
 
std::vector< long double > collocation_pointsL (casadi_int order, const std::string &scheme)
 Obtain collocation points of specific order and scheme. More...
 
MXDict dae_reduce_index (const MXDict &dae, Dict &stats, const Dict &opts={})
 Reduce index. More...
 
SXDict dae_reduce_index (const SXDict &dae, Dict &stats, const Dict &opts)
 Reduce index. More...
 
MXDict dae_map_semi_expl (const MXDict &dae, const MXDict &dae_red, Function &state_to_orig, Function &phi)
 Turn a reduced DAE into a semi explicit form suitable for CasADi integrator. More...
 
SXDict dae_map_semi_expl (const SXDict &dae, const SXDict &dae_red, Function &state_to_orig, Function &phi)
 Turn a reduced DAE into a semi explicit form suitable for CasADi integrator. More...
 
Function dae_init_gen (const MXDict &dae, const MXDict &dae_red, const std::string &init_solver, const DMDict &init_strength=DMDict(), const Dict &init_solver_options=Dict())
 Obtain a generator Function for producing consistent initial guesses of a reduced DAE. More...
 
Function dae_init_gen (const SXDict &dae, const SXDict &dae_red, const std::string &init_solver, const DMDict &init_strength, const Dict &init_solver_options)
 Obtain a generator Function for producing consistent initial guesses of a reduced DAE. More...
 
std::string to_string (DynIn v)
 
std::string to_string (DynOut v)
 
std::string to_string (EventIn v)
 
std::string to_string (EventOut v)
 
template<typename Scalar >
std::string matrixName ()
 Get typename. More...
 
template<>
std::string matrixName< double > ()
 Get typename. More...
 
template<>
std::string matrixName< casadi_int > ()
 Get typename. More...
 
double nlpsol_default_in (casadi_int ind)
 Default input for an NLP solver. More...
 
std::vector< double > nlpsol_default_in ()
 Default input for an NLP solver. More...
 

Variables

const double pi = 3.14159265358979323846
 Define pi. More...
 
const double inf = std::numeric_limits<double>::infinity()
 infinity More...
 
const double nan = std::numeric_limits<double>::quiet_NaN()
 Not a number. More...
 
const double eps = std::numeric_limits<double>::epsilon()
 Machine epsilon. More...
 
const int bvec_size = CHAR_BIT*sizeof(bvec_t)
 
constexpr casadi_int LOOKUP_LINEAR = 0
 
constexpr casadi_int LOOKUP_EXACT = 1
 
constexpr casadi_int LOOKUP_BINARY = 2
 
template class CASADI_EXPORT casadi_limits< double >
 
template class CASADI_EXPORT Matrix< double >
 
template class CASADI_EXPORT Matrix< casadi_int >
 
const long double legendre_points1 [] = { 0.50000000000000000000 }
 
const long double legendre_points2 []
 
const long double legendre_points3 []
 
const long double legendre_points4 []
 
const long double legendre_points5 []
 
const long double legendre_points6 []
 
const long double legendre_points7 []
 
const long double legendre_points8 []
 
const long double legendre_points9 []
 
const long double * legendre_points []
 
const long double radau_points1 []
 
const long double radau_points2 []
 
const long double radau_points3 []
 
const long double radau_points4 []
 
const long double radau_points5 []
 
const long double radau_points6 []
 
const long double radau_points7 []
 
const long double radau_points8 []
 
const long double radau_points9 []
 
const long double * radau_points []
 
const std::vector< std::string > NL_INPUTS = {"x", "p"}
 Shortname for onput arguments of an NLP function. More...
 
const std::vector< std::string > NL_OUTPUTS = {"f", "g"}
 Shortname for output arguments of an NLP function. More...
 
template class CASADI_EXPORT GenericShared< SharedSXElem, OutputSX >
 
template class CASADI_EXPORT GenericWeakRef< SharedSXElem, OutputSX >
 
const std::vector< std::string > RFP_INPUTS = {"x", "p"}
 Shortnames for DAE symbolic representation inputs. More...
 
const std::vector< std::string > RFP_OUTPUTS = {"g"}
 Shortnames for DAE symbolic representation outputs. More...
 
static casadi_int serialization_protocol_version = 3
 
static casadi_int serialization_check = 123456789012345
 
template class CASADI_EXPORT GenericShared< SharedObject, SharedObjectInternal >
 
template class CASADI_EXPORT GenericWeakRef< SharedObject, SharedObjectInternal >
 
template class CASADI_EXPORT Matrix< SXElem >
 

Detailed Description

Scalar expression (which also works as a smart pointer class to this class)

C/C++.

Convenience tools for C++ Standard Library vectors.

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

Author
Joel Andersson
Date
2010-2011

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

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

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

@requires_conic("hpipm") @requires_conic("qpoases") def test_hpipm_timevarying(self): def mat(a): def fl(a): return float(a) if len(a)>0 else 0 return sparsify(DM([list(map(fl,i.split("\t"))) for i in a.split("\n") if len(i)>0])) def vec(a): return DM(list(map(float,a.split("\n")))) N = 2 A = """ 1 0.2 1 -1 0 0 0 0 0 0 0 0 -0.1 0.4 0 0 -1 0 0 0 0 0 0 0 0.3 0.2 0 0 0 -1 0 0 0 0 0 0 2 0 0.3 0 0 0 0 0 0 0 0 0 1 1 0.4 0 0 0 0 0 0 0 0 0 0 0 1 4 2 1 0.3 -1 0 0 0 0 0 3 1 0 1 0.2 0 -1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 2 4 0 -1 0 0 0 0 0 0 0 2 3 1 0 0 0 0 0 0 0 0 0 0 0 3""" A = mat(A) nx = [2,3,2,1] nu = [1, 2,1] ng = [2, 1, 1, 1] N = 3 H = """7 0 0.2 0 0 0 0 0 0 0 0 0 7 0.3 0 0 0 0 0 0 0 0 0 0.2 0.3 1 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 1 0 0 0 0 0 0 0 2 0.1 0 0.7 0 0 0 0 0 0 0 0.1 1 0 1 0 0 0 0 0 0 0 0 0 1 0.1 0 0 0 0 0 0 1 0.7 1 0.1 2 0 0 0 0 0 0 0 0 0 0 0 6 0 1 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 1 0 4 0 0 0 0 0 0 0 0 0 0 0 9 """ H = mat(H) options = {"hpipm":{"iter_max":100,"res_g_max":1e-10,"res_b_max":1e-10,"res_d_max":1e-10,"res_m_max":1e-10}} #solver = conic('solver', 'hpipm', {"a": A.sparsity(), "h": H.sparsity()},{"N":N,"nx":nx,"nu":nu,"ng":ng,"tol":1e-12,"mu0":2,"max_iter":20}) solver = conic('solver', 'hpipm', {"a": A.sparsity(), "h": H.sparsity()},options) solver_ref = conic('solver', 'qpoases', {"a": A.sparsity(), "h": H.sparsity()})

g = vec("""1 1 0.2 0.4 1 0.5 0.3 1 0.6 1 1 0.7""") lbg = vec("""0 0 0 -2 -2 0 0 -2 0 -2 -2""")

ubg = vec("""0 0 0 2 2 0 0 2 0 2 2""")

lbx = vec("""0.5 0.2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1""") ubx = vec("""0.5 0.2 1 1 1 1 1 1 1 1 1 1""")

Typedef Documentation

◆ BoolType

Definition at line 40 of file generic_type.cpp.

◆ bvec_t

typedef unsigned long long casadi::bvec_t

Definition at line 125 of file casadi_common.hpp.

◆ casadi_checkout_t

typedef int(* casadi::casadi_checkout_t) (void)

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

Definition at line 145 of file casadi_common.hpp.

◆ casadi_release_t

typedef void(* casadi::casadi_release_t) (int)

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

Definition at line 146 of file casadi_common.hpp.

◆ config_t

typedef int(* casadi::config_t) (int, const char **)

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

Definition at line 138 of file casadi_common.hpp.

◆ default_t

typedef double(* casadi::default_t) (casadi_int i)

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

Definition at line 141 of file casadi_common.hpp.

◆ Deserialize

typedef ProtoFunction*(* casadi::Deserialize) (DeserializingStream &)

Definition at line 45 of file plugin_interface.hpp.

◆ Dict

typedef std::map< std::string, GenericType > casadi::Dict
Examples
Function/callback_c.cc.

Definition at line 258 of file generic_type.hpp.

◆ DictType

Definition at line 52 of file generic_type.cpp.

◆ DictVectorType

Definition at line 53 of file generic_type.cpp.

◆ diff_t

typedef int(* casadi::diff_t) (casadi_int i)

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

Definition at line 144 of file casadi_common.hpp.

◆ DM

typedef Matrix<double> casadi::DM
Examples
Function/callback_c.cc, and misc/all.cc.

Definition at line 33 of file dm_fwd.hpp.

◆ DMDict

typedef std::map<std::string, DM> casadi::DMDict

Definition at line 36 of file dm_fwd.hpp.

◆ DMVector

typedef std::vector<DM> casadi::DMVector

Definition at line 34 of file dm_fwd.hpp.

◆ DMVectorVector

typedef std::vector<DMVector> casadi::DMVectorVector

Definition at line 35 of file dm_fwd.hpp.

◆ DoubleType

Definition at line 38 of file generic_type.cpp.

◆ DoubleVectorType

Definition at line 41 of file generic_type.cpp.

◆ DoubleVectorVectorType

typedef GenericTypeInternal< OT_DOUBLEVECTORVECTOR, std::vector< std::vector< double > > > casadi::DoubleVectorVectorType

Definition at line 43 of file generic_type.cpp.

◆ eval_t

typedef int(* casadi::eval_t) (const double **arg, double **res, casadi_int *iw, double *w, int)

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

Definition at line 149 of file casadi_common.hpp.

◆ external_print_callback_t

typedef void(* casadi::external_print_callback_t) (const char *s)

Definition at line 47 of file tools.hpp.

◆ external_transform_t

typedef const char*(* casadi::external_transform_t) (char api_version, const char *casadi_version, const char *in, external_print_callback_t cb_stdout, external_print_callback_t cb_stderr)

Definition at line 48 of file tools.hpp.

◆ FunctionType

Definition at line 50 of file generic_type.cpp.

◆ FunctionVectorType

Definition at line 51 of file generic_type.cpp.

◆ getint_t

typedef casadi_int(* casadi::getint_t) (void)

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

Definition at line 140 of file casadi_common.hpp.

◆ IM

typedef Matrix<casadi_int> casadi::IM

Definition at line 31 of file im_fwd.hpp.

◆ IntType

typedef GenericTypeInternal< OT_INT, casadi_int > casadi::IntType

Definition at line 39 of file generic_type.cpp.

◆ IntVectorType

typedef GenericTypeInternal< OT_INTVECTOR, std::vector< casadi_int > > casadi::IntVectorType

Definition at line 44 of file generic_type.cpp.

◆ IntVectorVectorType

typedef GenericTypeInternal< OT_INTVECTORVECTOR, std::vector< std::vector< casadi_int > > > casadi::IntVectorVectorType

Definition at line 46 of file generic_type.cpp.

◆ MXDict

typedef std::map<std::string, MX> casadi::MXDict

Readability typedefs

Definition at line 1009 of file mx.hpp.

◆ MXIList

typedef std::initializer_list<MX> casadi::MXIList

Readability typedefs

Definition at line 1007 of file mx.hpp.

◆ MXVector

typedef std::vector<MX> casadi::MXVector

Readability typedefs

Definition at line 1006 of file mx.hpp.

◆ MXVectorVector

typedef std::vector<MXVector> casadi::MXVectorVector

Readability typedefs

Definition at line 1008 of file mx.hpp.

◆ name_t

typedef const char*(* casadi::name_t) (casadi_int i)

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

Definition at line 142 of file casadi_common.hpp.

◆ native_DM

Definition at line 33 of file optistack.hpp.

◆ signal_t

typedef void(* casadi::signal_t) (void)

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

Definition at line 139 of file casadi_common.hpp.

◆ sparsity_t

typedef const casadi_int*(* casadi::sparsity_t) (casadi_int i)

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

Definition at line 143 of file casadi_common.hpp.

◆ SpDict

typedef std::map<std::string, Sparsity> casadi::SpDict

Readability typedefs

Definition at line 1502 of file sparsity.hpp.

◆ StringType

Definition at line 37 of file generic_type.cpp.

◆ StringVector

typedef std::vector<std::string> casadi::StringVector

Readability typedefs

Definition at line 1002 of file casadi_misc.hpp.

◆ StringVectorType

typedef GenericTypeInternal< OT_STRINGVECTOR, std::vector< std::string > > casadi::StringVectorType

Definition at line 47 of file generic_type.cpp.

◆ StringVectorVectorType

typedef GenericTypeInternal<OT_STRINGVECTORVECTOR, std::vector<std::vector<std::string> > > casadi::StringVectorVectorType

Definition at line 49 of file generic_type.cpp.

◆ SX

Readability typedefs

Examples
SX/SXaddition.cc.

Definition at line 36 of file sx_fwd.hpp.

◆ SXDict

typedef std::map<std::string, SX> casadi::SXDict

Readability typedefs

Definition at line 40 of file sx_fwd.hpp.

◆ SXIList

typedef std::initializer_list<SX> casadi::SXIList

Readability typedefs

Definition at line 38 of file sx_fwd.hpp.

◆ SXPtr

typedef SX* casadi::SXPtr

Definition at line 45 of file symbolic_qr.hpp.

◆ SXPtrV

typedef std::vector<SXPtr> casadi::SXPtrV

Definition at line 46 of file symbolic_qr.hpp.

◆ SXVector

typedef std::vector<SX> casadi::SXVector

Readability typedefs

Definition at line 37 of file sx_fwd.hpp.

◆ SXVectorVector

typedef std::vector<SXVector> casadi::SXVectorVector

Readability typedefs

Definition at line 39 of file sx_fwd.hpp.

◆ VectorType

Definition at line 56 of file generic_type.cpp.

◆ VectorVectorType

typedef GenericTypeInternal< OT_VECTORVECTOR, std::vector< std::vector< GenericType > > > casadi::VectorVectorType

Definition at line 55 of file generic_type.cpp.

◆ VoidPointerType

Definition at line 57 of file generic_type.cpp.

◆ WeakRefInternalSXElem

Definition at line 60 of file output_sx.hpp.

◆ work_t

typedef int(* casadi::work_t) (casadi_int *sz_arg, casadi_int *sz_res, casadi_int *sz_iw, casadi_int *sz_w)

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

Definition at line 147 of file casadi_common.hpp.

Enumeration Type Documentation

◆ Attribute

enum casadi::Attribute
strong
Enumerator
MIN 
MAX 
NOMINAL 
START 
VALUE 
STRINGVALUE 
NUMEL 

Definition at line 72 of file dae_builder_internal.hpp.

◆ BStepIn

Enumerator
BSTEP_T 
BSTEP_H 
BSTEP_X0 
BSTEP_V0 
BSTEP_P 
BSTEP_U 
BSTEP_OUT_XF 
BSTEP_OUT_VF 
BSTEP_OUT_QF 
BSTEP_ADJ_XF 
BSTEP_ADJ_VF 
BSTEP_ADJ_QF 
BSTEP_NUM_IN 

Definition at line 528 of file integrator_impl.hpp.

528  {
529  BSTEP_T,
530  BSTEP_H,
531  BSTEP_X0,
532  BSTEP_V0,
533  BSTEP_P,
534  BSTEP_U,
535  BSTEP_OUT_XF,
536  BSTEP_OUT_VF,
537  BSTEP_OUT_QF,
538  BSTEP_ADJ_XF,
539  BSTEP_ADJ_VF,
540  BSTEP_ADJ_QF,
542 };

◆ BStepOut

Enumerator
BSTEP_ADJ_T 
BSTEP_ADJ_H 
BSTEP_ADJ_X0 
BSTEP_ADJ_V0 
BSTEP_ADJ_P 
BSTEP_ADJ_U 
BSTEP_NUM_OUT 

Definition at line 545 of file integrator_impl.hpp.

545  {
546  BSTEP_ADJ_T,
547  BSTEP_ADJ_H,
548  BSTEP_ADJ_X0,
549  BSTEP_ADJ_V0,
550  BSTEP_ADJ_P,
551  BSTEP_ADJ_U,
553 };

◆ Category

enum casadi::Category
strong
Enumerator
CALCULATED 
NUMEL 

Definition at line 63 of file dae_builder_internal.hpp.

◆ Causality

enum casadi::Causality
strong
Enumerator
PARAMETER 
CALCULATED_PARAMETER 
INPUT 
OUTPUT 
LOCAL 
INDEPENDENT 
NUMEL 

Definition at line 49 of file dae_builder_internal.hpp.

◆ CollocationPoints

Enumerator
LEGENDRE 
RADAU 

Definition at line 123 of file integration_tools.hpp.

◆ ConicInput

Enumerator
CONIC_H 

The square matrix H: sparse, (n x n). Only the lower triangular part is actually used. The matrix is assumed to be symmetrical.

CONIC_G 

The vector g: dense, (n x 1)

CONIC_A 

The matrix A: sparse, (nc x n) - product with x must be dense.

CONIC_LBA 

dense, (nc x 1)

CONIC_UBA 

dense, (nc x 1)

CONIC_LBX 

dense, (n x 1)

CONIC_UBX 

dense, (n x 1)

CONIC_X0 

dense, (n x 1)

CONIC_LAM_X0 

dense

CONIC_LAM_A0 

dense

CONIC_Q 

The matrix Q: sparse symmetric, (np^2 x n)

CONIC_P 

The matrix P: sparse symmetric, (np x np)

CONIC_NUM_IN 

Definition at line 170 of file conic.hpp.

170  {
173  CONIC_H,
175  CONIC_G,
177  CONIC_A,
179  CONIC_LBA,
181  CONIC_UBA,
183  CONIC_LBX,
185  CONIC_UBX,
187  CONIC_X0,
189  CONIC_LAM_X0,
191  CONIC_LAM_A0,
193  CONIC_Q,
195  CONIC_P,
196  CONIC_NUM_IN};
@ CONIC_UBA
dense, (nc x 1)
Definition: conic.hpp:181
@ CONIC_X0
dense, (n x 1)
Definition: conic.hpp:187
@ CONIC_A
The matrix A: sparse, (nc x n) - product with x must be dense.
Definition: conic.hpp:177
@ CONIC_G
The vector g: dense, (n x 1)
Definition: conic.hpp:175
@ CONIC_Q
The matrix Q: sparse symmetric, (np^2 x n)
Definition: conic.hpp:193
@ CONIC_LBA
dense, (nc x 1)
Definition: conic.hpp:179
@ CONIC_UBX
dense, (n x 1)
Definition: conic.hpp:185
@ CONIC_H
Definition: conic.hpp:173
@ CONIC_LAM_A0
dense
Definition: conic.hpp:191
@ CONIC_LBX
dense, (n x 1)
Definition: conic.hpp:183
@ CONIC_NUM_IN
Definition: conic.hpp:196
@ CONIC_LAM_X0
dense
Definition: conic.hpp:189
@ CONIC_P
The matrix P: sparse symmetric, (np x np)
Definition: conic.hpp:195

◆ ConicOutput

Enumerator
CONIC_X 

The primal solution.

CONIC_COST 

The optimal cost.

CONIC_LAM_A 

The dual solution corresponding to linear bounds.

CONIC_LAM_X 

The dual solution corresponding to simple bounds.

CONIC_NUM_OUT 

Definition at line 199 of file conic.hpp.

199  {
201  CONIC_X,
203  CONIC_COST,
205  CONIC_LAM_A,
207  CONIC_LAM_X,
208  CONIC_NUM_OUT};
@ CONIC_X
The primal solution.
Definition: conic.hpp:201
@ CONIC_LAM_A
The dual solution corresponding to linear bounds.
Definition: conic.hpp:205
@ CONIC_COST
The optimal cost.
Definition: conic.hpp:203
@ CONIC_LAM_X
The dual solution corresponding to simple bounds.
Definition: conic.hpp:207
@ CONIC_NUM_OUT
Definition: conic.hpp:208

◆ ConstraintType

Enumerator
OPTI_GENERIC_EQUALITY 
OPTI_GENERIC_INEQUALITY 
OPTI_EQUALITY 
OPTI_INEQUALITY 
OPTI_DOUBLE_INEQUALITY 
OPTI_PSD 
OPTI_UNKNOWN 

Definition at line 487 of file optistack.hpp.

487  {
488  OPTI_GENERIC_EQUALITY, // g1(x,p) == g2(x,p)
489  OPTI_GENERIC_INEQUALITY, // g1(x,p) <= g2(x,p)
490  OPTI_EQUALITY, // g(x,p) == bound(p)
491  OPTI_INEQUALITY, // g(x,p) <= bound(p)
492  OPTI_DOUBLE_INEQUALITY, // lb(p) <= g(x,p) <= ub(p)
493  OPTI_PSD, // A(x,p) >= b(p)
494  OPTI_UNKNOWN};
@ OPTI_DOUBLE_INEQUALITY
Definition: optistack.hpp:492
@ OPTI_INEQUALITY
Definition: optistack.hpp:491
@ OPTI_GENERIC_INEQUALITY
Definition: optistack.hpp:489
@ OPTI_EQUALITY
Definition: optistack.hpp:490
@ OPTI_GENERIC_EQUALITY
Definition: optistack.hpp:488
@ OPTI_UNKNOWN
Definition: optistack.hpp:494
@ OPTI_PSD
Definition: optistack.hpp:493

◆ DependenciesKind

Enumerator
DEPENDENT 
CONSTANT 
FIXED 
TUNABLE 
DISCRETE 
NUMEL 

Definition at line 75 of file dae_builder_internal.hpp.

◆ DomainType

Enumerator
OPTI_DOMAIN_REAL 
OPTI_DOMAIN_INTEGER 

Definition at line 500 of file optistack.hpp.

500  {
503  };
@ OPTI_DOMAIN_INTEGER
Definition: optistack.hpp:502
@ OPTI_DOMAIN_REAL
Definition: optistack.hpp:501

◆ DpleInput

Enumerator
DPLE_A 

A matrices (horzcat when const_dim, diagcat otherwise) [a].

DPLE_V 

V matrices (horzcat when const_dim, diagcat otherwise) [v].

DPLE_NUM_IN 

Definition at line 119 of file dple.hpp.

119  {
121  DPLE_A,
123  DPLE_V,
125 };
@ DPLE_NUM_IN
Definition: dple.hpp:124
@ DPLE_A
A matrices (horzcat when const_dim, diagcat otherwise) [a].
Definition: dple.hpp:121
@ DPLE_V
V matrices (horzcat when const_dim, diagcat otherwise) [v].
Definition: dple.hpp:123

◆ DpleOutput

Enumerator
DPLE_P 

Lyapunov matrix (horzcat when const_dim, diagcat otherwise) (Cholesky of P if pos_def) [p].

DPLE_NUM_OUT 

Number of arguments.

Definition at line 128 of file dple.hpp.

128  {
130  DPLE_P,
133 };
@ DPLE_NUM_OUT
Number of arguments.
Definition: dple.hpp:132
@ DPLE_P
Lyapunov matrix (horzcat when const_dim, diagcat otherwise) (Cholesky of P if pos_def) [p].
Definition: dple.hpp:130

◆ DynIn

Enumerator
DYN_T 
DYN_X 
DYN_Z 
DYN_P 
DYN_U 
DYN_NUM_IN 

Definition at line 190 of file integrator.hpp.

190  {
191  DYN_T,
192  DYN_X,
193  DYN_Z,
194  DYN_P,
195  DYN_U,
196  DYN_NUM_IN};
@ DYN_NUM_IN
Definition: integrator.hpp:196

◆ DynOut

Enumerator
DYN_ODE 
DYN_ALG 
DYN_QUAD 
DYN_ZERO 
DYN_NUM_OUT 

Definition at line 199 of file integrator.hpp.

199  {
200  DYN_ODE,
201  DYN_ALG,
202  DYN_QUAD,
203  DYN_ZERO,
204  DYN_NUM_OUT};
@ DYN_NUM_OUT
Definition: integrator.hpp:204

◆ EventIn

Enumerator
EVENT_INDEX 
EVENT_T 
EVENT_X 
EVENT_Z 
EVENT_P 
EVENT_U 
EVENT_NUM_IN 

Definition at line 207 of file integrator.hpp.

207  {
208  EVENT_INDEX,
209  EVENT_T,
210  EVENT_X,
211  EVENT_Z,
212  EVENT_P,
213  EVENT_U,
214  EVENT_NUM_IN};
@ EVENT_INDEX
Definition: integrator.hpp:208
@ EVENT_NUM_IN
Definition: integrator.hpp:214

◆ EventOut

Enumerator
EVENT_POST_X 
EVENT_POST_Z 
EVENT_NUM_OUT 

Definition at line 217 of file integrator.hpp.

217  {
218  EVENT_POST_X,
219  EVENT_POST_Z,
220  EVENT_NUM_OUT};
@ EVENT_POST_Z
Definition: integrator.hpp:219
@ EVENT_POST_X
Definition: integrator.hpp:218
@ EVENT_NUM_OUT
Definition: integrator.hpp:220

◆ FdMode

enum casadi::FdMode
strong
Enumerator
FORWARD 
BACKWARD 
CENTRAL 
SMOOTHING 
NUMEL 

Definition at line 36 of file finite_differences.hpp.

◆ FmuApi

enum casadi::FmuApi
strong
Enumerator
FMI2 
FMI3 
NUMEL 

Definition at line 46 of file fmu.hpp.

◆ Initial

enum casadi::Initial
strong
Enumerator
EXACT 
APPROX 
CALCULATED 
NA 
NUMEL 

Definition at line 69 of file dae_builder_internal.hpp.

◆ InputType

enum casadi::InputType
strong
Enumerator
REG 
FWD 
ADJ 
OUT 
ADJ_OUT 

Definition at line 93 of file fmu_function.hpp.

◆ IntegratorInput

Enumerator
INTEGRATOR_X0 

Differential state at the initial time.

INTEGRATOR_Z0 

Initial guess for the algebraic variable at the initial time.

INTEGRATOR_P 

Parameters.

INTEGRATOR_U 

Piecewise constant control, a new control interval starts at each output time.

INTEGRATOR_ADJ_XF 

Adjoint seeds corresponding to the states at the output times.

INTEGRATOR_ADJ_ZF 

Adjoint seeds corresponding to the algebraic variables at the output times.

INTEGRATOR_ADJ_QF 

Adjoint seeds corresponding to the quadratures at the output times.

INTEGRATOR_NUM_IN 

Number of input arguments of an integrator.

Definition at line 223 of file integrator.hpp.

223  {
229  INTEGRATOR_P,
231  INTEGRATOR_U,
240 };
@ INTEGRATOR_U
Piecewise constant control, a new control interval starts at each output time.
Definition: integrator.hpp:231
@ INTEGRATOR_ADJ_QF
Adjoint seeds corresponding to the quadratures at the output times.
Definition: integrator.hpp:237
@ INTEGRATOR_ADJ_ZF
Adjoint seeds corresponding to the algebraic variables at the output times.
Definition: integrator.hpp:235
@ INTEGRATOR_P
Parameters.
Definition: integrator.hpp:229
@ INTEGRATOR_ADJ_XF
Adjoint seeds corresponding to the states at the output times.
Definition: integrator.hpp:233
@ INTEGRATOR_Z0
Initial guess for the algebraic variable at the initial time.
Definition: integrator.hpp:227
@ INTEGRATOR_NUM_IN
Number of input arguments of an integrator.
Definition: integrator.hpp:239
@ INTEGRATOR_X0
Differential state at the initial time.
Definition: integrator.hpp:225

◆ IntegratorOutput

Enumerator
INTEGRATOR_XF 

Differential state at all output times.

INTEGRATOR_ZF 

Algebraic variable at all output times.

INTEGRATOR_QF 

Quadrature state at all output times.

INTEGRATOR_ADJ_X0 

Adjoint sensitivities corresponding to the initial state.

INTEGRATOR_ADJ_Z0 

Adjoint sensitivities corresponding to the algebraic variable guess.

INTEGRATOR_ADJ_P 

Adjoint sensitivities corresponding to the parameter vector.

INTEGRATOR_ADJ_U 

Adjoint sensitivities corresponding to the control vector.

INTEGRATOR_NUM_OUT 

Number of output arguments of an integrator.

Definition at line 243 of file integrator.hpp.

243  {
260 };
@ INTEGRATOR_ADJ_U
Adjoint sensitivities corresponding to the control vector.
Definition: integrator.hpp:257
@ INTEGRATOR_ADJ_Z0
Adjoint sensitivities corresponding to the algebraic variable guess.
Definition: integrator.hpp:253
@ INTEGRATOR_QF
Quadrature state at all output times.
Definition: integrator.hpp:249
@ INTEGRATOR_ADJ_P
Adjoint sensitivities corresponding to the parameter vector.
Definition: integrator.hpp:255
@ INTEGRATOR_ZF
Algebraic variable at all output times.
Definition: integrator.hpp:247
@ INTEGRATOR_XF
Differential state at all output times.
Definition: integrator.hpp:245
@ INTEGRATOR_NUM_OUT
Number of output arguments of an integrator.
Definition: integrator.hpp:259
@ INTEGRATOR_ADJ_X0
Adjoint sensitivities corresponding to the initial state.
Definition: integrator.hpp:251

◆ NLPInput

Enumerator
NL_X 

Decision variable.

NL_P 

Fixed parameter.

NL_NUM_IN 

Number of NLP inputs.

Definition at line 168 of file nlpsol.hpp.

168  {
170  NL_X,
172  NL_P,
174  NL_NUM_IN
175 };
@ NL_X
Decision variable.
Definition: nlpsol.hpp:170
@ NL_P
Fixed parameter.
Definition: nlpsol.hpp:172
@ NL_NUM_IN
Number of NLP inputs.
Definition: nlpsol.hpp:174

◆ NLPOutput

Enumerator
NL_F 

Objective function.

NL_G 

Constraint function.

NL_NUM_OUT 

Number of NLP outputs.

Definition at line 181 of file nlpsol.hpp.

181  {
183  NL_F,
185  NL_G,
187  NL_NUM_OUT
188 };
@ NL_F
Objective function.
Definition: nlpsol.hpp:183
@ NL_G
Constraint function.
Definition: nlpsol.hpp:185
@ NL_NUM_OUT
Number of NLP outputs.
Definition: nlpsol.hpp:187

◆ NlpsolInput

Enumerator
NLPSOL_X0 

Decision variables, initial guess (nx x 1)

NLPSOL_P 

Value of fixed parameters (np x 1)

NLPSOL_LBX 

Decision variables lower bound (nx x 1), default -inf.

NLPSOL_UBX 

Decision variables upper bound (nx x 1), default +inf.

NLPSOL_LBG 

Constraints lower bound (ng x 1), default -inf.

NLPSOL_UBG 

Constraints upper bound (ng x 1), default +inf.

NLPSOL_LAM_X0 

Lagrange multipliers for bounds on X, initial guess (nx x 1)

NLPSOL_LAM_G0 

Lagrange multipliers for bounds on G, initial guess (ng x 1)

NLPSOL_NUM_IN 

Definition at line 194 of file nlpsol.hpp.

194  {
196  NLPSOL_X0,
198  NLPSOL_P,
200  NLPSOL_LBX,
202  NLPSOL_UBX,
204  NLPSOL_LBG,
206  NLPSOL_UBG,
212 };
@ NLPSOL_P
Value of fixed parameters (np x 1)
Definition: nlpsol.hpp:198
@ NLPSOL_UBX
Decision variables upper bound (nx x 1), default +inf.
Definition: nlpsol.hpp:202
@ NLPSOL_X0
Decision variables, initial guess (nx x 1)
Definition: nlpsol.hpp:196
@ NLPSOL_LAM_G0
Lagrange multipliers for bounds on G, initial guess (ng x 1)
Definition: nlpsol.hpp:210
@ NLPSOL_UBG
Constraints upper bound (ng x 1), default +inf.
Definition: nlpsol.hpp:206
@ NLPSOL_LAM_X0
Lagrange multipliers for bounds on X, initial guess (nx x 1)
Definition: nlpsol.hpp:208
@ NLPSOL_NUM_IN
Definition: nlpsol.hpp:211
@ NLPSOL_LBG
Constraints lower bound (ng x 1), default -inf.
Definition: nlpsol.hpp:204
@ NLPSOL_LBX
Decision variables lower bound (nx x 1), default -inf.
Definition: nlpsol.hpp:200

◆ NlpsolOutput

Enumerator
NLPSOL_X 

Decision variables at the optimal solution (nx x 1)

NLPSOL_F 

Cost function value at the optimal solution (1 x 1)

NLPSOL_G 

Constraints function at the optimal solution (ng x 1)

NLPSOL_LAM_X 

Lagrange multipliers for bounds on X at the solution (nx x 1)

NLPSOL_LAM_G 

Lagrange multipliers for bounds on G at the solution (ng x 1)

NLPSOL_LAM_P 

Lagrange multipliers for bounds on P at the solution (np x 1)

NLPSOL_NUM_OUT 

Definition at line 215 of file nlpsol.hpp.

215  {
217  NLPSOL_X,
219  NLPSOL_F,
221  NLPSOL_G,
223  NLPSOL_LAM_X,
225  NLPSOL_LAM_G,
227  NLPSOL_LAM_P,
229 };
@ NLPSOL_G
Constraints function at the optimal solution (ng x 1)
Definition: nlpsol.hpp:221
@ NLPSOL_X
Decision variables at the optimal solution (nx x 1)
Definition: nlpsol.hpp:217
@ NLPSOL_NUM_OUT
Definition: nlpsol.hpp:228
@ NLPSOL_LAM_P
Lagrange multipliers for bounds on P at the solution (np x 1)
Definition: nlpsol.hpp:227
@ NLPSOL_F
Cost function value at the optimal solution (1 x 1)
Definition: nlpsol.hpp:219
@ NLPSOL_LAM_G
Lagrange multipliers for bounds on G at the solution (ng x 1)
Definition: nlpsol.hpp:225
@ NLPSOL_LAM_X
Lagrange multipliers for bounds on X at the solution (nx x 1)
Definition: nlpsol.hpp:223

◆ Operation

Enumerator
OP_ASSIGN 
OP_ADD 
OP_SUB 
OP_MUL 
OP_DIV 
OP_NEG 
OP_EXP 
OP_LOG 
OP_POW 
OP_CONSTPOW 
OP_SQRT 
OP_SQ 
OP_TWICE 
OP_SIN 
OP_COS 
OP_TAN 
OP_ASIN 
OP_ACOS 
OP_ATAN 
OP_LT 
OP_LE 
OP_EQ 
OP_NE 
OP_NOT 
OP_AND 
OP_OR 
OP_FLOOR 
OP_CEIL 
OP_FMOD 
OP_FABS 
OP_SIGN 
OP_COPYSIGN 
OP_IF_ELSE_ZERO 
OP_ERF 
OP_FMIN 
OP_FMAX 
OP_INV 
OP_SINH 
OP_COSH 
OP_TANH 
OP_ASINH 
OP_ACOSH 
OP_ATANH 
OP_ATAN2 
OP_CONST 
OP_INPUT 
OP_OUTPUT 
OP_PARAMETER 
OP_CALL 
OP_FIND 
OP_LOW 
OP_MAP 
OP_MTIMES 
OP_SOLVE 
OP_TRANSPOSE 
OP_DETERMINANT 
OP_INVERSE 
OP_DOT 
OP_BILIN 
OP_RANK1 
OP_HORZCAT 
OP_VERTCAT 
OP_DIAGCAT 
OP_HORZSPLIT 
OP_VERTSPLIT 
OP_DIAGSPLIT 
OP_RESHAPE 
OP_SUBREF 
OP_SUBASSIGN 
OP_GETNONZEROS 
OP_GETNONZEROS_PARAM 
OP_ADDNONZEROS 
OP_ADDNONZEROS_PARAM 
OP_SETNONZEROS 
OP_SETNONZEROS_PARAM 
OP_PROJECT 
OP_ASSERTION 
OP_MONITOR 
OP_NORM2 
OP_NORM1 
OP_NORMINF 
OP_NORMF 
OP_MMIN 
OP_MMAX 
OP_HORZREPMAT 
OP_HORZREPSUM 
OP_ERFINV 
OP_PRINTME 
OP_LIFT 
OP_EINSTEIN 
OP_BSPLINE 
OP_CONVEXIFY 
OP_SPARSITY_CAST 
OP_LOG1P 
OP_EXPM1 
OP_HYPOT 
OP_LOGSUMEXP 
OP_REMAINDER 

Definition at line 60 of file calculus.hpp.

60  {
61  // Simple assignment
62  OP_ASSIGN,
63 
64  // Standard unary and binary functions
73  OP_INV,
76  OP_ATAN2,
77 
78  // Double constant
79  OP_CONST,
80 
81  // Function input and output
83 
84  // Free parameter
86 
87  // Embedded function call
88  OP_CALL,
89 
90  // Find first nonzero in a vector
91  OP_FIND,
92 
93  // Find first nonzero in a vector
94  OP_LOW,
95 
96  // Embedded function call in parallel
97  OP_MAP,
98 
99  // Matrix multiplication
100  OP_MTIMES,
101 
102  // Solve linear system of equations
103  OP_SOLVE,
104 
105  // Matrix transpose
106  OP_TRANSPOSE,
107 
108  // Matrix determinant
110 
111  // Matrix inverse
112  OP_INVERSE,
113 
114  // Inner product
115  OP_DOT,
116 
117  // Bilinear form
118  OP_BILIN,
119 
120  // Rank-1 update
121  OP_RANK1,
122 
123  // Horizontal concatenation
124  OP_HORZCAT,
125 
126  // Vertical concatenation of vectors
127  OP_VERTCAT,
128 
129  // Diagonal concatenation
130  OP_DIAGCAT,
131 
132  // Horizontal split
133  OP_HORZSPLIT,
134 
135  // Vertical split of vectors
136  OP_VERTSPLIT,
137 
138  // Diagonal split
139  OP_DIAGSPLIT,
140 
141  // Reshape an expression
142  OP_RESHAPE,
143 
144  // Submatrix reference
145  OP_SUBREF,
146 
147  // Submatrix assignment
148  OP_SUBASSIGN,
149 
150  // Nonzero reference
152 
153  // Parametric nonzero reference
155 
156  // Nonzero addition
158 
159  // parametric nonzero addition
161 
162  // Nonzero assignment
164 
165  // Parametric nonzero assignment
167 
168  // Set sparse
169  OP_PROJECT,
170 
171  // Assertion
172  OP_ASSERTION,
173 
174  // Monitor
175  OP_MONITOR,
176 
177  // Norms
179 
180  // min/max
181  OP_MMIN, OP_MMAX,
182 
183  // Horizontal repeat
185 
186  // Horizontal repeat sum
188 
189  OP_ERFINV,
190  OP_PRINTME,
191  OP_LIFT,
192 
193  OP_EINSTEIN,
194 
195  OP_BSPLINE,
196 
197  OP_CONVEXIFY,
198 
199  // Sparsity cast
201 
202  OP_LOG1P,
203 
204  OP_EXPM1,
205 
206  OP_HYPOT,
207 
208  OP_LOGSUMEXP,
209 
211 
212  };
@ OP_DIAGCAT
Definition: calculus.hpp:130
@ OP_SIGN
Definition: calculus.hpp:71
@ OP_COS
Definition: calculus.hpp:68
@ OP_ERF
Definition: calculus.hpp:72
@ OP_NE
Definition: calculus.hpp:70
@ OP_HORZCAT
Definition: calculus.hpp:124
@ OP_FMAX
Definition: calculus.hpp:72
@ OP_SINH
Definition: calculus.hpp:74
@ OP_COSH
Definition: calculus.hpp:74
@ OP_VERTCAT
Definition: calculus.hpp:127
@ OP_SPARSITY_CAST
Definition: calculus.hpp:200
@ OP_ASINH
Definition: calculus.hpp:75
@ OP_ACOS
Definition: calculus.hpp:69
@ OP_LOW
Definition: calculus.hpp:94
@ OP_ATAN2
Definition: calculus.hpp:76
@ OP_HORZREPSUM
Definition: calculus.hpp:187
@ OP_ADDNONZEROS_PARAM
Definition: calculus.hpp:160
@ OP_COPYSIGN
Definition: calculus.hpp:71
@ OP_IF_ELSE_ZERO
Definition: calculus.hpp:71
@ OP_MMAX
Definition: calculus.hpp:181
@ OP_AND
Definition: calculus.hpp:70
@ OP_BSPLINE
Definition: calculus.hpp:195
@ OP_ATAN
Definition: calculus.hpp:69
@ OP_SQRT
Definition: calculus.hpp:67
@ OP_REMAINDER
Definition: calculus.hpp:210
@ OP_DIAGSPLIT
Definition: calculus.hpp:139
@ OP_INV
Definition: calculus.hpp:73
@ OP_INVERSE
Definition: calculus.hpp:112
@ OP_EXP
Definition: calculus.hpp:66
@ OP_OUTPUT
Definition: calculus.hpp:82
@ OP_MMIN
Definition: calculus.hpp:181
@ OP_SETNONZEROS
Definition: calculus.hpp:163
@ OP_LOG1P
Definition: calculus.hpp:202
@ OP_SIN
Definition: calculus.hpp:68
@ OP_ASIN
Definition: calculus.hpp:69
@ OP_FIND
Definition: calculus.hpp:91
@ OP_VERTSPLIT
Definition: calculus.hpp:136
@ OP_LT
Definition: calculus.hpp:70
@ OP_PRINTME
Definition: calculus.hpp:190
@ OP_ACOSH
Definition: calculus.hpp:75
@ OP_CEIL
Definition: calculus.hpp:71
@ OP_EQ
Definition: calculus.hpp:70
@ OP_CONST
Definition: calculus.hpp:79
@ OP_OR
Definition: calculus.hpp:70
@ OP_TWICE
Definition: calculus.hpp:67
@ OP_HYPOT
Definition: calculus.hpp:206
@ OP_EINSTEIN
Definition: calculus.hpp:193
@ OP_INPUT
Definition: calculus.hpp:82
@ OP_LIFT
Definition: calculus.hpp:191
@ OP_SUB
Definition: calculus.hpp:65
@ OP_ATANH
Definition: calculus.hpp:75
@ OP_SUBREF
Definition: calculus.hpp:145
@ OP_DETERMINANT
Definition: calculus.hpp:109
@ OP_DOT
Definition: calculus.hpp:115
@ OP_FMIN
Definition: calculus.hpp:72
@ OP_POW
Definition: calculus.hpp:66
@ OP_PROJECT
Definition: calculus.hpp:169
@ OP_EXPM1
Definition: calculus.hpp:204
@ OP_ADDNONZEROS
Definition: calculus.hpp:157
@ OP_PARAMETER
Definition: calculus.hpp:85
@ OP_SETNONZEROS_PARAM
Definition: calculus.hpp:166
@ OP_FABS
Definition: calculus.hpp:71
@ OP_BILIN
Definition: calculus.hpp:118
@ OP_MTIMES
Definition: calculus.hpp:100
@ OP_CONVEXIFY
Definition: calculus.hpp:197
@ OP_LOG
Definition: calculus.hpp:66
@ OP_LOGSUMEXP
Definition: calculus.hpp:208
@ OP_TANH
Definition: calculus.hpp:74
@ OP_NORM1
Definition: calculus.hpp:178
@ OP_CALL
Definition: calculus.hpp:88
@ OP_ADD
Definition: calculus.hpp:65
@ OP_ERFINV
Definition: calculus.hpp:189
@ OP_MAP
Definition: calculus.hpp:97
@ OP_NORM2
Definition: calculus.hpp:178
@ OP_LE
Definition: calculus.hpp:70
@ OP_RESHAPE
Definition: calculus.hpp:142
@ OP_DIV
Definition: calculus.hpp:65
@ OP_TRANSPOSE
Definition: calculus.hpp:106
@ OP_SOLVE
Definition: calculus.hpp:103
@ OP_FLOOR
Definition: calculus.hpp:71
@ OP_ASSERTION
Definition: calculus.hpp:172
@ OP_NEG
Definition: calculus.hpp:66
@ OP_RANK1
Definition: calculus.hpp:121
@ OP_CONSTPOW
Definition: calculus.hpp:66
@ OP_NOT
Definition: calculus.hpp:70
@ OP_SUBASSIGN
Definition: calculus.hpp:148
@ OP_MUL
Definition: calculus.hpp:65
@ OP_ASSIGN
Definition: calculus.hpp:62
@ OP_HORZREPMAT
Definition: calculus.hpp:184
@ OP_HORZSPLIT
Definition: calculus.hpp:133
@ OP_GETNONZEROS_PARAM
Definition: calculus.hpp:154
@ OP_SQ
Definition: calculus.hpp:67
@ OP_NORMF
Definition: calculus.hpp:178
@ OP_MONITOR
Definition: calculus.hpp:175
@ OP_GETNONZEROS
Definition: calculus.hpp:151
@ OP_FMOD
Definition: calculus.hpp:71
@ OP_TAN
Definition: calculus.hpp:68
@ OP_NORMINF
Definition: calculus.hpp:178

◆ OutputCategory

◆ OutputType

enum casadi::OutputType
strong
Enumerator
REG 
FWD 
ADJ 
JAC 
JAC_TRANS 
JAC_ADJ_OUT 
JAC_REG_ADJ 
HESS 

Definition at line 108 of file fmu_function.hpp.

◆ Parallelization

Enumerator
SERIAL 
OPENMP 
THREAD 
NUMEL 

Definition at line 87 of file fmu_function.hpp.

◆ StepIn

Enumerator
STEP_T 

Current time.

STEP_H 

Step size.

STEP_X0 

State vector.

STEP_V0 

Dependent variables.

STEP_P 

Parameter.

STEP_U 

Controls.

STEP_NUM_IN 

Number of arguments.

Definition at line 498 of file integrator_impl.hpp.

498  {
500  STEP_T,
502  STEP_H,
504  STEP_X0,
506  STEP_V0,
508  STEP_P,
510  STEP_U,
513 };
@ STEP_H
Step size.
@ STEP_T
Current time.
@ STEP_U
Controls.
@ STEP_X0
State vector.
@ STEP_P
Parameter.
@ STEP_NUM_IN
Number of arguments.
@ STEP_V0
Dependent variables.

◆ StepOut

Enumerator
STEP_XF 

State vector at next time.

STEP_VF 

Dependent variables at next time.

STEP_QF 

Quadrature state contribution.

STEP_NUM_OUT 

Number of arguments.

Definition at line 516 of file integrator_impl.hpp.

516  {
518  STEP_XF,
520  STEP_VF,
522  STEP_QF,
525 };
@ STEP_XF
State vector at next time.
@ STEP_QF
Quadrature state contribution.
@ STEP_VF
Dependent variables at next time.
@ STEP_NUM_OUT
Number of arguments.

◆ Type

enum casadi::Type
strong
Enumerator
FLOAT32 
FLOAT64 
INT8 
UINT8 
INT16 
UINT16 
INT32 
UINT32 
INT64 
UINT64 
BOOLEAN 
STRING 
BINARY 
ENUMERATION 
CLOCK 
NUMEL 

Definition at line 45 of file dae_builder_internal.hpp.

◆ TypeFmi2

enum casadi::TypeFmi2
strong
Enumerator
REAL 
INTEGER 
BOOLEAN 
STRING 
ENUM 
NUMEL 

Definition at line 42 of file dae_builder_internal.hpp.

◆ TypeID

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

Enumerator
OT_NULL 
OT_BOOL 
OT_INT 
OT_DOUBLE 
OT_STRING 
OT_INTVECTOR 
OT_INTVECTORVECTOR 
OT_BOOLVECTOR 
OT_DOUBLEVECTOR 
OT_DOUBLEVECTORVECTOR 
OT_STRINGVECTOR 
OT_DICT 
OT_FUNCTION 
OT_FUNCTIONVECTOR 
OT_VOIDPTR 
OT_UNKNOWN 
OT_STRINGVECTORVECTOR 
OT_DICTVECTOR 
OT_VECTORVECTOR 
OT_VECTOR 

Definition at line 43 of file generic_type.hpp.

43  {
44  OT_NULL,
45  OT_BOOL,
46  OT_INT,
47  OT_DOUBLE,
48  OT_STRING,
55  OT_DICT,
58  OT_VOIDPTR,
59  OT_UNKNOWN,
63  OT_VECTOR};
@ OT_STRINGVECTOR
@ OT_STRINGVECTORVECTOR
@ OT_BOOLVECTOR
@ OT_INTVECTOR
@ OT_FUNCTIONVECTOR
@ OT_DOUBLEVECTORVECTOR
@ OT_DICTVECTOR
@ OT_VECTORVECTOR
@ OT_INTVECTORVECTOR
@ OT_DOUBLEVECTOR

◆ UnifiedReturnStatus

Unified return status for solvers

Enumerator
SOLVER_RET_SUCCESS 
SOLVER_RET_UNKNOWN 
SOLVER_RET_LIMITED 
SOLVER_RET_NAN 
SOLVER_RET_INFEASIBLE 
SOLVER_RET_EXCEPTION 

Definition at line 55 of file casadi_types.hpp.

55  {
58  SOLVER_RET_LIMITED, // Out of time
62  };
@ SOLVER_RET_NAN
@ SOLVER_RET_INFEASIBLE
@ SOLVER_RET_LIMITED
@ SOLVER_RET_SUCCESS
@ SOLVER_RET_UNKNOWN
@ SOLVER_RET_EXCEPTION

◆ Variability

enum casadi::Variability
strong
Enumerator
CONSTANT 
FIXED 
TUNABLE 
DISCRETE 
CONTINUOUS 
NUMEL 

Definition at line 52 of file dae_builder_internal.hpp.

◆ VariableType

Enumerator
OPTI_VAR 
OPTI_PAR 
OPTI_DUAL_G 

Definition at line 495 of file optistack.hpp.

495  {
496  OPTI_VAR, // variable
497  OPTI_PAR, // parameter
498  OPTI_DUAL_G // dual
499  };
@ OPTI_VAR
Definition: optistack.hpp:496
@ OPTI_DUAL_G
Definition: optistack.hpp:498
@ OPTI_PAR
Definition: optistack.hpp:497

Function Documentation

◆ _function_buffer_eval()

void CASADI_EXPORT casadi::_function_buffer_eval ( void *  raw)

Definition at line 2005 of file function.cpp.

2005  {
2006  static_cast<FunctionBuffer*>(raw)->_eval();
2007  }

◆ _jacobian_sparsity()

template<typename MatType >
Sparsity casadi::_jacobian_sparsity ( const MatType &  expr,
const MatType &  var 
)

Definition at line 1239 of file x_function.hpp.

1239  {
1240  Dict opts{{"max_io", 0}, {"allow_free", true}};
1241  Function f = Function("tmp_jacobian_sparsity", {var}, {expr}, opts);
1242  return f.jac_sparsity(0, 0, false);
1243  }
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.

References casadi::Function::jac_sparsity().

Referenced by casadi::MX::jacobian_sparsity(), and casadi::Matrix< double >::which_function().

◆ _which_depends()

template<typename MatType >
std::vector<bool> casadi::_which_depends ( const MatType &  expr,
const MatType &  var,
casadi_int  order,
bool  tr 
)

Definition at line 1246 of file x_function.hpp.

1247  {
1248  // Short-circuit
1249  if (expr.is_empty() || var.is_empty()) {
1250  return std::vector<bool>(tr? expr.numel() : var.numel(), false);
1251  }
1252 
1253  MatType e = expr;
1254 
1255  // Create a function for calculating a forward-mode derivative
1256  casadi_assert(order==1 || order==2,
1257  "which_depends: order argument must be 1 or 2, got " + str(order) + " instead.");
1258 
1259  MatType v = MatType::sym("v", var.sparsity());
1260  for (casadi_int i=1;i<order;++i) {
1261  e = jtimes(e, var, v);
1262  }
1263 
1264  Dict opts{{"max_io", 0}, {"allow_free", true}};
1265  Function f = Function("tmp_which_depends", {var}, {e}, opts);
1266  // Propagate sparsities backwards seeding all outputs
1267  std::vector<bvec_t> seed(tr? f.nnz_in(0) : f.nnz_out(0), 1);
1268  std::vector<bvec_t> sens(tr? f.nnz_out(0) : f.nnz_in(0), 0);
1269 
1270  if (tr)
1271  f({get_ptr(seed)}, {get_ptr(sens)});
1272  else
1273  f.rev({get_ptr(sens)}, {get_ptr(seed)});
1274  // Temporaries for evaluation
1275  std::vector<bool> ret(sens.size());
1276  std::copy(sens.begin(), sens.end(), ret.begin());
1277 
1278  // Project the result back on the original sparsity
1279  if (tr && e.sparsity()!=expr.sparsity()) {
1280  // std::vector<bool> is not accessible as bool*
1281  // bool -> casadi_int
1282  std::vector<casadi_int> source(sens.size());
1283  std::copy(ret.begin(), ret.end(), source.begin());
1284  std::vector<casadi_int> target(expr.nnz());
1285 
1286  // project
1287  std::vector<casadi_int> scratch(expr.size1());
1288  casadi_project(get_ptr(source), e.sparsity(), get_ptr(target), expr.sparsity(),
1289  get_ptr(scratch));
1290 
1291  // casadi_int -> bool
1292  ret.resize(expr.nnz());
1293  std::copy(target.begin(), target.end(), ret.begin());
1294  }
1295 
1296  return ret;
1297  }
std::string str(const T &v)
String representation, any type.
T * get_ptr(std::vector< T > &v)
Get a pointer to the data contained in the vector.

References casadi_project(), get_ptr(), casadi::Function::nnz_in(), casadi::Function::nnz_out(), casadi::Function::rev(), and str().

Referenced by casadi::MX::which_depends(), and casadi::Matrix< double >::which_output().

◆ absolute()

std::string casadi::absolute ( const std::string &  path)

Definition at line 59 of file ghc.cpp.

59  {
60  return ghc::filesystem::absolute(ghc::filesystem::path(path)).string();
61  }

References path().

Referenced by casadi_register_filesystem_ghc().

◆ accepted_iterate()

static SLEQP_RETCODE casadi::accepted_iterate ( SleqpSolver *  solver,
SleqpIterate *  iterate,
void *  data 
)
static

Definition at line 497 of file sleqp_interface.cpp.

498  {
499  SLEQPMemory* m = static_cast<SLEQPMemory*>(data);
500 
501  const SLEQPInterface* interface = m->interface;
502  const Function& fcallback_ = interface->fcallback_;
503 
504  std::fill_n(m->arg, fcallback_.n_in(), nullptr);
505 
506  double ret_double;
507  m->res[0] = &ret_double;
508 
509  casadi_nlpsol_data<double>& d_nlp = m->d_nlp;
510 
511  double obj_val = sleqp_iterate_obj_val(iterate);
512 
513  m->arg[NLPSOL_F] = &obj_val;
514 
515  SleqpVec* primal = sleqp_iterate_primal(iterate);
516  SLEQP_CALL(sleqp_vec_to_raw(primal, m->cb_xk));
517  m->arg[NLPSOL_X] = m->cb_xk;
518 
519  SleqpVec* cons_val = sleqp_iterate_cons_val(iterate);
520  SLEQP_CALL(sleqp_vec_to_raw(cons_val, m->gk));
521  m->arg[NLPSOL_G] = m->gk;
522 
523  SleqpVec* vars_dual = sleqp_iterate_vars_dual(iterate);
524  SLEQP_CALL(sleqp_vec_to_raw(vars_dual, m->cb_lam_xk));
525  m->arg[NLPSOL_LAM_X] = m->cb_lam_xk;
526 
527  SleqpVec* cons_dual = sleqp_iterate_cons_dual(iterate);
528  SLEQP_CALL(sleqp_vec_to_raw(cons_dual, m->cb_lam_gk));
529  m->arg[NLPSOL_LAM_G] = m->cb_lam_gk;
530 
531  try {
532  fcallback_(m->arg, m->res, m->iw, m->w, 0);
533  } catch(KeyboardInterruptException& ex) {
534  sleqp_raise(SLEQP_CALLBACK_ERROR, "Interrupt caught in callback...");
535  } catch(std::exception& ex) {
536  casadi_warning("intermediate_callback: " + std::string(ex.what()));
537  if (m->iteration_callback_ignore_errors) return SLEQP_OKAY;
538  sleqp_raise(SLEQP_CALLBACK_ERROR, "Exception caught in callback...");
539  }
540 
541  casadi_int ret = static_cast<casadi_int>(ret_double);
542 
543  if(ret != 0 && !m->iteration_callback_ignore_errors)
544  {
545  sleqp_raise(SLEQP_CALLBACK_ERROR, "Error in callback...");
546  }
547 
548  return SLEQP_OKAY;
549  }

References casadi::OracleMemory::arg, casadi::SLEQPMemory::cb_lam_gk, casadi::SLEQPMemory::cb_lam_xk, casadi::SLEQPMemory::cb_xk, casadi::NlpsolMemory::d_nlp, casadi::SLEQPMemory::gk, casadi::SLEQPMemory::iteration_callback_ignore_errors, casadi::OracleMemory::iw, NLPSOL_F, NLPSOL_G, NLPSOL_LAM_G, NLPSOL_LAM_X, NLPSOL_X, casadi::OracleMemory::res, casadi::OracleMemory::w, and casadi::CasadiException::what().

Referenced by casadi::SLEQPInterface::solve().

◆ add_defaults()

template<class X >
std::map<std::string, X> casadi::add_defaults ( const std::map< std::string, X > &  in,
const std::vector< std::string > &  keys 
)

Definition at line 762 of file integration_tools.cpp.

763  {
764  std::map<std::string, X> ret;
765  for (const std::string& k : keys) {
766  auto it = in.find(k);
767  if (it==in.end()) {
768  ret[k] = X(0, 1);
769  } else {
770  ret[k] = it->second;
771  }
772  }
773  return ret;
774 }

References X.

◆ add_directory_recursive()

void casadi::add_directory_recursive ( zip_t *  archive,
const std::string &  base_dir,
const std::string &  current_dir,
const std::string &  rel_prefix 
)

Definition at line 168 of file libzip.cpp.

171  {
172  auto filesystem = Filesystem::getPlugin("ghc");
173  std::vector<std::string> entries = filesystem.exposed.iterate_directory_names(current_dir);
174 
175  for (const std::string& full_path : entries) {
176  std::string rel_path = full_path.substr(base_dir.size() + 1);
177 
178  if (filesystem.exposed.is_directory(full_path)) {
179  zip_dir_add(archive, (rel_path + "/").c_str(), ZIP_FL_ENC_UTF_8);
180  add_directory_recursive(archive, base_dir, full_path, rel_path);
181  } else {
182  add_file_to_zip(archive, full_path, rel_path);
183  }
184  }
185  }
bool add_file_to_zip(zip_t *archive, const std::string &file_path, const std::string &archive_name)
Definition: libzip.cpp:125
void add_directory_recursive(zip_t *archive, const std::string &base_dir, const std::string &current_dir, const std::string &rel_prefix)
Definition: libzip.cpp:168

References add_file_to_zip(), and casadi::PluginInterface< Filesystem >::getPlugin().

Referenced by zip_to_path2(), and zip_to_stream().

◆ add_file_to_zip()

bool casadi::add_file_to_zip ( zip_t *  archive,
const std::string &  file_path,
const std::string &  archive_name 
)

Definition at line 125 of file libzip.cpp.

126  {
127  std::ifstream file(file_path, std::ios::binary | std::ios::ate);
128  if (!file) {
129  uerr() << "Error: Cannot open file: " << file_path << std::endl;
130  return false;
131  }
132 
133  std::streamsize size = file.tellg();
134  file.seekg(0, std::ios::beg);
135 
136  char* data = static_cast<char*>(malloc(size)); // ← use malloc
137  if (!data) {
138  uerr() << "Error: Memory allocation failed for file: " << file_path << std::endl;
139  return false;
140  }
141 
142  if (!file.read(data, size)) {
143  uerr() << "Error: Cannot read file: " << file_path << std::endl;
144  free(data);
145  return false;
146  }
147 
148  zip_error_t ziperr;
149  zip_source_t* source = zip_source_buffer_create(data, size, 1, &ziperr); // ← freep = 1
150  if (!source) {
151  uerr() << "Error: Cannot create zip source for file: " << file_path
152  << ": " << zip_error_strerror(&ziperr) << std::endl;
153  free(data); // not strictly needed, but safe
154  zip_error_fini(&ziperr);
155  return false;
156  }
157 
158  zip_int64_t idx = zip_file_add(archive, archive_name.c_str(), source, ZIP_FL_ENC_UTF_8);
159  if (idx < 0) {
160  zip_source_free(source); // Only needed if not added
161  uerr() << "Error: Cannot add file to archive: " << archive_name << std::endl;
162  return false;
163  }
164 
165  return true;
166  }
std::ostream & uerr()

References uerr().

Referenced by add_directory_recursive().

◆ all()

CASADI_EXPORT bool casadi::all ( const std::vector< bool > &  v)

◆ any()

CASADI_EXPORT bool casadi::any ( const std::vector< bool > &  v)
Examples
misc/all.cc.

Definition at line 84 of file casadi_misc.cpp.

84  {
85  for (auto && e : v) {
86  if (e) return true;
87  }
88  return false;
89  }

Referenced by casadi::MX::graph_substitute(), casadi::GenericMatrix< MatType >::is_linear(), casadi::ProxqpInterface::solve(), and casadi::OptiNode::stats().

◆ applymap() [1/2]

template<class T >
std::vector< T > casadi::applymap ( T(*)(const T &)  f,
const std::vector< T > &  comp 
)

Apply a function f to each element in a vector

Definition at line 628 of file casadi_misc.hpp.

628  {
629  std::vector<T> ret(comp.size());
630  std::transform(comp.begin(), comp.end(), ret.begin(), f);
631  return ret;
632  }

◆ applymap() [2/2]

template<class T >
void casadi::applymap ( void(*)(T &)  f,
std::vector< T > &  comp 
)

Apply a function f to each element in a vector

Definition at line 635 of file casadi_misc.hpp.

635  {
636  std::for_each(comp.begin(), comp.end(), f);
637  }

◆ assert_read()

void casadi::assert_read ( std::istream &  stream,
const std::string &  s 
)

Definition at line 2206 of file function_internal.cpp.

2206  {
2207  casadi_int n = s.size();
2208  char c;
2209  std::stringstream ss;
2210  for (casadi_int i=0;i<n;++i) {
2211  stream >> c;
2212  ss << c;
2213  }
2214  casadi_assert_dev(s==ss.str());
2215  }

◆ assign_vector()

template<class S , class D >
void casadi::assign_vector ( const std::vector< S > &  s,
std::vector< D > &  d 
)

Definition at line 646 of file casadi_misc.hpp.

646  {
647  casadi_assert(d.empty(), "Receiving vector must be empty");
648  d.resize(s.size());
649  std::copy(s.begin(), s.end(), d.begin());
650  }

Referenced by casadi::Nlpsol::get_stats(), casadi::Nlpsol::init(), casadi::KnitroInterface::solve(), and casadi::OptiNode::to_function().

◆ blazing_spline()

CASADI_EXPORT Function casadi::blazing_spline ( const std::string &  name,
const std::vector< std::vector< double > > &  knots,
const Dict opts = Dict() 
)

Specialized in these ways:

  • order 3 is assumed
  • up to dimension 3 supported
  • a single scalar output (m=1)

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

Definition at line 38 of file blazing_spline.cpp.

40  {
41  return Function::create(new BlazingSplineFunction(name, knots, 0), opts);
42  }

References casadi::Function::create().

◆ boolvec_and()

CASADI_EXPORT std::vector< bool > casadi::boolvec_and ( const std::vector< bool > &  lhs,
const std::vector< bool > &  rhs 
)

Definition at line 379 of file casadi_misc.cpp.

379  {
380  casadi_assert(lhs.size()==rhs.size(), "Size mismatch.");
381  std::vector<bool> ret(lhs.size());
382  std::transform(lhs.begin(), lhs.end(), rhs.begin(), ret.begin(),
383  [](bool a, bool b) -> bool { return a && b; });
384  return ret;
385  }

◆ boolvec_not()

CASADI_EXPORT std::vector< bool > casadi::boolvec_not ( const std::vector< bool > &  v)

Definition at line 372 of file casadi_misc.cpp.

372  {
373  std::vector<bool> ret(v.size());
374  std::transform(v.begin(), v.end(), ret.begin(),
375  [](bool v) -> bool { return !v; });
376  return ret;
377  }

Referenced by construct_nlpsol(), and detect_simple_bounds_gen().

◆ boolvec_or()

CASADI_EXPORT std::vector< bool > casadi::boolvec_or ( const std::vector< bool > &  lhs,
const std::vector< bool > &  rhs 
)

Definition at line 387 of file casadi_misc.cpp.

387  {
388  casadi_assert(lhs.size()==rhs.size(), "Size mismatch.");
389  std::vector<bool> ret(lhs.size());
390  std::transform(lhs.begin(), lhs.end(), rhs.begin(), ret.begin(),
391  [](bool a, bool b) -> bool { return a || b; });
392  return ret;
393  }

◆ boolvec_to_index()

CASADI_EXPORT std::vector< casadi_int > casadi::boolvec_to_index ( const std::vector< bool > &  v)

Definition at line 396 of file casadi_misc.cpp.

396  {
397  std::vector<casadi_int> ret;
398  for (casadi_int i=0;i<v.size();++i) {
399  if (v[i]) ret.push_back(i);
400  }
401  return ret;
402  }

Referenced by construct_nlpsol(), and detect_simple_bounds_gen().

◆ bvec_clear()

void casadi::bvec_clear ( bvec_t s,
casadi_int  begin,
casadi_int  end 
)

Definition at line 1078 of file function_internal.cpp.

1078  {
1079  for (casadi_int i=begin; i<end; ++i) {
1080  s[i] = 0;
1081  }
1082  }

◆ bvec_or() [1/2]

CASADI_EXPORT bvec_t casadi::bvec_or ( const bvec_t arg,
casadi_int  n 
)

Definition at line 424 of file casadi_misc.cpp.

424  {
425  bvec_t acc = 0;
426  // vacuous truth
427  if (n==0) {
428  return~acc;
429  }
430  for (casadi_int i=0;i<n;++i) {
431  acc |= arg[i];
432  }
433  return acc;
434  }
unsigned long long bvec_t

Referenced by casadi::FunctionInternal::get_jac_sparsity_hierarchical(), casadi::FunctionInternal::get_jac_sparsity_hierarchical_symm(), casadi::GetNonzerosParam::sp_forward(), casadi::SetNonzerosParam< Add >::sp_forward(), casadi::GetNonzerosParam::sp_reverse(), and casadi::SetNonzerosParam< Add >::sp_reverse().

◆ bvec_or() [2/2]

void casadi::bvec_or ( const bvec_t s,
bvec_t r,
casadi_int  begin,
casadi_int  end 
)

Definition at line 1085 of file function_internal.cpp.

1085  {
1086  r = 0;
1087  for (casadi_int i=begin; i<end; ++i) r |= s[i];
1088  }

◆ bvec_toggle()

void casadi::bvec_toggle ( bvec_t s,
casadi_int  begin,
casadi_int  end,
casadi_int  j 
)

Definition at line 1072 of file function_internal.cpp.

1072  {
1073  for (casadi_int i=begin; i<end; ++i) {
1074  s[i] ^= (bvec_t(1) << j);
1075  }
1076  }

Referenced by casadi::FunctionInternal::get_jac_sparsity_hierarchical(), and casadi::FunctionInternal::get_jac_sparsity_hierarchical_symm().

◆ calc_function()

template<typename T1 >
int casadi::calc_function ( const OracleCallback cb,
casadi_oracle_data< T1 > *  d 
)

Definition at line 276 of file oracle_function.hpp.

276  {
277  OracleMemory* m = static_cast<OracleMemory*>(d->m);
278  try {
279  return cb->oracle_->calc_function(m, cb->name);
280  }
281  catch (const std::exception& e) {
282  uerr() << e.what() << std::endl;
283  return 1;
284  }
285  }

References casadi::OracleFunction::calc_function(), casadi_oracle_data< T1 >::m, casadi::OracleCallback::name, casadi::OracleCallback::oracle_, and uerr().

◆ callback_stderr()

void casadi::callback_stderr ( const char *  s)

Definition at line 41 of file tools.cpp.

41  {
42  uerr() << s << std::flush;
43 }

References uerr().

Referenced by external_transform().

◆ callback_stdout()

void casadi::callback_stdout ( const char *  s)

Definition at line 37 of file tools.cpp.

37  {
38  uout() << s << std::flush;
39 }
std::ostream & uout()

References uout().

Referenced by external_transform().

◆ casadi_add() [1/2]

template<>
void casadi::casadi_add ( casadi_int  n,
const bvec_t x,
bvec_t y 
)

Definition at line 141 of file mapsum.cpp.

141  {
142  casadi_int i;
143  if (!x || !y) return;
144  for (i=0; i<n; ++i) *y++ |= *x++;
145  }

◆ casadi_add() [2/2]

template<typename T1 >
void casadi::casadi_add ( casadi_int  n,
const T1 *  x,
T1 *  y 
)

Definition at line 134 of file mapsum.cpp.

134  {
135  casadi_int i;
136  if (!x || !y) return;
137  for (i=0; i<n; ++i) *y++ += *x++;
138  }

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

◆ casadi_axpy()

template<typename T1 >
void casadi::casadi_axpy ( casadi_int  n,
T1  alpha,
const T1 *  x,
T1 *  y 
)

◆ casadi_bilin()

template<typename T1 >
T1 casadi::casadi_bilin ( const T1 *  A,
const casadi_int *  sp_A,
const T1 *  x,
const T1 *  y 
)

◆ casadi_bound_consistency()

template<typename T1 >
void casadi::casadi_bound_consistency ( casadi_int  n,
T1 *  x,
T1 *  lam,
const T1 *  lbx,
const T1 *  ubx 
)

◆ casadi_clear()

template<typename T1 >
void casadi::casadi_clear ( T1 *  x,
casadi_int  n 
)

◆ casadi_clear_casadi_int()

void casadi::casadi_clear_casadi_int ( casadi_int *  x,
casadi_int  n 
)
inline

Definition at line 213 of file casadi_runtime.hpp.

213  {
214  casadi_clear(x, n);
215  }

References casadi_clear().

◆ casadi_copy()

template<typename T1 >
void casadi::casadi_copy ( const T1 *  x,
casadi_int  n,
T1 *  y 
)

Referenced by casadi::FixedStepIntegrator::advance_noevent(), casadi::CvodesInterface::advance_noevent(), casadi::IdasInterface::advance_noevent(), casadi::Feasiblesqpmethod::anderson_acc_init_memory(), casadi::Feasiblesqpmethod::anderson_acc_step_update(), casadi::Feasiblesqpmethod::anderson_acc_update_memory(), casadi::Blocksqp::calcLagrangeGradient(), casadi::FmuFunction::check_hessian(), casadi::Blocksqp::computeNextHessian(), casadi::FunctionInternal::eval(), casadi::Nlpsol::eval(), casadi::FiniteDiff::eval(), casadi::FmuInternal::eval_fd(), casadi::Rank1::eval_gen(), casadi::Scpgen::eval_mat(), casadi::CallSX::eval_sx(), casadi::Feasiblesqpmethod::feasibility_iterations(), casadi::BonminInterface::finalize_solution(), casadi::IpoptInterface::finalize_solution(), casadi::BonminInterface::get_bounds_info(), casadi::IpoptInterface::get_bounds_info(), get_initial_uk(), get_initial_xk(), casadi::Integrator::get_q(), casadi::BonminInterface::get_starting_point(), casadi::IpoptInterface::get_starting_point(), casadi::Integrator::get_x(), casadi::Integrator::get_z(), casadi::BonminInterface::intermediate_callback(), casadi::IpoptInterface::intermediate_callback(), casadi::FmuFunction::make_symmetric(), casadi::LinsolQr::nfact(), casadi::Integrator::predict_events(), casadi::CvodesInterface::psolveB(), casadi::CvodesInterface::psolveF(), casadi::IdasInterface::psolveF(), casadi::FmuFunction::remove_nans(), casadi::FixedStepIntegrator::reset(), casadi::SundialsInterface::reset(), casadi::Collocation::reset(), casadi::FixedStepIntegrator::retreat(), casadi::CvodesInterface::retreat(), casadi::IdasInterface::retreat(), casadi::Integrator::set_p(), casadi::Integrator::set_q(), casadi::Integrator::set_u(), casadi::Integrator::set_x(), casadi::Integrator::set_z(), casadi::CbcInterface::solve(), casadi::ClpInterface::solve(), casadi::CplexInterface::solve(), casadi::GurobiInterface::solve(), casadi::OoqpInterface::solve(), casadi::OsqpInterface::solve(), casadi::ProxqpInterface::solve(), casadi::QpoasesInterface::solve(), casadi::SuperscsInterface::solve(), casadi::Qrqp::solve(), casadi::AlpaqaInterface::solve(), casadi::Blocksqp::solve(), casadi::BonminInterface::solve(), casadi::IpoptInterface::solve(), casadi::KnitroInterface::solve(), casadi::SnoptInterface::solve(), casadi::KinsolInterface::solve(), casadi::WorhpInterface::solve(), casadi::FastNewton::solve(), casadi::Feasiblesqpmethod::solve(), casadi::ImplicitToNlp::solve(), casadi::Newton::solve(), casadi::Qrsqp::solve(), casadi::Scpgen::solve(), casadi::Sqpmethod::solve(), casadi::Sqpmethod::solve_elastic_mode(), casadi::Scpgen::solve_qp(), casadi::IdasInterface::solve_transposed(), casadi::MapSum::sp_reverse(), casadi::Feasiblesqpmethod::step_update(), casadi::Integrator::trigger_event(), and casadi::IdasInterface::z_impulseB().

◆ casadi_copy_block()

template<typename T1 >
void casadi::casadi_copy_block ( const T1 *  x,
const casadi_int *  sp_x,
T1 *  y,
const casadi_int *  sp_y,
casadi_int  r_begin,
casadi_int  c_begin,
T1 *  w 
)

Definition at line 799 of file idas_interface.cpp.

800  {
801  // x and y should be distinct
802  casadi_int nrow_x, ncol_x, ncol_y, i_x, i_y, j, el, r_end;
803  const casadi_int *colind_x, *row_x, *colind_y, *row_y;
804  nrow_x = sp_x[0];
805  ncol_x = sp_x[1];
806  colind_x = sp_x+2; row_x = sp_x + 2 + ncol_x+1;
807  ncol_y = sp_y[1];
808  colind_y = sp_y+2; row_y = sp_y + 2 + ncol_y+1;
809  // End of the rows to be copied
810  r_end = r_begin + nrow_x;
811  // w will correspond to a column of x, initialize to zero
812  casadi_clear(w, nrow_x);
813  // Loop over columns in x
814  for (i_x = 0; i_x < ncol_x; ++i_x) {
815  // Corresponding row in y
816  i_y = i_x + c_begin;
817  // Copy x entries to w
818  for (el=colind_x[i_x]; el<colind_x[i_x + 1]; ++el) w[row_x[el]] = x[el];
819  // Copy entries to y, if in interval
820  for (el=colind_y[i_y]; el<colind_y[i_y + 1]; ++el) {
821  j = row_y[el];
822  if (j >= r_begin && j < r_end) y[el] = w[j - r_begin];
823  }
824  // Restore w
825  for (el=colind_x[i_x]; el<colind_x[i_x + 1]; ++el) w[row_x[el]] = 0;
826  }
827 }

References casadi_clear().

Referenced by casadi::IdasInterface::psetupF().

◆ casadi_de_boor()

template<typename T1 >
void casadi::casadi_de_boor ( T1  x,
const T1 *  knots,
casadi_int  n_knots,
casadi_int  degree,
T1 *  boor 
)

◆ casadi_densify()

template<typename T1 , typename T2 >
void casadi::casadi_densify ( const T1 *  x,
const casadi_int *  sp_x,
T2 *  y,
casadi_int  tr 
)

◆ casadi_dot()

template<typename T1 >
T1 casadi::casadi_dot ( casadi_int  n,
const T1 *  x,
const T1 *  y 
)

◆ casadi_fill()

template<typename T1 >
void casadi::casadi_fill ( T1 *  x,
casadi_int  n,
T1  alpha 
)

◆ casadi_fill_casadi_int()

void casadi::casadi_fill_casadi_int ( casadi_int *  x,
casadi_int  n,
casadi_int  alpha 
)
inline

Definition at line 208 of file casadi_runtime.hpp.

208  {
209  casadi_fill(x, n, alpha);
210  }

References casadi_fill().

◆ casadi_flip()

casadi_int casadi::casadi_flip ( casadi_int *  corner,
casadi_int  ndim 
)

◆ casadi_func_cons_jac()

static SLEQP_RETCODE casadi::casadi_func_cons_jac ( SleqpFunc *  func,
SleqpMat *  cons_jac,
void *  func_data 
)
static

Definition at line 132 of file sleqp_func.cpp.

135  {
136  SLEQPMemory* m = static_cast<SLEQPMemory*>(func_data);
137 
138  m->arg[0] = m->xk;
139  m->arg[1] = m->d_nlp.p;
140  m->res[0] = nullptr;
141  m->res[1] = m->jac_gk;
142 
143  try {
144 
145  if(m->interface->calc_function(m, "nlp_jac_g") != 0) {
146  return SLEQP_ERROR;
147  }
148 
149  } catch (std::exception& ex) {
150  uerr() << "Error \""
151  << ex.what()
152  << "\" evaluating constraint Jacobian"
153  << std::endl;
154 
155  sleqp_raise(SLEQP_FUNC_EVAL_ERROR, "%s", ex.what());
156  }
157 
158  casadi_int ncol = m->interface->jac_sparsity().size2();
159  const casadi_int* colind = m->interface->jac_sparsity().colind();
160  const casadi_int* row = m->interface->jac_sparsity().row();
161 
162  const casadi_int nnz = colind[ncol];
163 
164  SLEQP_CALL(sleqp_mat_reserve(cons_jac, nnz));
165 
166  double* cons_jac_data = sleqp_mat_data(cons_jac);
167  int* cons_jac_rows = sleqp_mat_rows(cons_jac);
168  int* cons_jac_cols = sleqp_mat_cols(cons_jac);
169 
170  for(int k = 0; k < nnz; ++k) {
171  cons_jac_data[k] = m->jac_gk[k];
172  cons_jac_rows[k] = row[k];
173  }
174 
175  for(int k = 0; k <= ncol; ++k) {
176  cons_jac_cols[k] = colind[k];
177  }
178 
179  SLEQP_CALL(sleqp_mat_set_nnz(cons_jac, nnz));
180 
181  return SLEQP_OKAY;
182  }

References casadi::OracleMemory::arg, casadi::OracleFunction::calc_function(), casadi::Sparsity::colind(), casadi::NlpsolMemory::d_nlp, casadi::SLEQPMemory::interface, casadi::SLEQPMemory::jac_gk, casadi::SLEQPInterface::jac_sparsity(), casadi_nlpsol_data< T1 >::p, casadi::OracleMemory::res, casadi::Sparsity::row(), casadi::Sparsity::size2(), uerr(), and casadi::SLEQPMemory::xk.

Referenced by casadi_sleqp_func_create().

◆ casadi_func_cons_val()

static SLEQP_RETCODE casadi::casadi_func_cons_val ( SleqpFunc *  func,
SleqpVec *  cons_val,
void *  func_data 
)
static

Definition at line 97 of file sleqp_func.cpp.

100  {
101  SLEQPMemory* m = static_cast<SLEQPMemory*>(func_data);
102 
103  m->arg[0] = m->xk;
104  m->arg[1] = m->d_nlp.p;
105  m->res[0] = m->gk;
106 
107  try {
108 
109  if(m->interface->calc_function(m, "nlp_g") != 0) {
110  return SLEQP_ERROR;
111  }
112 
113  const int num_cons = sleqp_func_num_cons(func);
114 
115  SLEQP_CALL(sleqp_vec_set_from_raw(cons_val,
116  m->gk,
117  num_cons,
118  0.));
119 
120  } catch (std::exception& ex) {
121  uerr() << "Error \""
122  << ex.what()
123  << "\" evaluating constraint value"
124  << std::endl;
125 
126  sleqp_raise(SLEQP_FUNC_EVAL_ERROR, "%s", ex.what());
127  }
128 
129  return SLEQP_OKAY;
130  }

References casadi::OracleMemory::arg, casadi::OracleFunction::calc_function(), casadi::NlpsolMemory::d_nlp, casadi::SLEQPMemory::gk, casadi::SLEQPMemory::interface, casadi_nlpsol_data< T1 >::p, casadi::OracleMemory::res, uerr(), and casadi::SLEQPMemory::xk.

Referenced by casadi_sleqp_func_create().

◆ casadi_func_free()

static SLEQP_RETCODE casadi::casadi_func_free ( void *  func_data)
static

Definition at line 231 of file sleqp_func.cpp.

232  {
233  SLEQPMemory* m = static_cast<SLEQPMemory*>(func_data);
234  return SLEQP_OKAY;
235  }

Referenced by casadi_sleqp_func_create().

◆ casadi_func_hess_prod()

static SLEQP_RETCODE casadi::casadi_func_hess_prod ( SleqpFunc *  func,
const SleqpVec *  direction,
const SleqpVec *  cons_duals,
SleqpVec *  product,
void *  func_data 
)
static

Definition at line 184 of file sleqp_func.cpp.

189  {
190  SLEQPMemory* m = static_cast<SLEQPMemory*>(func_data);
191 
192  SLEQP_CALL(sleqp_vec_to_raw(direction, m->h_dk));
193  SLEQP_CALL(sleqp_vec_to_raw(cons_duals, m->h_mk));
194 
195  double one = 1.;
196 
197  m->arg[0] = m->xk; // x
198  m->arg[1] = m->d_nlp.p; // p
199  m->arg[2] = &one; // lam:f
200  m->arg[3] = m->h_mk; // lam:g
201  m->arg[4] = nullptr; // out:grad:gamma:x
202  m->arg[5] = m->h_dk; // fwd:x
203  m->arg[6] = nullptr; // fwd:p
204  m->arg[7] = nullptr; // fwd:lam:x
205  m->arg[8] = nullptr; // fwd:lam:g
206 
207  m->res[0] = m->h_pk; // fwd:grad:gamma:x
208 
209  try {
210 
211  if(m->interface->calc_function(m, "fwd1_nlp_grad_l") != 0) {
212  return SLEQP_ERROR;
213  }
214 
215  } catch (std::exception& ex) {
216  uerr() << "Error \""
217  << ex.what()
218  << "\" evaluating constraint Hessian product"
219  << std::endl;
220 
221  sleqp_raise(SLEQP_FUNC_EVAL_ERROR, "%s", ex.what());
222  }
223 
224  const int num_vars = sleqp_func_num_vars(func);
225 
226  SLEQP_CALL(sleqp_vec_set_from_raw(product, m->h_pk, num_vars, 0.));
227 
228  return SLEQP_OKAY;
229  }

References casadi::OracleMemory::arg, casadi::OracleFunction::calc_function(), casadi::NlpsolMemory::d_nlp, casadi::SLEQPMemory::h_dk, casadi::SLEQPMemory::h_mk, casadi::SLEQPMemory::h_pk, casadi::SLEQPMemory::interface, casadi_nlpsol_data< T1 >::p, product(), casadi::OracleMemory::res, uerr(), and casadi::SLEQPMemory::xk.

Referenced by casadi_sleqp_func_create().

◆ casadi_func_nonzeros()

static SLEQP_RETCODE casadi::casadi_func_nonzeros ( SleqpFunc *  func,
int *  obj_grad_nnz,
int *  cons_val_nnz,
int *  cons_jac_nnz,
int *  hess_prod_nnz,
void *  func_data 
)
static

Definition at line 22 of file sleqp_func.cpp.

28  {
29  SLEQPMemory* m = static_cast<SLEQPMemory*>(func_data);
30  return SLEQP_OKAY;
31  }

Referenced by casadi_sleqp_func_create().

◆ casadi_func_obj_grad()

static SLEQP_RETCODE casadi::casadi_func_obj_grad ( SleqpFunc *  func,
SleqpVec *  obj_grad,
void *  func_data 
)
static

Definition at line 61 of file sleqp_func.cpp.

64  {
65  SLEQPMemory* m = static_cast<SLEQPMemory*>(func_data);
66 
67  m->arg[0] = m->xk;
68  m->arg[1] = m->d_nlp.p;
69  m->res[0] = nullptr;
70  m->res[1] = m->grad_fk;
71 
72  try {
73 
74  if(m->interface->calc_function(m, "nlp_grad_f") != 0) {
75  return SLEQP_ERROR;
76  }
77 
78  const int num_vars = sleqp_func_num_vars(func);
79 
80  SLEQP_CALL(sleqp_vec_set_from_raw(obj_grad,
81  m->grad_fk,
82  num_vars,
83  0.));
84 
85  } catch (std::exception& ex) {
86  uerr() << "Error \""
87  << ex.what()
88  << "\" evaluating objective gradient"
89  << std::endl;
90 
91  sleqp_raise(SLEQP_FUNC_EVAL_ERROR, "%s", ex.what());
92  }
93 
94  return SLEQP_OKAY;
95  }

References casadi::OracleMemory::arg, casadi::OracleFunction::calc_function(), casadi::NlpsolMemory::d_nlp, casadi::SLEQPMemory::grad_fk, casadi::SLEQPMemory::interface, casadi_nlpsol_data< T1 >::p, casadi::OracleMemory::res, uerr(), and casadi::SLEQPMemory::xk.

Referenced by casadi_sleqp_func_create().

◆ casadi_func_obj_val()

static SLEQP_RETCODE casadi::casadi_func_obj_val ( SleqpFunc *  func,
double *  obj_val,
void *  func_data 
)
static

Definition at line 33 of file sleqp_func.cpp.

36  {
37  SLEQPMemory* m = static_cast<SLEQPMemory*>(func_data);
38 
39  m->arg[0] = m->xk;
40  m->arg[1] = m->d_nlp.p;
41  m->res[0] = obj_val;
42 
43  try {
44 
45  if(m->interface->calc_function(m, "nlp_f") == 0) {
46  return SLEQP_OKAY;
47  }
48 
49  } catch (std::exception& ex) {
50  uerr() << "Error \""
51  << ex.what()
52  << "\" evaluating objective value"
53  << std::endl;
54 
55  sleqp_raise(SLEQP_FUNC_EVAL_ERROR, "%s", ex.what());
56  }
57 
58  return SLEQP_ERROR;
59  }

References casadi::OracleMemory::arg, casadi::OracleFunction::calc_function(), casadi::NlpsolMemory::d_nlp, casadi::SLEQPMemory::interface, casadi_nlpsol_data< T1 >::p, casadi::OracleMemory::res, uerr(), and casadi::SLEQPMemory::xk.

Referenced by casadi_sleqp_func_create().

◆ casadi_func_set()

static SLEQP_RETCODE casadi::casadi_func_set ( SleqpFunc *  func,
SleqpVec *  value,
SLEQP_VALUE_REASON  reason,
bool *  reject,
void *  func_data 
)
static

Definition at line 9 of file sleqp_func.cpp.

14  {
15  SLEQPMemory* m = static_cast<SLEQPMemory*>(func_data);
16 
17  SLEQP_CALL(sleqp_vec_to_raw(value, m->xk));
18 
19  return SLEQP_OKAY;
20  }

References casadi::SLEQPMemory::xk.

Referenced by casadi_sleqp_func_create().

◆ casadi_getu()

template<typename T1 >
void casadi::casadi_getu ( const T1 *  x,
const casadi_int *  sp_x,
T1 *  v 
)

◆ casadi_iamax()

template<typename T1 >
casadi_int casadi::casadi_iamax ( casadi_int  n,
const T1 *  x,
casadi_int  inc_x 
)

◆ casadi_interpn()

template<typename T1 >
T1 casadi::casadi_interpn ( casadi_int  ndim,
const T1 *  grid,
const casadi_int *  offset,
const T1 *  values,
const T1 *  x,
casadi_int *  iw,
T1 *  w 
)

◆ casadi_interpn_grad()

template<typename T1 >
void casadi::casadi_interpn_grad ( T1 *  grad,
casadi_int  ndim,
const T1 *  grid,
const casadi_int *  offset,
const T1 *  values,
const T1 *  x,
casadi_int *  iw,
T1 *  w 
)

◆ casadi_interpn_interpolate()

template<typename T1 >
T1 casadi::casadi_interpn_interpolate ( casadi_int  ndim,
const casadi_int *  offset,
const T1 *  values,
const T1 *  alpha,
const casadi_int *  index,
const casadi_int *  corner,
T1 *  coeff 
)

◆ casadi_interpn_weights()

template<typename T1 >
void casadi::casadi_interpn_weights ( casadi_int  ndim,
const T1 *  grid,
const casadi_int *  offset,
const T1 *  x,
T1 *  alpha,
casadi_int *  index 
)

◆ casadi_KN_puts()

int casadi::casadi_KN_puts ( const char *const  str,
void *const  userParams 
)

Definition at line 204 of file knitro_interface.cpp.

204  {
205  std::string s(str);
206  uout() << s << std::flush;
207  return s.size();
208  }

References str(), and uout().

Referenced by casadi::KnitroInterface::solve().

◆ casadi_kron()

template<typename T1 >
void casadi::casadi_kron ( const T1 *  a,
const casadi_int *  sp_a,
const T1 *  b,
const casadi_int *  sp_b,
T1 *  r 
)

Calculates Calculates nonzeros of kronecker product

◆ casadi_load_archiver_libzip()

void CASADI_ARCHIVER_LIBZIP_EXPORT casadi::casadi_load_archiver_libzip ( )

Definition at line 350 of file libzip.cpp.

350  {
351  Archiver::registerPlugin(casadi_register_archiver_libzip);
352  }

References casadi_register_archiver_libzip(), and casadi::PluginInterface< Archiver >::registerPlugin().

◆ casadi_load_conic_cbc()

void CASADI_CONIC_CBC_EXPORT casadi::casadi_load_conic_cbc ( )

Definition at line 45 of file cbc_interface.cpp.

45  {
46  Conic::registerPlugin(casadi_register_conic_cbc);
47  }

References casadi_register_conic_cbc(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_clarabel()

void CASADI_CONIC_CLARABEL_EXPORT casadi::casadi_load_conic_clarabel ( )

Definition at line 45 of file clarabel_interface.cpp.

45  {
46  Conic::registerPlugin(casadi_register_conic_clarabel);
47 }

References casadi_register_conic_clarabel(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_clp()

void CASADI_CONIC_CLP_EXPORT casadi::casadi_load_conic_clp ( )

Definition at line 42 of file clp_interface.cpp.

42  {
43  Conic::registerPlugin(casadi_register_conic_clp);
44  }

References casadi_register_conic_clp(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_cplex()

void CASADI_CONIC_CPLEX_EXPORT casadi::casadi_load_conic_cplex ( )

Definition at line 56 of file cplex_interface.cpp.

56  {
57  Conic::registerPlugin(casadi_register_conic_cplex);
58  }

References casadi_register_conic_cplex(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_daqp()

void CASADI_CONIC_DAQP_EXPORT casadi::casadi_load_conic_daqp ( )

Definition at line 44 of file daqp_interface.cpp.

44  {
45  Conic::registerPlugin(casadi_register_conic_daqp);
46  }

References casadi_register_conic_daqp(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_fatrop()

void CASADI_CONIC_FATROP_EXPORT casadi::casadi_load_conic_fatrop ( )

Definition at line 46 of file fatrop_conic_interface.cpp.

46  {
47  Conic::registerPlugin(casadi_register_conic_fatrop);
48  }

References casadi_register_conic_fatrop(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_gurobi()

void CASADI_CONIC_GUROBI_EXPORT casadi::casadi_load_conic_gurobi ( )

Definition at line 53 of file gurobi_interface.cpp.

53  {
54  Conic::registerPlugin(casadi_register_conic_gurobi);
55  }

References casadi_register_conic_gurobi(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_highs()

void CASADI_CONIC_HIGHS_EXPORT casadi::casadi_load_conic_highs ( )

Definition at line 44 of file highs_interface.cpp.

44  {
45  Conic::registerPlugin(casadi_register_conic_highs);
46  }

References casadi_register_conic_highs(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_hpipm()

void CASADI_CONIC_HPIPM_EXPORT casadi::casadi_load_conic_hpipm ( )

Definition at line 45 of file hpipm_interface.cpp.

45  {
46  Conic::registerPlugin(casadi_register_conic_hpipm);
47  }

References casadi_register_conic_hpipm(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_hpmpc()

void CASADI_CONIC_HPMPC_EXPORT casadi::casadi_load_conic_hpmpc ( )

Definition at line 42 of file hpmpc_interface.cpp.

42  {
43  Conic::registerPlugin(casadi_register_conic_hpmpc);
44  }

References casadi_register_conic_hpmpc(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_ipqp()

void CASADI_CONIC_IPQP_EXPORT casadi::casadi_load_conic_ipqp ( )

Definition at line 44 of file ipqp.cpp.

44  {
45  Conic::registerPlugin(casadi_register_conic_ipqp);
46  }

References casadi_register_conic_ipqp(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_nlpsol()

void CASADI_CONIC_NLPSOL_EXPORT casadi::casadi_load_conic_nlpsol ( )

Definition at line 45 of file qp_to_nlp.cpp.

45  {
46  Conic::registerPlugin(casadi_register_conic_nlpsol);
47  }

References casadi_register_conic_nlpsol(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_ooqp()

void CASADI_CONIC_OOQP_EXPORT casadi::casadi_load_conic_ooqp ( )

Definition at line 53 of file ooqp_interface.cpp.

53  {
54  Conic::registerPlugin(casadi_register_conic_ooqp);
55  }

References casadi_register_conic_ooqp(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_osqp()

void CASADI_CONIC_OSQP_EXPORT casadi::casadi_load_conic_osqp ( )

Definition at line 44 of file osqp_interface.cpp.

44  {
45  Conic::registerPlugin(casadi_register_conic_osqp);
46  }

References casadi_register_conic_osqp(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_proxqp()

void CASADI_CONIC_PROXQP_EXPORT casadi::casadi_load_conic_proxqp ( )

Definition at line 47 of file proxqp_interface.cpp.

47  {
48  Conic::registerPlugin(casadi_register_conic_proxqp);
49  }

References casadi_load_conic_proxqp(), and casadi_register_conic_proxqp().

Referenced by casadi_load_conic_proxqp().

◆ casadi_load_conic_qpoases()

void CASADI_CONIC_QPOASES_EXPORT casadi::casadi_load_conic_qpoases ( )

Definition at line 47 of file qpoases_interface.cpp.

47  {
48  Conic::registerPlugin(casadi_register_conic_qpoases);
49  }

References casadi_register_conic_qpoases(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_qrqp()

void CASADI_CONIC_QRQP_EXPORT casadi::casadi_load_conic_qrqp ( )

Definition at line 44 of file qrqp.cpp.

44  {
45  Conic::registerPlugin(casadi_register_conic_qrqp);
46  }

References casadi_register_conic_qrqp(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_sqic()

void CASADI_CONIC_SQIC_EXPORT casadi::casadi_load_conic_sqic ( )

Definition at line 48 of file sqic_interface.cpp.

48  {
49  Conic::registerPlugin(casadi_register_conic_sqic);
50  }

References casadi_register_conic_sqic(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_conic_superscs()

void CASADI_CONIC_SUPERSCS_EXPORT casadi::casadi_load_conic_superscs ( )

Definition at line 48 of file superscs_interface.cpp.

48  {
49  Conic::registerPlugin(casadi_register_conic_superscs);
50  }

References casadi_register_conic_superscs(), and casadi::PluginInterface< Conic >::registerPlugin().

◆ casadi_load_dple_slicot()

void CASADI_DPLE_SLICOT_EXPORT casadi::casadi_load_dple_slicot ( )

Definition at line 52 of file slicot_dple.cpp.

52  {
53  Dple::registerPlugin(casadi_register_dple_slicot);
54  }

References casadi_register_dple_slicot(), and casadi::PluginInterface< Dple >::registerPlugin().

◆ casadi_load_expm_slicot()

void CASADI_EXPM_SLICOT_EXPORT casadi::casadi_load_expm_slicot ( )

Definition at line 52 of file slicot_expm.cpp.

52  {
53  Expm::registerPlugin(casadi_register_expm_slicot);
54  }

References casadi_register_expm_slicot(), and casadi::PluginInterface< Expm >::registerPlugin().

◆ casadi_load_filesystem_ghc()

void CASADI_FILESYSTEM_GHC_EXPORT casadi::casadi_load_filesystem_ghc ( )

Definition at line 90 of file ghc.cpp.

90  {
91  Filesystem::registerPlugin(casadi_register_filesystem_ghc);
92  }

References casadi_register_filesystem_ghc(), and casadi::PluginInterface< Filesystem >::registerPlugin().

◆ casadi_load_importer_clang()

void CASADI_IMPORTER_CLANG_EXPORT casadi::casadi_load_importer_clang ( )

Definition at line 55 of file clang_compiler.cpp.

55  {
56  ImporterInternal::registerPlugin(casadi_register_importer_clang);
57  }

References casadi_register_importer_clang(), and casadi::PluginInterface< ImporterInternal >::registerPlugin().

◆ casadi_load_importer_shell()

void CASADI_IMPORTER_SHELL_EXPORT casadi::casadi_load_importer_shell ( )

Definition at line 53 of file shell_compiler.cpp.

53  {
54  ImporterInternal::registerPlugin(casadi_register_importer_shell);
55  }

References casadi_register_importer_shell(), and casadi::PluginInterface< ImporterInternal >::registerPlugin().

◆ casadi_load_integrator_collocation()

void CASADI_INTEGRATOR_COLLOCATION_EXPORT casadi::casadi_load_integrator_collocation ( )

Definition at line 45 of file collocation.cpp.

45  {
46  Integrator::registerPlugin(casadi_register_integrator_collocation);
47  }

References casadi_register_integrator_collocation(), and casadi::PluginInterface< Integrator >::registerPlugin().

◆ casadi_load_integrator_cvodes()

void CASADI_INTEGRATOR_CVODES_EXPORT casadi::casadi_load_integrator_cvodes ( )

Definition at line 47 of file cvodes_interface.cpp.

47  {
48  Integrator::registerPlugin(casadi_register_integrator_cvodes);
49 }

References casadi_register_integrator_cvodes(), and casadi::PluginInterface< Integrator >::registerPlugin().

◆ casadi_load_integrator_idas()

void CASADI_INTEGRATOR_IDAS_EXPORT casadi::casadi_load_integrator_idas ( )

Definition at line 48 of file idas_interface.cpp.

48  {
49  Integrator::registerPlugin(casadi_register_integrator_idas);
50 }

References casadi_register_integrator_idas(), and casadi::PluginInterface< Integrator >::registerPlugin().

◆ casadi_load_integrator_rk()

void CASADI_INTEGRATOR_RK_EXPORT casadi::casadi_load_integrator_rk ( )

Definition at line 43 of file runge_kutta.cpp.

43  {
44  Integrator::registerPlugin(casadi_register_integrator_rk);
45  }

References casadi_register_integrator_rk(), and casadi::PluginInterface< Integrator >::registerPlugin().

◆ casadi_load_interpolant_bspline()

void CASADI_INTERPOLANT_BSPLINE_EXPORT casadi::casadi_load_interpolant_bspline ( )

Definition at line 45 of file bspline_interpolant.cpp.

45  {
46  Interpolant::registerPlugin(casadi_register_interpolant_bspline);
47  }

References casadi_register_interpolant_bspline(), and casadi::PluginInterface< Interpolant >::registerPlugin().

◆ casadi_load_interpolant_linear()

void CASADI_INTERPOLANT_LINEAR_EXPORT casadi::casadi_load_interpolant_linear ( )

Definition at line 44 of file linear_interpolant.cpp.

44  {
45  Interpolant::registerPlugin(casadi_register_interpolant_linear);
46  }

References casadi_register_interpolant_linear(), and casadi::PluginInterface< Interpolant >::registerPlugin().

◆ casadi_load_linsol_csparse()

void CASADI_LINSOL_CSPARSE_EXPORT casadi::casadi_load_linsol_csparse ( )

Definition at line 44 of file csparse_interface.cpp.

44  {
45  LinsolInternal::registerPlugin(casadi_register_linsol_csparse);
46  }

References casadi_register_linsol_csparse(), and casadi::PluginInterface< LinsolInternal >::registerPlugin().

◆ casadi_load_linsol_lapacklu()

void CASADI_LINSOL_LAPACKLU_EXPORT casadi::casadi_load_linsol_lapacklu ( )

Definition at line 44 of file lapack_lu.cpp.

44  {
45  LinsolInternal::registerPlugin(casadi_register_linsol_lapacklu);
46  }

References casadi_register_linsol_lapacklu(), and casadi::PluginInterface< LinsolInternal >::registerPlugin().

◆ casadi_load_linsol_lapackqr()

void CASADI_LINSOL_LAPACKQR_EXPORT casadi::casadi_load_linsol_lapackqr ( )

Definition at line 44 of file lapack_qr.cpp.

44  {
45  LinsolInternal::registerPlugin(casadi_register_linsol_lapackqr);
46  }

References casadi_register_linsol_lapackqr(), and casadi::PluginInterface< LinsolInternal >::registerPlugin().

◆ casadi_load_linsol_ldl()

void CASADI_LINSOL_LDL_EXPORT casadi::casadi_load_linsol_ldl ( )

Definition at line 44 of file linsol_ldl.cpp.

44  {
45  LinsolInternal::registerPlugin(casadi_register_linsol_ldl);
46  }

References casadi_register_linsol_ldl(), and casadi::PluginInterface< LinsolInternal >::registerPlugin().

◆ casadi_load_linsol_lsqr()

void CASADI_LINSOL_LSQR_EXPORT casadi::casadi_load_linsol_lsqr ( )

Definition at line 47 of file lsqr.cpp.

47  {
48  LinsolInternal::registerPlugin(casadi_register_linsol_lsqr);
49  }

References casadi_register_linsol_lsqr(), and casadi::PluginInterface< LinsolInternal >::registerPlugin().

◆ casadi_load_linsol_ma27()

void CASADI_LINSOL_MA27_EXPORT casadi::casadi_load_linsol_ma27 ( )

Definition at line 45 of file ma27_interface.cpp.

45  {
46  LinsolInternal::registerPlugin(casadi_register_linsol_ma27);
47  }

References casadi_register_linsol_ma27(), and casadi::PluginInterface< LinsolInternal >::registerPlugin().

◆ casadi_load_linsol_mumps()

void CASADI_LINSOL_MUMPS_EXPORT casadi::casadi_load_linsol_mumps ( )

Definition at line 45 of file mumps_interface.cpp.

45  {
46  LinsolInternal::registerPlugin(casadi_register_linsol_mumps);
47  }

References casadi_register_linsol_mumps(), and casadi::PluginInterface< LinsolInternal >::registerPlugin().

◆ casadi_load_linsol_qr()

void CASADI_LINSOL_QR_EXPORT casadi::casadi_load_linsol_qr ( )

Definition at line 44 of file linsol_qr.cpp.

44  {
45  LinsolInternal::registerPlugin(casadi_register_linsol_qr);
46  }

References casadi_register_linsol_qr(), and casadi::PluginInterface< LinsolInternal >::registerPlugin().

◆ casadi_load_linsol_symbolicqr()

void CASADI_LINSOL_SYMBOLICQR_EXPORT casadi::casadi_load_linsol_symbolicqr ( )

Definition at line 47 of file symbolic_qr.cpp.

47  {
48  LinsolInternal::registerPlugin(casadi_register_linsol_symbolicqr);
49  }

References casadi_register_linsol_symbolicqr(), and casadi::PluginInterface< LinsolInternal >::registerPlugin().

◆ casadi_load_linsol_tridiag()

void CASADI_LINSOL_TRIDIAG_EXPORT casadi::casadi_load_linsol_tridiag ( )

Definition at line 44 of file linsol_tridiag.cpp.

44  {
45  LinsolInternal::registerPlugin(casadi_register_linsol_tridiag);
46  }

References casadi_register_linsol_tridiag(), and casadi::PluginInterface< LinsolInternal >::registerPlugin().

◆ casadi_load_nlpsol_alpaqa()

void CASADI_NLPSOL_ALPAQA_EXPORT casadi::casadi_load_nlpsol_alpaqa ( )

Definition at line 45 of file alpaqa_interface.cpp.

45  {
46  Nlpsol::registerPlugin(casadi_register_nlpsol_alpaqa);
47  }

References casadi_register_nlpsol_alpaqa(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_ampl()

void CASADI_NLPSOL_AMPL_EXPORT casadi::casadi_load_nlpsol_ampl ( )

Definition at line 45 of file ampl_interface.cpp.

45  {
46  Nlpsol::registerPlugin(casadi_register_nlpsol_ampl);
47  }

References casadi_register_nlpsol_ampl(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_blocksqp()

void CASADI_NLPSOL_BLOCKSQP_EXPORT casadi::casadi_load_nlpsol_blocksqp ( )

Definition at line 45 of file blocksqp.cpp.

45  {
46  Nlpsol::registerPlugin(casadi_register_nlpsol_blocksqp);
47  }

References casadi_register_nlpsol_blocksqp(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_bonmin()

void CASADI_NLPSOL_BONMIN_EXPORT casadi::casadi_load_nlpsol_bonmin ( )

Definition at line 53 of file bonmin_interface.cpp.

53  {
54  Nlpsol::registerPlugin(casadi_register_nlpsol_bonmin);
55  }

References casadi_register_nlpsol_bonmin(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_fatrop()

void CASADI_NLPSOL_FATROP_EXPORT casadi::casadi_load_nlpsol_fatrop ( )

Definition at line 56 of file fatrop_interface.cpp.

56  {
57  Nlpsol::registerPlugin(casadi_register_nlpsol_fatrop);
58  }

References casadi_register_nlpsol_fatrop(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_feasiblesqpmethod()

void CASADI_NLPSOL_FEASIBLESQPMETHOD_EXPORT casadi::casadi_load_nlpsol_feasiblesqpmethod ( )

Definition at line 57 of file feasiblesqpmethod.cpp.

57  {
58  Nlpsol::registerPlugin(casadi_register_nlpsol_feasiblesqpmethod);
59  }

References casadi_register_nlpsol_feasiblesqpmethod(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_ipopt()

void CASADI_NLPSOL_IPOPT_EXPORT casadi::casadi_load_nlpsol_ipopt ( )

Definition at line 58 of file ipopt_interface.cpp.

58  {
59  Nlpsol::registerPlugin(casadi_register_nlpsol_ipopt);
60  }

References casadi_register_nlpsol_ipopt(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_knitro()

void CASADI_NLPSOL_KNITRO_EXPORT casadi::casadi_load_nlpsol_knitro ( )

Definition at line 55 of file knitro_interface.cpp.

55  {
56  Nlpsol::registerPlugin(casadi_register_nlpsol_knitro);
57  }

References casadi_register_nlpsol_knitro(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_madnlp()

void CASADI_NLPSOL_MADNLP_EXPORT casadi::casadi_load_nlpsol_madnlp ( )

Definition at line 58 of file madnlp_interface.cpp.

58  {
59  Nlpsol::registerPlugin(casadi_register_nlpsol_madnlp);
60 }

References casadi_register_nlpsol_madnlp(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_qrsqp()

void CASADI_NLPSOL_QRSQP_EXPORT casadi::casadi_load_nlpsol_qrsqp ( )

Definition at line 52 of file qrsqp.cpp.

52  {
53  Nlpsol::registerPlugin(casadi_register_nlpsol_qrsqp);
54  }

References casadi_register_nlpsol_qrsqp(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_scpgen()

void CASADI_NLPSOL_SCPGEN_EXPORT casadi::casadi_load_nlpsol_scpgen ( )

Definition at line 49 of file scpgen.cpp.

49  {
50  Nlpsol::registerPlugin(casadi_register_nlpsol_scpgen);
51  }

References casadi_register_nlpsol_scpgen(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_sleqp()

void CASADI_NLPSOL_SLEQP_EXPORT casadi::casadi_load_nlpsol_sleqp ( )

Definition at line 84 of file sleqp_interface.cpp.

84  {
85  Nlpsol::registerPlugin(casadi_register_nlpsol_sleqp);
86  }

References casadi_register_nlpsol_sleqp(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_snopt()

void CASADI_NLPSOL_SNOPT_EXPORT casadi::casadi_load_nlpsol_snopt ( )

Definition at line 51 of file snopt_interface.cpp.

51  {
52  Nlpsol::registerPlugin(casadi_register_nlpsol_snopt);
53  }

References casadi_register_nlpsol_snopt(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_sqpmethod()

void CASADI_NLPSOL_SQPMETHOD_EXPORT casadi::casadi_load_nlpsol_sqpmethod ( )

Definition at line 54 of file sqpmethod.cpp.

54  {
55  Nlpsol::registerPlugin(casadi_register_nlpsol_sqpmethod);
56 }

References casadi_register_nlpsol_sqpmethod(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_nlpsol_worhp()

void CASADI_NLPSOL_WORHP_EXPORT casadi::casadi_load_nlpsol_worhp ( )

Definition at line 47 of file worhp_interface.cpp.

47  {
48  Nlpsol::registerPlugin(casadi_register_nlpsol_worhp);
49  }

References casadi_register_nlpsol_worhp(), and casadi::PluginInterface< Nlpsol >::registerPlugin().

◆ casadi_load_rootfinder_fast_newton()

void CASADI_ROOTFINDER_FAST_NEWTON_EXPORT casadi::casadi_load_rootfinder_fast_newton ( )

Definition at line 45 of file fast_newton.cpp.

45  {
46  Rootfinder::registerPlugin(casadi_register_rootfinder_fast_newton);
47  }

References casadi_register_rootfinder_fast_newton(), and casadi::PluginInterface< Rootfinder >::registerPlugin().

◆ casadi_load_rootfinder_kinsol()

void CASADI_ROOTFINDER_KINSOL_EXPORT casadi::casadi_load_rootfinder_kinsol ( )

Definition at line 42 of file kinsol_interface.cpp.

42  {
43  Rootfinder::registerPlugin(casadi_register_rootfinder_kinsol);
44  }

References casadi_register_rootfinder_kinsol(), and casadi::PluginInterface< Rootfinder >::registerPlugin().

◆ casadi_load_rootfinder_newton()

void CASADI_ROOTFINDER_NEWTON_EXPORT casadi::casadi_load_rootfinder_newton ( )

Definition at line 44 of file newton.cpp.

44  {
45  Rootfinder::registerPlugin(casadi_register_rootfinder_newton);
46  }

References casadi_register_rootfinder_newton(), and casadi::PluginInterface< Rootfinder >::registerPlugin().

◆ casadi_load_rootfinder_nlpsol()

void CASADI_ROOTFINDER_NLPSOL_EXPORT casadi::casadi_load_rootfinder_nlpsol ( )

Definition at line 44 of file implicit_to_nlp.cpp.

44  {
45  Rootfinder::registerPlugin(casadi_register_rootfinder_nlpsol);
46  }

References casadi_register_rootfinder_nlpsol(), and casadi::PluginInterface< Rootfinder >::registerPlugin().

◆ casadi_load_xmlfile_tinyxml()

void CASADI_XMLFILE_TINYXML_EXPORT casadi::casadi_load_xmlfile_tinyxml ( )

Definition at line 41 of file tinyxml_interface.cpp.

41  {
42  XmlFileInternal::registerPlugin(casadi_register_xmlfile_tinyxml);
43 }

References casadi_register_xmlfile_tinyxml(), and casadi::PluginInterface< XmlFileInternal >::registerPlugin().

◆ casadi_log_output()

static void casadi::casadi_log_output ( SLEQP_LOG_LEVEL  level,
time_t  time,
const char *  message 
)
static

Definition at line 51 of file sleqp_interface.cpp.

54  {
55  switch(level)
56  {
57  case SLEQP_LOG_WARN:
58  casadi_warning(message);
59  break;
60  case SLEQP_LOG_ERROR:
61  casadi_error(message);
62  break;
63  default:
64  uout() << "[" << log_level_name(level) << "] " << message << std::endl;
65  }
66  }
std::string log_level_name(SLEQP_LOG_LEVEL level)

References log_level_name(), and uout().

Referenced by casadi_register_nlpsol_sleqp().

◆ casadi_logsumexp()

template<typename T1 >
T1 casadi::casadi_logsumexp ( const T1 *  x,
casadi_int  n 
)

◆ casadi_low()

template<typename T1 >
casadi_int casadi::casadi_low ( T1  x,
const T1 *  grid,
casadi_int  ng,
casadi_int  lookup_mode 
)

Referenced by casadi::Low::eval().

◆ casadi_madnlp_sparsity()

void casadi::casadi_madnlp_sparsity ( const casadi_int *  sp,
madnlp_int *  coord_i,
madnlp_int *  coord_j 
)

Definition at line 93 of file madnlp_interface.cpp.

93  {
94  // convert ccs to cco
95  casadi_int ncol = sp[1];
96  const casadi_int* colind = sp+2;
97  const casadi_int* row = colind+ncol+1;
98 
99  for (casadi_int cc=0; cc<ncol; ++cc) {
100  for (casadi_int el=colind[cc]; el<colind[cc+1]; ++el) {
101  *coord_i++ = row[el]+1;
102  *coord_j++ = cc+1;
103  }
104  }
105 }

Referenced by casadi::MadnlpInterface::init().

◆ casadi_max()

casadi_int casadi::casadi_max ( casadi_int  x,
casadi_int  y 
)
inline

CasADi additions

Definition at line 285 of file calculus.hpp.

285 { return std::max(x, y);}

◆ casadi_max_viol()

template<typename T1 >
T1 casadi::casadi_max_viol ( casadi_int  n,
const T1 *  x,
const T1 *  lb,
const T1 *  ub 
)

◆ casadi_min()

casadi_int casadi::casadi_min ( casadi_int  x,
casadi_int  y 
)
inline

CasADi additions

Definition at line 286 of file calculus.hpp.

286 { return std::min(x, y);}

◆ casadi_mmax()

template<typename T1 >
T1 casadi::casadi_mmax ( const T1 *  x,
casadi_int  n,
T1  is_dense 
)

◆ casadi_mmin()

template<typename T1 >
T1 casadi::casadi_mmin ( const T1 *  x,
casadi_int  n,
casadi_int  is_dense 
)

◆ casadi_mtimes()

template<typename T1 >
void casadi::casadi_mtimes ( const T1 *  x,
const casadi_int *  sp_x,
const T1 *  y,
const casadi_int *  sp_y,
T1 *  z,
const casadi_int *  sp_z,
T1 *  w,
casadi_int  tr 
)

◆ casadi_mv()

template<typename T1 >
void casadi::casadi_mv ( const T1 *  x,
const casadi_int *  sp_x,
const T1 *  y,
T1 *  z,
casadi_int  tr 
)

◆ casadi_nd_boor_eval()

template<typename T1 >
void casadi::casadi_nd_boor_eval ( T1 *  ret,
casadi_int  n_dims,
const T1 *  knots,
const casadi_int *  offset,
const casadi_int *  degree,
const casadi_int *  strides,
const T1 *  c,
casadi_int  m,
const T1 *  x,
const casadi_int *  lookup_mode,
casadi_int *  iw,
T1 *  w 
)

◆ casadi_newton()

template<typename T1 >
int casadi::casadi_newton ( const casadi_newton_mem< T1 > *  m)

◆ casadi_norm_1()

template<typename T1 >
T1 casadi::casadi_norm_1 ( casadi_int  n,
const T1 *  x 
)

◆ casadi_norm_2()

template<typename T1 >
T1 casadi::casadi_norm_2 ( casadi_int  n,
const T1 *  x 
)

◆ casadi_norm_inf()

template<typename T1 >
T1 casadi::casadi_norm_inf ( casadi_int  n,
const T1 *  x 
)

◆ casadi_norm_inf_mul()

template<typename T1 >
T1 casadi::casadi_norm_inf_mul ( const T1 *  x,
const casadi_int *  sp_x,
const T1 *  y,
const casadi_int *  sp_y,
T1 *  dwork,
casadi_int *  iwork 
)

Inf-norm of a Matrix-matrix product,*

Parameters
dworkA real work vector that you must allocate Minimum size: y.size1()
iworkA integer work vector that you must allocate Minimum size: y.size1()+x.size2()+1

◆ casadi_polyval()

template<typename T1 >
T1 casadi::casadi_polyval ( const T1 *  p,
casadi_int  n,
T1  x 
)

◆ casadi_project()

template<typename T1 >
void casadi::casadi_project ( const T1 *  x,
const casadi_int *  sp_x,
T1 *  y,
const casadi_int *  sp_y,
T1 *  w 
)

◆ casadi_rank1()

template<typename T1 >
void casadi::casadi_rank1 ( T1 *  A,
const casadi_int *  sp_A,
T1  alpha,
const T1 *  x 
)

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

◆ casadi_register_archiver_libzip()

int CASADI_ARCHIVER_LIBZIP_EXPORT casadi::casadi_register_archiver_libzip ( Archiver::Plugin *  plugin)

Definition at line 338 of file libzip.cpp.

338  {
339  plugin->name = "libzip";
340  plugin->doc = Libzip::meta_doc.c_str();
341  plugin->version = CASADI_VERSION;
342  plugin->exposed.unpack = &extract_zip_from_path;
343  plugin->exposed.unpack_from_stringstream = &extract_zip_from_stringstream;
344  plugin->exposed.pack = &zip_to_path;
345  plugin->exposed.pack_to_stream = &zip_to_stream;
346  return 0;
347  }
bool zip_to_path(const std::string &dir_path, const std::string &zip_path)
Definition: libzip.cpp:297
bool extract_zip_from_path(const std::string &zip_path, const std::string &output_dir)
Definition: libzip.cpp:57
bool zip_to_stream(const std::string &dir, std::ostream &output)
Definition: libzip.cpp:186
bool extract_zip_from_stringstream(std::stringstream &src, const std::string &output_dir)
Definition: libzip.cpp:34

References extract_zip_from_path(), extract_zip_from_stringstream(), casadi::Libzip::meta_doc, zip_to_path(), and zip_to_stream().

Referenced by casadi_load_archiver_libzip().

◆ casadi_register_conic_cbc()

int CASADI_CONIC_CBC_EXPORT casadi::casadi_register_conic_cbc ( Conic::Plugin *  plugin)

Definition at line 34 of file cbc_interface.cpp.

34  {
35  plugin->creator = CbcInterface::creator;
36  plugin->name = "cbc";
37  plugin->doc = CbcInterface::meta_doc.c_str();
38  plugin->version = CASADI_VERSION;
39  plugin->options = &CbcInterface::options_;
40  plugin->deserialize = &CbcInterface::deserialize;
41  return 0;
42  }

References casadi::CbcInterface::creator(), casadi::CbcInterface::deserialize(), casadi::CbcInterface::meta_doc, and casadi::CbcInterface::options_.

Referenced by casadi_load_conic_cbc().

◆ casadi_register_conic_clarabel()

int CASADI_CONIC_CLARABEL_EXPORT casadi::casadi_register_conic_clarabel ( Conic::Plugin *  plugin)

Definition at line 34 of file clarabel_interface.cpp.

34  {
35  plugin->creator = ClarabelInterface::creator;
36  plugin->name = "clarabel";
37  plugin->doc = ClarabelInterface::meta_doc.c_str();
38  plugin->version = CASADI_VERSION;
39  plugin->options = &ClarabelInterface::options_;
40  plugin->deserialize = &ClarabelInterface::deserialize;
41  return 0;
42 }

References casadi::ClarabelInterface::creator(), casadi::ClarabelInterface::deserialize(), casadi::ClarabelInterface::meta_doc, and casadi::ClarabelInterface::options_.

Referenced by casadi_load_conic_clarabel().

◆ casadi_register_conic_clp()

int CASADI_CONIC_CLP_EXPORT casadi::casadi_register_conic_clp ( Conic::Plugin *  plugin)

Definition at line 31 of file clp_interface.cpp.

31  {
32  plugin->creator = ClpInterface::creator;
33  plugin->name = "clp";
34  plugin->doc = ClpInterface::meta_doc.c_str();
35  plugin->version = CASADI_VERSION;
36  plugin->options = &ClpInterface::options_;
37  plugin->deserialize = &ClpInterface::deserialize;
38  return 0;
39  }

References casadi::ClpInterface::creator(), casadi::ClpInterface::deserialize(), casadi::ClpInterface::meta_doc, and casadi::ClpInterface::options_.

Referenced by casadi_load_conic_clp().

◆ casadi_register_conic_cplex()

int CASADI_CONIC_CPLEX_EXPORT casadi::casadi_register_conic_cplex ( Conic::Plugin *  plugin)

Definition at line 37 of file cplex_interface.cpp.

37  {
38  plugin->creator = CplexInterface::creator;
39  plugin->name = "cplex";
40  plugin->doc = CplexInterface::meta_doc.c_str();
41  plugin->version = CASADI_VERSION;
42  plugin->options = &CplexInterface::options_;
43  plugin->deserialize = &CplexInterface::deserialize;
44  #ifdef CPLEX_ADAPTOR
45  char buffer[400];
46  int ret = cplex_adaptor_load(buffer, sizeof(buffer));
47  if (ret!=0) {
48  casadi_warning("Failed to load CPLEX adaptor: " + std::string(buffer) + ".");
49  return 1;
50  }
51  #endif
52  return 0;
53  }

References casadi::CplexInterface::creator(), casadi::CplexInterface::deserialize(), casadi::CplexInterface::meta_doc, and casadi::CplexInterface::options_.

Referenced by casadi_load_conic_cplex().

◆ casadi_register_conic_daqp()

int CASADI_CONIC_DAQP_EXPORT casadi::casadi_register_conic_daqp ( Conic::Plugin *  plugin)

Definition at line 33 of file daqp_interface.cpp.

33  {
34  plugin->creator = DaqpInterface::creator;
35  plugin->name = "daqp";
36  plugin->doc = DaqpInterface::meta_doc.c_str();
37  plugin->version = CASADI_VERSION;
38  plugin->options = &DaqpInterface::options_;
39  plugin->deserialize = &DaqpInterface::deserialize;
40  return 0;
41  }

References casadi::DaqpInterface::creator(), casadi::DaqpInterface::deserialize(), casadi::DaqpInterface::meta_doc, and casadi::DaqpInterface::options_.

Referenced by casadi_load_conic_daqp().

◆ casadi_register_conic_fatrop()

int CASADI_CONIC_FATROP_EXPORT casadi::casadi_register_conic_fatrop ( Conic::Plugin *  plugin)

Definition at line 36 of file fatrop_conic_interface.cpp.

36  {
37  plugin->creator = FatropConicInterface::creator;
38  plugin->name = "fatrop";
39  plugin->doc = FatropConicInterface::meta_doc.c_str();
40  plugin->version = CASADI_VERSION;
41  plugin->options = &FatropConicInterface::options_;
42  return 0;
43  }

References casadi::FatropConicInterface::creator(), casadi::FatropConicInterface::meta_doc, and casadi::FatropConicInterface::options_.

Referenced by casadi_load_conic_fatrop().

◆ casadi_register_conic_gurobi()

int CASADI_CONIC_GUROBI_EXPORT casadi::casadi_register_conic_gurobi ( Conic::Plugin *  plugin)

Definition at line 34 of file gurobi_interface.cpp.

34  {
35  plugin->creator = GurobiInterface::creator;
36  plugin->name = "gurobi";
37  plugin->doc = GurobiInterface::meta_doc.c_str();
38  plugin->version = CASADI_VERSION;
39  plugin->options = &GurobiInterface::options_;
40  plugin->deserialize = &GurobiInterface::deserialize;
41  #ifdef GUROBI_ADAPTOR
42  char buffer[400];
43  int ret = gurobi_adaptor_load(buffer, sizeof(buffer));
44  if (ret!=0) {
45  casadi_warning("Failed to load Gurobi adaptor: " + std::string(buffer) + ".");
46  return 1;
47  }
48  #endif
49  return 0;
50  }

References casadi::GurobiInterface::creator(), casadi::GurobiInterface::deserialize(), casadi::GurobiInterface::meta_doc, and casadi::GurobiInterface::options_.

Referenced by casadi_load_conic_gurobi().

◆ casadi_register_conic_highs()

int CASADI_CONIC_HIGHS_EXPORT casadi::casadi_register_conic_highs ( Conic::Plugin *  plugin)

Definition at line 33 of file highs_interface.cpp.

33  {
34  plugin->creator = HighsInterface::creator;
35  plugin->name = "highs";
36  plugin->doc = HighsInterface::meta_doc.c_str();
37  plugin->version = CASADI_VERSION;
38  plugin->options = &HighsInterface::options_;
39  plugin->deserialize = &HighsInterface::deserialize;
40  return 0;
41  }

References casadi::HighsInterface::creator(), casadi::HighsInterface::deserialize(), casadi::HighsInterface::meta_doc, and casadi::HighsInterface::options_.

Referenced by casadi_load_conic_highs().

◆ casadi_register_conic_hpipm()

int CASADI_CONIC_HPIPM_EXPORT casadi::casadi_register_conic_hpipm ( Conic::Plugin *  plugin)

Definition at line 35 of file hpipm_interface.cpp.

35  {
36  plugin->creator = HpipmInterface::creator;
37  plugin->name = "hpipm";
38  plugin->doc = HpipmInterface::meta_doc.c_str();
39  plugin->version = CASADI_VERSION;
40  plugin->options = &HpipmInterface::options_;
41  return 0;
42  }

References casadi::HpipmInterface::creator(), casadi::HpipmInterface::meta_doc, and casadi::HpipmInterface::options_.

Referenced by casadi_load_conic_hpipm().

◆ casadi_register_conic_hpmpc()

int CASADI_CONIC_HPMPC_EXPORT casadi::casadi_register_conic_hpmpc ( Conic::Plugin *  plugin)

Definition at line 32 of file hpmpc_interface.cpp.

32  {
33  plugin->creator = HpmpcInterface::creator;
34  plugin->name = "hpmpc";
35  plugin->doc = HpmpcInterface::meta_doc.c_str();
36  plugin->version = CASADI_VERSION;
37  plugin->options = &HpmpcInterface::options_;
38  return 0;
39  }

References casadi::HpmpcInterface::creator(), casadi::HpmpcInterface::meta_doc, and casadi::HpmpcInterface::options_.

Referenced by casadi_load_conic_hpmpc().

◆ casadi_register_conic_ipqp()

int CASADI_CONIC_IPQP_EXPORT casadi::casadi_register_conic_ipqp ( Conic::Plugin *  plugin)

Definition at line 33 of file ipqp.cpp.

33  {
34  plugin->creator = Ipqp::creator;
35  plugin->name = "ipqp";
36  plugin->doc = Ipqp::meta_doc.c_str();
37  plugin->version = CASADI_VERSION;
38  plugin->options = &Ipqp::options_;
39  plugin->deserialize = &Ipqp::deserialize;
40  return 0;
41  }

References casadi::Ipqp::creator(), casadi::Ipqp::deserialize(), casadi::Ipqp::meta_doc, and casadi::Ipqp::options_.

Referenced by casadi_load_conic_ipqp().

◆ casadi_register_conic_nlpsol()

int CASADI_CONIC_NLPSOL_EXPORT casadi::casadi_register_conic_nlpsol ( Conic::Plugin *  plugin)

Definition at line 34 of file qp_to_nlp.cpp.

34  {
35  plugin->creator = QpToNlp::creator;
36  plugin->name = "nlpsol";
37  plugin->doc = QpToNlp::meta_doc.c_str();
38  plugin->version = CASADI_VERSION;
39  plugin->options = &QpToNlp::options_;
40  plugin->deserialize = &QpToNlp::deserialize;
41  return 0;
42  }

References casadi::QpToNlp::creator(), casadi::QpToNlp::deserialize(), casadi::QpToNlp::meta_doc, and casadi::QpToNlp::options_.

Referenced by casadi_load_conic_nlpsol().

◆ casadi_register_conic_ooqp()

int CASADI_CONIC_OOQP_EXPORT casadi::casadi_register_conic_ooqp ( Conic::Plugin *  plugin)

Definition at line 42 of file ooqp_interface.cpp.

42  {
43  plugin->creator = OoqpInterface::creator;
44  plugin->name = "ooqp";
45  plugin->doc = OoqpInterface::meta_doc.c_str();
46  plugin->version = CASADI_VERSION;
47  plugin->options = &OoqpInterface::options_;
48  plugin->deserialize = &OoqpInterface::deserialize;
49  return 0;
50  }

References casadi::OoqpInterface::creator(), casadi::OoqpInterface::deserialize(), casadi::OoqpInterface::meta_doc, and casadi::OoqpInterface::options_.

Referenced by casadi_load_conic_ooqp().

◆ casadi_register_conic_osqp()

int CASADI_CONIC_OSQP_EXPORT casadi::casadi_register_conic_osqp ( Conic::Plugin *  plugin)

Definition at line 33 of file osqp_interface.cpp.

33  {
34  plugin->creator = OsqpInterface::creator;
35  plugin->name = "osqp";
36  plugin->doc = OsqpInterface::meta_doc.c_str();
37  plugin->version = CASADI_VERSION;
38  plugin->options = &OsqpInterface::options_;
39  plugin->deserialize = &OsqpInterface::deserialize;
40  return 0;
41  }

References casadi::OsqpInterface::creator(), casadi::OsqpInterface::deserialize(), casadi::OsqpInterface::meta_doc, and casadi::OsqpInterface::options_.

Referenced by casadi_load_conic_osqp().

◆ casadi_register_conic_proxqp()

int CASADI_CONIC_PROXQP_EXPORT casadi::casadi_register_conic_proxqp ( Conic::Plugin *  plugin)

Definition at line 36 of file proxqp_interface.cpp.

36  {
37  plugin->creator = ProxqpInterface::creator;
38  plugin->name = "proxqp";
39  plugin->doc = ProxqpInterface::meta_doc.c_str();
40  plugin->version = CASADI_VERSION;
41  plugin->options = &ProxqpInterface::options_;
42  plugin->deserialize = &ProxqpInterface::deserialize;
43  return 0;
44  }

References casadi_register_conic_proxqp().

Referenced by casadi_load_conic_proxqp(), and casadi_register_conic_proxqp().

◆ casadi_register_conic_qpoases()

int CASADI_CONIC_QPOASES_EXPORT casadi::casadi_register_conic_qpoases ( Conic::Plugin *  plugin)

Definition at line 36 of file qpoases_interface.cpp.

36  {
37  plugin->creator = QpoasesInterface::creator;
38  plugin->name = "qpoases";
39  plugin->doc = QpoasesInterface::meta_doc.c_str();
40  plugin->version = CASADI_VERSION;
41  plugin->options = &QpoasesInterface::options_;
42  plugin->deserialize = &QpoasesInterface::deserialize;
43  return 0;
44  }

References casadi::QpoasesInterface::creator(), casadi::QpoasesInterface::deserialize(), casadi::QpoasesInterface::meta_doc, and casadi::QpoasesInterface::options_.

Referenced by casadi_load_conic_qpoases().

◆ casadi_register_conic_qrqp()

int CASADI_CONIC_QRQP_EXPORT casadi::casadi_register_conic_qrqp ( Conic::Plugin *  plugin)

Definition at line 33 of file qrqp.cpp.

33  {
34  plugin->creator = Qrqp::creator;
35  plugin->name = "qrqp";
36  plugin->doc = Qrqp::meta_doc.c_str();
37  plugin->version = CASADI_VERSION;
38  plugin->options = &Qrqp::options_;
39  plugin->deserialize = &Qrqp::deserialize;
40  return 0;
41  }

References casadi::Qrqp::creator(), casadi::Qrqp::deserialize(), casadi::Qrqp::meta_doc, and casadi::Qrqp::options_.

Referenced by casadi_load_conic_qrqp().

◆ casadi_register_conic_sqic()

int CASADI_CONIC_SQIC_EXPORT casadi::casadi_register_conic_sqic ( Conic::Plugin *  plugin)

Definition at line 38 of file sqic_interface.cpp.

38  {
39  plugin->creator = SqicInterface::creator;
40  plugin->name = "sqic";
41  plugin->doc = SqicInterface::meta_doc.c_str();
42  plugin->version = CASADI_VERSION;
43  plugin->options = &SqicInterface::options_;
44  return 0;
45  }

References casadi::SqicInterface::creator(), casadi::SqicInterface::meta_doc, and casadi::Conic::options_.

Referenced by casadi_load_conic_sqic().

◆ casadi_register_conic_superscs()

int CASADI_CONIC_SUPERSCS_EXPORT casadi::casadi_register_conic_superscs ( Conic::Plugin *  plugin)

Definition at line 37 of file superscs_interface.cpp.

37  {
38  plugin->creator = SuperscsInterface::creator;
39  plugin->name = "superscs";
40  plugin->doc = SuperscsInterface::meta_doc.c_str();
41  plugin->version = CASADI_VERSION;
42  plugin->options = &SuperscsInterface::options_;
43  plugin->deserialize = &SuperscsInterface::deserialize;
44  return 0;
45  }

References casadi::SuperscsInterface::creator(), casadi::SuperscsInterface::deserialize(), casadi::SuperscsInterface::meta_doc, and casadi::SuperscsInterface::options_.

Referenced by casadi_load_conic_superscs().

◆ casadi_register_dple_slicot()

int CASADI_DPLE_SLICOT_EXPORT casadi::casadi_register_dple_slicot ( Dple::Plugin *  plugin)

Definition at line 42 of file slicot_dple.cpp.

42  {
43  plugin->creator = SlicotDple::creator;
44  plugin->name = "slicot";
45  plugin->doc = SlicotDple::meta_doc.c_str();
46  plugin->version = CASADI_VERSION;
47  plugin->options = &SlicotDple::options_;
48  return 0;
49  }

References casadi::SlicotDple::creator(), casadi::SlicotDple::meta_doc, and casadi::SlicotDple::options_.

Referenced by casadi_load_dple_slicot().

◆ casadi_register_expm_slicot()

int CASADI_EXPM_SLICOT_EXPORT casadi::casadi_register_expm_slicot ( Expm::Plugin *  plugin)

Definition at line 42 of file slicot_expm.cpp.

42  {
43  plugin->creator = SlicotExpm::creator;
44  plugin->name = "slicot";
45  plugin->doc = SlicotExpm::meta_doc.c_str();
46  plugin->version = CASADI_VERSION;
47  plugin->options = &SlicotExpm::options_;
48  return 0;
49  }

References casadi::SlicotExpm::creator(), casadi::SlicotExpm::meta_doc, and casadi::Expm::options_.

Referenced by casadi_load_expm_slicot().

◆ casadi_register_filesystem_ghc()

int CASADI_FILESYSTEM_GHC_EXPORT casadi::casadi_register_filesystem_ghc ( Filesystem::Plugin *  plugin)

Definition at line 73 of file ghc.cpp.

73  {
74  plugin->name = "ghc";
75  plugin->doc = Ghc::meta_doc.c_str();
76  plugin->version = CASADI_VERSION;
77  plugin->exposed.is_directory = &is_directory;
78  plugin->exposed.create_directories = &create_directories;
79  plugin->exposed.remove = &remove;
80  plugin->exposed.remove_all = &remove_all;
81  plugin->exposed.filename = &filename;
82  plugin->exposed.has_parent_path = &has_parent_path;
83  plugin->exposed.parent_path = &parent_path;
84  plugin->exposed.iterate_directory_names = &iterate_directory_names;
85  plugin->exposed.absolute = &absolute;
86  return 0;
87  }
std::string parent_path(const std::string &path)
Definition: ghc.cpp:63
std::vector< std::string > iterate_directory_names(const std::string &path)
Definition: ghc.cpp:39
std::string absolute(const std::string &path)
Definition: ghc.cpp:59
bool create_directories(const std::string &path)
Definition: ghc.cpp:35
bool has_parent_path(const std::string &path)
Definition: ghc.cpp:67
casadi_int remove_all(const std::string &path)
Definition: ghc.cpp:51
bool remove(const std::string &path)
Definition: ghc.cpp:47
bool is_directory(const std::string &path)
Definition: ghc.cpp:31
std::string filename(const std::string &path)
Definition: ghc.cpp:55

References absolute(), create_directories(), filename(), has_parent_path(), is_directory(), iterate_directory_names(), casadi::Ghc::meta_doc, parent_path(), remove(), and remove_all().

Referenced by casadi_load_filesystem_ghc().

◆ casadi_register_importer_clang()

int CASADI_IMPORTER_CLANG_EXPORT casadi::casadi_register_importer_clang ( ImporterInternal::Plugin *  plugin)

Definition at line 45 of file clang_compiler.cpp.

45  {
46  plugin->creator = ClangCompiler::creator;
47  plugin->name = "clang";
48  plugin->doc = ClangCompiler::meta_doc.c_str();
49  plugin->version = CASADI_VERSION;
50  plugin->options = &ClangCompiler::options_;
51  return 0;
52  }

References casadi::ClangCompiler::creator(), casadi::ClangCompiler::meta_doc, and casadi::ClangCompiler::options_.

Referenced by casadi_load_importer_clang(), and casadi::ClangCompiler::init().

◆ casadi_register_importer_shell()

int CASADI_IMPORTER_SHELL_EXPORT casadi::casadi_register_importer_shell ( ImporterInternal::Plugin *  plugin)

Definition at line 43 of file shell_compiler.cpp.

43  {
44  plugin->creator = ShellCompiler::creator;
45  plugin->name = "shell";
46  plugin->doc = ShellCompiler::meta_doc.c_str();
47  plugin->version = CASADI_VERSION;
48  plugin->options = &ShellCompiler::options_;
49  return 0;
50  }

References casadi::ShellCompiler::creator(), casadi::ShellCompiler::meta_doc, and casadi::ShellCompiler::options_.

Referenced by casadi_load_importer_shell().

◆ casadi_register_integrator_collocation()

int CASADI_INTEGRATOR_COLLOCATION_EXPORT casadi::casadi_register_integrator_collocation ( Integrator::Plugin *  plugin)

Definition at line 34 of file collocation.cpp.

34  {
35  plugin->creator = Collocation::creator;
36  plugin->name = "collocation";
37  plugin->doc = Collocation::meta_doc.c_str();
38  plugin->version = CASADI_VERSION;
39  plugin->options = &Collocation::options_;
40  plugin->deserialize = &Collocation::deserialize;
41  return 0;
42  }

References casadi::Collocation::creator(), casadi::Collocation::deserialize(), casadi::Collocation::meta_doc, and casadi::Collocation::options_.

Referenced by casadi_load_integrator_collocation().

◆ casadi_register_integrator_cvodes()

int CASADI_INTEGRATOR_CVODES_EXPORT casadi::casadi_register_integrator_cvodes ( Integrator::Plugin *  plugin)

Definition at line 36 of file cvodes_interface.cpp.

36  {
37  plugin->creator = CvodesInterface::creator;
38  plugin->name = "cvodes";
39  plugin->doc = CvodesInterface::meta_doc.c_str();;
40  plugin->version = CASADI_VERSION;
41  plugin->options = &CvodesInterface::options_;
42  plugin->deserialize = &CvodesInterface::deserialize;
43  return 0;
44 }

References casadi::CvodesInterface::creator(), casadi::CvodesInterface::deserialize(), casadi::CvodesInterface::meta_doc, and casadi::CvodesInterface::options_.

Referenced by casadi_load_integrator_cvodes().

◆ casadi_register_integrator_idas()

int CASADI_INTEGRATOR_IDAS_EXPORT casadi::casadi_register_integrator_idas ( Integrator::Plugin *  plugin)

Definition at line 37 of file idas_interface.cpp.

37  {
38  plugin->creator = IdasInterface::creator;
39  plugin->name = "idas";
40  plugin->doc = IdasInterface::meta_doc.c_str();
41  plugin->version = CASADI_VERSION;
42  plugin->options = &IdasInterface::options_;
43  plugin->deserialize = &IdasInterface::deserialize;
44  return 0;
45 }

References casadi::IdasInterface::creator(), casadi::IdasInterface::deserialize(), casadi::IdasInterface::meta_doc, and casadi::IdasInterface::options_.

Referenced by casadi_load_integrator_idas().

◆ casadi_register_integrator_rk()

int CASADI_INTEGRATOR_RK_EXPORT casadi::casadi_register_integrator_rk ( Integrator::Plugin *  plugin)

Definition at line 32 of file runge_kutta.cpp.

32  {
33  plugin->creator = RungeKutta::creator;
34  plugin->name = "rk";
35  plugin->doc = RungeKutta::meta_doc.c_str();
36  plugin->version = CASADI_VERSION;
37  plugin->options = &RungeKutta::options_;
38  plugin->deserialize = &RungeKutta::deserialize;
39  return 0;
40  }

References casadi::RungeKutta::creator(), casadi::RungeKutta::deserialize(), casadi::RungeKutta::meta_doc, and casadi::FixedStepIntegrator::options_.

Referenced by casadi_load_integrator_rk().

◆ casadi_register_interpolant_bspline()

int CASADI_INTERPOLANT_BSPLINE_EXPORT casadi::casadi_register_interpolant_bspline ( Interpolant::Plugin *  plugin)

Definition at line 33 of file bspline_interpolant.cpp.

33  {
34  plugin->creator = BSplineInterpolant::creator;
35  plugin->name = "bspline";
36  plugin->doc = BSplineInterpolant::meta_doc.c_str();
37  plugin->version = CASADI_VERSION;
38  plugin->options = &BSplineInterpolant::options_;
39  plugin->deserialize = &BSplineInterpolant::deserialize;
40  plugin->exposed.do_inline = nullptr;
41  return 0;
42  }

References casadi::BSplineInterpolant::creator(), casadi::BSplineInterpolant::deserialize(), casadi::BSplineInterpolant::meta_doc, and casadi::BSplineInterpolant::options_.

Referenced by casadi_load_interpolant_bspline().

◆ casadi_register_interpolant_linear()

int CASADI_INTERPOLANT_LINEAR_EXPORT casadi::casadi_register_interpolant_linear ( Interpolant::Plugin *  plugin)

Definition at line 32 of file linear_interpolant.cpp.

32  {
33  plugin->creator = LinearInterpolant::creator;
34  plugin->name = "linear";
35  plugin->doc = LinearInterpolant::meta_doc.c_str();
36  plugin->version = CASADI_VERSION;
37  plugin->options = &LinearInterpolant::options_;
38  plugin->deserialize = &LinearInterpolant::deserialize;
39  plugin->exposed.do_inline = &LinearInterpolant::do_inline;
40  return 0;
41  }

References casadi::LinearInterpolant::creator(), casadi::LinearInterpolant::deserialize(), casadi::LinearInterpolant::do_inline(), casadi::LinearInterpolant::meta_doc, and casadi::LinearInterpolant::options_.

Referenced by casadi_load_interpolant_linear().

◆ casadi_register_linsol_csparse()

int CASADI_LINSOL_CSPARSE_EXPORT casadi::casadi_register_linsol_csparse ( LinsolInternal::Plugin *  plugin)

Definition at line 33 of file csparse_interface.cpp.

33  {
34  plugin->creator = CsparseInterface::creator;
35  plugin->name = "csparse";
36  plugin->doc = CsparseInterface::meta_doc.c_str();
37  plugin->version = CASADI_VERSION;
38  plugin->options = &CsparseInterface::options_;
39  plugin->deserialize = &CsparseInterface::deserialize;
40  return 0;
41  }

References casadi::CsparseInterface::creator(), casadi::CsparseInterface::deserialize(), casadi::CsparseInterface::meta_doc, and casadi::ProtoFunction::options_.

Referenced by casadi_load_linsol_csparse().

◆ casadi_register_linsol_lapacklu()

int CASADI_LINSOL_LAPACKLU_EXPORT casadi::casadi_register_linsol_lapacklu ( LinsolInternal::Plugin *  plugin)

Definition at line 33 of file lapack_lu.cpp.

33  {
34  plugin->creator = LapackLu::creator;
35  plugin->name = "lapacklu";
36  plugin->doc = LapackLu::meta_doc.c_str();
37  plugin->version = CASADI_VERSION;
38  plugin->options = &LapackLu::options_;
39  plugin->deserialize = &LapackLu::deserialize;
40  return 0;
41  }

References casadi::LapackLu::creator(), casadi::LapackLu::deserialize(), casadi::LapackLu::meta_doc, and casadi::LapackLu::options_.

Referenced by casadi_load_linsol_lapacklu().

◆ casadi_register_linsol_lapackqr()

int CASADI_LINSOL_LAPACKQR_EXPORT casadi::casadi_register_linsol_lapackqr ( LinsolInternal::Plugin *  plugin)

Definition at line 33 of file lapack_qr.cpp.

33  {
34  plugin->creator = LapackQr::creator;
35  plugin->name = "lapackqr";
36  plugin->doc = LapackQr::meta_doc.c_str();;
37  plugin->version = CASADI_VERSION;
38  plugin->options = &LapackQr::options_;
39  plugin->deserialize = &LapackQr::deserialize;
40  return 0;
41  }

References casadi::LapackQr::creator(), casadi::LapackQr::deserialize(), casadi::LapackQr::meta_doc, and casadi::LapackQr::options_.

Referenced by casadi_load_linsol_lapackqr().

◆ casadi_register_linsol_ldl()

int CASADI_LINSOL_LDL_EXPORT casadi::casadi_register_linsol_ldl ( LinsolInternal::Plugin *  plugin)

Definition at line 33 of file linsol_ldl.cpp.

33  {
34  plugin->creator = LinsolLdl::creator;
35  plugin->name = "ldl";
36  plugin->doc = LinsolLdl::meta_doc.c_str();
37  plugin->version = CASADI_VERSION;
38  plugin->options = &LinsolLdl::options_;
39  plugin->deserialize = &LinsolLdl::deserialize;
40  return 0;
41  }

References casadi::LinsolLdl::creator(), casadi::LinsolLdl::deserialize(), casadi::LinsolLdl::meta_doc, and casadi::LinsolLdl::options_.

Referenced by casadi_load_linsol_ldl().

◆ casadi_register_linsol_lsqr()

int CASADI_LINSOL_LSQR_EXPORT casadi::casadi_register_linsol_lsqr ( LinsolInternal::Plugin *  plugin)

Definition at line 36 of file lsqr.cpp.

36  {
37  plugin->creator = Lsqr::creator;
38  plugin->name = "lsqr";
39  plugin->doc = Lsqr::meta_doc.c_str();
40  plugin->version = CASADI_VERSION;
41  plugin->options = &Lsqr::options_;
42  plugin->deserialize = &Lsqr::deserialize;
43  return 0;
44  }

References casadi::Lsqr::creator(), casadi::Lsqr::deserialize(), casadi::Lsqr::meta_doc, and casadi::ProtoFunction::options_.

Referenced by casadi_load_linsol_lsqr().

◆ casadi_register_linsol_ma27()

int CASADI_LINSOL_MA27_EXPORT casadi::casadi_register_linsol_ma27 ( LinsolInternal::Plugin *  plugin)

Definition at line 34 of file ma27_interface.cpp.

34  {
35  plugin->creator = Ma27Interface::creator;
36  plugin->name = "ma27";
37  plugin->doc = Ma27Interface::meta_doc.c_str();
38  plugin->version = CASADI_VERSION;
39  plugin->options = &Ma27Interface::options_;
40  plugin->deserialize = &Ma27Interface::deserialize;
41  return 0;
42  }

References casadi::Ma27Interface::creator(), casadi::Ma27Interface::deserialize(), casadi::Ma27Interface::meta_doc, and casadi::ProtoFunction::options_.

Referenced by casadi_load_linsol_ma27().

◆ casadi_register_linsol_mumps()

int CASADI_LINSOL_MUMPS_EXPORT casadi::casadi_register_linsol_mumps ( LinsolInternal::Plugin *  plugin)

Definition at line 34 of file mumps_interface.cpp.

34  {
35  plugin->creator = MumpsInterface::creator;
36  plugin->name = "mumps";
37  plugin->doc = MumpsInterface::meta_doc.c_str();
38  plugin->version = CASADI_VERSION;
39  plugin->options = &MumpsInterface::options_;
40  plugin->deserialize = &MumpsInterface::deserialize;
41  return 0;
42  }

References casadi::MumpsInterface::creator(), casadi::MumpsInterface::deserialize(), casadi::MumpsInterface::meta_doc, and casadi::MumpsInterface::options_.

Referenced by casadi_load_linsol_mumps().

◆ casadi_register_linsol_qr()

int CASADI_LINSOL_QR_EXPORT casadi::casadi_register_linsol_qr ( LinsolInternal::Plugin *  plugin)

Definition at line 33 of file linsol_qr.cpp.

33  {
34  plugin->creator = LinsolQr::creator;
35  plugin->name = "qr";
36  plugin->doc = LinsolQr::meta_doc.c_str();
37  plugin->version = CASADI_VERSION;
38  plugin->options = &LinsolQr::options_;
39  plugin->deserialize = &LinsolQr::deserialize;
40  return 0;
41  }

References casadi::LinsolQr::creator(), casadi::LinsolQr::deserialize(), casadi::LinsolQr::meta_doc, and casadi::LinsolQr::options_.

Referenced by casadi_load_linsol_qr().

◆ casadi_register_linsol_symbolicqr()

int CASADI_LINSOL_SYMBOLICQR_EXPORT casadi::casadi_register_linsol_symbolicqr ( LinsolInternal::Plugin *  plugin)

Definition at line 36 of file symbolic_qr.cpp.

36  {
37  plugin->creator = SymbolicQr::creator;
38  plugin->name = "symbolicqr";
39  plugin->doc = SymbolicQr::meta_doc.c_str();
40  plugin->version = CASADI_VERSION;
41  plugin->options = &SymbolicQr::options_;
42  plugin->deserialize = &SymbolicQr::deserialize;
43  return 0;
44  }

References casadi::SymbolicQr::creator(), casadi::SymbolicQr::deserialize(), casadi::SymbolicQr::meta_doc, and casadi::SymbolicQr::options_.

Referenced by casadi_load_linsol_symbolicqr().

◆ casadi_register_linsol_tridiag()

int CASADI_LINSOL_TRIDIAG_EXPORT casadi::casadi_register_linsol_tridiag ( LinsolInternal::Plugin *  plugin)

Definition at line 34 of file linsol_tridiag.cpp.

34  {
35  plugin->creator = LinsolTridiag::creator;
36  plugin->name = "tridiag";
37  plugin->doc = LinsolTridiag::meta_doc.c_str();
38  plugin->version = CASADI_VERSION;
39  plugin->options = &LinsolTridiag::options_;
40  return 0;
41  }

References casadi::LinsolTridiag::creator(), casadi::LinsolTridiag::meta_doc, and casadi::ProtoFunction::options_.

Referenced by casadi_load_linsol_tridiag().

◆ casadi_register_nlpsol_alpaqa()

int CASADI_NLPSOL_ALPAQA_EXPORT casadi::casadi_register_nlpsol_alpaqa ( Nlpsol::Plugin *  plugin)

Definition at line 34 of file alpaqa_interface.cpp.

34  {
35  plugin->creator = AlpaqaInterface::creator;
36  plugin->name = "alpaqa";
37  plugin->doc = AlpaqaInterface::meta_doc.c_str();
38  plugin->version = CASADI_VERSION;
39  plugin->options = &AlpaqaInterface::options_;
40  plugin->deserialize = &AlpaqaInterface::deserialize;
41  return 0;
42  }

References casadi::AlpaqaInterface::creator(), casadi::AlpaqaInterface::deserialize(), casadi::AlpaqaInterface::meta_doc, and casadi::AlpaqaInterface::options_.

Referenced by casadi_load_nlpsol_alpaqa().

◆ casadi_register_nlpsol_ampl()

int CASADI_NLPSOL_AMPL_EXPORT casadi::casadi_register_nlpsol_ampl ( Nlpsol::Plugin *  plugin)

Definition at line 35 of file ampl_interface.cpp.

35  {
36  plugin->creator = AmplInterface::creator;
37  plugin->name = "ampl";
38  plugin->doc = AmplInterface::meta_doc.c_str();
39  plugin->version = CASADI_VERSION;
40  plugin->options = &AmplInterface::options_;
41  return 0;
42  }

References casadi::AmplInterface::creator(), casadi::AmplInterface::meta_doc, and casadi::AmplInterface::options_.

Referenced by casadi_load_nlpsol_ampl().

◆ casadi_register_nlpsol_blocksqp()

int CASADI_NLPSOL_BLOCKSQP_EXPORT casadi::casadi_register_nlpsol_blocksqp ( Nlpsol::Plugin *  plugin)

Definition at line 34 of file blocksqp.cpp.

34  {
35  plugin->creator = Blocksqp::creator;
36  plugin->name = "blocksqp";
37  plugin->doc = Blocksqp::meta_doc.c_str();
38  plugin->version = CASADI_VERSION;
39  plugin->options = &Blocksqp::options_;
40  plugin->deserialize = &Blocksqp::deserialize;
41  return 0;
42  }

References casadi::Blocksqp::creator(), casadi::Blocksqp::deserialize(), casadi::Blocksqp::meta_doc, and casadi::Blocksqp::options_.

Referenced by casadi_load_nlpsol_blocksqp().

◆ casadi_register_nlpsol_bonmin()

int CASADI_NLPSOL_BONMIN_EXPORT casadi::casadi_register_nlpsol_bonmin ( Nlpsol::Plugin *  plugin)

Definition at line 42 of file bonmin_interface.cpp.

42  {
43  plugin->creator = BonminInterface::creator;
44  plugin->name = "bonmin";
45  plugin->doc = BonminInterface::meta_doc.c_str();
46  plugin->version = CASADI_VERSION;
47  plugin->options = &BonminInterface::options_;
48  plugin->deserialize = &BonminInterface::deserialize;
49  return 0;
50  }

References casadi::BonminInterface::creator(), casadi::BonminInterface::deserialize(), casadi::BonminInterface::meta_doc, and casadi::BonminInterface::options_.

Referenced by casadi_load_nlpsol_bonmin().

◆ casadi_register_nlpsol_fatrop()

int CASADI_NLPSOL_FATROP_EXPORT casadi::casadi_register_nlpsol_fatrop ( Nlpsol::Plugin *  plugin)

Definition at line 45 of file fatrop_interface.cpp.

45  {
46  plugin->creator = FatropInterface::creator;
47  plugin->name = "fatrop";
48  plugin->doc = FatropInterface::meta_doc.c_str();
49  plugin->version = CASADI_VERSION;
50  plugin->options = &FatropInterface::options_;
51  plugin->deserialize = &FatropInterface::deserialize;
52  return 0;
53  }

References casadi::FatropInterface::creator(), casadi::FatropInterface::deserialize(), casadi::FatropInterface::meta_doc, and casadi::FatropInterface::options_.

Referenced by casadi_load_nlpsol_fatrop().

◆ casadi_register_nlpsol_feasiblesqpmethod()

int CASADI_NLPSOL_FEASIBLESQPMETHOD_EXPORT casadi::casadi_register_nlpsol_feasiblesqpmethod ( Nlpsol::Plugin *  plugin)

Definition at line 46 of file feasiblesqpmethod.cpp.

46  {
47  plugin->creator = Feasiblesqpmethod::creator;
48  plugin->name = "feasiblesqpmethod";
49  plugin->doc = Feasiblesqpmethod::meta_doc.c_str();
50  plugin->version = CASADI_VERSION;
51  plugin->options = &Feasiblesqpmethod::options_;
52  plugin->deserialize = &Feasiblesqpmethod::deserialize;
53  return 0;
54  }

References casadi::Feasiblesqpmethod::creator(), casadi::Feasiblesqpmethod::deserialize(), casadi::Feasiblesqpmethod::meta_doc, and casadi::Feasiblesqpmethod::options_.

Referenced by casadi_load_nlpsol_feasiblesqpmethod().

◆ casadi_register_nlpsol_ipopt()

int CASADI_NLPSOL_IPOPT_EXPORT casadi::casadi_register_nlpsol_ipopt ( Nlpsol::Plugin *  plugin)

Definition at line 47 of file ipopt_interface.cpp.

47  {
48  plugin->creator = IpoptInterface::creator;
49  plugin->name = "ipopt";
50  plugin->doc = IpoptInterface::meta_doc.c_str();
51  plugin->version = CASADI_VERSION;
52  plugin->options = &IpoptInterface::options_;
53  plugin->deserialize = &IpoptInterface::deserialize;
54  return 0;
55  }

References casadi::IpoptInterface::creator(), casadi::IpoptInterface::deserialize(), casadi::IpoptInterface::meta_doc, and casadi::IpoptInterface::options_.

Referenced by casadi_load_nlpsol_ipopt().

◆ casadi_register_nlpsol_knitro()

int CASADI_NLPSOL_KNITRO_EXPORT casadi::casadi_register_nlpsol_knitro ( Nlpsol::Plugin *  plugin)

Definition at line 44 of file knitro_interface.cpp.

44  {
45  plugin->creator = KnitroInterface::creator;
46  plugin->name = "knitro";
47  plugin->doc = KnitroInterface::meta_doc.c_str();
48  plugin->version = CASADI_VERSION;
49  plugin->options = &KnitroInterface::options_;
50  plugin->deserialize = &KnitroInterface::deserialize;
51  return 0;
52  }

References casadi::KnitroInterface::creator(), casadi::KnitroInterface::deserialize(), casadi::KnitroInterface::meta_doc, and casadi::KnitroInterface::options_.

Referenced by casadi_load_nlpsol_knitro().

◆ casadi_register_nlpsol_madnlp()

int CASADI_NLPSOL_MADNLP_EXPORT casadi::casadi_register_nlpsol_madnlp ( Nlpsol::Plugin *  plugin)

Definition at line 47 of file madnlp_interface.cpp.

47  {
48  plugin->creator = MadnlpInterface::creator;
49  plugin->name = "madnlp";
50  plugin->doc = MadnlpInterface::meta_doc.c_str();
51  plugin->version = CASADI_VERSION;
52  plugin->options = &MadnlpInterface::options_;
53  plugin->deserialize = &MadnlpInterface::deserialize;
54  return 0;
55 }

References casadi::MadnlpInterface::creator(), casadi::MadnlpInterface::deserialize(), casadi::MadnlpInterface::meta_doc, and casadi::MadnlpInterface::options_.

Referenced by casadi_load_nlpsol_madnlp().

◆ casadi_register_nlpsol_qrsqp()

int CASADI_NLPSOL_QRSQP_EXPORT casadi::casadi_register_nlpsol_qrsqp ( Nlpsol::Plugin *  plugin)

Definition at line 42 of file qrsqp.cpp.

42  {
43  plugin->creator = Qrsqp::creator;
44  plugin->name = "qrsqp";
45  plugin->doc = Qrsqp::meta_doc.c_str();
46  plugin->version = CASADI_VERSION;
47  plugin->options = &Qrsqp::options_;
48  return 0;
49  }

References casadi::Qrsqp::creator(), casadi::Qrsqp::meta_doc, and casadi::Qrsqp::options_.

Referenced by casadi_load_nlpsol_qrsqp().

◆ casadi_register_nlpsol_scpgen()

int CASADI_NLPSOL_SCPGEN_EXPORT casadi::casadi_register_nlpsol_scpgen ( Nlpsol::Plugin *  plugin)

Definition at line 39 of file scpgen.cpp.

39  {
40  plugin->creator = Scpgen::creator;
41  plugin->name = "scpgen";
42  plugin->doc = Scpgen::meta_doc.c_str();
43  plugin->version = CASADI_VERSION;
44  plugin->options = &Scpgen::options_;
45  return 0;
46  }

References casadi::Scpgen::creator(), casadi::Scpgen::meta_doc, and casadi::Scpgen::options_.

Referenced by casadi_load_nlpsol_scpgen().

◆ casadi_register_nlpsol_sleqp()

int CASADI_NLPSOL_SLEQP_EXPORT casadi::casadi_register_nlpsol_sleqp ( Nlpsol::Plugin *  plugin)

Definition at line 70 of file sleqp_interface.cpp.

70  {
71  plugin->creator = SLEQPInterface::creator;
72  plugin->name = "sleqp";
73  plugin->doc = SLEQPInterface::meta_doc.c_str();
74  plugin->version = CASADI_VERSION;
75  plugin->options = &SLEQPInterface::options_;
76  plugin->deserialize = &SLEQPInterface::deserialize;
77 
78  sleqp_log_set_handler(casadi_log_output);
79 
80  return 0;
81  }

References casadi_log_output(), casadi::SLEQPInterface::creator(), casadi::SLEQPInterface::deserialize(), casadi::SLEQPInterface::meta_doc, and casadi::SLEQPInterface::options_.

Referenced by casadi_load_nlpsol_sleqp().

◆ casadi_register_nlpsol_snopt()

int CASADI_NLPSOL_SNOPT_EXPORT casadi::casadi_register_nlpsol_snopt ( Nlpsol::Plugin *  plugin)

Definition at line 40 of file snopt_interface.cpp.

40  {
41  plugin->creator = SnoptInterface::creator;
42  plugin->name = "snopt";
43  plugin->doc = SnoptInterface::meta_doc.c_str();
44  plugin->version = CASADI_VERSION;
45  plugin->options = &SnoptInterface::options_;
46  plugin->deserialize = &SnoptInterface::deserialize;
47  return 0;
48  }

References casadi::SnoptInterface::creator(), casadi::SnoptInterface::deserialize(), casadi::SnoptInterface::meta_doc, and casadi::SnoptInterface::options_.

Referenced by casadi_load_nlpsol_snopt().

◆ casadi_register_nlpsol_sqpmethod()

int CASADI_NLPSOL_SQPMETHOD_EXPORT casadi::casadi_register_nlpsol_sqpmethod ( Nlpsol::Plugin *  plugin)

Definition at line 43 of file sqpmethod.cpp.

43  {
44  plugin->creator = Sqpmethod::creator;
45  plugin->name = "sqpmethod";
46  plugin->doc = Sqpmethod::meta_doc.c_str();
47  plugin->version = CASADI_VERSION;
48  plugin->options = &Sqpmethod::options_;
49  plugin->deserialize = &Sqpmethod::deserialize;
50  return 0;
51 }

References casadi::Sqpmethod::creator(), casadi::Sqpmethod::deserialize(), casadi::Sqpmethod::meta_doc, and casadi::Sqpmethod::options_.

Referenced by casadi_load_nlpsol_sqpmethod().

◆ casadi_register_nlpsol_worhp()

int CASADI_NLPSOL_WORHP_EXPORT casadi::casadi_register_nlpsol_worhp ( Nlpsol::Plugin *  plugin)

Definition at line 36 of file worhp_interface.cpp.

36  {
37  plugin->creator = WorhpInterface::creator;
38  plugin->name = "worhp";
39  plugin->doc = WorhpInterface::meta_doc.c_str();
40  plugin->version = CASADI_VERSION;
41  plugin->options = &WorhpInterface::options_;
42  plugin->deserialize = &WorhpInterface::deserialize;
43  return 0;
44  }

References casadi::WorhpInterface::creator(), casadi::WorhpInterface::deserialize(), casadi::WorhpInterface::meta_doc, and casadi::WorhpInterface::options_.

Referenced by casadi_load_nlpsol_worhp().

◆ casadi_register_rootfinder_fast_newton()

int CASADI_ROOTFINDER_FAST_NEWTON_EXPORT casadi::casadi_register_rootfinder_fast_newton ( Rootfinder::Plugin *  plugin)

Definition at line 34 of file fast_newton.cpp.

34  {
35  plugin->creator = FastNewton::creator;
36  plugin->name = "fast_newton";
37  plugin->doc = FastNewton::meta_doc.c_str();
38  plugin->version = CASADI_VERSION;
39  plugin->options = &FastNewton::options_;
40  plugin->deserialize = &FastNewton::deserialize;
41  return 0;
42  }

References casadi::FastNewton::creator(), casadi::FastNewton::deserialize(), casadi::FastNewton::meta_doc, and casadi::FastNewton::options_.

Referenced by casadi_load_rootfinder_fast_newton().

◆ casadi_register_rootfinder_kinsol()

int CASADI_ROOTFINDER_KINSOL_EXPORT casadi::casadi_register_rootfinder_kinsol ( Rootfinder::Plugin *  plugin)

Definition at line 32 of file kinsol_interface.cpp.

32  {
33  plugin->creator = KinsolInterface::creator;
34  plugin->name = "kinsol";
35  plugin->doc = KinsolInterface::meta_doc.c_str();
36  plugin->version = CASADI_VERSION;
37  plugin->options = &KinsolInterface::options_;
38  return 0;
39  }

References casadi::KinsolInterface::creator(), casadi::KinsolInterface::meta_doc, and casadi::KinsolInterface::options_.

Referenced by casadi_load_rootfinder_kinsol().

◆ casadi_register_rootfinder_newton()

int CASADI_ROOTFINDER_NEWTON_EXPORT casadi::casadi_register_rootfinder_newton ( Rootfinder::Plugin *  plugin)

Definition at line 33 of file newton.cpp.

33  {
34  plugin->creator = Newton::creator;
35  plugin->name = "newton";
36  plugin->doc = Newton::meta_doc.c_str();
37  plugin->version = CASADI_VERSION;
38  plugin->options = &Newton::options_;
39  plugin->deserialize = &Newton::deserialize;
40  return 0;
41  }

References casadi::Newton::creator(), casadi::Newton::deserialize(), casadi::Newton::meta_doc, and casadi::Newton::options_.

Referenced by casadi_load_rootfinder_newton().

◆ casadi_register_rootfinder_nlpsol()

int CASADI_ROOTFINDER_NLPSOL_EXPORT casadi::casadi_register_rootfinder_nlpsol ( Rootfinder::Plugin *  plugin)

Definition at line 34 of file implicit_to_nlp.cpp.

34  {
35  plugin->creator = ImplicitToNlp::creator;
36  plugin->name = "nlpsol";
37  plugin->doc = ImplicitToNlp::meta_doc.c_str();
38  plugin->version = CASADI_VERSION;
39  plugin->options = &ImplicitToNlp::options_;
40  return 0;
41  }

References casadi::ImplicitToNlp::creator(), casadi::ImplicitToNlp::meta_doc, and casadi::ImplicitToNlp::options_.

Referenced by casadi_load_rootfinder_nlpsol().

◆ casadi_register_xmlfile_tinyxml()

int CASADI_XMLFILE_TINYXML_EXPORT casadi::casadi_register_xmlfile_tinyxml ( XmlFileInternal::Plugin *  plugin)

Definition at line 32 of file tinyxml_interface.cpp.

32  {
33  plugin->creator = TinyXmlInterface::creator;
34  plugin->name = "tinyxml";
35  plugin->doc = TinyXmlInterface::meta_doc.c_str();
36  plugin->version = CASADI_VERSION;
37  return 0;
38 }

References casadi::TinyXmlInterface::creator(), and casadi::TinyXmlInterface::meta_doc.

Referenced by casadi_load_xmlfile_tinyxml().

◆ casadi_scal()

template<typename T1 >
void casadi::casadi_scal ( casadi_int  n,
T1  alpha,
T1 *  x 
)

◆ casadi_sleqp_func_create()

void casadi::casadi_sleqp_func_create ( SleqpFunc **  star,
int  num_vars,
int  num_cons,
SLEQPMemory m 
)

Definition at line 237 of file sleqp_func.cpp.

241  {
242  SleqpFuncCallbacks callbacks{};
243 
244  callbacks.set_value = casadi_func_set;
245  callbacks.nonzeros = casadi_func_nonzeros;
246  callbacks.obj_val = casadi_func_obj_val;
247  callbacks.obj_grad = casadi_func_obj_grad;
248  callbacks.cons_val = casadi_func_cons_val;
249  callbacks.cons_jac = casadi_func_cons_jac;
250  callbacks.hess_prod = casadi_func_hess_prod;
251  callbacks.func_free = casadi_func_free;
252 
253 
254  SLEQP_CALL_EXC(sleqp_func_create(star,
255  &callbacks,
256  num_vars,
257  num_cons,
258  static_cast<void*>(m)));
259  }
static SLEQP_RETCODE casadi_func_cons_val(SleqpFunc *func, SleqpVec *cons_val, void *func_data)
Definition: sleqp_func.cpp:97
static SLEQP_RETCODE casadi_func_free(void *func_data)
Definition: sleqp_func.cpp:231
static SLEQP_RETCODE casadi_func_nonzeros(SleqpFunc *func, int *obj_grad_nnz, int *cons_val_nnz, int *cons_jac_nnz, int *hess_prod_nnz, void *func_data)
Definition: sleqp_func.cpp:22
static SLEQP_RETCODE casadi_func_obj_val(SleqpFunc *func, double *obj_val, void *func_data)
Definition: sleqp_func.cpp:33
static SLEQP_RETCODE casadi_func_hess_prod(SleqpFunc *func, const SleqpVec *direction, const SleqpVec *cons_duals, SleqpVec *product, void *func_data)
Definition: sleqp_func.cpp:184
static SLEQP_RETCODE casadi_func_obj_grad(SleqpFunc *func, SleqpVec *obj_grad, void *func_data)
Definition: sleqp_func.cpp:61
static SLEQP_RETCODE casadi_func_cons_jac(SleqpFunc *func, SleqpMat *cons_jac, void *func_data)
Definition: sleqp_func.cpp:132
static SLEQP_RETCODE casadi_func_set(SleqpFunc *func, SleqpVec *value, SLEQP_VALUE_REASON reason, bool *reject, void *func_data)
Definition: sleqp_func.cpp:9

References casadi_func_cons_jac(), casadi_func_cons_val(), casadi_func_free(), casadi_func_hess_prod(), casadi_func_nonzeros(), casadi_func_obj_grad(), casadi_func_obj_val(), and casadi_func_set().

Referenced by casadi::SLEQPInterface::set_work().

◆ casadi_sparsify()

template<typename T1 , typename T2 >
void casadi::casadi_sparsify ( const T1 *  x,
T2 *  y,
const casadi_int *  sp_y,
casadi_int  tr 
)

◆ casadi_sum_viol()

template<typename T1 >
T1 casadi::casadi_sum_viol ( casadi_int  n,
const T1 *  x,
const T1 *  lb,
const T1 *  ub 
)

◆ casadi_swap()

template<typename T1 >
void casadi::casadi_swap ( casadi_int  n,
T1 *  x,
casadi_int  inc_x,
T1 *  y,
casadi_int  inc_y 
)

◆ casadi_trans()

template<typename T1 >
void casadi::casadi_trans ( const T1 *  x,
const casadi_int *  sp_x,
T1 *  y,
const casadi_int *  sp_y,
casadi_int *  tmp 
)

◆ casadi_trilsolve()

template<typename T1 >
void casadi::casadi_trilsolve ( const casadi_int *  sp_a,
const T1 *  nz_a,
T1 *  x,
int  tr,
int  unity,
casadi_int  nrhs 
)

◆ casadi_triusolve()

template<typename T1 >
void casadi::casadi_triusolve ( const casadi_int *  sp_a,
const T1 *  nz_a,
T1 *  x,
int  tr,
int  unity,
casadi_int  nrhs 
)

◆ casadi_vfmax()

template<typename T1 >
T1 casadi::casadi_vfmax ( const T1 *  x,
casadi_int  n,
T1  r 
)

◆ casadi_vfmin()

template<typename T1 >
T1 casadi::casadi_vfmin ( const T1 *  x,
casadi_int  n,
T1  r 
)

◆ check_exposed()

template<typename T >
T casadi::check_exposed ( t)

Definition at line 40 of file plugin_interface.hpp.

40  {
41  casadi_assert(t!=0, "Static function not implemented for plugin");
42  return t;
43  }

References T.

◆ check_sos()

template<class T >
void casadi::check_sos ( casadi_int  nx,
const std::vector< std::vector< T > > &  groups,
std::vector< std::vector< double > > &  weights,
std::vector< casadi_int > &  types 
)

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

Definition at line 79 of file nlp_tools.hpp.

81  {
82  // Checks on presence
83  if (groups.empty()) {
84  casadi_assert(weights.empty(), "Missing sos_groups.");
85  casadi_assert(types.empty(), "Missing sos_groups.");
86  }
87 
88  // Checks on dimensions
89  casadi_int sos_num = groups.size();
90 
91  casadi_assert(weights.empty() || weights.size()==sos_num,
92  "sos_weights has incorrect size");
93 
94  // Set default types
95  if (!groups.empty() && types.empty())
96  types.resize(sos_num, 1);
97 
98  // Set default weights
99  if (weights.empty()) {
100  for (const auto& e : groups) {
101  std::vector<double> w(e.size());
102  for (casadi_int i=0;i<w.size();++i) w[i] = i;
103  weights.push_back(w);
104  }
105  }
106 
107  casadi_assert(types.size()==sos_num,
108  "sos_types has incorrect size");
109 
110  // Group-wise dimension check
111  for (casadi_int i=0;i<weights.size();++i) {
112  casadi_assert(weights[i].size()==groups[i].size(),
113  "Dimension mismatch in weights for group " + str(i) + ": "
114  "Expected " + str(groups[i].size()) + ", got " + str(weights[i].size()));
115  }
116 
117  // Checks on contents
118  for (casadi_int t : types) casadi_assert(t==1 || t==2, "SOS type must be either 1 or 2.");
119  for (const auto& v : groups) casadi_assert(in_range(v, 0, nx), "Index out of bound");
120  }
bool in_range(const std::vector< T > &v, casadi_int upper)
Check if for each element of v holds: v_i < upper.

References in_range(), and str().

Referenced by casadi::CbcInterface::init(), casadi::CplexInterface::init(), and casadi::GurobiInterface::init().

◆ codegen_local()

void casadi::codegen_local ( CodeGenerator g,
const std::string &  name,
const std::vector< int > &  v 
)

Definition at line 105 of file clarabel_interface.cpp.

105  {
106  std::string n = name + "[]";
107  g.local(n, "static const int");
108  std::stringstream init;
109  init << "{";
110  for (casadi_int i = 0; i < v.size(); ++i) {
111  init << v[i];
112  if (i < v.size()-1) init << ", ";
113  }
114  if (v.empty()) init << "0"; // ISO C forbids empty initializer braces
115  init << "}";
116  g.init_local(n, init.str());
117 }

References casadi::CodeGenerator::init_local(), and casadi::CodeGenerator::local().

Referenced by casadi::ClarabelInterface::set_clarabel_prob(), casadi::HighsInterface::set_highs_prob(), and casadi::HpipmInterface::set_hpipm_prob().

◆ codegen_unpack_block() [1/2]

void casadi::codegen_unpack_block ( CodeGenerator g,
const std::string &  name,
const std::vector< casadi_hpipm_block > &  blocks 
)

Definition at line 490 of file hpipm_interface.cpp.

491  {
492  std::string n = "block_" + name + "[" + str(blocks.size()) + "]";
493  g.local(n, "static struct casadi_hpipm_block");
494  g << "p." << name << " = block_" + name + ";\n";
495  g << "casadi_hpipm_unpack_blocks(" << blocks.size()
496  << ", p." << name
497  << ", " << g.constant(hpipm_blocks_pack(blocks)) << ");\n";
498  }
std::vector< casadi_int > hpipm_blocks_pack(const std::vector< casadi_hpipm_block > &blocks)

References casadi::CodeGenerator::constant(), hpipm_blocks_pack(), casadi::CodeGenerator::local(), and str().

◆ codegen_unpack_block() [2/2]

void casadi::codegen_unpack_block ( CodeGenerator g,
const std::string &  name,
const std::vector< casadi_ocp_block > &  blocks 
)

Definition at line 772 of file fatrop_interface.cpp.

773  {
774  casadi_int sz = blocks.size();
775  if (sz==0) sz++;
776  std::string n = "block_" + name + "[" + str(sz) + "]";
777  g.local(n, "static struct casadi_ocp_block");
778  g << "p." << name << " = block_" + name + ";\n";
779  g << "casadi_unpack_ocp_blocks(" << "p." << name
780  << ", " << g.constant(fatrop_blocks_pack(blocks)) << ");\n";
781  }
std::vector< casadi_int > fatrop_blocks_pack(const std::vector< casadi_ocp_block > &blocks)

References casadi::CodeGenerator::constant(), fatrop_blocks_pack(), casadi::CodeGenerator::local(), and str().

Referenced by casadi::FatropInterface::set_fatrop_prob(), and casadi::HpipmInterface::set_hpipm_prob().

◆ collocation_coeff()

CASADI_EXPORT void casadi::collocation_coeff ( const std::vector< double > &  tau,
DM C,
DM D,
DM B 
)

A collocation method poses a polynomial Pi that interpolates exactly through an initial state (0,X_0) and helper states at collocation points (tau_j,Xc_j) with j=1..degree.

This function computes the linear mapping between dPi/dt and coefficients Z=[X_0 Xc].

Parameters
taulocation of collocation points (length: degree), as obtained from collocation_points
[out]Cinterpolating coefficients to obtain derivatives. Size: (degree+1)-by-degree

You may find the slopes of Pi at the collocation points as

    dPi/dt @ Xc = (1/h) Z*C,

with h the length of the integration interval.

Parameters
[out]Dinterpolating coefficients to obtain end state. Size: (degree+1)-by-1

You may find the end point of Pi as

    Pi @X_f = Z*D
Parameters
[out]Bquadrature coefficients Size: degree-by-1

Given quadrature righ-hand-sides 'quad' evaluated at the collocation points, you may find the integrated quadratures as

    q = quad*B*h

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

Definition at line 233 of file integration_tools.cpp.

234  {
235  // Find the degree of the interpolation
236  casadi_int deg = tau.size();
237 
238  // Include zero
239  std::vector<double> etau_root = tau;
240  etau_root.insert(etau_root.begin(), 0);
241 
242  // Check if tau ends with '1' (cfr. radau scheme)
243  bool has_end = tau.back()==1;
244 
245  // Coefficients of the collocation equation
246  std::vector<std::vector<double> > C_(deg+1, std::vector<double>(deg+1, 0));
247 
248  // Coefficients of the continuity equation
249  std::vector<double> D_(deg+1, 0);
250 
251  // Coefficients of the quadratures
252  std::vector<double> B_(deg+1, 0);
253 
254  // For all collocation points
255  for (casadi_int j=0; j<deg+1; ++j) {
256 
257  // Construct Lagrange polynomials to get the polynomial basis at the collocation point
258  Polynomial p = 1;
259  for (casadi_int r=0; r<deg+1; ++r) {
260  if (r!=j) {
261  p *= Polynomial(-etau_root[r], 1)/(etau_root[j]-etau_root[r]);
262  }
263  }
264 
265  // Evaluate the polynomial at the final time to get the
266  // coefficients of the continuity equation
267  if (has_end) {
268  D_[j] = j==deg ? 1 : 0;
269  } else {
270  D_[j] = p(1.0);
271  }
272  // Evaluate the time derivative of the polynomial at all collocation points to
273  // get the coefficients of the continuity equation
274  Polynomial dp = p.derivative();
275  for (casadi_int r=0; r<deg+1; ++r) {
276  C_[j][r] = dp(etau_root[r]);
277  }
278 
279  // Integrate polynomial to get the coefficients of the quadratures
280  Polynomial ip = p.anti_derivative();
281  B_[j] = ip(1.0);
282  }
283  C = DM(C_);
284  C = C(Slice(), Slice(1, deg+1)); // NOLINT(cppcoreguidelines-slicing)
285  D = DM(D_);
286  B = DM(std::vector<double>(B_.begin()+1, B_.end()));
287 }
Matrix< double > DM
Definition: dm_fwd.hpp:33

References casadi::Polynomial::anti_derivative(), C, D, and casadi::Polynomial::derivative().

◆ collocation_interpolators()

CASADI_EXPORT void casadi::collocation_interpolators ( const std::vector< double > &  tau,
std::vector< std::vector< double > > &  C,
std::vector< double > &  D 
)

A collocation method poses a polynomial Pi that interpolates exactly through an initial state (0,X_0) and helper states at collocation points (tau_j,X:collPoint(j)).

This function computes the linear mapping between dPi/dt and coefficients Z=[X_0 X:collPoints].

Parameters
taulocation of collocation points, as obtained from collocation_points
[out]Cinterpolating coefficients to obtain derivatives. Length: order+1, order+1
    dPi/dt @Z_j = (1/h) Sum_i C[j][i]*Z_i,

with h the length of the integration interval.

Parameters
[out]Dinterpolating coefficients to obtain end state. Length: order+1
    Pi @X_f = Sum_i D[i]*Z_i

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

Definition at line 189 of file integration_tools.cpp.

190  {
191  // Find the degree of the interpolation
192  casadi_int deg = tau.size();
193 
194  // Include zero
195  std::vector<double> etau_root = tau;
196  etau_root.insert(etau_root.begin(), 0);
197 
198  // Allocate storage space for resulting coefficients
199  C.resize(deg+1);
200  for (casadi_int i=0;i<deg+1;++i) {
201  C[i].resize(deg+1);
202  }
203  D.resize(deg+1);
204 
205  // Collocation point
206  SX tau_sym = SX::sym("tau");
207 
208  // For all collocation points
209  for (casadi_int j=0; j<deg+1; ++j) {
210  // Construct Lagrange polynomials to get the polynomial basis at the collocation point
211  SX L = 1;
212  for (casadi_int j2=0; j2<deg+1; ++j2) {
213  if (j2 != j) {
214  L *= (tau_sym-etau_root[j2])/(etau_root[j]-etau_root[j2]);
215  }
216  }
217 
218  Function lfcn("lfcn", {tau_sym}, {L});
219 
220  // Evaluate the polynomial at the final time to get the
221  // coefficients of the continuity equation
222  D[j] = lfcn(std::vector<DM>{1.}).at(0)->front();
223 
224  // Evaluate the time derivative of the polynomial at all collocation points to
225  // get the coefficients of the continuity equation
226  Function tfcn("tfcn", {tau_sym}, {tangent(L, tau_sym)});
227  for (casadi_int j2=0; j2<deg+1; ++j2) {
228  C[j2][j] = tfcn(std::vector<DM>{etau_root[j2]}).at(0)->front();
229  }
230  }
231 }
Matrix< SXElem > SX
Definition: sx_fwd.hpp:32

References C, D, and casadi::GenericMatrix< Matrix< Scalar > >::sym().

Referenced by simpleIRK().

◆ collocation_points()

CASADI_EXPORT std::vector< double > casadi::collocation_points ( casadi_int  order,
const std::string &  scheme = "radau" 
)
Parameters
orderWhich order (1 to 9 supported)
scheme'radau' or 'legendre'

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

Definition at line 120 of file integration_tools.cpp.

120  {
121  return collocation_pointsGen<double>(order, scheme);
122 }

Referenced by casadi::Collocation::setup_step(), and simpleIRK().

◆ collocation_pointsGen()

template<typename RealT >
std::vector<RealT> casadi::collocation_pointsGen ( casadi_int  order,
const std::string &  scheme 
)

Definition at line 103 of file integration_tools.cpp.

103  {
104  if (scheme=="radau") {
105  casadi_assert(order>0 && order<10,
106  "Error in collocationPoints(order, scheme): "
107  "only order up to 9 supported for scheme 'radau', but got " + str(order) + ".");
108  return std::vector<RealT>(radau_points[order], radau_points[order]+order);
109  } else if (scheme=="legendre") {
110  casadi_assert(order>0 && order<10,
111  "Error in collocationPoints(order, scheme): "
112  "only order up to 9 supported for scheme 'legendre', but got " + str(order) + ".");
113  return std::vector<RealT>(legendre_points[order], legendre_points[order]+order);
114  } else {
115  casadi_error("Error in collocationPoints(order, scheme): unknown scheme '"
116  + scheme + "'. Select one of 'radau', 'legendre'.");
117  }
118 }

References legendre_points, radau_points, and str().

◆ collocation_pointsL()

CASADI_EXPORT std::vector< long double > casadi::collocation_pointsL ( casadi_int  order,
const std::string &  scheme 
)
Parameters
orderWhich order (1 to 9 supported)
scheme'radau' or 'legendre'

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

Definition at line 124 of file integration_tools.cpp.

124  {
125  return collocation_pointsGen<long double>(order, scheme);
126 }

◆ combine()

CASADI_EXPORT Dict casadi::combine ( const Dict first,
const Dict second,
bool  recurse = false 
)

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

Definition at line 796 of file generic_type.cpp.

796  {
797  if (first.empty()) return second;
798  if (second.empty()) return first;
799  Dict ret = second;
800  update_dict(ret, first, recurse);
801  return ret;
802  }
void update_dict(Dict &target, const Dict &source, bool recurse)
Update the target dictionary in place with source elements.

References update_dict().

Referenced by casadi::OracleFunction::create_function(), casadi::FunctionInternal::forward(), casadi::BlazingSplineFunction::get_jacobian(), casadi::FunctionInternal::jacobian(), casadi::FunctionInternal::reverse(), and casadi::MX::stop_diff().

◆ complement()

CASADI_EXPORT std::vector< casadi_int > casadi::complement ( const std::vector< casadi_int > &  v,
casadi_int  size 
)

The supplied vector may contain duplicates and may be non-monotonous The supplied vector will be checked for bounds The result vector is guaranteed to be monotonously increasing

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

Definition at line 137 of file casadi_misc.cpp.

137  {
138  casadi_assert(in_range(v, size),
139  "complement: out of bounds. Some elements in v fall out of [0, size[");
140  std::vector<casadi_int> lookup(size, 0);
141  std::vector<casadi_int> ret;
142 
143  for (casadi_int i=0;i<v.size();i++) {
144  lookup[v[i]] = 1;
145  }
146 
147  for (casadi_int i=0;i<size;i++) {
148  if (lookup[i]==0) ret.push_back(i);
149  }
150 
151  return ret;
152 
153  }

References in_range().

Referenced by casadi::Function::mapaccum(), and reduce_index_gen().

◆ ConstantSX_deserialize()

SXNode* casadi::ConstantSX_deserialize ( DeserializingStream s)
inline

Definition at line 489 of file constant_sx.hpp.

489  {
490  char type;
491  s.unpack("ConstantSX::type", type);
492  switch (type) {
493  case '1': return casadi_limits<SXElem>::one.get();
494  case '0': return casadi_limits<SXElem>::zero.get();
495  case 'r': {
496  double value;
497  s.unpack("ConstantSX::value", value);
498  return RealtypeSX::create(value);
499  }
500  case 'i': {
501  int value;
502  s.unpack("ConstantSX::value", value);
503  if (value==2) return casadi_limits<SXElem>::two.get();
504  return IntegerSX::create(value);
505  }
506  case 'n': return casadi_limits<SXElem>::nan.get();
507  case 'f': return casadi_limits<SXElem>::minus_inf.get();
508  case 'F': return casadi_limits<SXElem>::inf.get();
509  case 'm': return casadi_limits<SXElem>::minus_one.get();
510  default: casadi_error("ConstantSX::deserialize error");
511  }
512 }

References casadi::IntegerSX::create(), casadi::RealtypeSX::create(), and casadi::DeserializingStream::unpack().

◆ constpow()

double casadi::constpow ( double  x,
double  y 
)
inline

CasADi additions

Definition at line 272 of file calculus.hpp.

272 { return pow(x, y);}

◆ construct_nlpsol()

template<class X >
Function casadi::construct_nlpsol ( const std::string &  name,
const std::string &  solver,
const std::map< std::string, X > &  nlp,
const Dict opts 
)

Definition at line 47 of file nlpsol.cpp.

48  {
49 
50  if (get_from_dict(opts, "detect_simple_bounds", false)) {
51  X x = get_from_dict(nlp, "x", X(0, 1));
52  X p = get_from_dict(nlp, "p", X(0, 1));
53  X f = get_from_dict(nlp, "f", X(0));
54  X g = get_from_dict(nlp, "g", X(0, 1));
55 
56  if (g.size1()>0 || g.size2()>0) {
57  // Dimension checks
58  casadi_assert(g.is_dense() && g.is_vector(),
59  "Expected a dense vector 'g', but got " + g.dim(true) + ".");
60  }
61 
62  // Read dimensions
63  casadi_int ng = g.size1();
64  casadi_int nx = x.size1();
65 
66  // Get constraint Jacobian sparsity
67  Sparsity sp = jacobian_sparsity(g, x).T();
68 
69  // Reset result vector
70  std::vector<bool> is_simple(ng, true);
71 
72  // Check nonlinearity
73  std::vector<bool> is_nonlin = which_depends(g, x, 2, true);
74 
75  const casadi_int* row = sp.colind();
76  for (casadi_int i=0;i<ng;++i) {
77  // Check if each row of jac_g_x only depends on one column
78  bool single_dependency = row[i+1]-row[i]==1;
79  is_simple[i] = single_dependency && !is_nonlin[i];
80  }
81 
82  // Full-indices of all simple constraints
83  std::vector<casadi_int> sgi = boolvec_to_index(is_simple);
84  std::vector<casadi_int> gi = boolvec_to_index(boolvec_not(is_simple));
85  X g_bounds = g(sgi);
86 
87  // Detect f2(p)x+f1(p)==0
88  Function gf = Function("gf", std::vector<X>{x, p},
89  std::vector<X>{jtimes(g_bounds, x, X::ones(nx, 1)), g_bounds});
90  casadi_assert_dev(!gf.has_free());
91 
92  std::vector<casadi_int> target_x;
93  // Loop over all constraints
94  for (casadi_int i=0;i<ng;++i) {
95  // Only treat simple ones
96  if (!is_simple[i]) continue;
97  target_x.push_back(sp.row()[row[i]]);
98  }
99 
100  Dict nlpsol_opts = opts;
101  nlpsol_opts["detect_simple_bounds_is_simple"] = is_simple;
102  nlpsol_opts["detect_simple_bounds_parts"] = gf;
103  nlpsol_opts["detect_simple_bounds_target_x"] = target_x;
104 
105  if (opts.find("equality")!=opts.end()) {
106  std::vector<bool> equality = opts.find("equality")->second;
107  nlpsol_opts["equality"] = vector_select(equality, is_simple, true);
108  }
109 
110  std::map<std::string, X> nlpsol_nlp = nlp;
111  nlpsol_nlp["g"] = g(gi);
112  return nlpsol(name, solver, Nlpsol::create_oracle(nlpsol_nlp, opts), nlpsol_opts);
113  } else {
114  return nlpsol(name, solver, Nlpsol::create_oracle(nlp, opts), opts);
115  }
116  }
Function nlpsol(const std::string &name, const std::string &solver, const Function &nlp, const Dict &opts)
Definition: nlpsol.cpp:191
T get_from_dict(const std::map< std::string, T > &d, const std::string &key, const T &default_value)
std::vector< bool > boolvec_not(const std::vector< bool > &v)
Invert all entries.
std::vector< T > vector_select(const std::vector< T > &v, const std::vector< bool > &s, bool invert=false)
Select subset of vector.
std::vector< casadi_int > boolvec_to_index(const std::vector< bool > &v)

References boolvec_not(), boolvec_to_index(), casadi::Sparsity::colind(), casadi::Nlpsol::create_oracle(), get_from_dict(), casadi::Function::has_free(), nlpsol(), casadi::Sparsity::row(), casadi::Sparsity::T(), vector_select(), and X.

Referenced by nlpsol().

◆ Contraction() [1/2]

template<>
void casadi::Contraction ( const bvec_t a,
const bvec_t b,
bvec_t r 
)
inline

Definition at line 156 of file shared.hpp.

156  {
157  r|= a | b;
158  }

◆ Contraction() [2/2]

template<typename T >
void casadi::Contraction ( const T &  a,
const T &  b,
T &  r 
)

Definition at line 151 of file shared.hpp.

151  {
152  r+= a*b;
153  }

◆ copy()

template<typename T1 , typename T2 >
void casadi::copy ( const T1 *  x,
casadi_int  n,
T2 *  y 
)

Definition at line 63 of file alpaqa_problem.cpp.

63  {
64  casadi_int i;
65  if (y) {
66  if (x) {
67  for (i=0; i<n; ++i) *y++ = *x++;
68  } else {
69  for (i=0; i<n; ++i) *y++ = 0.;
70  }
71  }
72 }

Referenced by casadi::OptiNode::baked_copy(), casadi::AlpaqaProblem::eval_hess_L(), casadi::AlpaqaProblem::eval_hess_ψ(), and casadi::AlpaqaProblem::eval_jac_g().

◆ copy_vector() [1/2]

template<class S , class D >
void casadi::copy_vector ( const S *  s,
std::vector< D > &  d 
)

Definition at line 653 of file casadi_misc.hpp.

653  {
654  for (casadi_int i=0;i<d.size();++i) {
655  d[i] = static_cast<D>(s[i]);
656  }
657  }

References D.

◆ copy_vector() [2/2]

template<class S , class D >
void casadi::copy_vector ( const std::vector< S > &  s,
std::vector< D > &  d 
)

◆ create_directories()

bool casadi::create_directories ( const std::string &  path)

Definition at line 35 of file ghc.cpp.

35  {
36  return ghc::filesystem::create_directories(path);
37  }

References path().

Referenced by casadi_register_filesystem_ghc().

◆ cumsum()

template<typename T >
std::vector< T > casadi::cumsum ( const std::vector< T > &  values)

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

Definition at line 923 of file casadi_misc.hpp.

923  {
924  std::vector<T> ret(values.size());
925  T acc = 0;
926  for (casadi_int i=0;i<values.size();++i) {
927  acc+= values[i];
928  ret[i] = acc;
929  }
930  return ret;
931  }

References T.

◆ cumsum0()

template<typename T >
std::vector< T > casadi::cumsum0 ( const std::vector< T > &  values)

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

Definition at line 934 of file casadi_misc.hpp.

934  {
935  std::vector<T> ret(values.size()+1, 0);
936  T acc = 0;
937  for (casadi_int i=0;i<values.size();++i) {
938  acc+= values[i];
939  ret[i+1] = acc;
940  }
941  return ret;
942  }

References T.

Referenced by interpolant().

◆ dae_init_gen() [1/2]

CASADI_EXPORT Function casadi::dae_init_gen ( const MXDict dae,
const MXDict dae_red,
const std::string &  init_solver,
const DMDict init_strength = DMDict(),
const Dict init_solver_options = Dict() 
)
Parameters
[in]daeOriginal (unreduced) DAE structure
[in]dae_redReduced DAE (see dae_reduce_index)
[in]init_solverNLP solver plugin name for nlpsol used to construct an initial guess
[in]init_strengthInfluence the nature of the NLP Structure with keys x_impl, dx_impl, z corresponding to inputs of init_gen Each key maps to a DM that should match the variable size corresponding to that key. For each variable the meaning of the corresponding DM value is as follows: When >=0, indicates that the provided initial guess is used in a quadratic penalty (value used as weight) When -1, indicates that the provided initial guess must be observed (simple bound on variable)
[in]init_solver_optionsNLP solver options to be passed to nlpsol
Returns
init_gen A function to generate a consistent initial guess that can be used to pass to an integrator constructed from a semi explict reduced DAE Inputs:
  • x_impl, dx_impl, z: initial guesses in the original DAE space
  • p: parameters
  • t: time Outputs:
  • x0, z0: (semi explicit) integrator states and algebraic variables; typically used as input for integrators
See also
dae_reduce_index

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

Definition at line 1221 of file integration_tools.cpp.

1222  {
1223  return init_gen(dae, dae_red, init_solver, init_strength, init_solver_options);
1224 }
Function init_gen(const std::map< std::string, X > &dae, const std::map< std::string, X > &dae_red, const std::string &init_solver, const DMDict &init_strength, const Dict &init_solver_options)

References init_gen().

◆ dae_init_gen() [2/2]

CASADI_EXPORT Function casadi::dae_init_gen ( const SXDict dae,
const SXDict dae_red,
const std::string &  init_solver,
const DMDict init_strength,
const Dict init_solver_options 
)
Parameters
[in]daeOriginal (unreduced) DAE structure
[in]dae_redReduced DAE (see dae_reduce_index)
[in]init_solverNLP solver plugin name for nlpsol used to construct an initial guess
[in]init_strengthInfluence the nature of the NLP Structure with keys x_impl, dx_impl, z corresponding to inputs of init_gen Each key maps to a DM that should match the variable size corresponding to that key. For each variable the meaning of the corresponding DM value is as follows: When >=0, indicates that the provided initial guess is used in a quadratic penalty (value used as weight) When -1, indicates that the provided initial guess must be observed (simple bound on variable)
[in]init_solver_optionsNLP solver options to be passed to nlpsol
Returns
init_gen A function to generate a consistent initial guess that can be used to pass to an integrator constructed from a semi explict reduced DAE Inputs:
  • x_impl, dx_impl, z: initial guesses in the original DAE space
  • p: parameters
  • t: time Outputs:
  • x0, z0: (semi explicit) integrator states and algebraic variables; typically used as input for integrators
See also
dae_reduce_index

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

Definition at line 1226 of file integration_tools.cpp.

1227  {
1228  return init_gen(dae, dae_red, init_solver, init_strength, init_solver_options);
1229 }

References init_gen().

◆ dae_map_semi_expl() [1/2]

CASADI_EXPORT MXDict casadi::dae_map_semi_expl ( const MXDict dae,
const MXDict dae_red,
Function state_to_orig,
Function phi 
)
Parameters
[in]daeOriginal (unreduced) DAE structure
[in]dae_redReduced DAE (see dae_reduce_index)
[out]state_to_origA mapping of integrator (semi explicit) states to states of the original DAE
[out]phiA function to compute the invariants of the reduced DAE Inputs:
  • x and z: (semi explicit) integrator states; typically integrator outputs xf and zf
  • p: parameters
  • t: time
Returns
Semi explicit DAE dictionary, suitable to pass to a CasADi integrator
See also
dae_reduce_index

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

Definition at line 1211 of file integration_tools.cpp.

1212  {
1213  return map_semi_expl(dae, dae_red, state_to_orig, phi);
1214 }
std::map< std::string, X > map_semi_expl(const std::map< std::string, X > &dae, const std::map< std::string, X > &dae_red, Function &state_to_orig, Function &phi)

References map_semi_expl().

◆ dae_map_semi_expl() [2/2]

CASADI_EXPORT SXDict casadi::dae_map_semi_expl ( const SXDict dae,
const SXDict dae_red,
Function state_to_orig,
Function phi 
)
Parameters
[in]daeOriginal (unreduced) DAE structure
[in]dae_redReduced DAE (see dae_reduce_index)
[out]state_to_origA mapping of integrator (semi explicit) states to states of the original DAE
[out]phiA function to compute the invariants of the reduced DAE Inputs:
  • x and z: (semi explicit) integrator states; typically integrator outputs xf and zf
  • p: parameters
  • t: time
Returns
Semi explicit DAE dictionary, suitable to pass to a CasADi integrator
See also
dae_reduce_index

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

Definition at line 1216 of file integration_tools.cpp.

1217  {
1218  return map_semi_expl(dae, dae_red, state_to_orig, phi);
1219 }

References map_semi_expl().

◆ dae_reduce_index() [1/2]

CASADI_EXPORT MXDict casadi::dae_reduce_index ( const MXDict dae,
Dict stats,
const Dict opts = {} 
)

Index reduction leads to a new set of variables and equations.

In the process, a set of constraints (algebraic equations or derivatives) a.k.a invariants is constructed that are invariant to the problem: whenever an initial point satisfies these constraints, the boundary-value-problem outcome will keep satisfying those constraints automatically, even though they are not part of the reduced DAE.

For any practical numerical integration method, there will be numerical drift away from satisfaction of those constraints. In other words, you will see the value of invariants slowly moving away from original zero.

A classic mitigation technique is Baumgarte stabilization: you add these invariants to the reduced DAE as a correction term that acts in a way to make small (numerical) perturbations to the invariants decay to the origin as a dampened linear system.

in which a certain set of constraints (algebraic equations or derivatives) has been dropped in favour of

Parameters
daeExpression dictionary describing the DAE

Each value must be a dense column vector.

keys:

  • x_impl: symbol for implicit differential states
  • dx_impl: symbol for implicit differential state derivatives
  • z: symbol for algebraic variables
  • alg: expression for algebraic equations
  • t: symbol for time
  • p: symbol for parameters
    Parameters
    optsOption dictionary
    'baumgarte_pole': double Poles (inverse time constants) of the Baumgarte invariant correction term. Must be <0 to dampen out perturbations 0 (default) amounts to no correction. Corresponds to -gamma of equation (1.5) in Ascher, Uri M., Hongsheng Chin, and Sebastian Reich. "Stabilization of DAEs and invariant manifolds." Numerische Mathematik 67.2 (1994): 131-149.
Parameters
statsStatistics
Returns
Expression dictionary describing the reduced DAE

In addition the fields allowed in the input DAE, the following keys occur:

  • x: symbol for explicit differential states
  • ode: expression for right-hand-side of explicit differential states
  • I: expression for invariants

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

Definition at line 1067 of file integration_tools.cpp.

1067  {
1068  return reduce_index_gen(dae, stats, opts);
1069 }
const std::map< std::string, X > reduce_index_gen(const std::map< std::string, X > &dae, Dict &stats, const Dict &opts)

References reduce_index_gen().

◆ dae_reduce_index() [2/2]

CASADI_EXPORT SXDict casadi::dae_reduce_index ( const SXDict dae,
Dict stats,
const Dict opts 
)

Index reduction leads to a new set of variables and equations.

In the process, a set of constraints (algebraic equations or derivatives) a.k.a invariants is constructed that are invariant to the problem: whenever an initial point satisfies these constraints, the boundary-value-problem outcome will keep satisfying those constraints automatically, even though they are not part of the reduced DAE.

For any practical numerical integration method, there will be numerical drift away from satisfaction of those constraints. In other words, you will see the value of invariants slowly moving away from original zero.

A classic mitigation technique is Baumgarte stabilization: you add these invariants to the reduced DAE as a correction term that acts in a way to make small (numerical) perturbations to the invariants decay to the origin as a dampened linear system.

in which a certain set of constraints (algebraic equations or derivatives) has been dropped in favour of

Parameters
daeExpression dictionary describing the DAE

Each value must be a dense column vector.

keys:

  • x_impl: symbol for implicit differential states
  • dx_impl: symbol for implicit differential state derivatives
  • z: symbol for algebraic variables
  • alg: expression for algebraic equations
  • t: symbol for time
  • p: symbol for parameters
    Parameters
    optsOption dictionary
    'baumgarte_pole': double Poles (inverse time constants) of the Baumgarte invariant correction term. Must be <0 to dampen out perturbations 0 (default) amounts to no correction. Corresponds to -gamma of equation (1.5) in Ascher, Uri M., Hongsheng Chin, and Sebastian Reich. "Stabilization of DAEs and invariant manifolds." Numerische Mathematik 67.2 (1994): 131-149.
Parameters
statsStatistics
Returns
Expression dictionary describing the reduced DAE

In addition the fields allowed in the input DAE, the following keys occur:

  • x: symbol for explicit differential states
  • ode: expression for right-hand-side of explicit differential states
  • I: expression for invariants

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

Definition at line 1071 of file integration_tools.cpp.

1071  {
1072  return reduce_index_gen(dae, stats, opts);
1073 }

References reduce_index_gen().

◆ dense_copy_stride()

void casadi::dense_copy_stride ( casadi_int  n,
casadi_int  m,
const double *  A,
double *  B,
casadi_int  strideA,
casadi_int  strideB 
)
inline

Definition at line 73 of file slicot_la.hpp.

74  {
75  for (casadi_int i=0;i<n;++i) {
76  for (casadi_int j=0;j<m;++j) {
77  B[strideB*i + j] = A[strideA*i+j];
78  }
79  }
80  }

Referenced by casadi::SlicotDple::eval().

◆ dense_copy_t_stride()

void casadi::dense_copy_t_stride ( casadi_int  n,
casadi_int  m,
const double *  A,
double *  B,
casadi_int  strideA,
casadi_int  strideB 
)
inline

Definition at line 82 of file slicot_la.hpp.

83  {
84  for (casadi_int i=0;i<n;++i) {
85  for (casadi_int j=0;j<m;++j) {
86  B[strideB*j + i] = A[strideA*i+j];
87  }
88  }
89  }

Referenced by casadi::SlicotDple::eval().

◆ dense_kron_stride()

void casadi::dense_kron_stride ( casadi_int  n,
casadi_int  m,
const double *  A,
const double *  B,
double *  C,
casadi_int  strideA,
casadi_int  strideB,
casadi_int  strideC 
)
inline

Definition at line 32 of file slicot_la.hpp.

34  {
35  for (casadi_int i=0;i<n;++i) {
36  for (casadi_int j=0;j<n;++j) {
37  C[strideC*i + j] = -A[strideA*(i/m) + (j/m)]*B[strideB*(i%m) + (j%m)];
38  }
39  }
40  }

References C.

Referenced by casadi::SlicotDple::eval().

◆ dense_mul_nn()

void casadi::dense_mul_nn ( casadi_int  n,
casadi_int  m,
casadi_int  l,
const double *  A,
const double *  B,
double *  C 
)
inline

Definition at line 93 of file slicot_la.hpp.

94  {
95  dense_mul_nn_stride(n, m, l, A, B, C, n, l, n);
96  }
void dense_mul_nn_stride(casadi_int n, casadi_int m, casadi_int l, const double *A, const double *B, double *C, casadi_int strideA, casadi_int strideB, casadi_int strideC)
Definition: slicot_la.hpp:61

References C, and dense_mul_nn_stride().

Referenced by casadi::SlicotDple::eval().

◆ dense_mul_nn2()

void casadi::dense_mul_nn2 ( casadi_int  n,
casadi_int  m,
casadi_int  l,
const double *  A,
const double *  B,
double *  C 
)
inline

Definition at line 100 of file slicot_la.hpp.

101  {
102  for (casadi_int i=0;i<n;++i) {
103  for (casadi_int j=0;j<m;++j) {
104  for (casadi_int k=0;k<l;++k) {
105  C[i + n*j] += A[i + n*k]*B[k + l*j];
106  }
107  }
108  }
109  //dense_mul_nn_stride(m, n, l, B, A, C, l, n, n);
110  }

References C.

◆ dense_mul_nn_stride()

void casadi::dense_mul_nn_stride ( casadi_int  n,
casadi_int  m,
casadi_int  l,
const double *  A,
const double *  B,
double *  C,
casadi_int  strideA,
casadi_int  strideB,
casadi_int  strideC 
)
inline

Definition at line 61 of file slicot_la.hpp.

63  {
64  for (casadi_int i=0;i<n;++i) {
65  for (casadi_int j=0;j<m;++j) {
66  for (casadi_int k=0;k<l;++k) {
67  C[strideC*i + j] += A[strideA*i + k]*B[strideB*k + j];
68  }
69  }
70  }
71  }

References C.

Referenced by dense_mul_nn(), and casadi::SlicotDple::eval().

◆ dense_mul_nt()

void casadi::dense_mul_nt ( casadi_int  n,
casadi_int  m,
casadi_int  l,
const double *  A,
const double *  B,
double *  C 
)
inline

Definition at line 56 of file slicot_la.hpp.

57  {
58  dense_mul_nt_stride(n, m, l, A, B, C, n, m, n);
59  }
void dense_mul_nt_stride(casadi_int n, casadi_int m, casadi_int l, const double *A, const double *B, double *C, casadi_int strideA, casadi_int strideB, casadi_int strideC)
Definition: slicot_la.hpp:42

References C, and dense_mul_nt_stride().

Referenced by casadi::SlicotDple::eval().

◆ dense_mul_nt_stride()

void casadi::dense_mul_nt_stride ( casadi_int  n,
casadi_int  m,
casadi_int  l,
const double *  A,
const double *  B,
double *  C,
casadi_int  strideA,
casadi_int  strideB,
casadi_int  strideC 
)
inline

Definition at line 42 of file slicot_la.hpp.

44  {
45  for (casadi_int i=0;i<n;++i) {
46  for (casadi_int j=0;j<m;++j) {
47  for (casadi_int k=0;k<l;++k) {
48  C[strideC*i + j] += A[strideA*i + k]*B[strideB*j + k];
49  }
50  }
51  }
52  }

References C.

Referenced by dense_mul_nt(), and casadi::SlicotDple::eval().

◆ dense_mul_tn()

void casadi::dense_mul_tn ( casadi_int  n,
casadi_int  m,
casadi_int  l,
const double *  A,
const double *  B,
double *  C 
)
inline

Definition at line 114 of file slicot_la.hpp.

115  {
116  for (casadi_int i=0;i<n;++i) {
117  for (casadi_int j=0;j<m;++j) {
118  for (casadi_int k=0;k<l;++k) {
119  C[n*i + j] += A[l*k + i]*B[l*k + j];
120  }
121  }
122  }
123  }

References C.

Referenced by casadi::SlicotDple::eval().

◆ dependent_definition()

CASADI_EXPORT OutputCategory casadi::dependent_definition ( Category  cat)

Definition at line 256 of file dae_builder_internal.cpp.

256  {
257  switch (cat) {
258  case Category::D:
259  return OutputCategory::DDEF;
260  case Category::W:
261  return OutputCategory::WDEF;
262  default:
263  break;
264  }
265  casadi_error("No dependent definition category for: " + to_string(cat));
266 }
std::string to_string(TypeFmi2 v)

References D, DDEF, to_string(), W, and WDEF.

Referenced by casadi::DaeBuilderInternal::eliminate(), and casadi::DaeBuilderInternal::sort().

◆ description()

CASADI_EXPORT std::string casadi::description ( Category  v)

Get description

Definition at line 206 of file dae_builder_internal.cpp.

206  {
207  switch (v) {
208  case Category::T: return "independent variable";
209  case Category::P: return "parameter";
210  case Category::U: return "control";
211  case Category::X: return "differential state";
212  case Category::Z: return "algebraic variable";
213  case Category::Q: return "quadrature state";
214  case Category::C: return "constant";
215  case Category::D: return "dependent parameter";
216  case Category::W: return "dependent variable";
217  case Category::CALCULATED: return "calculated variable";
218  default: break;
219  }
220  return "";
221 }

References C, CALCULATED, D, P, Q, T, U, W, X, and Z.

Referenced by casadi::DaeBuilderInternal::add(), casadi::OptiNode::describe(), casadi::DaeBuilderInternal::disp(), casadi::OptiNode::g_describe(), casadi::DaeBuilderInternal::generate_model_description(), casadi::DaeBuilderInternal::import_model_variables(), and casadi::OptiNode::x_describe().

◆ detect_bounds_callback()

int casadi::detect_bounds_callback ( const double **  arg,
double **  res,
casadi_int *  iw,
double *  w,
void *  callback_data 
)

Definition at line 576 of file nlpsol.cpp.

577  {
578  Function* f = static_cast<Function*>(callback_data);
579  return f->operator()(arg, res, iw, w);
580  }

◆ detect_simple_bounds() [1/2]

CASADI_EXPORT void casadi::detect_simple_bounds ( const MX x,
const MX p,
const MX g,
const MX lbg,
const MX ubg,
std::vector< casadi_int > &  gi,
MX lbx,
MX ubx,
Function lam_forward,
Function lam_backward 
)

Definition at line 227 of file nlp_tools.cpp.

232  {
233  detect_simple_bounds_gen(x, p, g, lbg, ubg,
234  gi, lbx, ubx, lam_forward, lam_backward);
235 }
void detect_simple_bounds_gen(const T &x, const T &p, const T &g, const T &lbg, const T &ubg, std::vector< casadi_int > &gi, T &lbx, T &ubx, Function &lam_forward, Function &lam_backward)
Definition: nlp_tools.cpp:33

References detect_simple_bounds_gen().

◆ detect_simple_bounds() [2/2]

CASADI_EXPORT void casadi::detect_simple_bounds ( const SX xX,
const SX p,
const SX g,
const SX lbg,
const SX ubg,
std::vector< casadi_int > &  gi,
SX lbx,
SX ubx,
Function lam_forward,
Function lam_backward 
)

Given parametric constraints:

*   subject to lbg(p) <= g(x,p) <= ubg(p)
* 

Returns an equivalent set

*   subject to  lbg(p)(gi) <= g(x,p)(gi) <= ubg(p)(gi)
*               lbx(p) <= x                 <= ubx(p)
* 
Parameters
[out]lam_forward(lam_g,p)->(lam_sg,lam_x)
[out]lam_backward(lam_sg,lam_x,p)->(lam_g)

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

Definition at line 217 of file nlp_tools.cpp.

222  {
223  detect_simple_bounds_gen(x, p, g, lbg, ubg,
224  gi, lbx, ubx, lam_forward, lam_backward);
225 }

References detect_simple_bounds_gen().

◆ detect_simple_bounds_gen()

template<class T >
void casadi::detect_simple_bounds_gen ( const T &  x,
const T &  p,
const T &  g,
const T &  lbg,
const T &  ubg,
std::vector< casadi_int > &  gi,
T &  lbx,
T &  ubx,
Function lam_forward,
Function lam_backward 
)

Definition at line 33 of file nlp_tools.cpp.

38  {
39 
40  // Read dimensions
41  casadi_int ng = g.size1();
42  casadi_int nx = x.size1();
43 
44  casadi_assert(lbg.size1()==ng, "Dimension mismatch");
45  casadi_assert(ubg.size1()==ng, "Dimension mismatch");
46  casadi_assert(g.is_column(), "Dimension mismatch");
47  casadi_assert(lbg.is_column(), "Dimension mismatch");
48  casadi_assert(ubg.is_column(), "Dimension mismatch");
49  casadi_assert(x.is_column(), "Dimension mismatch");
50 
51  // Get constraint Jacobian sparsity
52  Function temp("temp_detect_simple_bounds_gen", {x, p}, {g});
53  Sparsity sp = temp.jac_sparsity().at(0);
54  Sparsity spT = sp.T();
55 
56  // Reset result vector
57  std::vector<bool> is_simple(ng, true);
58 
59  // Check nonlinearity
60  std::vector<bool> is_nonlin = which_depends(g, x, 2, true);
61 
62  const casadi_int* row = spT.colind();
63  for (casadi_int i=0;i<ng;++i) {
64  // Check if each row of jac_g_x only depends on one column
65  bool single_dependency = row[i+1]-row[i]==1;
66  is_simple[i] = single_dependency && !is_nonlin[i];
67  }
68 
69  // Full-indices of all simple constraints
70  std::vector<casadi_int> sgi = boolvec_to_index(is_simple);
71  gi = boolvec_to_index(boolvec_not(is_simple));
72  T g_bounds = g(sgi);
73  std::vector<casadi_int> sgi_to_sgsi = lookupvector(sgi, ng);
74 
75  // Detect f2(p)x+f1(p)==0
76  Function gf = Function("gf", std::vector<T>{x, p},
77  std::vector<T>{g_bounds, jtimes(g_bounds, x, T::ones(nx, 1))});
78 
79  std::vector<T> res;
80  gf.call(std::vector<T>{0, p}, res, true, false);
81  T f1 = res[0];
82  T f2 = res[1];
83 
84  T f2_inv = 1/f2;
85 
86  T lb_pre = (lbg(sgi)-f1)*f2_inv;
87  T ub_pre = (ubg(sgi)-f1)*f2_inv;
88 
89  T pos_f2 = f2>=0;
90  T neg_f2 = !pos_f2;
91 
92  T lb = lb_pre*pos_f2+ub_pre*neg_f2;
93  T ub = ub_pre*pos_f2+lb_pre*neg_f2;
94 
95 
96 
97  // Start without simple bounds
98  lbx = -T::inf(nx);
99  ubx = T::inf(nx);
100 
101  const casadi_int* xi = spT.row();
102 
103 
104  /* We will process in groups
105  * (=collection of bounds that have been re-defined a certain number of times)
106  * instead of element-wise to keep the MX graph size minimal.
107  */
108 
109  std::vector< std::vector<casadi_int> > sgsi_groups, sgi_groups, sxi_groups;
110  casadi_int n_groups = 0;
111 
112  // How often has a certain variable been encountered?
113  std::vector<casadi_int> group_count(nx);
114 
115  // Loop over all constraints
116  for (casadi_int i=0;i<ng;++i) {
117  // Only treat simple ones
118  if (!is_simple[i]) continue;
119 
120  casadi_int j = xi[row[i]];
121  casadi_int& k = group_count[j];
122  // Grow as needed
123  if (k==n_groups) {
124  sgsi_groups.emplace_back();
125  sgi_groups.emplace_back();
126  sxi_groups.emplace_back();
127  n_groups++;
128  }
129  sxi_groups[k].push_back(j);
130  sgi_groups[k].push_back(i);
131  sgsi_groups[k].push_back(sgi_to_sgsi[i]);
132  k++;
133  }
134 
135  casadi_assert(n_groups>=1, "mismatch");
136  // Take min/max group-wise to determine simple bounds
137  for (casadi_int i=0;i<n_groups;++i) {
138  lbx(sxi_groups[i]) = fmax(lbx(sxi_groups[i]), lb(sgsi_groups[i]));
139  ubx(sxi_groups[i]) = fmin(ubx(sxi_groups[i]), ub(sgsi_groups[i]));
140  }
141 
142 
143  // Choose the first group as reference
144  const std::vector<casadi_int>& sxi_ref = sxi_groups[0];
145  // Indices into the first group that reproduce the contents of other groups
146  std::vector< std::vector<casadi_int> > xsub(n_groups);
147  // Identity map for first entry of xsub
148  xsub[0] = range(sxi_ref.size());
149 
150  // Computations for other xsub entries
151  std::vector<casadi_int> lookup = lookupvector(sxi_ref, nx);
152  for (casadi_int i=1;i<n_groups;++i) {
153  const std::vector<casadi_int>& sxi = sxi_groups[i];
154  for (casadi_int j=0;j<sxi.size();++j) {
155  xsub[i].push_back(lookup[sxi[j]]);
156  }
157  }
158 
159  // Determine multiplier maps
160 
161  // Symbols
162  T lam_g_forward = T::sym("lam_g", ng);
163  T lam_sg_backward = T::sym("lam_g", gi.size());
164  T lam_x_backward = T::sym("lam_x", nx);
165 
166 
167  T lam_sg_forward = lam_g_forward(sgi); // NOLINT(cppcoreguidelines-slicing)
168  T lam_x_forward = T::zeros(nx, 1);
169  T lam_g_backward = T::zeros(ng, 1);
170  lam_g_backward(gi) = lam_sg_backward;
171 
172  // Comparison expression per group
173  std::vector<T> lcomp, ucomp;
174  for (casadi_int i=0;i<n_groups;++i) {
175  lcomp.push_back(lbx(sxi_groups[i])==lb(sgsi_groups[i]));
176  ucomp.push_back(ubx(sxi_groups[i])==ub(sgsi_groups[i]));
177  }
178 
179  // How many lb/ub are active?
180  T count_lb = T::zeros(nx);
181  T count_ub = T::zeros(nx);
182  for (casadi_int i=0;i<n_groups;++i) {
183  count_lb(sxi_groups[i]) += lcomp[i];
184  count_ub(sxi_groups[i]) += ucomp[i];
185  }
186 
187  // Compute lam_x from lam_g
188  for (casadi_int i=0;i<n_groups;++i) {
189  T l = lam_sg_forward(sgsi_groups[i]); // NOLINT(cppcoreguidelines-slicing)
190  T lt = (l<0);
191  T gt = !lt;
192  lam_x_forward(sxi_groups[i]) += l*(lt*lcomp[i]+gt*ucomp[i]);
193  }
194 
195  // Compute lam_g from lam_x
196  T l = lam_x_backward(sxi_ref); // NOLINT(cppcoreguidelines-slicing)
197  T lt = (l<0);
198  T gt = !lt;
199  T lam_xl = l*lt/count_lb(sxi_ref);
200  T lam_xu = l*gt/count_ub(sxi_ref);
201 
202  for (casadi_int i=0;i<n_groups;++i) {
203  lam_g_backward(sgi_groups[i]) = lam_xl(xsub[i])*lcomp[i]+lam_xu(xsub[i])*ucomp[i];
204  }
205 
206  // Construct Functions for mappings
207  lam_forward = Function("lam_forward",
208  {lam_g_forward, p}, {lam_g_forward(gi), lam_x_forward},// NOLINT(cppcoreguidelines-slicing)
209  {"lam_g", "p"}, {"lam_sg", "lam_x"});
210  casadi_assert_dev(!lam_forward.has_free());
211  lam_backward = Function("lam_backward",
212  {lam_sg_backward, lam_x_backward, p}, {lam_g_backward},
213  {"lam_sg", "lam_x", "p"}, {"lam_g"});
214  casadi_assert_dev(!lam_backward.has_free());
215  }
std::vector< casadi_int > range(casadi_int start, casadi_int stop, casadi_int step, casadi_int len)
Range function.
std::vector< casadi_int > lookupvector(const std::vector< casadi_int > &v, casadi_int size)
Returns a vector for quickly looking up entries of supplied list.

References boolvec_not(), boolvec_to_index(), casadi::Function::call(), casadi::Sparsity::colind(), casadi::Function::has_free(), lookupvector(), range(), casadi::Sparsity::row(), T, and casadi::Sparsity::T().

Referenced by detect_simple_bounds().

◆ diff()

template<typename T >
std::vector< T > casadi::diff ( const std::vector< T > &  values)

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

Definition at line 945 of file casadi_misc.hpp.

945  {
946  casadi_assert(!values.empty(), "Array must be non-empty");
947  std::vector<T> ret(values.size()-1);
948  for (casadi_int i=0;i<values.size()-1;++i) {
949  ret[i] = values[i+1]-values[i];
950  }
951  return ret;
952  }

Referenced by casadi::FunctionInternal::get_jac_sparsity_hierarchical(), casadi::FunctionInternal::get_jac_sparsity_hierarchical_symm(), and casadi::SuperscsInterface::init_mem().

◆ do_inline()

MX casadi::do_inline ( const MX x,
const std::vector< std::vector< double > > &  knots,
const MX coeffs,
casadi_int  m,
const std::vector< casadi_int > &  degree,
const std::vector< casadi_int > &  lookup_mode 
)

Definition at line 211 of file bspline.cpp.

216  {
217 
218  casadi_int batch_x = x.size2();
219 
220  // Number of grid points
221  casadi_int N = knots.size();
222  std::vector<MX> xs = vertsplit(x);
223 
224  // Compute De Boor vector in each direction
225  std::vector<MX> starts(N);
226  std::vector< std::vector<MX> > boors(N);
227  for (casadi_int i=0;i<N;++i) {
228  MX boor;
229  get_boor(xs[i], knots[i], degree[i], lookup_mode[i], starts[i], boor);
230  boors[i] = horzsplit(boor.T());
231  }
232 
233  // Compute strides
234  std::vector<casadi_int> strides = {m};
235  for (casadi_int i=0;i<N-1;++i) {
236  strides.push_back(strides.back()*(knots[i].size()-degree[i]-1));
237  }
238 
239  // Start index of subtensor: row vector
240  MX start = mtimes(DM(strides).T(), vertcat(starts));
241 
242  // Elements of subtensor
243  DM core = DM(range(m));
244  for (casadi_int i=0;i<N;++i) {
245  casadi_int n = degree[i]+1;
246  core = vec(repmat(core, 1, n)+repmat(strides[i]*DM(range(n)).T(), core.size1(), 1));
247  }
248 
249  std::vector<MX> res;
250 
251  for (casadi_int k=0;k<batch_x;++k) {
252 
253  // Flattened subtensor of coefficients
254  MX c = reshape(coeffs(start(k)+core), m, -1);
255 
256  // Compute outer product of De Boor vectors
257  MX boor = 1;
258  for (casadi_int i=0;i<N;++i) {
259  boor = vec(mtimes(boor, boors[i][k].T()));
260  }
261 
262  res.push_back(mtimes(c, boor));
263  }
264 
265  return horzcat(res);
266  }
void get_boor(const MX &x, const MX &knots, casadi_int degree, casadi_int lookup_mode, MX &start, MX &boor)
Definition: bspline.cpp:177

References get_boor(), range(), casadi::GenericMatrix< MatType >::size1(), casadi::GenericMatrix< MatType >::size2(), T, and casadi::MX::T().

Referenced by casadi::Interpolant::construct(), casadi::BSplineInterpolant::construct_graph(), casadi::BSplineParametric::create(), and casadi::BSpline::create().

◆ doc_archiver()

CASADI_EXPORT std::string casadi::doc_archiver ( const std::string &  name)

Definition at line 46 of file archiver.cpp.

46  {
47  return Archiver::getPlugin(name).doc;
48  }

References casadi::PluginInterface< Archiver >::getPlugin().

◆ doc_filesystem()

CASADI_EXPORT std::string casadi::doc_filesystem ( const std::string &  name)

Definition at line 100 of file filesystem.cpp.

100  {
101  return Filesystem::getPlugin(name).doc;
102 }

References casadi::PluginInterface< Filesystem >::getPlugin().

◆ doc_linsol()

CASADI_EXPORT std::string casadi::doc_linsol ( const std::string &  name)

Definition at line 214 of file linsol.cpp.

214  {
215  return Linsol::doc(name);
216  }

References casadi::Linsol::doc().

◆ dot()

template<typename T >
T casadi::dot ( const std::vector< T > &  a,
const std::vector< T > &  b 
)

◆ dummy_signal()

void casadi::dummy_signal ( void *  user_data)

Definition at line 1022 of file fatrop_conic_interface.cpp.

1022  {
1023 
1024  }

◆ einstein_eval()

template<typename T >
void casadi::einstein_eval ( casadi_int  n_iter,
const std::vector< casadi_int > &  iter_dims,
const std::vector< casadi_int > &  strides_a,
const std::vector< casadi_int > &  strides_b,
const std::vector< casadi_int > &  strides_c,
const T *  a_in,
const T *  b_in,
T *  c_in 
)

Definition at line 161 of file shared.hpp.

164  {
165 
166  if (!n_iter) return;
167 
168  casadi_int iter_dim1 = 1, iter_dim2 = 1, iter_dim3 = 1;
169 
170  casadi_int n = iter_dims.size();
171 
172  casadi_int stridea1=0, strideb1=0, stridec1=0;
173  casadi_int stridea2=0, strideb2=0, stridec2=0;
174  casadi_int stridea3=0, strideb3=0, stridec3=0;
175  if (n>0) {
176  iter_dim3 = iter_dims[n-1];
177  stridea3 = strides_a[n];
178  strideb3 = strides_b[n];
179  stridec3 = strides_c[n];
180  }
181  if (n>1) {
182  iter_dim2 = iter_dims[n-2];
183  stridea2 = strides_a[n-1];
184  strideb2 = strides_b[n-1];
185  stridec2 = strides_c[n-1];
186  }
187  if (n>2) {
188  iter_dim1 = iter_dims[n-3];
189  stridea1 = strides_a[n-2];
190  strideb1 = strides_b[n-2];
191  stridec1 = strides_c[n-2];
192  }
193 
194 
195  const casadi_int* ptr_iter_dims = get_ptr(iter_dims);
196 
197  const casadi_int *ptr_strides_a = get_ptr(strides_a)+1;
198  const casadi_int *ptr_strides_b = get_ptr(strides_b)+1;
199  const casadi_int *ptr_strides_c = get_ptr(strides_c)+1;
200 
201  // Data pointers
202  const T* a_perm = a_in+strides_a[0];
203  const T* b_perm = b_in+strides_b[0];
204  T* c_perm = c_in+strides_c[0];
205 
206  n_iter/= iter_dim1*iter_dim2*iter_dim3;
207 
208  // Main loop
209  for (casadi_int i=0;i<n_iter;++i) {
210 
211  // Data pointers
212  const T* a = a_perm;
213  const T* b = b_perm;
214  T* c = c_perm;
215 
216  // Construct indices
217  casadi_int sub = i;
218  for (casadi_int j=0;j<n-3;++j) {
219  casadi_int ind = sub % ptr_iter_dims[j];
220  a+= ptr_strides_a[j]*ind;
221  b+= ptr_strides_b[j]*ind;
222  c+= ptr_strides_c[j]*ind;
223  sub/= ptr_iter_dims[j];
224  }
225 
226  const T* a1 = a;
227  const T* b1 = b;
228  T* c1 = c;
229  for (casadi_int i1=0;i1<iter_dim1;++i1) {
230  const T* a2 = a1;
231  const T* b2 = b1;
232  T* c2 = c1;
233  for (casadi_int i2=0;i2<iter_dim2;++i2) {
234  const T* a3 = a2;
235  const T* b3 = b2;
236  T* c3 = c2;
237  for (casadi_int i3=0;i3<iter_dim3;++i3) {
238  // Perform the actual multiplication
239  Contraction<T>(*a3, *b3, *c3);
240 
241  a3+= stridea3;
242  b3+= strideb3;
243  c3+= stridec3;
244  }
245  a2+= stridea2;
246  b2+= strideb2;
247  c2+= stridec2;
248  }
249  a1+= stridea1;
250  b1+= strideb1;
251  c1+= stridec1;
252  }
253 
254 
255  }
256 
257  }

References get_ptr(), and T.

Referenced by casadi::Matrix< Scalar >::einstein(), and casadi::Einstein::eval_gen().

◆ einstein_process()

template<typename T >
casadi_int casadi::einstein_process ( const T &  A,
const T &  B,
const T &  C,
const std::vector< casadi_int > &  dim_a,
const std::vector< casadi_int > &  dim_b,
const std::vector< casadi_int > &  dim_c,
const std::vector< casadi_int > &  a,
const std::vector< casadi_int > &  b,
const std::vector< casadi_int > &  c,
std::vector< casadi_int > &  iter_dims,
std::vector< casadi_int > &  strides_a,
std::vector< casadi_int > &  strides_b,
std::vector< casadi_int > &  strides_c 
)

Definition at line 35 of file shared.hpp.

40  {
41 
42  casadi_assert_dev(A.is_vector() && A.is_dense());
43  casadi_assert_dev(B.is_vector() && B.is_dense());
44  casadi_assert_dev(C.is_vector() && C.is_dense());
45 
46  // Dimension check
47  casadi_assert_dev(A.numel()==product(dim_a));
48  casadi_assert_dev(B.numel()==product(dim_b));
49  casadi_assert_dev(C.numel()==product(dim_c));
50 
51  casadi_assert_dev(dim_a.size()==a.size());
52  casadi_assert_dev(dim_b.size()==b.size());
53 
54  casadi_assert_dev(c.size()<=a.size()+b.size());
55 
56  std::map<casadi_int, casadi_int> dim_map;
57 
58  // Check if shared nodes dimensions match up
59  for (casadi_int i=0;i<a.size();++i) {
60  casadi_int ai = a[i];
61  if (ai>=0) continue;
62  auto al = dim_map.find(ai);
63  if (al==dim_map.end()) {
64  dim_map[ai] = dim_a[i];
65  } else {
66  casadi_assert_dev(al->second==dim_a[i]);
67  }
68  }
69 
70  for (casadi_int i=0;i<b.size();++i) {
71  casadi_int bi = b[i];
72  if (bi>=0) continue;
73  auto bl = dim_map.find(bi);
74  if (bl==dim_map.end()) {
75  dim_map[bi] = dim_b[i];
76  } else {
77  casadi_assert_dev(bl->second==dim_b[i]);
78  }
79  }
80 
81  for (casadi_int i=0;i<c.size();++i) {
82  casadi_int ci = c[i];
83  if (ci>=0) continue;
84  auto cl = dim_map.find(ci);
85  if (cl==dim_map.end()) {
86  dim_map[ci] = dim_c[i];
87  } else {
88  casadi_assert_dev(cl->second==dim_c[i]);
89  }
90  }
91 
92  std::vector< std::pair<casadi_int, casadi_int> > dim_map_pair;
93  for (const auto & i : dim_map) dim_map_pair.push_back(i);
94 
95  std::sort(dim_map_pair.begin(), dim_map_pair.end(),
96  [](const std::pair<casadi_int, casadi_int>& a, const std::pair<casadi_int, casadi_int>& b) { return a.second < b.second;});
97 
98  std::vector<casadi_int> dim_map_keys;
99  // Compute the total number of iterations needed
100  casadi_int n_iter = 1;
101  for (const auto& e : dim_map_pair) {
102  n_iter*= e.second;
103  dim_map_keys.push_back(-e.first);
104  iter_dims.push_back(e.second);
105  }
106 
107  strides_a.clear();
108  strides_a.resize(iter_dims.size()+1);
109  strides_b.clear();
110  strides_b.resize(iter_dims.size()+1);
111  strides_c.clear();
112  strides_c.resize(iter_dims.size()+1);
113 
114  std::vector<casadi_int> lu;
115 
116  if (!dim_map_keys.empty()) lu = lookupvector(dim_map_keys);
117 
118  // Update data pointers to match indices
119  casadi_int cumprod = 1;
120  for (casadi_int j=0;j<a.size();++j) {
121  if (a[j]<0) {
122  strides_a[1+lu[-a[j]]] = cumprod;
123  } else {
124  strides_a[0]+=a[j]*cumprod;
125  }
126  cumprod*= dim_a[j];
127  }
128  cumprod = 1;
129  for (casadi_int j=0;j<b.size();++j) {
130  if (b[j]<0) {
131  strides_b[1+lu[-b[j]]] = cumprod;
132  } else {
133  strides_b[0]+=b[j]*cumprod;
134  }
135  cumprod*= dim_b[j];
136  }
137  cumprod = 1;
138  for (casadi_int j=0;j<c.size();++j) {
139  if (c[j]<0) {
140  strides_c[1+lu[-c[j]]] = cumprod;
141  } else {
142  strides_c[0]+=c[j]*cumprod;
143  }
144  cumprod*= dim_c[j];
145  }
146 
147  return n_iter;
148  }
T product(const std::vector< T > &values)
product

References C, lookupvector(), and product().

Referenced by casadi::Matrix< Scalar >::einstein(), and casadi::Einstein::Einstein().

◆ enum_names()

template<typename T >
std::vector<std::string> casadi::enum_names ( )

Definition at line 80 of file casadi_enum.hpp.

80  {
81  std::vector<std::string> r(enum_traits<T>::n_enum);
82  for (size_t i = 0; i < enum_traits<T>::n_enum; ++i)
83  r[i] = to_string(static_cast<T>(i));
84  return r;
85 }

References T, and to_string().

◆ erfinv()

double casadi::erfinv ( double  x)
throw (
)
inline

CasADi additions

Definition at line 294 of file calculus.hpp.

294  {
295  // Approximation found in Sourceforge and modified: Not very efficient
296  if (x>=1) {
297  return x==1 ? inf : nan;
298  } else if (x<=-1) {
299  return x==-1 ? -inf : nan;
300  } else if (x<-0.7) {
301  double z = sqrt(-log((1.0+x)/2.0));
302  return -(((1.641345311*z+3.429567803)*z-1.624906493)*z-1.970840454)/
303  ((1.637067800*z+3.543889200)*z+1.0);
304  } else {
305  double y;
306  if (x<0.7) {
307  double z = x*x;
308  y = x*(((-0.140543331*z+0.914624893)*z-1.645349621)*z+0.886226899)/
309  ((((-0.329097515*z+0.012229801)*z+1.442710462)*z-2.118377725)*z+1.0);
310  } else {
311  double z = sqrt(-log((1.0-x)/2.0));
312  y = (((1.641345311*z+3.429567803)*z-1.624906493)*z-1.970840454)/
313  ((1.637067800*z+3.543889200)*z+1.0);
314  }
315 
316  //polish x to full accuracy
317  y = y - (erf(y) - x) / (2.0/sqrt(pi) * exp(-y*y));
318  y = y - (erf(y) - x) / (2.0/sqrt(pi) * exp(-y*y));
319  return y;
320  }
321  }
const double inf
infinity
Definition: calculus.hpp:50
const double nan
Not a number.
Definition: calculus.hpp:53

References inf, nan, and pi.

Referenced by casadi::UnaryOperation< OP_ERFINV >::fcn().

◆ eval_b()

fatrop_int casadi::eval_b ( const double *  states_kp1,
const double *  inputs_k,
const double *  states_k,
const double *  stage_params_k,
const double *  global_params,
double *  res,
const fatrop_int  k,
void *  user_data 
)

Definition at line 787 of file fatrop_conic_interface.cpp.

794  {
795  FatropUserData* data = static_cast<FatropUserData*>(user_data);
796  auto m = data->mem;
797  auto d = &m->d;
798  auto p = d->prob;
799 
800  blasfeo_dmat BAbtk;
801  blasfeo_allocate_dmat(p->nx[k]+p->nu[k]+1, p->nx[k+1], &BAbtk);
802  eval_BAbt(states_kp1, inputs_k, states_k, stage_params_k, global_params, &BAbtk, k, user_data);
803  blasfeo_unpack_dmat(1, p->nx[k+1], &BAbtk, p->nx[k]+p->nu[k], 0, res, 1);
804  blasfeo_free_dmat(&BAbtk);
805 
806  return 0;
807 
808  }
fatrop_int eval_BAbt(const double *states_kp1, const double *inputs_k, const double *states_k, const double *stage_params_k, const double *global_params, MAT *res, const fatrop_int k, void *user_data)

References eval_BAbt().

Referenced by casadi::FatropConicInterface::solve().

◆ eval_BAbt()

fatrop_int casadi::eval_BAbt ( const double *  states_kp1,
const double *  inputs_k,
const double *  states_k,
const double *  stage_params_k,
const double *  global_params,
MAT *  res,
const fatrop_int  k,
void *  user_data 
)

Definition at line 482 of file fatrop_conic_interface.cpp.

484  {
485  FatropUserData* data = static_cast<FatropUserData*>(user_data);
486  auto m = data->mem;
487  double one = 1.0;
488  auto d = &m->d;
489  auto p = d->prob;
490  casadi_qp_data<double>* d_qp = d->qp;
491  blasfeo_pack_tran_dmat(p->nx[k+1], p->nx[k],
492  d->AB+p->AB_offsets[k], p->nx[k+1], res, p->nu[k], 0);
493  blasfeo_pack_tran_dmat(p->nx[k+1], p->nu[k],
494  d->AB+p->AB_offsets[k]+p->nx[k]*p->nx[k+1], p->nx[k+1], res, 0, 0);
495  blasfeo_pack_dmat(1, p->nx[k+1], const_cast<double*>(d_qp->lba+p->AB[k].offset_r),
496  1, res, p->nx[k]+p->nu[k], 0);
497 
498  blasfeo_dvec v, r;
499  blasfeo_allocate_dvec(p->nx[k]+p->nu[k]+1, &v);
500  blasfeo_allocate_dvec(p->nx[k+1], &r);
501  // Fill v with [u;x;1]
502  blasfeo_pack_dvec(p->nu[k], const_cast<double*>(inputs_k), 1, &v, 0);
503  blasfeo_pack_dvec(p->nx[k], const_cast<double*>(states_k), 1, &v, p->nu[k]);
504  blasfeo_pack_dvec(1, &one, 1, &v, p->nu[k]+p->nx[k]);
505 
506  blasfeo_dgemv_t(p->nx[k]+p->nu[k]+1, p->nx[k+1], 1.0, res, 0, 0,
507  &v, 0,
508  0.0, &r, 0,
509  &r, 0);
510 
511  std::vector<double> mem(p->nx[k+1]);
512  blasfeo_unpack_dvec(p->nx[k+1], &r, 0, get_ptr(mem), 1);
513 
514  if (states_kp1) {
515  for (int i=0;i<p->nx[k+1];++i) {
516  mem[i] -= states_kp1[i];
517  }
518  }
519 
520  blasfeo_pack_dmat(1, p->nx[k+1], get_ptr(mem), 1, res, p->nx[k]+p->nu[k], 0);
521 
522  blasfeo_free_dvec(&v);
523  blasfeo_free_dvec(&r);
524 
525  return 0;
526  }
const T1 * lba
Definition: casadi_qp.hpp:64

References get_ptr(), and casadi_qp_data< T1 >::lba.

Referenced by eval_b(), eval_RSQrqt(), and casadi::FatropConicInterface::solve().

◆ eval_g()

fatrop_int casadi::eval_g ( const double *  states_k,
const double *  inputs_k,
const double *  stage_params_k,
const double *  global_params,
double *  res,
const fatrop_int  k,
void *  user_data 
)

Definition at line 810 of file fatrop_conic_interface.cpp.

816  {
817  FatropUserData* data = static_cast<FatropUserData*>(user_data);
818 
819  auto m = data->mem;
820  auto d = &m->d;
821  auto p = d->prob;
822 
823  int n_a_eq = d->a_eq_idx[k+1]-d->a_eq_idx[k];
824  int n_x_eq = d->x_eq_idx[k+1]-d->x_eq_idx[k];
825  int ng_eq = n_a_eq+n_x_eq;
826 
827  blasfeo_dmat Ggtk;
828  blasfeo_allocate_dmat(p->nx[k]+p->nu[k]+1, ng_eq, &Ggtk);
829  eval_Ggt(states_k, inputs_k, stage_params_k, global_params, &Ggtk, k, user_data);
830  blasfeo_unpack_dmat(1, ng_eq, &Ggtk, p->nx[k]+p->nu[k], 0, res, 1);
831  blasfeo_free_dmat(&Ggtk);
832 
833  return 0;
834  }
fatrop_int eval_Ggt(const double *inputs_k, const double *states_k, const double *stage_params_k, const double *global_params, MAT *res, const fatrop_int k, void *user_data)

References eval_Ggt().

Referenced by casadi::FatropConicInterface::solve().

◆ eval_Ggt()

fatrop_int casadi::eval_Ggt ( const double *  inputs_k,
const double *  states_k,
const double *  stage_params_k,
const double *  global_params,
MAT *  res,
const fatrop_int  k,
void *  user_data 
)

Definition at line 529 of file fatrop_conic_interface.cpp.

535  {
536  FatropUserData* data = static_cast<FatropUserData*>(user_data);
537  auto m = data->mem;
538 casadi_int i, column;
539  double one = 1;
540  auto d = &m->d;
541  auto p = d->prob;
542  casadi_qp_data<double>* d_qp = d->qp;
543 
544  int n_a_eq = d->a_eq_idx[k+1]-d->a_eq_idx[k];
545  int n_x_eq = d->x_eq_idx[k+1]-d->x_eq_idx[k];
546  int ng_eq = n_a_eq+n_x_eq;
547 
548  blasfeo_dgese(p->nx[k]+p->nu[k]+1, ng_eq, 0.0, res, 0, 0);
549 
550  column = 0;
551  for (i=d->a_eq_idx[k];i<d->a_eq_idx[k+1];++i) {
552  blasfeo_pack_tran_dmat(1, p->nx[k],
553  d->CD+p->CD_offsets[k]+(d->a_eq[i]-p->CD[k].offset_r),
554  p->CD[k].rows, res, p->nu[k], column);
555  blasfeo_pack_tran_dmat(1, p->nu[k],
556  d->CD+p->CD_offsets[k]+(d->a_eq[i]-p->CD[k].offset_r)+p->nx[k]*p->CD[k].rows,
557  p->CD[k].rows, res, 0, column);
558  double v = -d_qp->lba[d->a_eq[i]];
559  blasfeo_pack_tran_dmat(1, 1, &v, 1, res, p->nx[k]+p->nu[k], column);
560  column++;
561  }
562  for (i=d->x_eq_idx[k];i<d->x_eq_idx[k+1];++i) {
563  int j = d->x_eq[i]-p->CD[k].offset_c;
564  if (j>=p->nx[k]) {
565  j -= p->nx[k];
566  } else {
567  j += p->nu[k];
568  }
569  blasfeo_pack_tran_dmat(1, 1, &one, 1, res, j, column);
570  double v = -d_qp->lbx[d->x_eq[i]];
571  blasfeo_pack_tran_dmat(1, 1, &v, 1, res, p->nx[k]+p->nu[k], column);
572  column++;
573  }
574 
575  // Second part
576  blasfeo_dvec v, r;
577  blasfeo_allocate_dvec(p->nx[k]+p->nu[k]+1, &v);
578  blasfeo_allocate_dvec(ng_eq, &r);
579  // Fill v with [u;x;1]
580  blasfeo_pack_dvec(p->nu[k], const_cast<double*>(inputs_k), 1, &v, 0);
581  blasfeo_pack_dvec(p->nx[k], const_cast<double*>(states_k), 1, &v, p->nu[k]);
582  blasfeo_pack_dvec(1, &one, 1, &v, p->nu[k]+p->nx[k]);
583 
584  blasfeo_dgemv_t(p->nx[k]+p->nu[k]+1, ng_eq, 1.0, res, 0, 0,
585  &v, 0,
586  0.0, &r, 0,
587  &r, 0);
588 
589  std::vector<double> mem(ng_eq);
590  blasfeo_unpack_dvec(ng_eq, &r, 0, get_ptr(mem), 1);
591 
592  blasfeo_pack_dmat(1, ng_eq, get_ptr(mem), 1, res, p->nx[k]+p->nu[k], 0);
593 
594  blasfeo_free_dvec(&v);
595  blasfeo_free_dvec(&r);
596 
597  return 0;
598  }
const T1 * lbx
Definition: casadi_qp.hpp:64

References get_ptr(), casadi_qp_data< T1 >::lba, and casadi_qp_data< T1 >::lbx.

Referenced by eval_g(), eval_RSQrqt(), and casadi::FatropConicInterface::solve().

◆ eval_Ggt_ineq()

fatrop_int casadi::eval_Ggt_ineq ( const double *  inputs_k,
const double *  states_k,
const double *  stage_params_k,
const double *  global_params,
MAT *  res,
const fatrop_int  k,
void *  user_data 
)

Definition at line 600 of file fatrop_conic_interface.cpp.

606  {
607  FatropUserData* data = static_cast<FatropUserData*>(user_data);
608  auto m = data->mem;
609  casadi_int i, column;
610  double one = 1;
611  double zero = 0;
612  auto d = &m->d;
613  auto p = d->prob;
614  //casadi_qp_data<double>* d_qp = d->qp;
615 
616  int n_a_ineq = d->a_ineq_idx[k+1]-d->a_ineq_idx[k];
617  int n_x_ineq = d->x_ineq_idx[k+1]-d->x_ineq_idx[k];
618  int ng_ineq = n_a_ineq+n_x_ineq;
619 
620  blasfeo_dgese(p->nx[k]+p->nu[k]+1, ng_ineq, 0.0, res, 0, 0);
621 
622  column = 0;
623  for (i=d->a_ineq_idx[k];i<d->a_ineq_idx[k+1];++i) {
624  blasfeo_pack_tran_dmat(1, p->nx[k],
625  d->CD+p->CD_offsets[k]+(d->a_ineq[i]-p->CD[k].offset_r),
626  p->CD[k].rows, res, p->nu[k], column);
627  blasfeo_pack_tran_dmat(1, p->nu[k],
628  d->CD+p->CD_offsets[k]+(d->a_ineq[i]-p->CD[k].offset_r)+p->nx[k]*p->CD[k].rows,
629  p->CD[k].rows, res, 0, column);
630  blasfeo_pack_tran_dmat(1, 1, &zero, 1, res, p->nx[k]+p->nu[k], column);
631  column++;
632  }
633  for (i=d->x_ineq_idx[k];i<d->x_ineq_idx[k+1];++i) {
634  int j = d->x_ineq[i]-p->CD[k].offset_c;
635  if (j>=p->nx[k]) {
636  j -= p->nx[k];
637  } else {
638  j += p->nu[k];
639  }
640  blasfeo_pack_tran_dmat(1, 1, &one, 1, res, j, column);
641  blasfeo_pack_tran_dmat(1, 1, &zero, 1, res, p->nx[k]+p->nu[k], column);
642  column++;
643  }
644 
645  // Second part
646  blasfeo_dvec v, r;
647  blasfeo_allocate_dvec(p->nx[k]+p->nu[k]+1, &v);
648  blasfeo_allocate_dvec(ng_ineq, &r);
649  // Fill v with [u;x;1]
650  blasfeo_pack_dvec(p->nu[k], const_cast<double*>(inputs_k), 1, &v, 0);
651  blasfeo_pack_dvec(p->nx[k], const_cast<double*>(states_k), 1, &v, p->nu[k]);
652  blasfeo_pack_dvec(1, &zero, 1, &v, p->nu[k]+p->nx[k]);
653 
654  blasfeo_dgemv_t(p->nx[k]+p->nu[k]+1, ng_ineq, 1.0, res, 0, 0,
655  &v, 0,
656  0.0, &r, 0,
657  &r, 0);
658  std::vector<double> mem(ng_ineq);
659  blasfeo_unpack_dvec(ng_ineq, &r, 0, get_ptr(mem), 1);
660 
661  blasfeo_pack_dmat(1, ng_ineq, get_ptr(mem), 1, res, p->nx[k]+p->nu[k], 0);
662 
663  blasfeo_free_dvec(&v);
664  blasfeo_free_dvec(&r);
665 
666  return 0;
667  }

References get_ptr().

Referenced by eval_gineq(), eval_RSQrqt(), and casadi::FatropConicInterface::solve().

◆ eval_gineq()

fatrop_int casadi::eval_gineq ( const double *  states_k,
const double *  inputs_k,
const double *  stage_params_k,
const double *  global_params,
double *  res,
const fatrop_int  k,
void *  user_data 
)

Definition at line 836 of file fatrop_conic_interface.cpp.

842  {
843  FatropUserData* data = static_cast<FatropUserData*>(user_data);
844  auto m = data->mem;
845  auto d = &m->d;
846  auto p = d->prob;
847 
848  int n_a_ineq = d->a_ineq_idx[k+1]-d->a_ineq_idx[k];
849  int n_x_ineq = d->x_ineq_idx[k+1]-d->x_ineq_idx[k];
850  int ng_ineq = n_a_ineq+n_x_ineq;
851 
852 
853  blasfeo_dmat Ggtk;
854  blasfeo_allocate_dmat(p->nx[k]+p->nu[k]+1, ng_ineq, &Ggtk);
855  eval_Ggt_ineq(states_k, inputs_k, stage_params_k, global_params, &Ggtk, k, user_data);
856  blasfeo_unpack_dmat(1, ng_ineq, &Ggtk, p->nx[k]+p->nu[k], 0, res, 1);
857  blasfeo_free_dmat(&Ggtk);
858 
859  return 0;
860  }
fatrop_int eval_Ggt_ineq(const double *inputs_k, const double *states_k, const double *stage_params_k, const double *global_params, MAT *res, const fatrop_int k, void *user_data)

References eval_Ggt_ineq().

Referenced by casadi::FatropConicInterface::solve().

◆ eval_L()

fatrop_int casadi::eval_L ( const double *  objective_scale,
const double *  inputs_k,
const double *  states_k,
const double *  stage_params_k,
const double *  global_params,
double *  res,
const fatrop_int  k,
void *  user_data 
)

Definition at line 915 of file fatrop_conic_interface.cpp.

922  {
923  FatropUserData* data = static_cast<FatropUserData*>(user_data);
924  auto m = data->mem;
925  *res = 0.0;
926  casadi_assert_dev(*objective_scale==1);
927  auto d = &m->d;
928  auto p = d->prob;
929  casadi_qp_data<double>* d_qp = d->qp;
930  blasfeo_dmat RSQrqtk;
931 
932  int n = p->nx[k]+p->nu[k];
933 
934  blasfeo_dvec v, r;
935  blasfeo_allocate_dmat(n, n, &RSQrqtk);
936  blasfeo_allocate_dvec(n, &v);
937  blasfeo_allocate_dvec(n, &r);
938  blasfeo_pack_dmat(p->nx[k], p->nx[k], d->RSQ+p->RSQ_offsets[k],
939  n, &RSQrqtk, p->nu[k], p->nu[k]);
940  blasfeo_pack_dmat(p->nu[k], p->nu[k], d->RSQ+p->RSQ_offsets[k]+p->nx[k]*n+p->nx[k],
941  n, &RSQrqtk, 0, 0);
942  blasfeo_pack_dmat(p->nu[k], p->nx[k], d->RSQ+p->RSQ_offsets[k]+p->nx[k],
943  n, &RSQrqtk, 0, p->nu[k]);
944  blasfeo_pack_dmat(p->nx[k], p->nu[k], d->RSQ+p->RSQ_offsets[k]+p->nx[k]*n,
945  n, &RSQrqtk, p->nu[k], 0);
946 
947  // Fill v with [u;x]
948  blasfeo_pack_dvec(p->nu[k], const_cast<double*>(inputs_k), 1, &v, 0);
949  blasfeo_pack_dvec(p->nx[k], const_cast<double*>(states_k), 1, &v, p->nu[k]);
950 
951  blasfeo_dgemv_n(n, n, 1.0, &RSQrqtk, 0, 0,
952  &v, 0,
953  0.0, &r, 0,
954  &r, 0);
955 
956  double obj = 0.5*blasfeo_ddot(n, &v, 0, &r, 0);
957 
958  blasfeo_pack_dvec(p->nx[k], const_cast<double*>(d_qp->g+p->RSQ[k].offset_r),
959  1, &r, p->nu[k]);
960  blasfeo_pack_dvec(p->nu[k], const_cast<double*>(d_qp->g+p->RSQ[k].offset_r+p->nx[k]),
961  1, &r, 0);
962 
963  obj += blasfeo_ddot(n, &v, 0, &r, 0);
964 
965  blasfeo_free_dmat(&RSQrqtk);
966  blasfeo_free_dvec(&v);
967  blasfeo_free_dvec(&r);
968  *res = obj;
969 
970  return 0;
971 
972  }
const T1 * g
Definition: casadi_qp.hpp:64

References casadi_qp_data< T1 >::g.

Referenced by casadi::FatropConicInterface::solve().

◆ eval_rq()

fatrop_int casadi::eval_rq ( const double *  objective_scale,
const double *  inputs_k,
const double *  states_k,
const double *  stage_params_k,
const double *  global_params,
double *  res,
const fatrop_int  k,
void *  user_data 
)

Definition at line 862 of file fatrop_conic_interface.cpp.

869  {
870  FatropUserData* data = static_cast<FatropUserData*>(user_data);
871  auto m = data->mem;
872  *res = 0.0;
873  casadi_assert_dev(*objective_scale==1);
874  auto d = &m->d;
875  auto p = d->prob;
876  casadi_qp_data<double>* d_qp = d->qp;
877  blasfeo_dmat RSQrqtk;
878 
879  int n = p->nx[k]+p->nu[k];
880 
881  blasfeo_dvec v, r;
882  blasfeo_allocate_dmat(n, n, &RSQrqtk);
883  blasfeo_allocate_dvec(n, &v);
884  blasfeo_allocate_dvec(n, &r);
885  blasfeo_pack_dmat(p->nx[k], p->nx[k], d->RSQ+p->RSQ_offsets[k],
886  n, &RSQrqtk, p->nu[k], p->nu[k]);
887  blasfeo_pack_dmat(p->nu[k], p->nu[k], d->RSQ+p->RSQ_offsets[k]+p->nx[k]*n+p->nx[k],
888  n, &RSQrqtk, 0, 0);
889  blasfeo_pack_dmat(p->nu[k], p->nx[k], d->RSQ+p->RSQ_offsets[k]+p->nx[k],
890  n, &RSQrqtk, 0, p->nu[k]);
891  blasfeo_pack_dmat(p->nx[k], p->nu[k], d->RSQ+p->RSQ_offsets[k]+p->nx[k]*n,
892  n, &RSQrqtk, p->nu[k], 0);
893 
894  // Fill v with [u;x]
895  blasfeo_pack_dvec(p->nu[k], const_cast<double*>(inputs_k), 1, &v, 0);
896  blasfeo_pack_dvec(p->nx[k], const_cast<double*>(states_k), 1, &v, p->nu[k]);
897 
898  blasfeo_pack_dvec(p->nx[k], const_cast<double*>(d_qp->g+p->RSQ[k].offset_r), 1, &r, p->nu[k]);
899  blasfeo_pack_dvec(p->nu[k], const_cast<double*>(d_qp->g+p->RSQ[k].offset_r+p->nx[k]), 1, &r, 0);
900 
901  blasfeo_dgemv_n(n, n, 1.0, &RSQrqtk, 0, 0,
902  &v, 0,
903  1.0, &r, 0,
904  &r, 0);
905 
906  blasfeo_unpack_dvec(n, &r, 0, res, 1);
907 
908  blasfeo_free_dmat(&RSQrqtk);
909  blasfeo_free_dvec(&v);
910  blasfeo_free_dvec(&r);
911 
912  return 0;
913  }

References casadi_qp_data< T1 >::g.

Referenced by casadi::FatropConicInterface::solve().

◆ eval_RSQrqt()

fatrop_int casadi::eval_RSQrqt ( const double *  objective_scale,
const double *  inputs_k,
const double *  states_k,
const double *  lam_dyn_k,
const double *  lam_eq_k,
const double *  lam_eq_ineq_k,
const double *  stage_params_k,
const double *  global_params,
MAT *  res,
const fatrop_int  k,
void *  user_data 
)

Definition at line 669 of file fatrop_conic_interface.cpp.

679  {
680  FatropUserData* data = static_cast<FatropUserData*>(user_data);
681  auto m = data->mem;
682  const auto& solver = *data->solver;
683  casadi_assert_dev(*objective_scale==1);
684 
685  auto d = &m->d;
686  auto p = d->prob;
687  casadi_qp_data<double>* d_qp = d->qp;
688  int n = p->nx[k]+p->nu[k];
689  blasfeo_pack_dmat(p->nx[k], p->nx[k],
690  d->RSQ+p->RSQ_offsets[k], n, res, p->nu[k], p->nu[k]);
691  blasfeo_pack_dmat(p->nu[k], p->nu[k],
692  d->RSQ+p->RSQ_offsets[k]+p->nx[k]*n+p->nx[k], n, res, 0, 0);
693  blasfeo_pack_dmat(p->nu[k], p->nx[k],
694  d->RSQ+p->RSQ_offsets[k]+p->nx[k], n, res, 0, p->nu[k]);
695  blasfeo_pack_dmat(p->nx[k], p->nu[k],
696  d->RSQ+p->RSQ_offsets[k]+p->nx[k]*n, n, res, p->nu[k], 0);
697 
698  blasfeo_pack_dmat(1, p->nx[k], const_cast<double*>(d_qp->g+p->RSQ[k].offset_r),
699  1, res, p->nu[k]+p->nx[k], p->nu[k]);
700  blasfeo_pack_dmat(1, p->nu[k], const_cast<double*>(d_qp->g+p->RSQ[k].offset_r+p->nx[k]),
701  1, res, p->nu[k]+p->nx[k], 0);
702 
703  blasfeo_dvec r, v;
704  blasfeo_allocate_dvec(n, &v);
705  blasfeo_allocate_dvec(p->nx[k]+p->nu[k], &r);
706  // Fill v with [u;x]
707  blasfeo_pack_dvec(p->nu[k], const_cast<double*>(inputs_k), 1, &v, 0);
708  blasfeo_pack_dvec(p->nx[k], const_cast<double*>(states_k), 1, &v, p->nu[k]);
709 
710  blasfeo_pack_dvec(p->nx[k], const_cast<double*>(d_qp->g+p->RSQ[k].offset_r),
711  1, &r, p->nu[k]);
712  blasfeo_pack_dvec(p->nu[k], const_cast<double*>(d_qp->g+p->RSQ[k].offset_r+p->nx[k]),
713  1, &r, 0);
714 
715  blasfeo_dgemv_n(n, n, 1.0, res, 0, 0,
716  &v, 0,
717  1.0, &r, 0,
718  &r, 0);
719 
720  int n_a_eq = d->a_eq_idx[k+1]-d->a_eq_idx[k];
721  int n_x_eq = d->x_eq_idx[k+1]-d->x_eq_idx[k];
722  int ng_eq = n_a_eq+n_x_eq;
723  int n_a_ineq = d->a_ineq_idx[k+1]-d->a_ineq_idx[k];
724  int n_x_ineq = d->x_ineq_idx[k+1]-d->x_ineq_idx[k];
725  int ng_ineq = n_a_ineq+n_x_ineq;
726 
727  bool last_k = k==solver.N_;
728 
729  blasfeo_dvec lam_dyn, lam_g, lam_g_ineq;
730  blasfeo_dmat BAbtk, Ggtk, Ggt_ineqk;
731  if (!last_k)
732  blasfeo_allocate_dvec(p->nx[k+1], &lam_dyn);
733  blasfeo_allocate_dvec(ng_eq, &lam_g);
734  blasfeo_allocate_dvec(ng_ineq, &lam_g_ineq);
735  if (!last_k)
736  blasfeo_allocate_dmat(p->nx[k]+p->nu[k]+1, p->nx[k+1], &BAbtk);
737  blasfeo_allocate_dmat(p->nx[k]+p->nu[k]+1, ng_eq, &Ggtk);
738  blasfeo_allocate_dmat(p->nx[k]+p->nu[k]+1, ng_ineq, &Ggt_ineqk);
739 
740  if (!last_k)
741  eval_BAbt(0, inputs_k, states_k, stage_params_k, global_params, &BAbtk, k, user_data);
742  eval_Ggt(inputs_k, states_k, stage_params_k, global_params, &Ggtk, k, user_data);
743  eval_Ggt_ineq(inputs_k, states_k, stage_params_k, global_params, &Ggt_ineqk, k, user_data);
744 
745  if (!last_k)
746  blasfeo_pack_dvec(p->nx[k+1], const_cast<double*>(lam_dyn_k), 1, &lam_dyn, 0);
747  blasfeo_pack_dvec(ng_eq, const_cast<double*>(lam_eq_k), 1, &lam_g, 0);
748  blasfeo_pack_dvec(ng_ineq, const_cast<double*>(lam_eq_ineq_k), 1, &lam_g_ineq, 0);
749 
750  if (!last_k)
751  blasfeo_dgemv_n(p->nx[k]+p->nu[k], p->nx[k+1], 1.0, &BAbtk, 0, 0,
752  &lam_dyn, 0,
753  1.0, &r, 0,
754  &r, 0);
755 
756  blasfeo_dgemv_n(p->nx[k]+p->nu[k], ng_eq, 1.0, &Ggtk, 0, 0,
757  &lam_g, 0,
758  1.0, &r, 0,
759  &r, 0);
760 
761  blasfeo_dgemv_n(p->nx[k]+p->nu[k], ng_ineq, 1.0, &Ggt_ineqk, 0, 0,
762  &lam_g_ineq, 0,
763  1.0, &r, 0,
764  &r, 0);
765 
766  std::vector<double> mem(p->nx[k]+p->nu[k]);
767  blasfeo_unpack_dvec(p->nx[k]+p->nu[k], &r, 0, get_ptr(mem), 1);
768 
769  blasfeo_pack_dmat(1, p->nx[k]+p->nu[k], const_cast<double*>(get_ptr(mem)),
770  1, res, p->nu[k]+p->nx[k], 0);
771 
772 
773  if (!last_k)
774  blasfeo_free_dmat(&BAbtk);
775  blasfeo_free_dmat(&Ggtk);
776  blasfeo_free_dmat(&Ggt_ineqk);
777  blasfeo_free_dvec(&r);
778  if (!last_k)
779  blasfeo_free_dvec(&lam_dyn);
780  blasfeo_free_dvec(&lam_g);
781  blasfeo_free_dvec(&lam_g_ineq);
782  blasfeo_free_dvec(&v);
783 
784  return 0;
785  }

References eval_BAbt(), eval_Ggt(), eval_Ggt_ineq(), casadi_qp_data< T1 >::g, and get_ptr().

Referenced by casadi::FatropConicInterface::solve().

◆ external() [1/3]

CASADI_EXPORT Function casadi::external ( const std::string &  name,
const Dict opts = Dict() 
)
Parameters
nameName as in the label assigned to a CasADi Function object: Function(name,...,...) Will be used to look up symbols/functions named eg. <name>_eval Use nm (linux/osx) or depends.exe (win) to check which symbols are present in your shared library

File name is assumed to be ./<name>.so

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

Definition at line 50 of file external.cpp.

50  {
51  return external(name, "./" + name + SHARED_LIBRARY_SUFFIX, opts);
52 }
Function external(const std::string &name, const Importer &li, const Dict &opts)
Load a just-in-time compiled external function.
Definition: external.cpp:42

References external().

◆ external() [2/3]

CASADI_EXPORT Function casadi::external ( const std::string &  name,
const Importer li,
const Dict opts = Dict() 
)

File name given

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

Definition at line 42 of file external.cpp.

43  {
44  std::vector<std::string> config_args;
45  Dict opts_filtered = extract_from_dict(opts, "config_args", config_args);
46  config_args.insert(config_args.begin(), li.library());
47  return Function::create(new GenericExternal(name, li, config_args), opts_filtered);
48 }
Dict extract_from_dict(const Dict &d, const std::string &key, T &value)

References casadi::Function::create(), extract_from_dict(), and casadi::Importer::library().

Referenced by casadi::DaeBuilder::add_fun(), external(), casadi::External::factory(), casadi::External::get_forward(), casadi::External::get_jacobian(), casadi::External::get_reverse(), casadi::Scpgen::init(), casadi::OracleFunction::jit_dependencies(), and nlpsol().

◆ external() [3/3]

CASADI_EXPORT Function casadi::external ( const std::string &  name,
const std::string &  bin_name,
const Dict opts = Dict() 
)
Parameters
nameName as in the label assigned to a CasADi Function object: Function(name,...,...) Will be used to look up symbols/functions named eg. <name>_eval Use nm (linux/osx) or depends.exe (win) to check which symbols are present in your shared library
bin_nameFile name of the shared library

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

Definition at line 54 of file external.cpp.

55  {
56  return external(name, Importer(bin_name, "dll"), opts);
57 }

References external().

◆ external_transform()

CASADI_EXPORT Function casadi::external_transform ( const std::string &  name,
const std::string &  op,
const Function f,
const Dict opts = Dict() 
)
Parameters
nameName of the shared library
opName of the operation
fFunction to transform
optsOptions
Extra doc: https://github.com/casadi/casadi/wiki/L_27i 

Definition at line 45 of file tools.cpp.

48  {
49  std::string signature = "f";
50  Importer li(name + SHARED_LIBRARY_SUFFIX, "dll");
51  std::string op_full = op + "__" + signature;
52  external_transform_t t = (external_transform_t) li.get_function(op_full);
53  if (!t) {
54  casadi_error("Transformation '" + op + "' not defined in library '" + name +
55  "' for the following signature: " + signature);
56  }
57 
58  StringSerializer ss;
59  ss.pack(f);
60  ss.pack(opts);
61 
62  char api_version = 0;
63  std::string casadi_version = CasadiMeta::version();
64 
65  std::string s = ss.encode();
66  const char* out = t(api_version, casadi_version.c_str(), s.c_str(),
67  callback_stdout, callback_stderr);
68  if (!out) {
69  casadi_error("Transformation '" + op + "' defined in library '" + name +
70  "' failed.");
71  }
72 
73  StringDeserializer sd(out);
74  Function r = sd.unpack_function();
75 
76  return r;
77 }
const char *(* external_transform_t)(char api_version, const char *casadi_version, const char *in, external_print_callback_t cb_stdout, external_print_callback_t cb_stderr)
Definition: tools.hpp:48

References callback_stderr(), callback_stdout(), casadi::StringSerializer::encode(), casadi::Importer::get_function(), casadi::SerializerBase::pack(), casadi::DeserializerBase::unpack_function(), and casadi::CasadiMeta::version().

Referenced by casadi::Function::construct().

◆ extract_from_dict()

template<class T >
Dict casadi::extract_from_dict ( const Dict d,
const std::string &  key,
T &  value 
)

Definition at line 277 of file generic_type.hpp.

277  {
278  Dict ret = d;
279  auto it = ret.find(key);
280  if (it!=ret.end()) {
281  value = it->second;
282  ret.erase(it);
283  }
284  return ret;
285  }

Referenced by casadi::Function::bspline(), casadi::Interpolant::construct(), external(), casadi::MX::forward(), casadi::Matrix< double >::is_leaf(), casadi::Matrix< double >::is_symbolic(), casadi::MX::jacobian(), casadi::Matrix< double >::reset_input(), and casadi::MX::reverse().

◆ extract_from_dict_inplace()

template<class T >
void casadi::extract_from_dict_inplace ( Dict d,
const std::string &  key,
T &  value 
)

Definition at line 288 of file generic_type.hpp.

288  {
289  auto it = d.find(key);
290  if (it!=d.end()) {
291  value = it->second;
292  d.erase(it);
293  }
294  }

Referenced by casadi::XFunction< DerivedType, MatType, NodeType >::factory(), and qpsol_nlp().

◆ extract_zip_from_path()

bool casadi::extract_zip_from_path ( const std::string &  zip_path,
const std::string &  output_dir 
)

Definition at line 57 of file libzip.cpp.

57  {
58  int err;
59  zip_t* za = zip_open(zip_path.c_str(), ZIP_RDONLY, &err);
60  if (!za) {
61  casadi_error("Cannot open ZIP file: " + zip_path);
62  return false;
63  }
64  return extract_zip_internal(za, output_dir);
65  }
bool extract_zip_internal(zip_t *za, const std::string &output_dir)
Definition: libzip.cpp:67

References extract_zip_internal().

Referenced by casadi_register_archiver_libzip().

◆ extract_zip_from_stringstream()

bool casadi::extract_zip_from_stringstream ( std::stringstream &  src,
const std::string &  output_dir 
)

Definition at line 34 of file libzip.cpp.

34  {
35  src.clear();
36  src.seekg(0, std::ios::beg);
37  const std::string& s = src.str();
38  // Open zip archive from memory buffer
39  zip_error_t errorp;
40  zip_source_t* zip_src = zip_source_buffer_create(s.data(), s.size(), 0, &errorp);
41 
42  if (!zip_src) {
43  casadi_error("Failed to create zip source: " +
44  std::string(zip_error_strerror(&errorp)) + "\n");
45  return false;
46  }
47 
48  zip_t* archive = zip_open_from_source(zip_src, 0, &errorp);
49  if (!archive) {
50  zip_source_free(zip_src);
51  casadi_error("Failed to open zip from source: " +
52  std::string(zip_error_strerror(&errorp)) + "\n");
53  }
54  return extract_zip_internal(archive, output_dir);
55  }

References extract_zip_internal().

Referenced by casadi_register_archiver_libzip().

◆ extract_zip_internal()

bool casadi::extract_zip_internal ( zip_t *  za,
const std::string &  output_dir 
)

Definition at line 67 of file libzip.cpp.

67  {
68  Filesystem::assert_enabled();
69  auto filesystem = Filesystem::getPlugin("ghc");
70 
71  zip_int64_t num_entries = zip_get_num_entries(za, 0);
72  if (num_entries < 0) {
73  zip_close(za);
74  casadi_error("Cannot read ZIP contents.");
75  return false;
76  }
77 
78 
79  for (zip_uint64_t i = 0; i < static_cast<zip_uint64_t>(num_entries); ++i) {
80  const char* name = zip_get_name(za, i, 0);
81  if (!name) {
82  uerr() << "Error: Cannot get file name for entry " << i << std::endl;
83  continue;
84  }
85 
86  std::string full_path = output_dir + "/" + name;
87  if (full_path.back() == '/') { // Directory entry
88  filesystem.exposed.create_directories(full_path);
89  } else { // File entry
90  std::string dir_path = full_path.substr(0, full_path.find_last_of('/'));
91  filesystem.exposed.create_directories(dir_path);
92 
93  zip_file_t* zf = zip_fopen_index(za, i, 0);
94  if (!zf) {
95  uerr() << "Error: Cannot open file in ZIP: " << name << std::endl;
96  continue;
97  }
98 
99  std::ofstream out_file(full_path, std::ios::binary);
100  if (!out_file) {
101  uerr() << "Error: Cannot write file: " << full_path << std::endl;
102  zip_fclose(zf);
103  continue;
104  }
105 
106  char buffer[8192];
107  zip_int64_t bytes_read;
108  while ((bytes_read = zip_fread(zf, buffer, sizeof(buffer))) > 0) {
109  out_file.write(buffer, bytes_read);
110  }
111 
112  if (bytes_read < 0) {
113  uerr() << "Error: Read failed for file in ZIP: " << name << std::endl;
114  }
115 
116  out_file.close();
117  zip_fclose(zf);
118  }
119  }
120 
121  zip_close(za);
122  return true;
123  }

References casadi::Filesystem::assert_enabled(), casadi::PluginInterface< Filesystem >::getPlugin(), and uerr().

Referenced by extract_zip_from_path(), and extract_zip_from_stringstream().

◆ fatrop_blocks_pack()

std::vector< casadi_int > casadi::fatrop_blocks_pack ( const std::vector< casadi_ocp_block > &  blocks)

Definition at line 311 of file fatrop_conic_interface.cpp.

311  {
312  size_t N = blocks.size();
313  std::vector<casadi_int> ret(4*N);
314  casadi_int* r = get_ptr(ret);
315  for (casadi_int i=0;i<N;++i) {
316  *r++ = blocks[i].offset_r;
317  *r++ = blocks[i].offset_c;
318  *r++ = blocks[i].rows;
319  *r++ = blocks[i].cols;
320  }
321  return ret;
322  }

References get_ptr().

Referenced by codegen_unpack_block(), and casadi::FatropInterface::serialize_body().

◆ fd_offset()

CASADI_EXPORT casadi_int casadi::fd_offset ( FdMode  v)

Definition at line 52 of file finite_differences.cpp.

52  {
53  switch (v) {
54  case FdMode::FORWARD: return 0;
55  case FdMode::BACKWARD: return 1;
56  case FdMode::CENTRAL: return 1;
57  case FdMode::SMOOTHING: return 2;
58  default: break;
59  }
60  return -1;
61 }

References BACKWARD, CENTRAL, FORWARD, and SMOOTHING.

Referenced by casadi::FmuInternal::eval_fd().

◆ filename()

std::string casadi::filename ( const std::string &  path)

◆ filesep()

CASADI_EXPORT std::string casadi::filesep ( )

Definition at line 41 of file casadi_os.cpp.

41  {
42  #ifdef _WIN32
43  return "\\";
44  #else
45  return "/";
46  #endif
47 }

Referenced by casadi::ClangCompiler::init().

◆ find()

template<typename T >
std::vector< casadi_int > casadi::find ( const std::vector< T > &  v)

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

Definition at line 618 of file casadi_misc.hpp.

618  {
619  std::vector<casadi_int> ret;
620  for (casadi_int i=0;i<v.size();++i) {
621  if (v[i]) ret.push_back(i);
622  }
623  return ret;
624  }

Referenced by casadi::Find::eval_mx(), casadi::MXNode::get_find(), casadi::PluginInterface< Derived >::has_plugin(), casadi::PluginInterface< Derived >::load_plugin(), casadi::Opti::to_function(), and casadi::DaeBuilderInternal::variable().

◆ finite_diff()

template<typename T1 >
CASADI_EXPORT void casadi::finite_diff ( FdMode  v,
const T1 **  yk,
T1 *  J,
T1  h,
casadi_int  n_y,
T1  smoothing 
)

Definition at line 49 of file finite_differences.hpp.

50  {
51  switch (v) {
52  case FdMode::FORWARD:
53  case FdMode::BACKWARD:
54  return casadi_forward_diff(yk, J, h, n_y);
55  case FdMode::CENTRAL:
56  return casadi_central_diff(yk, J, h, n_y);
57  case FdMode::SMOOTHING:
58  return casadi_smoothing_diff(yk, J, h, n_y, eps);
59  default:
60  casadi_error("FD mode " + to_string(v) + " not implemented");
61  }
62 }

References BACKWARD, CENTRAL, eps, FORWARD, SMOOTHING, and to_string().

Referenced by casadi::FmuInternal::eval_fd().

◆ flatten_nested_vector() [1/2]

template<class T , class S >
void casadi::flatten_nested_vector ( const std::vector< std::vector< T > > &  nested,
std::vector< S > &  flat 
)

Contents of nested[i] ends up in flat[indices[i]]..flat[indices[i+1]-1]

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

Definition at line 681 of file casadi_misc.hpp.

682  {
683  // Count total elements in nested
684  casadi_int N = 0;
685  for (const auto& e : nested) {
686  N += e.size();
687  }
688 
689  // Populate flat, one nested section at a time
690  flat.clear();
691  flat.reserve(N);
692  for (const auto& e : nested) {
693  flat.insert(flat.end(), e.begin(), e.end());
694  }
695  }

Referenced by flatten_nested_vector(), casadi::CplexInterface::init(), and casadi::GurobiInterface::init().

◆ flatten_nested_vector() [2/2]

template<class T , class S , class I >
void casadi::flatten_nested_vector ( const std::vector< std::vector< T > > &  nested,
std::vector< S > &  flat,
std::vector< I > &  indices 
)

Contents of nested[i] ends up in flat[indices[i]]..flat[indices[i+1]-1]

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

Definition at line 698 of file casadi_misc.hpp.

700  {
701  // Delegate
702  flatten_nested_vector(nested, flat);
703 
704  // Build up indices
705  casadi_int N = nested.size();
706  indices.resize(1, 0);
707  indices.reserve(N+1);
708  casadi_int offset = 0;
709  for (const auto& e : nested) {
710  offset += e.size();
711  indices.push_back(offset);
712  }
713  }
void flatten_nested_vector(const std::vector< std::vector< T > > &nested, std::vector< S > &flat)
Flatten a nested std::vector tot a single flattened vector.

References flatten_nested_vector().

◆ fmtstr()

std::string casadi::fmtstr ( const std::string &  fmt,
const std::vector< std::string > &  args 
)
inline

Definition at line 235 of file casadi_common.hpp.

235  {
236  std::string s = fmt;
237  for (auto&& e : args) {
238  std::string::size_type n = s.find("%s");
239  if (n==std::string::npos) return "** Ill-formatted string ** " + fmt;
240  s.replace(n, 2, e);
241  }
242  return s;
243  }

◆ from_fmi2()

CASADI_EXPORT Type casadi::from_fmi2 ( TypeFmi2  v)

Version mappings

Definition at line 59 of file dae_builder_internal.cpp.

59  {
60  switch (v) {
61  case TypeFmi2::REAL: return Type::FLOAT64;
62  case TypeFmi2::INTEGER: return Type::INT32;
63  case TypeFmi2::BOOLEAN: return Type::BOOLEAN;
64  case TypeFmi2::STRING: return Type::STRING;
65  case TypeFmi2::ENUM: return Type::ENUMERATION;
66  default: break;
67  }
68  return Type::NUMEL;
69 }

References BOOLEAN, ENUM, ENUMERATION, FLOAT64, INT32, INTEGER, NUMEL, REAL, and STRING.

Referenced by casadi::DaeBuilder::set_type().

◆ full_eval_constr_jac()

fatrop_int casadi::full_eval_constr_jac ( const double *  primal_data,
const double *  stageparams_p,
const double *  globalparams_p,
MAT *  BAbt_p,
MAT *  Ggt_p,
MAT *  Ggt_ineq_p,
const FatropOcpCDims *  s,
void *  user_data 
)

Definition at line 1033 of file fatrop_conic_interface.cpp.

1035  {
1036  return 0;
1037  }

Referenced by casadi::FatropConicInterface::solve().

◆ full_eval_contr_viol()

fatrop_int casadi::full_eval_contr_viol ( const double *  primal_data,
const double *  stageparams_p,
const double *  globalparams_p,
double *  cv_p,
const FatropOcpCDims *  s,
void *  user_data 
)

Definition at line 1039 of file fatrop_conic_interface.cpp.

1041  {
1042  return 0;
1043  }

Referenced by casadi::FatropConicInterface::solve().

◆ full_eval_lag_hess()

fatrop_int casadi::full_eval_lag_hess ( double  objective_scale,
const double *  primal_data,
const double *  lam_data,
const double *  stageparams_p,
const double *  globalparams_p,
MAT *  RSQrqt_p,
const FatropOcpCDims *  s,
void *  user_data 
)

Definition at line 1026 of file fatrop_conic_interface.cpp.

1029  {
1030  return 0;
1031  }

Referenced by casadi::FatropConicInterface::solve().

◆ full_eval_obj()

fatrop_int casadi::full_eval_obj ( double  objective_scale,
const double *  primal_data,
const double *  stageparams_p,
const double *  globalparams_p,
double *  res,
const FatropOcpCDims *  s,
void *  user_data 
)

Definition at line 1051 of file fatrop_conic_interface.cpp.

1053  {
1054  return 0;
1055  }

Referenced by casadi::FatropConicInterface::solve().

◆ full_eval_obj_grad()

fatrop_int casadi::full_eval_obj_grad ( double  objective_scale,
const double *  primal_data,
const double *  stageparams_p,
const double *  globalparams_p,
double *  grad_p,
const FatropOcpCDims *  s,
void *  user_data 
)

Definition at line 1045 of file fatrop_conic_interface.cpp.

1047  {
1048  return 0;
1049  }

Referenced by casadi::FatropConicInterface::solve().

◆ get_boor()

void casadi::get_boor ( const MX x,
const MX knots,
casadi_int  degree,
casadi_int  lookup_mode,
MX start,
MX boor 
)

Definition at line 177 of file bspline.cpp.

178  {
179  MX knots_clipped = knots(range(degree, knots.size1()-degree));
180 
181  Dict low_opts;
182  low_opts["lookup_mode"] = Low::lookup_mode_from_enum(lookup_mode);
183  MX L = low(knots_clipped, x, low_opts);
184  start = fmin(L, knots.size1()-2*degree-2);
185 
186  DM boor_init = DM::zeros(x.size2(), 2*degree+1);
187  boor_init(Slice(), degree) = 1;
188  std::vector<MX> boor_full = horzsplit(MX(boor_init));
189  casadi_int n_knots = 2*degree+2;
190 
191  MX kn;
192  MX(knots).get_nz(kn, false, start, MX(range(n_knots)));
193 
194  std::vector<MX> knv = horzsplit(kn);
195 
196  MX xt = x.T();
197 
198  for (casadi_int d=1;d<degree+1;++d) {
199  for (casadi_int i=0;i<n_knots-d-1;++i) {
200  MX bottom = knv[i+d]-knv[i];
201  MX b = if_else_zero(bottom, (xt-knv[i])*boor_full[i]/(bottom+1e-100));
202  bottom = knv[i+d+1]-knv[i + 1];
203  b += if_else_zero(bottom, (knv[i+d+1]-xt)*boor_full[i+1]/(bottom+1e-100));
204  boor_full[i] = b;
205  }
206  }
207 
208  boor = horzcat(std::vector<MX>(boor_full.begin(), boor_full.begin()+degree+1));
209  }
double if_else_zero(double x, double y)
Conditional assignment.
Definition: calculus.hpp:289

References casadi::MX::get_nz(), if_else_zero(), casadi::Low::lookup_mode_from_enum(), range(), casadi::GenericMatrix< MatType >::size1(), casadi::GenericMatrix< MatType >::size2(), casadi::MX::T(), and casadi::GenericMatrix< MatType >::zeros().

Referenced by do_inline().

◆ get_bounds()

fatrop_int casadi::get_bounds ( double *  lower,
double *  upper,
const fatrop_int  k,
void *  user_data 
)

Definition at line 974 of file fatrop_conic_interface.cpp.

974  {
975  FatropUserData* data = static_cast<FatropUserData*>(user_data);
976  auto m = data->mem;
977  auto d = &m->d;
978  //auto p = d->prob;
979  casadi_qp_data<double>* d_qp = d->qp;
980  int i=0;
981  int column = 0;
982  for (i=d->a_ineq_idx[k];i<d->a_ineq_idx[k+1];++i) {
983  lower[column] = d_qp->lba[d->a_ineq[i]];
984  upper[column] = d_qp->uba[d->a_ineq[i]];
985  column++;
986  }
987  //int offset = d->a_ineq_idx[k+1]-d->a_ineq_idx[k];
988  for (i=d->x_ineq_idx[k];i<d->x_ineq_idx[k+1];++i) {
989  lower[column] = d_qp->lbx[d->x_ineq[i]];
990  upper[column] = d_qp->ubx[d->x_ineq[i]];
991  column++;
992  }
993 
994  //fatrop_int n_a_ineq = d->a_ineq_idx[k+1]-d->a_ineq_idx[k];
995  //fatrop_int n_x_ineq = d->x_ineq_idx[k+1]-d->x_ineq_idx[k];
996  //fatrop_int ng_ineq = n_a_ineq+n_x_ineq;
997 
998  return 0;
999  }
const T1 * uba
Definition: casadi_qp.hpp:64
const T1 * ubx
Definition: casadi_qp.hpp:64

References casadi_qp_data< T1 >::lba, casadi_qp_data< T1 >::lbx, casadi_qp_data< T1 >::uba, and casadi_qp_data< T1 >::ubx.

Referenced by casadi::FatropConicInterface::solve().

◆ get_bvec_t() [1/4]

CASADI_EXPORT const bvec_t * casadi::get_bvec_t ( const std::vector< double > &  v)

Definition at line 264 of file casadi_misc.cpp.

264  {
265  if (v.empty()) {
266  return nullptr;
267  } else {
268  return reinterpret_cast<const bvec_t*>(&v.front());
269  }
270  }

◆ get_bvec_t() [2/4]

template<typename T >
const bvec_t * casadi::get_bvec_t ( const std::vector< T > &  v)

Definition at line 996 of file casadi_misc.hpp.

996  {
997  casadi_assert(0, "get_bvec_t only supported for double");
998  }

◆ get_bvec_t() [3/4]

CASADI_EXPORT bvec_t * casadi::get_bvec_t ( std::vector< double > &  v)

Get an pointer of sets of booleans from a double vector

Definition at line 255 of file casadi_misc.cpp.

255  {
256  if (v.empty()) {
257  return nullptr;
258  } else {
259  return reinterpret_cast<bvec_t*>(&v.front());
260  }
261  }

◆ get_bvec_t() [4/4]

template<typename T >
bvec_t * casadi::get_bvec_t ( std::vector< T > &  v)

Definition at line 991 of file casadi_misc.hpp.

991  {
992  casadi_assert(0, "get_bvec_t only supported for double");
993  }

◆ get_default_global_params()

fatrop_int casadi::get_default_global_params ( double *  global_params,
void *  user_data 
)

Definition at line 465 of file fatrop_conic_interface.cpp.

465  {
466  return 0;
467  }

Referenced by casadi::FatropConicInterface::solve().

◆ get_default_stage_params()

fatrop_int casadi::get_default_stage_params ( double *  stage_params,
const fatrop_int  k,
void *  user_data 
)

Definition at line 461 of file fatrop_conic_interface.cpp.

461  {
462  return 0;
463  }

Referenced by casadi::FatropConicInterface::solve().

◆ get_from_dict() [1/2]

template<class T >
T casadi::get_from_dict ( const Dict d,
const std::string &  key,
const T &  default_value 
)

Definition at line 270 of file generic_type.hpp.

270  {
271  auto it = d.find(key);
272  if (it==d.end()) return default_value;
273  return it->second;
274  }

References T.

◆ get_from_dict() [2/2]

template<class T >
T casadi::get_from_dict ( const std::map< std::string, T > &  d,
const std::string &  key,
const T &  default_value 
)

Definition at line 262 of file generic_type.hpp.

263  {
264  auto it = d.find(key);
265  if (it==d.end()) return default_value;
266  return it->second;
267  }

References T.

Referenced by construct_nlpsol(), casadi::FunctionInternal::finalize(), init_gen(), map_semi_expl(), qpsol_nlp(), reduce_index_gen(), casadi::OptiNode::stats(), and casadi::FunctionInternal::~FunctionInternal().

◆ get_horizon_length()

fatrop_int casadi::get_horizon_length ( void *  user_data)

Definition at line 477 of file fatrop_conic_interface.cpp.

477  {
478  FatropUserData* data = static_cast<FatropUserData*>(user_data);
479  return data->solver->N_+1;
480  }

Referenced by casadi::FatropConicInterface::solve().

◆ get_initial_uk()

fatrop_int casadi::get_initial_uk ( double *  uk,
const fatrop_int  k,
void *  user_data 
)

Definition at line 1012 of file fatrop_conic_interface.cpp.

1012  {
1013  FatropUserData* data = static_cast<FatropUserData*>(user_data);
1014  auto m = data->mem;
1015  auto d = &m->d;
1016  auto p = d->prob;
1017  casadi_qp_data<double>* d_qp = d->qp;
1018  casadi_copy(d_qp->x0+p->CD[k].offset_c+p->nx[k], p->nu[k], uk);
1019  return 0;
1020  }
const T1 * x0
Definition: casadi_qp.hpp:64

References casadi_copy(), and casadi_qp_data< T1 >::x0.

Referenced by casadi::FatropConicInterface::solve().

◆ get_initial_xk()

fatrop_int casadi::get_initial_xk ( double *  xk,
const fatrop_int  k,
void *  user_data 
)

Definition at line 1001 of file fatrop_conic_interface.cpp.

1001  {
1002  FatropUserData* data = static_cast<FatropUserData*>(user_data);
1003  auto m = data->mem;
1004  auto d = &m->d;
1005  auto p = d->prob;
1006  casadi_qp_data<double>* d_qp = d->qp;
1007  casadi_copy(d_qp->x0+p->CD[k].offset_c, p->nx[k], xk);
1008 
1009  return 0;
1010  }

References casadi_copy(), and casadi_qp_data< T1 >::x0.

Referenced by casadi::FatropConicInterface::solve().

◆ get_inverse()

std::vector<casadi_int> casadi::get_inverse ( const std::vector< casadi_int > &  map)

Definition at line 785 of file integration_tools.cpp.

785  {
786  std::vector<casadi_int> ret(map.size(), -1);
787  for (casadi_int i=0;i<ret.size();++i) {
788  if (map[i]>=0) ret[map[i]] = i;
789  }
790  return ret;
791 }

Referenced by reduce_index_gen().

◆ get_n_global_params()

fatrop_int casadi::get_n_global_params ( void *  user_data)

Definition at line 457 of file fatrop_conic_interface.cpp.

457  {
458  return 0;
459  }

Referenced by casadi::FatropConicInterface::solve().

◆ get_n_stage_params()

fatrop_int casadi::get_n_stage_params ( const fatrop_int  k,
void *  user_data 
)

Definition at line 453 of file fatrop_conic_interface.cpp.

453  {
454  return 0;
455  }

Referenced by casadi::FatropConicInterface::solve().

◆ get_ng()

fatrop_int casadi::get_ng ( const fatrop_int  k,
void *  user_data 
)

Definition at line 442 of file fatrop_conic_interface.cpp.

442  {
443  FatropUserData* data = static_cast<FatropUserData*>(user_data);
444  auto d = &data->mem->d;
445  int ret;
446  fatrop_int n_a_eq = d->a_eq_idx[k+1]-d->a_eq_idx[k];
447  fatrop_int n_x_eq = d->x_eq_idx[k+1]-d->x_eq_idx[k];
448 
449  ret = n_a_eq+n_x_eq;
450  return ret;
451  }

Referenced by casadi::FatropConicInterface::solve().

◆ get_ng_ineq()

fatrop_int casadi::get_ng_ineq ( const fatrop_int  k,
void *  user_data 
)

Definition at line 469 of file fatrop_conic_interface.cpp.

469  {
470  FatropUserData* data = static_cast<FatropUserData*>(user_data);
471  auto d = &data->mem->d;
472  fatrop_int n_a_ineq = d->a_ineq_idx[k+1]-d->a_ineq_idx[k];
473  fatrop_int n_x_ineq = d->x_ineq_idx[k+1]-d->x_ineq_idx[k];
474  return n_a_ineq+n_x_ineq;
475  }

Referenced by casadi::FatropConicInterface::solve().

◆ get_nu()

fatrop_int casadi::get_nu ( const fatrop_int  k,
void *  user_data 
)

Definition at line 436 of file fatrop_conic_interface.cpp.

436  {
437  FatropUserData* data = static_cast<FatropUserData*>(user_data);
438  const auto& solver = *data->solver;
439  return solver.nus_[k];
440  }

Referenced by casadi::FatropConicInterface::solve().

◆ get_nx()

fatrop_int casadi::get_nx ( const fatrop_int  k,
void *  user_data 
)

Definition at line 429 of file fatrop_conic_interface.cpp.

429  {
430  FatropUserData* data = static_cast<FatropUserData*>(user_data);
431  const auto& solver = *data->solver;
432  if (k==solver.nxs_.size()) return solver.nxs_[k-1];
433  return solver.nxs_[k];
434  }

Referenced by casadi::FatropConicInterface::solve().

◆ get_orders()

std::vector<casadi_int> casadi::get_orders ( const std::vector< casadi_int > &  map)

Definition at line 777 of file integration_tools.cpp.

777  {
778  std::vector<casadi_int> ret(map.size(), 0);
779  for (casadi_int i=0;i<ret.size();++i) {
780  if (map[i]>=0) ret[map[i]] = ret[i]+1;
781  }
782  return ret;
783 }

Referenced by reduce_index_gen().

◆ get_ptr() [1/2]

template<typename T >
const T * casadi::get_ptr ( const std::vector< T > &  v)

Definition at line 865 of file casadi_misc.hpp.

865  {
866  if (v.empty())
867  return nullptr;
868  else
869  return &v.front();
870  }

References T.

◆ get_ptr() [2/2]

template<typename T >
T * casadi::get_ptr ( std::vector< T > &  v)

Definition at line 857 of file casadi_misc.hpp.

857  {
858  if (v.empty())
859  return nullptr;
860  else
861  return &v.front();
862  }

References T.

Referenced by casadi::FunctionBuffer::_eval(), _which_depends(), casadi::SparsityInternal::amd(), casadi::HpmpcInterface::blockptr(), casadi::HpipmInterface::blockptr(), casadi::FatropConicInterface::blockptr(), casadi::Function::buf_in(), casadi::Function::buf_out(), casadi::Blocksqp::calcSR1(), casadi::FunctionInternal::call_gen(), casadi::Function::call_gen(), casadi::ConstantFile::ConstantFile(), casadi::MX::depends_on(), casadi::BSplineCommon::derivative_coeff(), casadi::Convexify::deserialize(), casadi::BSpline::dual(), casadi::Matrix< Scalar >::einstein(), einstein_eval(), casadi::Sparsity::etree(), casadi::BSpline::eval(), casadi::BSplineParametric::eval(), casadi::LinearInterpolant::eval(), casadi::LinearInterpolantJac::eval(), casadi::FmuInternal::eval(), casadi::FmuInternal::eval_ad(), casadi::FmuInternal::eval_adj(), eval_BAbt(), casadi::FmuInternal::eval_fd(), eval_Ggt(), eval_Ggt_ineq(), casadi::SXFunction::eval_mx(), eval_RSQrqt(), casadi::CallSX::eval_sx(), casadi::MXFunction::eval_sx(), casadi::Switch::eval_sx(), casadi::Blocksqp::evaluate(), fatrop_blocks_pack(), casadi::Blocksqp::feasibilityRestorationPhase(), casadi::FmuInternal::finalize(), casadi::FmuFunction::FmuFunction(), casadi::Fmu2::get_aux(), casadi::Fmu3::get_aux(), casadi::FunctionInternal::get_jac_sparsity_gen(), casadi::FunctionInternal::get_jac_sparsity_hierarchical(), casadi::FunctionInternal::get_jac_sparsity_hierarchical_symm(), casadi::FmuFunction::get_stats(), hash_combine(), hash_sparsity(), hpipm_blocks_pack(), casadi::FmuFunction::init(), casadi::SXFunction::init(), casadi::MadnlpInterface::init(), casadi::External::init_external(), casadi::CsparseInterface::init_mem(), casadi::HpmpcInterface::init_mem(), casadi::OsqpInterface::init_mem(), casadi::SuperscsInterface::init_mem(), casadi::SparsityInternal::is_equal(), casadi::Blocksqp::kktErrorReduction(), casadi::Sparsity::kron(), casadi::Sparsity::ldl(), casadi::Ma27Interface::nfact(), casadi::LapackLu::nfact(), casadi::LapackQr::nfact(), casadi::MumpsInterface::nfact(), casadi::LinsolLdl::nfact(), casadi::LinsolQr::nfact(), casadi::Lsqr::nfact(), casadi::SymbolicQr::nfact(), casadi::Sparsity::norm_0_mul(), casadi::QpoasesInterface::qpoases_nfact(), casadi::QpoasesInterface::qpoases_sfact(), casadi::QpoasesInterface::qpoases_solve(), casadi::Sparsity::qr_sparse(), casadi::Function::rev(), casadi::Blocksqp::secondOrderCorrection(), casadi::ClarabelInterface::set_clarabel_prob(), casadi::FatropConicInterface::set_fatrop_conic_prob(), casadi::FatropInterface::set_fatrop_prob(), casadi::HighsInterface::set_highs_prob(), casadi::HpipmInterface::set_hpipm_prob(), casadi::MadnlpInterface::set_madnlp_prob(), casadi::Fmu2::set_values(), casadi::Fmu3::set_values(), casadi::FastNewton::set_work(), casadi::Convexify::setup(), casadi::CbcInterface::solve(), casadi::ClpInterface::solve(), casadi::CplexInterface::solve(), casadi::FatropConicInterface::solve(), casadi::GurobiInterface::solve(), casadi::HpmpcInterface::solve(), casadi::OoqpInterface::solve(), casadi::ProxqpInterface::solve(), casadi::QpoasesInterface::solve(), casadi::SuperscsInterface::solve(), casadi::KnitroInterface::solve(), casadi::SnoptInterface::solve(), casadi::Feasiblesqpmethod::solve(), casadi::Ma27Interface::solve(), casadi::LapackLu::solve(), casadi::LinsolLdl::solve(), casadi::LinsolQr::solve(), casadi::Lsqr::solve(), casadi::SymbolicQr::solve(), casadi::LapackQr::solve_batch(), casadi::Blocksqp::solveQP(), and unpack_block().

◆ get_search_paths()

CASADI_EXPORT std::vector< std::string > casadi::get_search_paths ( )

Definition at line 49 of file casadi_os.cpp.

49  {
50 
51  // Build up search paths;
52  std::vector<std::string> search_paths;
53 
54  // Search path: global casadipath option
55  std::stringstream casadipaths(GlobalOptions::getCasadiPath());
56  std::string casadipath;
57  while (std::getline(casadipaths, casadipath, pathsep())) {
58  search_paths.push_back(casadipath);
59  }
60 
61  // Search path: CASADIPATH env variable
62  char* pLIBDIR;
63  pLIBDIR = getenv("CASADIPATH");
64 
65  if (pLIBDIR!=nullptr) {
66  std::stringstream casadipaths(pLIBDIR);
67  std::string casadipath;
68  while (std::getline(casadipaths, casadipath, pathsep())) {
69  search_paths.push_back(casadipath);
70  }
71  }
72 
73  // Search path: bare
74  search_paths.push_back("");
75 
76  // Search path : PLUGIN_EXTRA_SEARCH_PATH
77  #ifdef PLUGIN_EXTRA_SEARCH_PATH
78  search_paths.push_back(
79  std::string("") + PLUGIN_EXTRA_SEARCH_PATH);
80  #endif // PLUGIN_EXTRA_SEARCH_PATH
81 
82  // Search path : current directory
83  search_paths.push_back(".");
84 
85  return search_paths;
86 }
char pathsep()
Definition: casadi_os.cpp:34

References casadi::GlobalOptions::getCasadiPath(), and pathsep().

Referenced by casadi::ShellCompiler::init(), casadi::DllLibrary::init_handle(), and casadi::PluginInterface< Derived >::load_library().

◆ getcopy()

template<class A >
A casadi::getcopy ( const A &  a,
std::map< typename A::base_type *, typename A::internal_base_type > &  already_copied 
)

Definition at line 123 of file generic_shared_internal.hpp.

125  {
126  A ret;
127  if (!a.is_null()) {
128  auto it =
129  already_copied.find(const_cast<typename A::base_type*>(a.get()));
130  if (it!=already_copied.end()) {
131  ret.own(it->second.get());
132  }
133  }
134  return ret;
135  }

◆ has_archiver()

CASADI_EXPORT bool casadi::has_archiver ( const std::string &  name)

Definition at line 38 of file archiver.cpp.

38  {
39  return Archiver::has_plugin(name);
40  }

References casadi::PluginInterface< Archiver >::has_plugin().

◆ has_empty()

bool casadi::has_empty ( const std::vector< MX > &  x,
bool  both = false 
)

Definition at line 1038 of file mx.cpp.

1038  {
1039  for (auto&& i : x) {
1040  if (i.is_empty(both)) return true;
1041  }
1042  return false;
1043  }

Referenced by casadi::MX::diagcat(), casadi::MX::horzcat(), and casadi::MX::vertcat().

◆ has_enum()

template<typename T >
bool casadi::has_enum ( const std::string &  s)

Definition at line 47 of file casadi_enum.hpp.

47  {
48  // Look for a match
49  for (size_t i = 0; i < enum_traits<T>::n_enum; ++i) {
50  if (s == to_string(static_cast<T>(i))) return true;
51  }
52  // Not found
53  return false;
54 }

References T, and to_string().

◆ has_filesystem()

CASADI_EXPORT bool casadi::has_filesystem ( const std::string &  name)

Definition at line 92 of file filesystem.cpp.

92  {
93  return Filesystem::has_plugin(name);
94 }

References casadi::PluginInterface< Filesystem >::has_plugin().

◆ has_linsol()

CASADI_EXPORT bool casadi::has_linsol ( const std::string &  name)

Definition at line 206 of file linsol.cpp.

206  {
207  return Linsol::has_plugin(name);
208  }

References casadi::Linsol::has_plugin().

◆ has_negative()

template<typename T >
bool casadi::has_negative ( const std::vector< T > &  v)

Definition at line 776 of file casadi_misc.hpp.

776  {
777  for (std::size_t i=0; i<v.size(); ++i) {
778  if (v[i]<0) return true;
779  }
780  return false;
781  }

Referenced by casadi::SparsityInternal::_enlargeColumns(), casadi::SparsityInternal::_enlargeRows(), casadi::SparsityInternal::_erase(), casadi::GetNonzerosVector::generate(), casadi::SetNonzerosVector< Add >::generate(), lookupvector(), and casadi::SparsityInternal::sub().

◆ has_parent_path()

bool casadi::has_parent_path ( const std::string &  path)

Definition at line 67 of file ghc.cpp.

67  {
68  return ghc::filesystem::path(path).has_parent_path();
69  }

References path().

Referenced by casadi_register_filesystem_ghc().

◆ has_prefix()

CASADI_EXPORT bool casadi::has_prefix ( const std::string &  s)

◆ hash_combine() [1/3]

template<typename T >
void casadi::hash_combine ( std::size_t &  seed,
const std::vector< T > &  v 
)
inline

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

Definition at line 1223 of file sparsity.hpp.

1223  {
1224  hash_combine(seed, get_ptr(v), v.size());
1225  }
void hash_combine(std::size_t &seed, T v)
Generate a hash value incrementally (function taken from boost)
Definition: sparsity.hpp:1207

References get_ptr(), and hash_combine().

◆ hash_combine() [2/3]

template<typename T >
void casadi::hash_combine ( std::size_t &  seed,
const T *  v,
std::size_t  sz 
)
inline

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

Definition at line 1215 of file sparsity.hpp.

1215  {
1216  for (casadi_int i=0; i<sz; ++i) hash_combine(seed, v[i]);
1217  }

References hash_combine().

◆ hash_combine() [3/3]

template<typename T >
void casadi::hash_combine ( std::size_t &  seed,
v 
)
inline

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

Definition at line 1207 of file sparsity.hpp.

1207  {
1208  seed ^= hash_value(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
1209  }
size_t hash_value(T v)
Hash value of an integer.
Definition: sparsity.hpp:1201

References hash_value().

Referenced by casadi::CodeGenerator::hash(), hash_combine(), hash_sparsity(), and hash_value().

◆ hash_sparsity() [1/2]

CASADI_EXPORT std::size_t casadi::hash_sparsity ( casadi_int  nrow,
casadi_int  ncol,
const casadi_int *  colind,
const casadi_int *  row 
)

Definition at line 1001 of file sparsity.cpp.

1002  {
1003  // Condense the sparsity pattern to a single, deterministric number
1004  std::size_t ret=0;
1005  hash_combine(ret, nrow);
1006  hash_combine(ret, ncol);
1007  hash_combine(ret, colind, ncol+1);
1008  hash_combine(ret, row, colind[ncol]);
1009  return ret;
1010  }

References hash_combine().

◆ hash_sparsity() [2/2]

CASADI_EXPORT std::size_t casadi::hash_sparsity ( casadi_int  nrow,
casadi_int  ncol,
const std::vector< casadi_int > &  colind,
const std::vector< casadi_int > &  row 
)

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

Definition at line 996 of file sparsity.cpp.

997  {
998  return hash_sparsity(nrow, ncol, get_ptr(colind), get_ptr(row));
999  }
std::size_t hash_sparsity(casadi_int nrow, casadi_int ncol, const std::vector< casadi_int > &colind, const std::vector< casadi_int > &row)
Hash a sparsity pattern.
Definition: sparsity.cpp:996

References get_ptr().

Referenced by casadi::SparsityInternal::hash().

◆ hash_value() [1/2]

template<>
size_t casadi::hash_value ( std::string  v)
inline

Definition at line 1228 of file sparsity.hpp.

1228  {
1229  size_t seed = 0;
1230  hash_combine(seed, v.c_str(), v.size());
1231  return seed;
1232  }

References hash_combine().

◆ hash_value() [2/2]

template<typename T >
size_t casadi::hash_value ( v)
inline

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

Definition at line 1201 of file sparsity.hpp.

1201 { return size_t(v);}

Referenced by hash_combine().

◆ hpipm_blocks_pack()

std::vector<casadi_int> casadi::hpipm_blocks_pack ( const std::vector< casadi_hpipm_block > &  blocks)

Definition at line 476 of file hpipm_interface.cpp.

476  {
477  size_t N = blocks.size();
478  std::vector<casadi_int> ret(4*N);
479  casadi_int* r = get_ptr(ret);
480  for (casadi_int i=0;i<N;++i) {
481  *r++ = blocks[i].offset_r;
482  *r++ = blocks[i].offset_c;
483  *r++ = blocks[i].rows;
484  *r++ = blocks[i].cols;
485  }
486  return ret;
487  }

References get_ptr().

Referenced by codegen_unpack_block().

◆ if_else()

double casadi::if_else ( double  x,
double  y,
double  z 
)
inline

◆ if_else_zero()

double casadi::if_else_zero ( double  x,
double  y 
)
inline

◆ in_range() [1/2]

template<typename T >
bool casadi::in_range ( const std::vector< T > &  v,
casadi_int  lower,
casadi_int  upper 
)

Definition at line 672 of file casadi_misc.hpp.

672  {
673  if (v.empty()) return true;
674  casadi_int max = *std::max_element(v.begin(), v.end());
675  if (max >= upper) return false;
676  casadi_int min = *std::min_element(v.begin(), v.end());
677  return (min >= lower);
678  }

◆ in_range() [2/2]

template<typename T >
bool casadi::in_range ( const std::vector< T > &  v,
casadi_int  upper 
)

Definition at line 667 of file casadi_misc.hpp.

667  {
668  return in_range(v, 0, upper);
669  }

Referenced by check_sos(), complement(), lookupvector(), and casadi::Function::mapaccum().

◆ index_interp1d()

double CASADI_EXPORT casadi::index_interp1d ( const std::vector< double > &  x,
double  xq,
bool  equidistant 
)

Definition at line 30 of file generic_matrix.cpp.

30  {
31 
32  if (equidistant) {
33  double delta = x[1]-x[0];
34  double i = (xq-x[0])/delta;
35  double imax = static_cast<double>(x.size()-1);
36  return std::max(std::min(i, imax), 0.0);
37 
38  } else {
39  std::vector<double>::const_iterator it = std::lower_bound(x.begin(), x.end(), xq);
40 
41  // End of x
42  if (it==x.end()) return static_cast<double>(x.size()-1);
43 
44  // Start of x
45  if (it==x.begin()) return 0.0;
46 
47  casadi_int i = std::distance(x.begin(), it);
48 
49  // Exactly on an entry
50  if (*it == xq) return static_cast<double>(i);
51 
52  double b = *it;
53  double a = *(it-1);
54 
55  return static_cast<double>(i)+(xq-b)/(b-a);
56  }
57  }

Referenced by casadi::GenericMatrix< MatType >::interp1d().

◆ init_gen()

template<class X >
Function casadi::init_gen ( const std::map< std::string, X > &  dae,
const std::map< std::string, X > &  dae_red,
const std::string &  init_solver,
const DMDict init_strength,
const Dict init_solver_options 
)

Definition at line 1112 of file integration_tools.cpp.

1114  {
1115 
1116  X x_impl = get_from_dict(dae, "x_impl", X(0, 1));
1117  X dx_impl = get_from_dict(dae, "dx_impl", X(0, 1));
1118  X z = get_from_dict(dae, "z", X(0, 1));
1119  X p_orig = get_from_dict(dae, "p", X(0, 1));
1120 
1121  Sparsity var_map_sp = jacobian(
1122  vertcat(dae_red.at("x"), dae_red.at("x_impl"), dae_red.at("dx_impl"), dae_red.at("z")),
1123  vertcat(x_impl, dx_impl, z)).sparsity();
1124  DM var_map(var_map_sp, 1.0);
1125 
1126  // NLP to obtain consistent initial guesses
1127  std::map<std::string, X> nlp;
1128 
1129  MX pmx = MX::sym("pmx", p_orig.sparsity());
1130  MX tmx = MX::sym("t");
1131 
1132  X init_x_impl_orig = X::sym("x_impl_init", x_impl.sparsity());
1133  X init_dx_impl_orig = X::sym("dx_impl_init", dx_impl.sparsity());
1134  X init_z_orig = X::sym("z_init", z.sparsity());
1135 
1136  MX init_x_impl_orig_mx = MX::sym("x_impl_init", x_impl.sparsity());
1137  MX init_dx_impl_orig_mx = MX::sym("dx_impl_init", dx_impl.sparsity());
1138  MX init_z_orig_mx = MX::sym("z_init", z.sparsity());
1139 
1140  X init_orig = vertcat(init_x_impl_orig, init_dx_impl_orig, init_z_orig);
1141  MX init_orig_mx = vertcat(init_x_impl_orig_mx, init_dx_impl_orig_mx, init_z_orig_mx);
1142 
1143  X init_sym_red = mtimes(X(var_map), init_orig);
1144  nlp["p"] = vertcat(init_orig, dae_red.at("p"), dae_red.at("t"));
1145  MX p = vertcat(init_orig_mx, pmx, tmx);
1146 
1147  // Dae input sanitization
1148 
1149  for (const auto& e : init_strength) {
1150  casadi_assert(e.second.is_column() && e.second.is_dense(),
1151  "Dense column vector expected for key '" + e.first + "' of init_strength. "
1152  "Got " + e.second.dim(true) + " instead.");
1153  }
1154 
1155  DM init_strength_x_impl = get_from_dict(init_strength, "x_impl", DM::zeros(x_impl.numel(), 1));
1156  casadi_assert(x_impl.numel()==init_strength_x_impl.numel(),
1157  "init_strength 'x_impl' entry should have length " + str(x_impl.numel()) + ". "
1158  "Got length " + str(init_strength_x_impl.numel()) + " instead.");
1159 
1160  DM init_strength_dx_impl = get_from_dict(init_strength, "dx_impl",
1161  DM::zeros(dx_impl.numel(), 1));
1162  casadi_assert(dx_impl.numel()==init_strength_dx_impl.numel(),
1163  "init_strength 'dx_impl' entry should have length " + str(dx_impl.numel()) + ". "
1164  "Got length " + str(init_strength_dx_impl.numel()) + " instead.");
1165 
1166  DM init_strength_z = get_from_dict(init_strength, "z", DM::zeros(z.numel(), 1));
1167  casadi_assert(z.numel()==init_strength_z.numel(),
1168  "init_strength 'z' entry should have length " + str(z.numel()) + ". "
1169  "Got length " + str(init_strength_z.numel()) + " instead.");
1170 
1171  DM init_strength_cat = vertcat(init_strength_x_impl, init_strength_dx_impl, init_strength_z);
1172 
1173  DM weights = mtimes(var_map, init_strength_cat);
1174  // Should be written more cleanly
1175  std::vector<casadi_int> ind = sparsify(weights>0).sparsity().T().get_col();
1176 
1177  std::vector<X> x_parts = {dae_red.at("x"), dae_red.at("x_impl"),
1178  dae_red.at("dx_impl"), dae_red.at("z")};
1179 
1180  nlp["x"] = vertcat(x_parts);
1181  nlp["g"] = vertcat(dae_red.at("I"), dae_red.at("alg"));
1182  nlp["f"] = sumsqr((nlp["x"](ind)-init_sym_red(ind))*X(weights(ind)));
1183 
1184 
1185  MX x0 = mtimes(var_map, init_orig_mx);
1186  MX lbx = -MX::inf(nlp.at("x").numel());
1187  MX ubx = MX::inf(lbx.size());
1188 
1189  // Should be written more cleanly
1190  ind = sparsify(mtimes(var_map, init_strength_cat)==-1).sparsity().T().get_col();
1191  lbx(ind) = ubx(ind) = x0(ind);
1192 
1193  Function solver = nlpsol("init_solver", init_solver, nlp, init_solver_options);
1194  MXDict res = solver(MXDict{{"x0", x0}, {"lbg", 0}, {"ubg", 0},
1195  {"lbx", lbx}, {"ubx", ubx}, {"p", p}});
1196 
1197  std::vector<casadi_int> x_parts_offsets = {0};
1198  for (casadi_int i=0;i<x_parts.size();i+=2) {
1199  x_parts_offsets.push_back(x_parts_offsets.back() + x_parts[i].numel() + x_parts[i+1].numel());
1200  }
1201 
1202  std::vector<MX> parts = vertsplit(res["x"], x_parts_offsets);
1203 
1204  return Function("init_gen",
1205  {init_x_impl_orig_mx, init_dx_impl_orig_mx, init_z_orig_mx, pmx, tmx},
1206  parts,
1207  {"x_impl", "dx_impl", "z", "p", "t"},
1208  {"x0", "z0"});
1209 }
Function nlpsol(const std::string &name, const std::string &solver, const SXDict &nlp, const Dict &opts)
Definition: nlpsol.cpp:118
std::map< std::string, MX > MXDict
Definition: mx.hpp:1009

References get_from_dict(), casadi::MX::inf(), nlpsol(), casadi::GenericMatrix< MatType >::numel(), casadi::GenericMatrix< MatType >::size(), str(), casadi::GenericMatrix< MX >::sym(), X, and casadi::GenericMatrix< MatType >::zeros().

Referenced by dae_init_gen().

◆ init_vector()

template<class S , class D >
void casadi::init_vector ( std::vector< S > &  d,
const std::vector< D > &  s 
)

Definition at line 660 of file casadi_misc.hpp.

660  {
661  d.resize(s.size());
662  std::copy(s.begin(), s.end(), d.begin());
663  }

Referenced by casadi::HpmpcInterface::init_mem().

◆ input_categories()

CASADI_EXPORT std::vector< Category > casadi::input_categories ( )

Definition at line 268 of file dae_builder_internal.cpp.

268  {
269  std::vector<Category> ret;
270  for (casadi_int i = 0; i != enum_traits<Category>::n_enum; ++i) {
271  auto cat = static_cast<Category>(i);
272  if (is_input_category(cat)) ret.push_back(cat);
273  }
274  return ret;
275 }
bool is_input_category(Category cat)

References is_input_category().

Referenced by casadi::DaeBuilderInternal::oracle(), and casadi::DaeBuilderInternal::prune().

◆ input_category()

CASADI_EXPORT Category casadi::input_category ( OutputCategory  cat)

Definition at line 1806 of file dae_builder_internal.cpp.

1806  {
1807  switch (cat) {
1808  case OutputCategory::ODE: return Category::X;
1809  case OutputCategory::QUAD: return Category::Q;
1810  case OutputCategory::DDEF: return Category::D;
1811  case OutputCategory::WDEF: return Category::W;
1812  default: break;
1813  }
1814  casadi_error("No input category for " + to_string(cat));
1815 }

References D, DDEF, ODE, Q, QUAD, to_string(), W, WDEF, and X.

Referenced by casadi::DaeBuilderInternal::output().

◆ interpn_G()

MX casadi::interpn_G ( casadi_int  i,
const MX v,
const std::vector< MX > &  xis,
const std::vector< MX > &  L,
const std::vector< MX > &  Lp,
const std::vector< casadi_int > &  strides,
const Slice I,
const MX offset = 0 
)

Definition at line 2629 of file mx.cpp.

2636  {
2637  if (i==0) {
2638  MX ret;
2639  v.get_nz(ret, false, offset, I);
2640  return ret;
2641  } else {
2642  casadi_int j = xis.size()-i;
2643  MX offsetL, offsetR;
2644  if (strides[j]==1) {
2645  offsetL = offset+L[j];
2646  offsetR = offset+Lp[j];
2647  } else {
2648  offsetL = offset+L[j]*strides[j];
2649  offsetR = offsetL+strides[j];
2650  }
2651  MX vl = interpn_G(i-1, v, xis, L, Lp, strides, I, offsetL);
2652  MX vu = interpn_G(i-1, v, xis, L, Lp, strides, I, offsetR);
2653 
2654  // Perform interpolation between vl and vu
2655  return vl + xis[j]*(vu-vl);
2656  }
2657  }
MX interpn_G(casadi_int i, const MX &v, const std::vector< MX > &xis, const std::vector< MX > &L, const std::vector< MX > &Lp, const std::vector< casadi_int > &strides, const Slice &I, const MX &offset=0)
Definition: mx.cpp:2629

References casadi::MX::get_nz(), and casadi::GenericMatrix< MatType >::size().

Referenced by casadi::MX::interpn_linear().

◆ invert_lookup()

std::vector<casadi_int> casadi::invert_lookup ( const std::vector< casadi_int > &  lookup)

Definition at line 398 of file integration_tools.cpp.

398  {
399  std::vector<casadi_int> ret(lookup.size(), -1);
400  for (casadi_int i=0;i<lookup.size();++i) {
401  casadi_int e = lookup[i];
402  if (e>=0) {
403  ret[e] = i;
404  }
405  }
406  return ret;
407 }

◆ invert_permutation()

std::vector< casadi_int > casadi::invert_permutation ( const std::vector< casadi_int > &  a)

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

Definition at line 178 of file casadi_misc.cpp.

178  {
179  casadi_assert(is_permutation(a), "Not a permutation");
180  std::vector<casadi_int> ret(a.size());
181  for (casadi_int i=0;i<a.size();++i) {
182  ret[a[i]] = i;
183  }
184  return ret;
185  }
bool is_permutation(const std::vector< casadi_int > &order)
Does the list represent a permutation?

References is_permutation().

Referenced by casadi::Sparsity::permutation(), casadi::Sparsity::permutation_vector(), casadi::SparsityInternal::pmult(), and casadi::Sparsity::pmult().

◆ is_acyclic()

CASADI_EXPORT bool casadi::is_acyclic ( Category  cat)

Definition at line 244 of file dae_builder_internal.cpp.

244  {
245  switch (cat) {
246  case Category::C: // Fall-through
247  case Category::D: // Fall-through
248  case Category::W:
249  // Acyclic category
250  return true;
251  default:
252  return false;
253  }
254 }

References C, D, and W.

Referenced by casadi::DaeBuilderInternal::categorize(), casadi::DaeBuilderInternal::eliminate(), and casadi::DaeBuilderInternal::sort().

◆ is_decreasing()

template<typename T >
bool casadi::is_decreasing ( const std::vector< T > &  v)

Definition at line 733 of file casadi_misc.hpp.

733  {
734  if (v.empty()) return true;
735  T el = v[0];
736  for (casadi_int i=1;i<v.size();++i) {
737  if (!(v[i] < el)) return false;
738  el = v[i];
739  }
740  return el==el; // nan -> false
741  }

References T.

Referenced by is_strictly_monotone().

◆ is_directory()

bool casadi::is_directory ( const std::string &  path)

Definition at line 31 of file ghc.cpp.

31  {
32  return ghc::filesystem::is_directory(path);
33  }

References path().

Referenced by casadi_register_filesystem_ghc().

◆ is_equal()

bool casadi::is_equal ( double  x,
double  y,
casadi_int  depth = 0 
)
inline

◆ is_equally_spaced()

CASADI_EXPORT bool casadi::is_equally_spaced ( const std::vector< double > &  v)

Definition at line 118 of file casadi_misc.cpp.

118  {
119  // Quick return if 2 or less entries
120  if (v.size()<=2) return true;
121  // Permitted error margin
122  // NOTE(@jaeandersson) 1e-14 good idea?
123  double margin = (v.back()-v.front())*1e-14;
124  // Make sure spacing is consistent throughout
125  double spacing = v[1]-v[0];
126  for (size_t i=2; i<v.size(); ++i) {
127  if (fabs(v[i]-v[i-1]-spacing)>margin) return false;
128  }
129  // Equal if reached this point
130  return true;
131  }

Referenced by casadi::Interpolant::interpret_lookup_mode().

◆ is_increasing()

template<typename T >
bool casadi::is_increasing ( const std::vector< T > &  v)

Definition at line 722 of file casadi_misc.hpp.

722  {
723  if (v.empty()) return true;
724  T el = v[0];
725  for (casadi_int i=1;i<v.size();++i) {
726  if (!(v[i] > el)) return false;
727  el = v[i];
728  }
729  return el==el; // nan -> false
730  }

References T.

Referenced by casadi::Interpolant::check_grid(), casadi::GenericMatrix< MatType >::interp1d(), casadi::Interpolant::interpret_lookup_mode(), and is_strictly_monotone().

◆ is_input_category()

CASADI_EXPORT bool casadi::is_input_category ( Category  cat)

Definition at line 223 of file dae_builder_internal.cpp.

223  {
224  switch (cat) {
225  case Category::T: // Fall-through
226  case Category::P: // Fall-through
227  case Category::U: // Fall-through
228  case Category::X: // Fall-through
229  case Category::Z: // Fall-through
230  case Category::Q: // Fall-through
231  case Category::C: // Fall-through
232  case Category::D: // Fall-through
233  case Category::W:
234  // Input category
235  return true;
236  case Category::CALCULATED:
237  // Output category
238  return false;
239  default: break;
240  }
241  casadi_error("Cannot handle: " + to_string(cat));
242 }

References C, CALCULATED, D, P, Q, T, to_string(), U, W, X, and Z.

Referenced by casadi::DaeBuilderInternal::input(), and input_categories().

◆ is_monotone()

template<typename T >
bool casadi::is_monotone ( const std::vector< T > &  v)

Definition at line 766 of file casadi_misc.hpp.

766  {
767  return is_nondecreasing(v) || is_nonincreasing(v);
768  }
bool is_nonincreasing(const std::vector< T > &v)
Check if the vector is non-increasing.
bool is_nondecreasing(const std::vector< T > &v)
Check if the vector is non-decreasing.

References is_nondecreasing(), and is_nonincreasing().

Referenced by casadi::MX::diagsplit(), casadi::Sparsity::diagsplit(), casadi::MX::horzsplit(), casadi::Sparsity::horzsplit(), and casadi::MX::vertsplit().

◆ is_nondecreasing()

template<typename T >
bool casadi::is_nondecreasing ( const std::vector< T > &  v)

Definition at line 755 of file casadi_misc.hpp.

755  {
756  if (v.empty()) return true;
757  T el = v[0];
758  for (casadi_int i=1;i<v.size();++i) {
759  if (!(v[i] >= el)) return false;
760  el = v[i];
761  }
762  return el==el; // nan -> false
763  }

References T.

Referenced by casadi::SparsityInternal::_erase(), and is_monotone().

◆ is_nonincreasing()

template<typename T >
bool casadi::is_nonincreasing ( const std::vector< T > &  v)

Definition at line 744 of file casadi_misc.hpp.

744  {
745  if (v.empty()) return true;
746  T el = v[0];
747  for (casadi_int i=1;i<v.size();++i) {
748  if (!(v[i] <= el)) return false;
749  el = v[i];
750  }
751  return el==el; // nan -> false
752  }

References T.

Referenced by is_monotone().

◆ is_permutation()

bool casadi::is_permutation ( const std::vector< casadi_int > &  order)

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

Definition at line 171 of file casadi_misc.cpp.

171  {
172  std::set<casadi_int> order_set(order.begin(), order.end());
173  return (order_set.size()==order.size()) &&
174  (*order_set.begin()==0) &&
175  (*order_set.rbegin()==order.size()-1);
176  }

Referenced by invert_permutation(), casadi::Sparsity::permutation(), and permute().

◆ is_range()

CASADI_EXPORT bool casadi::is_range ( const std::vector< casadi_int > &  v,
casadi_int  start,
casadi_int  stop,
casadi_int  step = 1 
)

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

Definition at line 91 of file casadi_misc.cpp.

92  {
93  casadi_int nret = (stop-start)/step + ((stop-start)%step!=0);
94  if (v.size()!=nret) return false;
95  casadi_int ind = start;
96  for (casadi_int e : v) {
97  if (e!=ind) return false;
98  ind += step;
99  }
100  return true;
101  }

Referenced by casadi::MXNode::get_nzref().

◆ is_regular() [1/2]

template<typename T >
bool casadi::is_regular ( const std::vector< T > &  v)

Definition at line 415 of file casadi_misc.hpp.

415  {
416  for (auto&& vk : v) {
417  if (vk!=vk || vk==std::numeric_limits<T>::infinity() ||
418  vk==-std::numeric_limits<T>::infinity()) return false;
419  }
420  return true;
421  }

Referenced by casadi::Interpolant::check_grid(), is_regular(), and casadi::OptiNode::solve_prepare().

◆ is_regular() [2/2]

bool casadi::is_regular ( N_Vector  v)
inline

Definition at line 239 of file sundials_interface.hpp.

239  {
240  std::vector<double> tmp(NV_DATA_S(v), NV_DATA_S(v)+NV_LENGTH_S(v));
241  return is_regular(tmp);
242  }
bool is_regular(const std::vector< T > &v)
Checks if array does not contain NaN or Inf.

References is_regular().

◆ is_slice() [1/2]

bool CASADI_EXPORT casadi::is_slice ( const IM x,
bool  ind1 = false 
)

Definition at line 30 of file im_instantiator.cpp.

30  {
31  return x.is_scalar() || (x.is_column() && x.is_dense() && is_slice(x.nonzeros(), ind1));
32  }
bool CASADI_EXPORT is_slice(const IM &x, bool ind1=false)
Is the IM a Slice.

References casadi::GenericMatrix< MatType >::is_column(), casadi::GenericMatrix< MatType >::is_dense(), casadi::GenericMatrix< MatType >::is_scalar(), and casadi::Matrix< Scalar >::nonzeros().

Referenced by casadi::SetNonzeros< Add >::create(), casadi::GetNonzeros::create(), is_slice2(), to_slice(), and to_slice2().

◆ is_slice() [2/2]

bool CASADI_EXPORT casadi::is_slice ( const std::vector< casadi_int > &  v,
bool  ind1 
)

Definition at line 170 of file slice.cpp.

170  {
171  // Always false if negative numbers or non-increasing
172  casadi_int last_v = -1;
173  for (casadi_int i=0; i<v.size(); ++i) {
174  casadi_assert(!(ind1 && v[i]<=0),
175  "Matlab is 1-based, but requested index " + str(v[i]) + ". "
176  "Note that negative slices are disabled in the Matlab interface. "
177  "Possibly you may want to use 'end'.");
178  if (v[i]-ind1<=last_v) return false;
179  last_v = v[i]-ind1;
180  }
181 
182  // Always true if less than 2 elements
183  if (v.size()<2) return true;
184 
185  // If two elements, true if they are different
186  if (v.size()==2) return v[0]!=v[1];
187 
188  // We can now get the beginning, end and step
189  casadi_int start = v[0]-ind1;
190  casadi_int step = v[1]-v[0];
191  //casadi_int stop = start + step*v.size();
192 
193  // Consistency check
194  for (casadi_int i=2; i<v.size(); ++i) {
195  if (v[i]-ind1!=start+i*step) return false;
196  }
197 
198  // True if reached this point
199  return true;
200  }

References str().

◆ is_slice2()

bool CASADI_EXPORT casadi::is_slice2 ( const std::vector< casadi_int > &  v)

Definition at line 202 of file slice.cpp.

202  {
203  // Always true if 1D slice
204  if (is_slice(v)) return true;
205 
206  // Always false if negative numbers or non-increasing
207  casadi_int last_v = -1;
208  for (casadi_int i=0; i<v.size(); ++i) {
209  if (v[i]<=last_v) return false;
210  last_v = v[i];
211  }
212 
213  // Get the slices
214  casadi_int start_outer = 0;
215  casadi_int step_outer = -1;
216  casadi_int start_inner = v.front();
217  casadi_int step_inner = v[1]-v[0];
218  casadi_int stop_inner = -1;
219  for (casadi_int i=2; i<v.size(); ++i) {
220  casadi_int predicted_v = start_inner+i*step_inner;
221  if (v[i]!=predicted_v) {
222  stop_inner = predicted_v;
223  step_outer = v[i] - start_inner;
224  break;
225  }
226  }
227  casadi_assert_dev(stop_inner>=0);
228 
229  // Get the end of the outer slice
230  casadi_int stop_outer = v.back();
231  do {
232  if (step_outer>0) stop_outer++;
233  else stop_outer--;
234  } while (stop_outer % step_outer!=0);
235 
236  // Check consistency
237  std::vector<casadi_int>::const_iterator it=v.begin();
238  for (casadi_int i=start_outer; i!=stop_outer; i+=step_outer) {
239  for (casadi_int j=i+start_inner; j!=i+stop_inner; j+=step_inner) {
240  // False if we've reached the end
241  if (it==v.end()) return false;
242 
243  // Check if value matches
244  if (*it++ != j) return false;
245  }
246  }
247 
248  // False if there are still elements not accounted for
249  if (it!=v.end()) return false; // NOLINT
250 
251  // True if reached this point
252  return true;
253  }

References is_slice().

Referenced by casadi::SetNonzeros< Add >::create(), casadi::GetNonzeros::create(), and to_slice2().

◆ is_strictly_monotone()

template<typename T >
bool casadi::is_strictly_monotone ( const std::vector< T > &  v)

Definition at line 771 of file casadi_misc.hpp.

771  {
772  return is_decreasing(v) || is_increasing(v);
773  }
bool is_decreasing(const std::vector< T > &v)
Check if the vector is strictly decreasing.
bool is_increasing(const std::vector< T > &v)
Check if the vector is strictly increasing.

References is_decreasing(), and is_increasing().

◆ is_zero()

template<class T >
bool casadi::is_zero ( const T &  x)
inline

◆ isUnique()

template<typename T >
bool casadi::isUnique ( const std::vector< T > &  v)

Definition at line 716 of file casadi_misc.hpp.

716  {
717  std::set<T> s(v.begin(), v.end());
718  return v.size()==s.size();
719  }

Referenced by casadi::Function::mapaccum().

◆ iterate_directory_names()

std::vector<std::string> casadi::iterate_directory_names ( const std::string &  path)

Definition at line 39 of file ghc.cpp.

39  {
40  std::vector<std::string> ret;
41  for (const auto& entry : ghc::filesystem::directory_iterator(path)) {
42  ret.push_back(entry.path().string());
43  }
44  return ret;
45  }

References path().

Referenced by casadi_register_filesystem_ghc().

◆ join() [1/3]

CASADI_EXPORT std::string casadi::join ( const std::vector< std::string > &  l,
const std::string &  delim 
)

◆ join() [2/3]

template<typename T >
std::vector< T > casadi::join ( const std::vector< T > &  a,
const std::vector< T > &  b 
)

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

Definition at line 596 of file casadi_misc.hpp.

596  {
597  std::vector<T> ret = a;
598  ret.insert(ret.end(), b.begin(), b.end());
599  return ret;
600  }

◆ join() [3/3]

template<typename T >
std::vector< T > casadi::join ( const std::vector< T > &  a,
const std::vector< T > &  b,
const std::vector< T > &  c 
)

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

Definition at line 603 of file casadi_misc.hpp.

603  {
604  std::vector<T> ret = a;
605  ret.insert(ret.end(), b.begin(), b.end());
606  ret.insert(ret.end(), c.begin(), c.end());
607  return ret;
608  }

◆ linspace()

template<typename T , typename F , typename L >
void casadi::linspace ( std::vector< T > &  v,
const F &  first,
const L &  last 
)

Definition at line 843 of file casadi_misc.hpp.

843  {
844  if (v.size()<2)
845  throw CasadiException("std::linspace: vector must contain at least two elements");
846 
847  // Increment
848  T increment = (last-first)/T(v.size()-1);
849 
850  v[0] = first;
851  for (unsigned i=1; i<v.size()-1; ++i)
852  v[i] = v[i-1] + increment;
853  v[v.size()-1] = last;
854  }

References T.

◆ load_archiver()

CASADI_EXPORT void casadi::load_archiver ( const std::string &  name)

Definition at line 42 of file archiver.cpp.

42  {
43  Archiver::load_plugin(name);
44  }

References casadi::PluginInterface< Archiver >::load_plugin().

◆ load_filesystem()

CASADI_EXPORT void casadi::load_filesystem ( const std::string &  name)

Definition at line 96 of file filesystem.cpp.

96  {
97  Filesystem::load_plugin(name);
98 }

References casadi::PluginInterface< Filesystem >::load_plugin().

◆ load_linsol()

CASADI_EXPORT void casadi::load_linsol ( const std::string &  name)

Definition at line 210 of file linsol.cpp.

210  {
211  Linsol::load_plugin(name);
212  }

References casadi::Linsol::load_plugin().

◆ log_level_name()

std::string casadi::log_level_name ( SLEQP_LOG_LEVEL  level)

Definition at line 39 of file sleqp_interface.cpp.

40  {
41  switch (level) {
42  case SLEQP_LOG_DEBUG:
43  return " debug";
44  case SLEQP_LOG_INFO:
45  return " info";
46  default:
47  return "unknown";
48  }
49  }

Referenced by casadi_log_output().

◆ lookupvector() [1/2]

CASADI_EXPORT std::vector< casadi_int > casadi::lookupvector ( const std::vector< casadi_int > &  v)

Definition at line 166 of file casadi_misc.cpp.

166  {
167  casadi_assert_dev(!has_negative(v));
168  return lookupvector(v, (*std::max_element(v.begin(), v.end()))+1);
169  }
bool has_negative(const std::vector< T > &v)
Check if the vector has negative entries.

References has_negative(), and lookupvector().

◆ lookupvector() [2/2]

CASADI_EXPORT std::vector< casadi_int > casadi::lookupvector ( const std::vector< casadi_int > &  v,
casadi_int  size 
)

lookupvector[i]!=-1 <=> v contains i v[lookupvector[i]] == i <=> v contains i

Duplicates are treated by looking up last occurrence

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

Definition at line 155 of file casadi_misc.cpp.

155  {
156  casadi_assert(in_range(v, size),
157  "lookupvector: out of bounds. Some elements in v fall out of [0, size[");
158  std::vector<casadi_int> lookup(size, -1);
159 
160  for (casadi_int i=0;i<v.size();i++) {
161  lookup[v[i]] = i;
162  }
163  return lookup;
164  }

References in_range().

Referenced by detect_simple_bounds_gen(), einstein_process(), casadi::FunctionInternal::get_jac_sparsity_hierarchical(), casadi::FunctionInternal::get_jac_sparsity_hierarchical_symm(), casadi::SuperscsInterface::init(), lookupvector(), casadi::Function::mapaccum(), casadi::Convexify::setup(), casadi::SuperscsInterface::solve(), and casadi::SparsityInternal::sub().

◆ map_semi_expl()

template<class X >
std::map<std::string, X> casadi::map_semi_expl ( const std::map< std::string, X > &  dae,
const std::map< std::string, X > &  dae_red,
Function state_to_orig,
Function phi 
)

Definition at line 1076 of file integration_tools.cpp.

1078  {
1079 
1080  std::map<std::string, X> dae_se;
1081  dae_se["x"] = vertcat(dae_red.at("x"), dae_red.at("x_impl"));
1082  dae_se["z"] = vertcat(dae_red.at("dx_impl"), dae_red.at("z"));
1083  dae_se["ode"] = vertcat(dae_red.at("ode"), dae_red.at("dx_impl"));
1084  dae_se["alg"] = dae_red.at("alg");
1085  dae_se["t"] = dae_red.at("t");
1086  dae_se["p"] = dae_red.at("p");
1087 
1088  X x_impl = get_from_dict(dae, "x_impl", X(0, 1));
1089  X dx_impl = get_from_dict(dae, "dx_impl", X(0, 1));
1090  X z = get_from_dict(dae, "z", X(0, 1));
1091 
1092  Sparsity var_map_sp = jacobian(vertcat(dae_red.at("x"), dae_red.at("x_impl"),
1093  dae_red.at("dx_impl"), dae_red.at("z")), vertcat(x_impl, dx_impl, z)).sparsity();
1094  DM var_map(var_map_sp, 1.0);
1095 
1096  state_to_orig = Function("state_to_orig",
1097  {dae_se["x"], dae_se["z"]},
1098  {x_impl, dx_impl, z},
1099  {"xf", "zf"},
1100  {"x_impl", "dx_impl", "z"});
1101 
1102  phi = Function("phi",
1103  {dae_se["x"], dae_se["z"], dae_se["p"], dae_se["t"]},
1104  {dae_red.at("I")},
1105  {"x", "z", "p", "t"},
1106  {"I"});
1107 
1108  return dae_se;
1109 }

References get_from_dict(), and X.

Referenced by dae_map_semi_expl().

◆ map_status()

UnifiedReturnStatus casadi::map_status ( SLEQP_STATUS  status)

Definition at line 475 of file sleqp_interface.cpp.

476  {
477  switch (status) {
478  case SLEQP_STATUS_OPTIMAL:
479  return SOLVER_RET_SUCCESS;
480  case SLEQP_STATUS_INFEASIBLE:
481  return SOLVER_RET_INFEASIBLE;
482 
483  case SLEQP_STATUS_ABORT_ITER:
484  case SLEQP_STATUS_ABORT_MANUAL:
485  case SLEQP_STATUS_ABORT_TIME:
486  return SOLVER_RET_LIMITED;
487  default:
488  // case SLEQP_STATUS_UNKNOWN:
489  // case SLEQP_STATUS_RUNNING:
490  // case SLEQP_STATUS_UNBOUNDED:
491  // case SLEQP_STATUS_ABORT_DEADPOINT:
492  return SOLVER_RET_UNKNOWN;
493  }
494  }

References SOLVER_RET_INFEASIBLE, SOLVER_RET_LIMITED, SOLVER_RET_SUCCESS, and SOLVER_RET_UNKNOWN.

Referenced by casadi::SLEQPInterface::solve().

◆ matrixName()

template<typename Scalar >
std::string casadi::matrixName ( )
inline

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

Definition at line 63 of file matrix_decl.hpp.

64  { return std::string("Matrix<") + typeid(Scalar).name() + std::string(">");}

◆ matrixName< casadi_int >()

template<>
std::string casadi::matrixName< casadi_int > ( )
inline

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

Definition at line 66 of file matrix_decl.hpp.

66 { return "IM"; }

◆ matrixName< double >()

template<>
std::string casadi::matrixName< double > ( )
inline

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

Definition at line 65 of file matrix_decl.hpp.

65 { return "DM"; }

◆ matrixName< SXElem >()

template<>
std::string casadi::matrixName< SXElem > ( )
inline

Definition at line 33 of file sx.hpp.

33 { return "SX"; }

◆ message_prefix()

std::ostream& casadi::message_prefix ( std::ostream &  stream)
inline

Definition at line 119 of file exception.hpp.

119  {
120  // CasADi prefix
121  stream << "CasADi - ";
122  // Get current time
123  auto now = std::chrono::system_clock::now();
124  std::time_t tt = std::chrono::system_clock::to_time_t(now);
125  auto local_tm = *std::localtime(&tt); // NOLINT(runtime/threadsafe_fn)
126  // Convert to YYYY-MM-DD HH:MM:SS format
127  stream << local_tm.tm_year + 1900 << '-'; // YYYY-
128  stream << std::setfill('0') << std::setw(2) << local_tm.tm_mon + 1 << '-'; // MM-
129  stream << std::setfill('0') << std::setw(2) << local_tm.tm_mday << ' '; // DD
130  stream << std::setfill('0') << std::setw(2) << local_tm.tm_hour << ':'; // hh:
131  stream << std::setfill('0') << std::setw(2) << local_tm.tm_min << ':'; // mm:
132  stream << std::setfill('0') << std::setw(2) << local_tm.tm_sec; // ss
133  return stream;
134 }

◆ mtaylor_recursive()

SX casadi::mtaylor_recursive ( const SX ex,
const SX x,
const SX a,
casadi_int  order,
const std::vector< casadi_int > &  order_contributions,
const SXElem current_dx = casadi_limits<SXElem>::one,
double  current_denom = 1,
casadi_int  current_order = 1 
)

Definition at line 1188 of file sx_instantiator.cpp.

1191  {
1192  SX result = substitute(ex, x, a)*current_dx/current_denom;
1193  for (casadi_int i=0;i<x.nnz();i++) {
1194  if (order_contributions[i]<=order) {
1195  result += mtaylor_recursive(SX::jacobian(ex, x->at(i)),
1196  x, a,
1197  order-order_contributions[i],
1198  order_contributions,
1199  current_dx*(x->at(i)-a->at(i)),
1200  current_denom*static_cast<double>(current_order),
1201  current_order+1);
1202  }
1203  }
1204  return result;
1205  }
SX mtaylor_recursive(const SX &ex, const SX &x, const SX &a, casadi_int order, const std::vector< casadi_int > &order_contributions, const SXElem &current_dx=casadi_limits< SXElem >::one, double current_denom=1, casadi_int current_order=1)

References mtaylor_recursive(), and casadi::GenericMatrix< MatType >::nnz().

Referenced by mtaylor_recursive(), and casadi::Matrix< double >::op().

◆ n_fd_points()

CASADI_EXPORT casadi_int casadi::n_fd_points ( FdMode  v)

Definition at line 41 of file finite_differences.cpp.

41  {
42  switch (v) {
43  case FdMode::FORWARD: return 2;
44  case FdMode::BACKWARD: return 2;
45  case FdMode::CENTRAL: return 3;
46  case FdMode::SMOOTHING: return 5;
47  default: break;
48  }
49  return -1;
50 }

References BACKWARD, CENTRAL, FORWARD, and SMOOTHING.

Referenced by casadi::FmuInternal::eval_fd().

◆ norm_1()

template<typename T >
T casadi::norm_1 ( const std::vector< T > &  x)

Definition at line 973 of file casadi_misc.hpp.

973  {
974  T ret = 0;
975  for (casadi_int k=0; k<x.size(); ++k) {
976  ret += fabs(x[k]);
977  }
978  return ret;
979  }

References T.

Referenced by casadi::BSplineInterpolant::construct_graph().

◆ norm_2()

template<typename T >
T casadi::norm_2 ( const std::vector< T > &  x)

Definition at line 982 of file casadi_misc.hpp.

982  {
983  T ret = 0;
984  for (casadi_int k=0; k<x.size(); ++k) {
985  ret += x[k]*x[k];
986  }
987  return sqrt(ret);
988  }

References T.

◆ norm_inf()

template<typename T >
T casadi::norm_inf ( const std::vector< T > &  x)

Definition at line 964 of file casadi_misc.hpp.

964  {
965  T ret = 0;
966  for (casadi_int k=0; k<x.size(); ++k) {
967  ret = fmax(ret, fabs(x[k]));
968  }
969  return ret;
970  }

References T.

◆ normalized_in()

int casadi::normalized_in ( std::istream &  stream,
double &  ret 
)
inline

Definition at line 440 of file casadi_misc.hpp.

440  {
441  std::streampos start = stream.tellg();
442  stream >> ret;
443  // Failed to interpret as double?
444  if (stream.fail()) {
445  // Clear error flag
446  stream.clear();
447  // Reset stream position
448  // Need to parse e.g "-inf"
449  stream.seekg(start);
450  // Might be a inf/nan
451  std::string non_reg;
452  stream >> non_reg;
453  // Break on trailing whitespace
454  if (stream.fail()) {
455  if (stream.eof()) {
456  ret = std::numeric_limits<double>::quiet_NaN();
457  return -1; // End of stream
458  } else {
459  ret = std::numeric_limits<double>::quiet_NaN();
460  return 1; // Failed to parse to string
461  }
462  }
463  if (non_reg=="inf") {
464  ret = std::numeric_limits<double>::infinity();
465  } else if (non_reg=="-inf") {
466  ret = -std::numeric_limits<double>::infinity();
467  } else if (non_reg=="nan") {
468  ret = std::numeric_limits<double>::quiet_NaN();
469  } else {
470  ret = std::numeric_limits<double>::quiet_NaN();
471  return 2; // Failed to interpret as number
472  }
473  }
474  return 0;
475  }

◆ normalized_out()

void casadi::normalized_out ( std::ostream &  stream,
double  val 
)
inline

Definition at line 429 of file casadi_misc.hpp.

429  {
430  if (val==std::numeric_limits<double>::infinity()) {
431  stream << "inf";
432  } else if (val==-std::numeric_limits<double>::infinity()) {
433  stream << "-inf";
434  } else if (val!=val) {
435  stream << "nan";
436  } else {
437  stream << val;
438  }
439  }

Referenced by casadi::FunctionInternal::generate_in(), casadi::Function::generate_in(), casadi::Function::generate_out(), and casadi::FunctionInternal::generate_out().

◆ normalized_setup() [1/2]

CASADI_EXPORT void casadi::normalized_setup ( std::istream &  stream)

Definition at line 404 of file casadi_misc.cpp.

404  {
405  stream.imbue(std::locale("C"));
406  }

Referenced by casadi::FunctionInternal::generate_in(), casadi::Function::generate_in(), casadi::Function::generate_out(), and casadi::FunctionInternal::generate_out().

◆ normalized_setup() [2/2]

CASADI_EXPORT void casadi::normalized_setup ( std::ostream &  stream)

Definition at line 408 of file casadi_misc.cpp.

408  {
409  stream.imbue(std::locale("C"));
410  stream << std::scientific;
411  stream << std::setprecision(std::numeric_limits<double>::digits10 + 1);
412  }

◆ operation_checker()

template<template< casadi_int > class F>
bool casadi::operation_checker ( casadi_int  op)

Definition at line 1119 of file calculus.hpp.

1119  {
1120  return operation_getter<F, bool>(op);
1121  }

◆ operation_getter()

template<template< casadi_int > class F, typename T >
T casadi::operation_getter ( casadi_int  op)

Definition at line 1014 of file calculus.hpp.

1014  {
1015  switch (static_cast<Operation>(op)) {
1016  case OP_ASSIGN: return F<OP_ASSIGN>::check;
1017  case OP_ADD: return F<OP_ADD>::check;
1018  case OP_SUB: return F<OP_SUB>::check;
1019  case OP_MUL: return F<OP_MUL>::check;
1020  case OP_DIV: return F<OP_DIV>::check;
1021  case OP_NEG: return F<OP_NEG>::check;
1022  case OP_EXP: return F<OP_EXP>::check;
1023  case OP_LOG: return F<OP_LOG>::check;
1024  case OP_POW: return F<OP_POW>::check;
1025  case OP_CONSTPOW: return F<OP_CONSTPOW>::check;
1026  case OP_SQRT: return F<OP_SQRT>::check;
1027  case OP_SQ: return F<OP_SQ>::check;
1028  case OP_TWICE: return F<OP_TWICE>::check;
1029  case OP_SIN: return F<OP_SIN>::check;
1030  case OP_COS: return F<OP_COS>::check;
1031  case OP_TAN: return F<OP_TAN>::check;
1032  case OP_ASIN: return F<OP_ASIN>::check;
1033  case OP_ACOS: return F<OP_ACOS>::check;
1034  case OP_ATAN: return F<OP_ATAN>::check;
1035  case OP_LT: return F<OP_LT>::check;
1036  case OP_LE: return F<OP_LE>::check;
1037  case OP_EQ: return F<OP_EQ>::check;
1038  case OP_NE: return F<OP_NE>::check;
1039  case OP_NOT: return F<OP_NOT>::check;
1040  case OP_AND: return F<OP_AND>::check;
1041  case OP_OR: return F<OP_OR>::check;
1042  case OP_FLOOR: return F<OP_FLOOR>::check;
1043  case OP_CEIL: return F<OP_CEIL>::check;
1044  case OP_FMOD: return F<OP_FMOD>::check;
1045  case OP_REMAINDER: return F<OP_REMAINDER>::check;
1046  case OP_FABS: return F<OP_FABS>::check;
1047  case OP_SIGN: return F<OP_SIGN>::check;
1048  case OP_COPYSIGN: return F<OP_COPYSIGN>::check;
1049  case OP_IF_ELSE_ZERO: return F<OP_IF_ELSE_ZERO>::check;
1050  case OP_ERF: return F<OP_ERF>::check;
1051  case OP_FMIN: return F<OP_FMIN>::check;
1052  case OP_FMAX: return F<OP_FMAX>::check;
1053  case OP_INV: return F<OP_INV>::check;
1054  case OP_SINH: return F<OP_SINH>::check;
1055  case OP_COSH: return F<OP_COSH>::check;
1056  case OP_TANH: return F<OP_TANH>::check;
1057  case OP_ASINH: return F<OP_ASINH>::check;
1058  case OP_ACOSH: return F<OP_ACOSH>::check;
1059  case OP_ATANH: return F<OP_ATANH>::check;
1060  case OP_ATAN2: return F<OP_ATAN2>::check;
1061  case OP_CONST: return F<OP_CONST>::check;
1062  case OP_INPUT: return F<OP_INPUT>::check;
1063  case OP_OUTPUT: return F<OP_OUTPUT>::check;
1064  case OP_PARAMETER: return F<OP_PARAMETER>::check;
1065  case OP_CALL: return F<OP_CALL>::check;
1066  case OP_FIND: return F<OP_FIND>::check;
1067  case OP_LOW: return F<OP_LOW>::check;
1068  case OP_MAP: return F<OP_MAP>::check;
1069  case OP_MTIMES: return F<OP_MTIMES>::check;
1070  case OP_SOLVE: return F<OP_SOLVE>::check;
1071  case OP_TRANSPOSE: return F<OP_TRANSPOSE>::check;
1072  case OP_DETERMINANT: return F<OP_DETERMINANT>::check;
1073  case OP_INVERSE: return F<OP_INVERSE>::check;
1074  case OP_DOT: return F<OP_DOT>::check;
1075  case OP_BILIN: return F<OP_BILIN>::check;
1076  case OP_RANK1: return F<OP_RANK1>::check;
1077  case OP_HORZCAT: return F<OP_HORZCAT>::check;
1078  case OP_VERTCAT: return F<OP_VERTCAT>::check;
1079  case OP_DIAGCAT: return F<OP_DIAGCAT>::check;
1080  case OP_HORZSPLIT: return F<OP_HORZSPLIT>::check;
1081  case OP_VERTSPLIT: return F<OP_VERTSPLIT>::check;
1082  case OP_DIAGSPLIT: return F<OP_DIAGSPLIT>::check;
1083  case OP_RESHAPE: return F<OP_RESHAPE>::check;
1084  case OP_SPARSITY_CAST: return F<OP_SPARSITY_CAST>::check;
1085  case OP_SUBREF: return F<OP_SUBREF>::check;
1086  case OP_SUBASSIGN: return F<OP_SUBASSIGN>::check;
1087  case OP_GETNONZEROS: return F<OP_GETNONZEROS>::check;
1088  case OP_GETNONZEROS_PARAM: return F<OP_GETNONZEROS_PARAM>::check;
1089  case OP_ADDNONZEROS: return F<OP_ADDNONZEROS>::check;
1090  case OP_ADDNONZEROS_PARAM: return F<OP_ADDNONZEROS>::check;
1091  case OP_SETNONZEROS: return F<OP_SETNONZEROS>::check;
1092  case OP_SETNONZEROS_PARAM: return F<OP_SETNONZEROS>::check;
1093  case OP_PROJECT: return F<OP_PROJECT>::check;
1094  case OP_ASSERTION: return F<OP_ASSERTION>::check;
1095  case OP_MONITOR: return F<OP_MONITOR>::check;
1096  case OP_NORM2: return F<OP_NORM2>::check;
1097  case OP_NORM1: return F<OP_NORM1>::check;
1098  case OP_NORMINF: return F<OP_NORMINF>::check;
1099  case OP_NORMF: return F<OP_NORMF>::check;
1100  case OP_MMIN: return F<OP_MMIN>::check;
1101  case OP_MMAX: return F<OP_MMAX>::check;
1102  case OP_HORZREPMAT: return F<OP_HORZREPMAT>::check;
1103  case OP_HORZREPSUM: return F<OP_HORZREPSUM>::check;
1104  case OP_ERFINV: return F<OP_ERFINV>::check;
1105  case OP_PRINTME: return F<OP_PRINTME>::check;
1106  case OP_LIFT: return F<OP_LIFT>::check;
1107  case OP_EINSTEIN: return F<OP_EINSTEIN>::check;
1108  case OP_BSPLINE: return F<OP_BSPLINE>::check;
1109  case OP_CONVEXIFY: return F<OP_CONVEXIFY>::check;
1110  case OP_LOG1P: return F<OP_LOG1P>::check;
1111  case OP_EXPM1: return F<OP_EXPM1>::check;
1112  case OP_HYPOT: return F<OP_HYPOT>::check;
1113  case OP_LOGSUMEXP: return F<OP_LOGSUMEXP>::check;
1114  }
1115  return T();
1116  }
Operation
Enum for quick access to any node.
Definition: calculus.hpp:60

References OP_ACOS, OP_ACOSH, OP_ADD, OP_ADDNONZEROS, OP_ADDNONZEROS_PARAM, OP_AND, OP_ASIN, OP_ASINH, OP_ASSERTION, OP_ASSIGN, OP_ATAN, OP_ATAN2, OP_ATANH, OP_BILIN, OP_BSPLINE, OP_CALL, OP_CEIL, OP_CONST, OP_CONSTPOW, OP_CONVEXIFY, OP_COPYSIGN, OP_COS, OP_COSH, OP_DETERMINANT, OP_DIAGCAT, OP_DIAGSPLIT, OP_DIV, OP_DOT, OP_EINSTEIN, OP_EQ, OP_ERF, OP_ERFINV, OP_EXP, OP_EXPM1, OP_FABS, OP_FIND, OP_FLOOR, OP_FMAX, OP_FMIN, OP_FMOD, OP_GETNONZEROS, OP_GETNONZEROS_PARAM, OP_HORZCAT, OP_HORZREPMAT, OP_HORZREPSUM, OP_HORZSPLIT, OP_HYPOT, OP_IF_ELSE_ZERO, OP_INPUT, OP_INV, OP_INVERSE, OP_LE, OP_LIFT, OP_LOG, OP_LOG1P, OP_LOGSUMEXP, OP_LOW, OP_LT, OP_MAP, OP_MMAX, OP_MMIN, OP_MONITOR, OP_MTIMES, OP_MUL, OP_NE, OP_NEG, OP_NORM1, OP_NORM2, OP_NORMF, OP_NORMINF, OP_NOT, OP_OR, OP_OUTPUT, OP_PARAMETER, OP_POW, OP_PRINTME, OP_PROJECT, OP_RANK1, OP_REMAINDER, OP_RESHAPE, OP_SETNONZEROS, OP_SETNONZEROS_PARAM, OP_SIGN, OP_SIN, OP_SINH, OP_SOLVE, OP_SPARSITY_CAST, OP_SQ, OP_SQRT, OP_SUB, OP_SUBASSIGN, OP_SUBREF, OP_TAN, OP_TANH, OP_TRANSPOSE, OP_TWICE, OP_VERTCAT, OP_VERTSPLIT, and T.

◆ operator<<()

std::ostream& casadi::operator<< ( std::ostream &  stream,
const XmlNode node 
)

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

Definition at line 79 of file xml_node.cpp.

79  {
80  node.dump(stream);
81  return stream;
82 }

◆ Orring()

static bvec_t casadi::Orring ( bvec_t  x,
bvec_t  y 
)
static

Definition at line 64 of file repmat.cpp.

64 { return x | y; }

Referenced by casadi::HorzRepsum::sp_forward(), casadi::HorzRepmat::sp_reverse(), and casadi::HorzRepsum::sp_reverse().

◆ output_categories()

CASADI_EXPORT std::vector< OutputCategory > casadi::output_categories ( )

Definition at line 277 of file dae_builder_internal.cpp.

277  {
278  std::vector<OutputCategory> ret;
279  for (casadi_int i = 0; i != enum_traits<OutputCategory>::n_enum; ++i) {
280  ret.push_back(static_cast<OutputCategory>(i));
281  }
282  return ret;
283 }

Referenced by casadi::DaeBuilderInternal::gather_eq(), casadi::DaeBuilderInternal::oracle(), and casadi::DaeBuilderInternal::prune().

◆ override_num()

bool casadi::override_num ( const std::map< casadi_int, MX > &  temp,
std::vector< DM > &  num,
casadi_int  i 
)

Definition at line 1385 of file optistack_internal.cpp.

1385  {
1386  // Override when values are supplied
1387  auto it = temp.find(i);
1388  if (it==temp.end()) {
1389  return true;
1390  } else {
1391  Slice all;
1392  DM t = static_cast<DM>(it->second);
1393  num.back().set(t, false, all, all);
1394  }
1395  return false;
1396 }
void set(const Matrix< Scalar > &m, bool ind1, const Slice &rr)
bool all(const std::vector< bool > &v)
Check if all arguments are true.
Definition: casadi_misc.cpp:77

References all(), and casadi::Matrix< Scalar >::set().

Referenced by casadi::OptiNode::value().

◆ param_by_name()

int casadi::param_by_name ( CPXENVptr  env,
const std::string &  name 
)

Definition at line 191 of file cplex_interface.cpp.

191  {
192  int whichparam;
193  if (CPXXgetparamnum(env, name.c_str(), &whichparam)) {
194  casadi_error("No such CPLEX parameter: " + name);
195  }
196  return whichparam;
197  }

Referenced by casadi::CplexInterface::init_mem(), and casadi::CplexInterface::solve().

◆ parent_path()

std::string casadi::parent_path ( const std::string &  path)

Definition at line 63 of file ghc.cpp.

63  {
64  return ghc::filesystem::path(path).parent_path().string();
65  }

References path().

Referenced by casadi_register_filesystem_ghc().

◆ path()

std::vector<casadi_int> casadi::path ( const std::vector< casadi_int > &  map,
casadi_int  i_start 
)

◆ pathsep()

CASADI_EXPORT char casadi::pathsep ( )

Definition at line 34 of file casadi_os.cpp.

34  {
35  #ifdef _WIN32
36  return ';';
37  #else
38  return ':';
39  #endif
40 }

Referenced by get_search_paths(), and casadi::ClangCompiler::init().

◆ permute()

template<typename T >
std::vector< T > casadi::permute ( const std::vector< T > &  a,
const std::vector< casadi_int > &  order 
)

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

Definition at line 611 of file casadi_misc.hpp.

611  {
612  casadi_assert_dev(order.size()==a.size());
613  casadi_assert_dev(is_permutation(order));
614  return vector_slice(a, order);
615  }
std::vector< T > vector_slice(const std::vector< T > &v, const std::vector< casadi_int > &i)
Slicing vector.

References is_permutation(), and vector_slice().

Referenced by casadi::BSplineCommon::derivative_coeff().

◆ pop_prefix()

CASADI_EXPORT std::string casadi::pop_prefix ( const std::string &  s,
std::string *  rem 
)

Definition at line 1367 of file fmu_function.cpp.

1367  {
1368  // Get prefix
1369  casadi_assert_dev(!s.empty());
1370  size_t pos = s.find('_');
1371  casadi_assert(pos < s.size(), "Cannot process \"" + s + "\"");
1372  // Get prefix
1373  std::string r = s.substr(0, pos);
1374  // Remainder, if requested (note that rem == &s is possible)
1375  if (rem) *rem = s.substr(pos+1, std::string::npos);
1376  // Return prefix
1377  return r;
1378 }

Referenced by casadi::InputStruct::parse(), and casadi::OutputStruct::parse().

◆ print_vec()

void casadi::print_vec ( const std::string &  str,
const double *  v,
casadi_int  n 
)

Definition at line 48 of file ipqp.cpp.

48  {
49  uout() << str << " =";
50  for (casadi_int k = 0; k < n; ++k) uout() << " " << v[k];
51  uout() << "\n";
52  }

References str(), and uout().

◆ printme()

double casadi::printme ( double  x,
double  y 
)
inline

CasADi additions

Examples
misc/printme.py.

Definition at line 273 of file calculus.hpp.

273  {
274  std::ios::fmtflags f(uout().flags());
275  uout() << "|> " << y << " : ";
276  uout() << std::setprecision(std::numeric_limits<double>::digits10 + 1) << std::scientific;
277  uout() << x << std::endl;
278  uout().flags(f);
279  return x;
280  }

References uout().

Referenced by casadi::BinaryOperation< OP_PRINTME >::fcn().

◆ product()

template<typename T >
T casadi::product ( const std::vector< T > &  values)

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

Definition at line 909 of file casadi_misc.hpp.

909  {
910  T r = 1;
911  for (casadi_int i=0;i<values.size();++i) r*=values[i];
912  return r;
913  }

References T.

Referenced by casadi_func_hess_prod(), casadi::Matrix< Scalar >::einstein(), casadi::MX::einstein(), einstein_process(), casadi::MX::interpn_linear(), interpolant(), and tensor_permute_mapping().

◆ qpsol_nlp()

template<typename M >
Function casadi::qpsol_nlp ( const std::string &  name,
const std::string &  solver,
const std::map< std::string, M > &  qp,
const Dict opts 
)

Definition at line 112 of file conic.cpp.

113  {
114  // We have: minimize f(x) = 1/2 * x' H x + c'x
115  // subject to lbx <= x <= ubx
116  // lbg <= g(x) = A x + b <= ubg
117  // h(x) >=0 (psd)
118 
119  // Extract 'expand' option
120  bool expand = false;
121  Dict opt = opts;
122  extract_from_dict_inplace(opt, "expand", expand);
123  bool postpone_expand = false;
124  extract_from_dict_inplace(opt, "postpone_expand", postpone_expand);
125  bool error_on_fail = get_from_dict(opts, "error_on_fail", true);
126 
127  if (expand && !postpone_expand && M::type_name()=="MX") {
128  Function f = Function("f", qp, {"x", "p"}, {"f", "g", "h"});
129  std::vector<SX> arg = f.sx_in();
130  std::vector<SX> res = f(arg);
131  SXDict qp_mod;
132  for (casadi_int i=0;i<f.n_in();++i) qp_mod[f.name_in(i)] = arg[i];
133  for (casadi_int i=0;i<f.n_out();++i) qp_mod[f.name_out(i)] = res[i];
134  return qpsol_nlp(name, solver, qp_mod, opt);
135  }
136 
137  M x, p, f, g, h;
138  for (auto&& i : qp) {
139  if (i.first=="x") {
140  x = i.second;
141  } else if (i.first=="p") {
142  p = i.second;
143  } else if (i.first=="f") {
144  f = i.second;
145  } else if (i.first=="g") {
146  g = i.second;
147  } else if (i.first=="h") {
148  h = i.second;
149  } else {
150  casadi_error("No such field: " + i.first);
151  }
152  }
153 
154  if (f.is_empty()) f = 0;
155  if (g.is_empty()) g = M(0, 1);
156 
157  // Dimension checks
158  casadi_assert(g.is_dense() && g.is_vector(),
159  "Expected a dense vector 'g', but got " + g.dim() + ".");
160 
161  casadi_assert(f.is_dense() && f.is_scalar(),
162  "Expected a dense scalar 'f', but got " + f.dim() + ".");
163 
164  casadi_assert(x.is_dense() && x.is_vector(),
165  "Expected a dense vector 'x', but got " + x.dim() + ".");
166 
167  casadi_assert(h.is_square(),
168  "Expected a symmetric matrix 'h', but got " + h.dim() + ".");
169 
170  if (g.is_empty(true)) g = M(0, 1); // workaround
171 
172  // Gradient of the objective: gf == Hx + g
173  M gf = M::gradient(f, x);
174 
175  // Identify the linear term in the objective
176  M c = substitute(gf, x, M::zeros(x.sparsity()));
177 
178  // Identify the quadratic term in the objective
179  M H = M::jacobian(gf, x, {{"symmetric", true}});
180 
181  // Identify constant term in the objective
182  Function r("constant_qp", {x, p}, {substitute(f, x, M::zeros(x.sparsity()))});
183 
184  // Identify the constant term in the constraints
185  M b = substitute(g, x, M::zeros(x.sparsity()));
186 
187  // Identify the linear term in the constraints
188  M A = M::jacobian(g, x);
189 
190  // Identify the constant term in the psd constraints
191  M P = substitute(h, x, M::zeros(x.sparsity()));
192 
193  // Identify the linear term in the psd constraints
194  M Q = M::jacobian(h, x);
195 
196  // Create a function for calculating the required matrices vectors
197  Function prob(name + "_qp", {x, p}, {H, c, A, b, Q, P},
198  {"x", "p"}, {"H", "c", "A", "b", "Q", "P"});
199  if (expand && postpone_expand) prob = prob.expand();
200 
201  // Make sure that the problem is sound
202  casadi_assert(!prob.has_free(), "Cannot create '" + prob.name() + "' "
203  "since " + str(prob.get_free()) + " are free.");
204 
205  // Create the QP solver
206  Function conic_f = conic(name + "_qpsol", solver,
207  {{"h", H.sparsity()}, {"a", A.sparsity()},
208  {"p", P.sparsity()}, {"q", Q.sparsity()}}, opt);
209 
210  // Create an MXFunction with the right signature
211  std::vector<MX> ret_in(NLPSOL_NUM_IN);
212  ret_in[NLPSOL_X0] = MX::sym("x0", x.sparsity());
213  ret_in[NLPSOL_P] = MX::sym("p", p.sparsity());
214  ret_in[NLPSOL_LBX] = MX::sym("lbx", x.sparsity());
215  ret_in[NLPSOL_UBX] = MX::sym("ubx", x.sparsity());
216  ret_in[NLPSOL_LBG] = MX::sym("lbg", g.sparsity());
217  ret_in[NLPSOL_UBG] = MX::sym("ubg", g.sparsity());
218  ret_in[NLPSOL_LAM_X0] = MX::sym("lam_x0", x.sparsity());
219  ret_in[NLPSOL_LAM_G0] = MX::sym("lam_g0", g.sparsity());
220  std::vector<MX> ret_out(NLPSOL_NUM_OUT);
221 
222 
223  std::vector<MX> v(NL_NUM_IN);
224  v[NL_X] = ret_in[NLPSOL_X0];
225  v[NL_P] = ret_in[NLPSOL_P];
226  // Evaluate constant part of objective
227  MX rv = r(v)[0];
228  // Get expressions for the QP matrices and vectors
229  v = prob(v);
230 
231  // Call the QP solver
232  std::vector<MX> w(CONIC_NUM_IN);
233  w[CONIC_H] = v.at(0);
234  w[CONIC_G] = v.at(1);
235  w[CONIC_A] = v.at(2);
236  w[CONIC_Q] = v.at(4);
237  w[CONIC_P] = v.at(5);
238  w[CONIC_LBX] = ret_in[NLPSOL_LBX];
239  w[CONIC_UBX] = ret_in[NLPSOL_UBX];
240  w[CONIC_LBA] = ret_in[NLPSOL_LBG] - v.at(3);
241  w[CONIC_UBA] = ret_in[NLPSOL_UBG] - v.at(3);
242  w[CONIC_X0] = ret_in[NLPSOL_X0];
243  w[CONIC_LAM_X0] = ret_in[NLPSOL_LAM_X0];
244  w[CONIC_LAM_A0] = ret_in[NLPSOL_LAM_G0];
245  w = conic_f(w);
246 
247  // Get expressions for the solution
248  ret_out[NLPSOL_X] = reshape(w[CONIC_X], x.size());
249  ret_out[NLPSOL_F] = rv + w[CONIC_COST];
250  ret_out[NLPSOL_G] = reshape(mtimes(v.at(2), w[CONIC_X]), g.size()) + v.at(3);
251  ret_out[NLPSOL_LAM_X] = reshape(w[CONIC_LAM_X], x.size());
252  ret_out[NLPSOL_LAM_G] = reshape(w[CONIC_LAM_A], g.size());
253  ret_out[NLPSOL_LAM_P] = MX::nan(p.sparsity());
254 
255  Dict fun_opts;
256  fun_opts["default_in"] = nlpsol_default_in();
257  fun_opts["error_on_fail"] = error_on_fail;
258 
259  return Function(name, ret_in, ret_out, nlpsol_in(), nlpsol_out(), fun_opts);
260  }
Function conic(const std::string &name, const std::string &solver, const SpDict &qp, const Dict &opts)
Definition: conic.cpp:44
std::vector< std::string > nlpsol_in()
Get input scheme of NLP solvers.
Definition: nlpsol.cpp:200
std::vector< std::string > nlpsol_out()
Get NLP solver output scheme of NLP solvers.
Definition: nlpsol.cpp:206
double nlpsol_default_in(casadi_int ind)
Default input for an NLP solver.
Definition: nlpsol.cpp:212
std::map< std::string, SX > SXDict
Definition: sx_fwd.hpp:40
void extract_from_dict_inplace(Dict &d, const std::string &key, T &value)
Function qpsol_nlp(const std::string &name, const std::string &solver, const std::map< std::string, M > &qp, const Dict &opts)
Definition: conic.cpp:112

References conic(), CONIC_A, CONIC_COST, CONIC_G, CONIC_H, CONIC_LAM_A, CONIC_LAM_A0, CONIC_LAM_X, CONIC_LAM_X0, CONIC_LBA, CONIC_LBX, CONIC_NUM_IN, CONIC_P, CONIC_Q, CONIC_UBA, CONIC_UBX, CONIC_X, CONIC_X0, casadi::Function::expand(), extract_from_dict_inplace(), get_from_dict(), casadi::Function::n_in(), casadi::Function::n_out(), casadi::Function::name_in(), casadi::Function::name_out(), casadi::MX::nan(), NL_NUM_IN, NL_P, NL_X, nlpsol_default_in(), NLPSOL_F, NLPSOL_G, nlpsol_in(), NLPSOL_LAM_G, NLPSOL_LAM_G0, NLPSOL_LAM_P, NLPSOL_LAM_X, NLPSOL_LAM_X0, NLPSOL_LBG, NLPSOL_LBX, NLPSOL_NUM_IN, NLPSOL_NUM_OUT, nlpsol_out(), NLPSOL_P, NLPSOL_UBG, NLPSOL_UBX, NLPSOL_X, NLPSOL_X0, P, Q, str(), casadi::Function::sx_in(), and casadi::GenericMatrix< MX >::sym().

Referenced by qpsol().

◆ range() [1/2]

CASADI_EXPORT std::vector< casadi_int > casadi::range ( casadi_int  start,
casadi_int  stop,
casadi_int  step = 1,
casadi_int  len = std::numeric_limits< casadi_int >::max() 
)
Parameters
start
stop
step
lenConsider a infinitely long list [start, start+step, start+2*step, ...] Elements larger than or equal to stop are chopped off.

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

Examples
misc/range.cc.

Definition at line 104 of file casadi_misc.cpp.

105  {
106  start = std::min(start, len);
107  stop = std::min(stop, len);
108  casadi_int nret = (stop-start)/step + ((stop-start)%step!=0);
109  std::vector<casadi_int> ret(nret);
110  casadi_int ind = start;
111  for (std::vector<casadi_int>::iterator it=ret.begin(); it!=ret.end(); ++it) {
112  *it = ind;
113  ind += step;
114  }
115  return ret;
116  }

Referenced by casadi::SparsityInternal::_erase(), casadi::Slice::all(), casadi::HpmpcInterface::blocksparsity(), casadi::HpipmInterface::blocksparsity(), casadi::FatropConicInterface::blocksparsity(), casadi::SparsityInterface< MatType >::blocksplit(), casadi::BSplineCommon::derivative_coeff(), detect_simple_bounds_gen(), casadi::Sparsity::diag(), casadi::SparsityInterface< MatType >::diagsplit(), do_inline(), casadi::MX::enlarge(), casadi::MXFunction::export_code_body(), casadi::SparsityInternal::find(), casadi::Function::fold(), get_boor(), casadi::External::get_forward(), casadi::FunctionInternal::get_jac_sparsity_hierarchical(), casadi::FunctionInternal::get_jac_sparsity_hierarchical_symm(), casadi::External::get_reverse(), casadi::SparsityInterface< MatType >::horzsplit(), casadi::FmuFunction::init(), casadi::SnoptInterface::init(), casadi::SuperscsInterface::init(), casadi::LinsolLdl::init(), casadi::Sqpmethod::init(), casadi::Sparsity::ldl(), casadi::Function::map(), casadi::Function::mapaccum(), casadi::FunctionInternal::mapsum_mx(), casadi::MX::MX(), casadi::Sparsity::permutation(), casadi::Sparsity::qr_sparse(), range(), casadi::Conic::sdp_to_socp_init(), casadi::Convexify::setup(), casadi::SuperscsInterface::solve(), casadi::SparsityInternal::star_coloring(), tensor_permute_mapping(), and casadi::SparsityInterface< MatType >::vertsplit().

◆ range() [2/2]

CASADI_EXPORT std::vector< casadi_int > casadi::range ( casadi_int  stop)
Parameters
stop
Returns
list [0, 1, 2...stop-1]

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

Definition at line 133 of file casadi_misc.cpp.

133  {
134  return range(0, stop);
135  }

References range().

◆ read_list()

template<typename T >
std::vector<T> casadi::read_list ( const XmlNode n)

Definition at line 3263 of file dae_builder_internal.cpp.

3263  {
3264  // Number of elements
3265  size_t sz = n.size();
3266  // Read the elements
3267  std::vector<T> r;
3268  r.reserve(sz);
3269  for (size_t i = 0; i < sz; ++i) {
3270  r.push_back(T(n[i]));
3271  }
3272  return r;
3273 }

References casadi::XmlNode::size(), and T.

◆ read_matlab() [1/2]

template<typename T >
void casadi::read_matlab ( std::ifstream &  file,
std::vector< std::vector< T > > &  v 
)

Definition at line 817 of file casadi_misc.hpp.

817  {
818  v.clear();
819  std::string line;
820  while (!getline(file, line, '\n').eof()) {
821  std::istringstream reader(line);
822  std::vector<T> lineData;
823 
824  while (!reader.eof()) {
825  T val;
826  reader >> val;
827  if (reader.fail()) {
828  reader.clear();
829  std::string s;
830  reader >> s;
831  if (s=="inf")
832  val = std::numeric_limits<T>::infinity();
833  else
834  break;
835  }
836  lineData.push_back(val);
837  }
838  v.push_back(lineData);
839  }
840  }

References T.

◆ read_matlab() [2/2]

template<typename T >
void casadi::read_matlab ( std::istream &  stream,
std::vector< T > &  v 
)

Definition at line 797 of file casadi_misc.hpp.

797  {
798  v.clear();
799 
800  while (!stream.eof()) {
801  T val;
802  stream >> val;
803  if (stream.fail()) {
804  stream.clear();
805  std::string s;
806  stream >> s;
807  if (s=="inf")
808  val = std::numeric_limits<T>::infinity();
809  else
810  break;
811  }
812  v.push_back(val);
813  }
814  }

References T.

◆ reduce_index_gen()

template<class X >
const std::map<std::string, X> casadi::reduce_index_gen ( const std::map< std::string, X > &  dae,
Dict stats,
const Dict opts 
)

Definition at line 807 of file integration_tools.cpp.

807  {
808  double baumgarte_pole_ = 0;
809  std::string algorithm = "pantelides";
810  casadi_int max_iter = 500;
811  // Option parsing
812  for (auto&& op : opts) {
813  if (op.first=="baumgarte_pole") {
814  baumgarte_pole_ = op.second;
815  } else if (op.first=="algorithm") {
816  algorithm = op.second.to_string();
817  } else if (op.first=="max_iter") {
818  max_iter = op.second;
819  } else {
820  casadi_error("Unknown option '" + op.first + "'.");
821  }
822  }
823 
824  // Dae input sanitization
825 
826  for (const auto& e : dae) {
827  casadi_assert(e.second.is_column() && e.second.is_dense(),
828  "Dense column vector expected for key '" + e.first + "'. "
829  "Got " + e.second.dim(true) + " instead.");
830  }
831 
832  X x = get_from_dict(dae, "x", X(0, 1));
833  X ode = get_from_dict(dae, "ode", X(0, 1));
834  casadi_assert(x.numel()==ode.numel(),
835  "Size of explicit differential state vector (x: " + str(x.numel()) + ") must "
836  "match size of ode right-hand-side (ode: " + str(ode.numel()) + ").");
837  casadi_assert(x.size1()==0, "Explicit differential states not supported yet.");
838 
839  X x_impl = get_from_dict(dae, "x_impl", X(0, 1));
840  X dx_impl = get_from_dict(dae, "dx_impl", X(0, 1));
841  casadi_assert(x_impl.numel()==dx_impl.numel(),
842  "Size of implicit differential state vector (x_impl: " + str(x_impl.numel()) + ") must "
843  "match size of implicit differential state derivative vector (dx_impl: "
844  + str(dx_impl.numel()) + ").");
845 
846  X z = get_from_dict(dae, "z", X(0, 1));
847  X alg = get_from_dict(dae, "alg", X(0, 1));
848  casadi_assert(z.numel()+x_impl.numel()==alg.numel(),
849  "Size of algebraic state vector (z: " + str(z.numel()) + ") + "
850  "size of implicit states (x_impl: " + str(x_impl.numel()) + ") must "
851  "match size of algebraic equations (alg: " + str(alg.numel()) + ").");
852 
853  X t = get_from_dict(dae, "t", X::sym("t"));
854  casadi_assert(t.is_scalar(), "Time must be scalar. Got " + t.dim() + " instead.");
855 
856  X p = get_from_dict(dae, "p", X(0, 1));
857 
858  // Check that dx_impl are classified correctly
859  std::vector<bool> dep = X::which_depends(alg, dx_impl);
860 
861  if (!all(dep)) {
862  std::vector<X> dx_impl_split = vertsplit(dx_impl);
863  std::vector<std::string> prob;
864  for (casadi_int i=0;i<dep.size();++i) {
865  if (!dep[i]) prob.push_back(dx_impl_split[i].name());
866  }
867  casadi_error("Found dx_impl variables that do not appear in alg: " + join(prob, ",") +
868  ". They should be classified as z instead.");
869  }
870 
871 
872  bool normal_order = true;
873 
874  // Determine graph structure of problem for structural index reduction
875  X V;
876  if (normal_order) {
877  V = vertcat(x_impl, dx_impl, z);
878  } else {
879  V = vertcat(x_impl, z, dx_impl);
880  }
881 
882  Function temp("temp", {V, p, t}, {alg});
883  Sparsity G = temp.jac_sparsity(0, 0);
884 
885  // Populate var_map: a list that associates variables with their derivatives
886  int nx_impl = x_impl.numel();
887  int nz = z.numel();
888  std::vector<casadi_int> var_map(V.numel(), -1);
889  for (casadi_int i=0;i<nx_impl;++i) {
890  var_map[i] = i+nx_impl+(normal_order? 0: nz);
891  }
892 
893  // Allocate space for eq_map: a list that associates equations with their derivatives
894  std::vector<casadi_int> eq_map;
895 
896  // Modifies var_map and eq_map
897  dae_struct_detect(algorithm, G, var_map, eq_map, max_iter);
898 
899  // Variables should not be removed
900  casadi_assert_dev(var_map.size()>=2*nx_impl+nz);
901 
902  // List of scalarized variables
903  std::vector<X> var_ext = vertsplit(V);
904  // Allocate extra space for extension due to index reduction
905  var_ext.resize(var_map.size());
906 
907  // Populate extra space
908  for (casadi_int i=0;i<var_map.size();++i) {
909  casadi_int i_der = var_map[i];
910  // Derivate index is in the extra space?
911  if (i_der>=V.numel())
912  // Consstruct a new symbol with derived name
913  var_ext[i_der] = X::sym("d"+var_ext[i].name());
914  }
915 
916  // Prepare arguments for jtimes
917  // In essence, this is like to the novel x_impl and dx_impl,
918  // but a subset may be promoted to x (explicit diff. state)
919  std::vector<X> xs; xs.reserve(var_map.size());
920  std::vector<X> dxs; dxs.reserve(var_map.size());
921 
922  for (casadi_int i=0;i<var_map.size();++i) {
923  casadi_int i_der = var_map[i];
924  if (i_der>=0) {
925  xs.push_back(var_ext[i]);
926  dxs.push_back(var_ext[i_der]);
927  }
928  }
929 
930  // Stack to be used as jtimes arguments
931  X x_cat = vertcat(xs);
932  X dx_cat = vertcat(dxs);
933 
934  // Don't forget to differentiate time itself
935  X j1 = vertcat(x_cat, t);
936  X j2 = vertcat(dx_cat, 1);
937 
938  // List of scalarized equations
939  std::vector<X> eq_ext = vertsplit(alg);
940  // Allocate extra space for extension due to index reduction
941  eq_ext.resize(eq_map.size());
942 
943  // For each equation, figure out how many times it was differentiated (=order)
944  std::vector<casadi_int> order = get_orders(eq_map);
945  casadi_int max_order = *std::max_element(order.begin(), order.end());
946 
947  // We lump together all relevant equations before doing differentiation in a target group,
948  // in order to make use of shared subexpressions.
949  // order -> all equations that give rise to an equation of this order
950  std::map<casadi_int, std::vector<casadi_int> > targets;
951  for (casadi_int i=0;i<eq_map.size();++i) {
952  if (eq_map[i]>=0) {
953  targets[order[eq_map[i]]].push_back(i);
954  }
955  }
956 
957  // Non-active equations will be dropped from the final set
958  std::vector<bool> active(eq_map.size(), true);
959 
960  // Equations that get dropped, but should still hold for initial guess
961  std::vector<X> dropped_constraints;
962 
963  // Loop over equation elements in increasing order
964  for (casadi_int ord=1;ord<=max_order;++ord) {
965  const std::vector<casadi_int> & target = targets[ord];
966 
967  // Remember to-be-dropped equations
968  for (casadi_int i : target) dropped_constraints.push_back(eq_ext[i]);
969 
970  // Gather target's equations
971  X block = vertcat(vector_slice(eq_ext, target));
972  // Perform differentiation
973  std::vector<X> dblocks = vertsplit(jtimes(block, j1, j2, false));
974  // Scatter computed derivatives into target resultant equation slots
975  for (casadi_int i=0;i<target.size();++i) {
976  casadi_int t = target[i];
977  eq_ext[eq_map[t]] = dblocks[i];
978  active[t] = false;
979  }
980  }
981 
982  std::vector<casadi_int> eq_map_inverse = get_inverse(eq_map);
983 
984  // Construct the new list of algebraic equations
985  // In theory, just collect all active members of eq_ext
986  // In practice, we add some Baumgarte stabilization to avoid constraint drifting
987  std::vector<X> alg_new;
988  for (casadi_int i=0;i<eq_map.size();++i) {
989  if (active[i]) {
990 
991  // Start from the pure equation
992  X new_eq = eq_ext[i];
993 
994  // Construct coefficients of the polynomial (x-gamma)^order
995  Polynomial p(1);
996  for (casadi_int k=0;k<order[i];++k) {
997  p *= Polynomial(1, -baumgarte_pole_);
998  }
999 
1000  const std::vector<double>& coeff = p.coeff();
1001 
1002  // Find indices of originating equations of equation i
1003  // e.g. if eq_i = der(eq_j), eq_j = der(eq_k), obtain [j,k]
1004  std::vector<casadi_int> gen_i = path(eq_map_inverse, i);
1005 
1006  // Add inner product of coefficients with originating equations of new_eq
1007  for (casadi_int k=0;k<gen_i.size();++k) {
1008  new_eq += coeff[k+1]*eq_ext[gen_i[k]];
1009  }
1010 
1011  // Ready to add
1012  alg_new.push_back(new_eq);
1013  }
1014  }
1015 
1016  std::vector<casadi_int> var_order = get_orders(var_map);
1017  std::vector<casadi_int> var_map_inverse = get_inverse(var_map);
1018 
1019 
1020  // Which implicit states become explicit pure integrators?
1021  std::vector<casadi_int> impl_to_expl;
1022  for (casadi_int i=0;i<var_map.size();++i) {
1023  if (var_order[i]>=2) {
1024  // Find indices of originating variables of variable i
1025  // e.g. if var_i = der(var_j), var_j = der(var_k), obtain [j,k]
1026  std::vector<casadi_int> gen_i = path(var_map_inverse, i);
1027 
1028  // Anything too deep should become explicit integrator
1029  if (gen_i.size()>1)
1030  impl_to_expl.insert(impl_to_expl.end(), gen_i.begin()+1, gen_i.end());
1031 
1032  }
1033  }
1034 
1035  // Take complement
1036  std::vector<casadi_int> impl_to_expl_compl = complement(impl_to_expl, xs.size());
1037  std::map<std::string, X> dae_result;
1038 
1039  dae_result["x"] = vertcat(vector_slice(xs, impl_to_expl));
1040  dae_result["ode"] = vertcat(vector_slice(dxs, impl_to_expl));
1041 
1042  dae_result["x_impl"] = vertcat(vector_slice(xs, impl_to_expl_compl));
1043  dae_result["dx_impl"] = vertcat(vector_slice(dxs, impl_to_expl_compl));
1044 
1045  dae_result["t"] = t;
1046  dae_result["p"] = p;
1047 
1048  // Which algebraic variables were not promoted to differential states?
1049  std::vector<X> z_orig = vertsplit(z);
1050  std::vector<X> z_new;
1051  for (casadi_int i=0;i<var_map.size();++i) {
1052  // Algebraic
1053  if (var_order[i]==0 && var_map[i]==-1) {
1054  z_new.push_back(z_orig.at(i-(normal_order?2:1)*nx_impl));
1055  }
1056  }
1057  dae_result["z"] = vertcat(z_new);
1058  dae_result["alg"] = vertcat(alg_new);
1059 
1060  dae_result["I"] = vertcat(dropped_constraints);
1061 
1062  stats["index"] = max_order+1;
1063 
1064  return dae_result;
1065 }
void dae_struct_detect(const std::string &algorithm, const Sparsity &graph, std::vector< casadi_int > &var_map, std::vector< casadi_int > &eq_map, casadi_int max_iter)
std::string join(const std::vector< std::string > &l, const std::string &delim)
std::vector< casadi_int > get_inverse(const std::vector< casadi_int > &map)
std::vector< casadi_int > get_orders(const std::vector< casadi_int > &map)
std::vector< casadi_int > complement(const std::vector< casadi_int > &v, casadi_int size)
Returns the list of all i in [0, size[ not found in supplied list.
std::vector< casadi_int > path(const std::vector< casadi_int > &map, casadi_int i_start)

References all(), casadi::Polynomial::coeff(), complement(), casadi::IndexReduction::dae_struct_detect(), get_from_dict(), get_inverse(), get_orders(), join(), casadi::Sparsity::numel(), path(), str(), vector_slice(), and X.

Referenced by dae_reduce_index().

◆ register_symbol() [1/2]

MX casadi::register_symbol ( const MX node,
std::map< MXNode *, MX > &  symbol_map,
std::vector< MX > &  symbol_v,
std::vector< MX > &  parametric_v,
bool  extract_trivial,
casadi_int  v_offset,
const std::string &  v_prefix,
const std::string &  v_suffix 
)

Definition at line 2294 of file mx.cpp.

2297  {
2298  // Check if a symbol is already registered
2299  auto it = symbol_map.find(node.get());
2300 
2301  // Ignore trivial expressions if applicable
2302  bool is_trivial = node.is_symbolic();
2303  if (is_trivial && !extract_trivial) {
2304  return node;
2305  }
2306 
2307  if (it==symbol_map.end()) {
2308  // Create a symbol and register
2309  MX sym = MX::sym(v_prefix + str(symbol_map.size()+v_offset) + v_suffix, node.sparsity());
2310  symbol_map[node.get()] = sym;
2311 
2312  // Make the (symbol,parametric expression) pair available
2313  symbol_v.push_back(sym);
2314  parametric_v.push_back(node);
2315 
2316  // Use the new symbol
2317  return sym;
2318  } else {
2319  // Just use the registered symbol
2320  return it->second;
2321  }
2322  }

References casadi::MX::find(), casadi::MX::get(), casadi::MX::is_symbolic(), casadi::MX::sparsity(), str(), and casadi::GenericMatrix< MX >::sym().

Referenced by casadi::MX::extract_parametric().

◆ register_symbol() [2/2]

SXElem casadi::register_symbol ( const SXElem node,
std::map< SXNode *, SXElem > &  symbol_map,
std::vector< SXElem > &  symbol_v,
std::vector< SXElem > &  parametric_v,
bool  extract_trivial,
casadi_int  v_offset,
const std::string &  v_prefix,
const std::string &  v_suffix 
)

Definition at line 579 of file sx_instantiator.cpp.

582  {
583 
584  // Check if a symbol is already registered
585  auto it = symbol_map.find(node.get());
586 
587  // Ignore trivial expressions if applicable
588  bool is_trivial = node.is_symbolic();
589  if (is_trivial && !extract_trivial) {
590  return node;
591  }
592 
593  if (it==symbol_map.end()) {
594  // Create a symbol and register
595  SXElem sym = SXElem::sym(v_prefix + str(symbol_map.size()+v_offset) + v_suffix);
596  symbol_map[node.get()] = sym;
597 
598  // Make the (symbol,parametric expression) pair available
599  symbol_v.push_back(sym);
600  parametric_v.push_back(node);
601 
602  // Overwrite the argument
603  return sym;
604  } else {
605  // Just use the registered symbol
606  return it->second;
607  }
608  }

References casadi::MX::find(), casadi::SXElem::get(), casadi::SXElem::is_symbolic(), str(), and casadi::SXElem::sym().

◆ remove()

bool casadi::remove ( const std::string &  path)

Definition at line 47 of file ghc.cpp.

47  {
48  return ghc::filesystem::remove(path);
49  }

References path().

Referenced by casadi_register_filesystem_ghc(), casadi::AmplInterface::solve(), casadi::FunctionInternal::~FunctionInternal(), and casadi::ShellCompiler::~ShellCompiler().

◆ remove_all()

casadi_int casadi::remove_all ( const std::string &  path)

Definition at line 51 of file ghc.cpp.

51  {
52  return ghc::filesystem::remove_all(path);
53  }

References path().

Referenced by casadi_register_filesystem_ghc().

◆ replace()

CASADI_EXPORT std::string casadi::replace ( const std::string &  s,
const std::string &  p,
const std::string &  r 
)

Definition at line 289 of file casadi_misc.cpp.

290  {
291  std::string ret = s;
292  std::string::size_type n = 0;
293  while ((n = ret.find(p, n)) != std::string::npos) {
294  ret.replace(n, p.size(), r);
295  n += r.size();
296  }
297  return ret;
298  }

Referenced by casadi::CodeGenerator::constant(), casadi::MX::extract(), casadi::External::factory(), casadi::CodeGenerator::fmu_helpers(), casadi::Factory< MatType >::request_output(), and casadi::CodeGenerator::sanitize_source().

◆ replace_mat()

template<typename M >
M casadi::replace_mat ( const M &  arg,
const Sparsity inp,
casadi_int  npar 
)

Definition at line 1742 of file function_internal.hpp.

1742  {
1743  if (arg.size()==inp.size()) {
1744  // Matching dimensions already
1745  return arg;
1746  } else if (arg.is_empty()) {
1747  // Empty matrix means set zero
1748  return M(inp.size());
1749  } else if (arg.is_scalar()) {
1750  // Scalar assign means set all
1751  return M(inp, arg);
1752  } else if (arg.is_vector() && inp.size()==std::make_pair(arg.size2(), arg.size1())) {
1753  // Transpose vector
1754  return arg.T();
1755  } else if (arg.size1()==inp.size1() && arg.size2()>0 && inp.size2()>0
1756  && inp.size2()%arg.size2()==0) {
1757  // Horizontal repmat
1758  return repmat(arg, 1, inp.size2()/arg.size2());
1759  } else {
1760  casadi_assert_dev(npar!=-1);
1761  // Multiple evaluation
1762  return repmat(arg, 1, (npar*inp.size2())/arg.size2());
1763  }
1764  }

References casadi::Sparsity::size(), casadi::Sparsity::size1(), and casadi::Sparsity::size2().

Referenced by casadi::FunctionInternal::mapsum_mx(), casadi::FunctionInternal::replace_arg(), and casadi::FunctionInternal::replace_res().

◆ report_issue()

void casadi::report_issue ( casadi_int  i,
const std::string &  msg 
)

Definition at line 84 of file fatrop_interface.cpp.

84  {
85  casadi_int idx = i+GlobalOptions::start_index;
86  casadi_warning("Structure detection error on row " + str(idx) + ". " + msg);
87  }

References casadi::GlobalOptions::start_index, and str().

Referenced by casadi::FatropInterface::init().

◆ return_code()

std::string casadi::return_code ( casadi_int  status)

Definition at line 233 of file fast_newton.cpp.

233  {
234  switch (status) {
235  case 0:
236  return "max_iteration_reached";
237  case 1:
238  return "converged_abstol";
239  case 2:
240  return "converged_abstol_step";
241  default:
242  return "unknown";
243  }
244  }

Referenced by casadi::FastNewton::get_stats().

◆ return_secondary_status_string()

std::string casadi::return_secondary_status_string ( int  status)
inline

Definition at line 141 of file cbc_interface.cpp.

141  {
142  switch (status) {
143  case -1:
144  return "unset";
145  case 0:
146  return "search completed with solution";
147  case 1:
148  return "linear relaxation not feasible (or worse than cutoff)";
149  case 2:
150  return "stopped on gap";
151  case 3:
152  return "stopped on nodes";
153  case 4:
154  return "stopped on time";
155  case 5:
156  return "stopped on user event";
157  case 6:
158  return "stopped on solutions";
159  case CbcEventHandler::CbcEvent::node:
160  return "node";
161  case CbcEventHandler::CbcEvent::treeStatus:
162  return "treeStatus";
163  case CbcEventHandler::CbcEvent::solution:
164  return "solution";
165  case CbcEventHandler::CbcEvent::heuristicSolution:
166  return "heuristicSolution";
167  case CbcEventHandler::CbcEvent::beforeSolution1:
168  return "beforeSolution1";
169  case CbcEventHandler::CbcEvent::beforeSolution2:
170  return "beforeSolution2";
171  case CbcEventHandler::CbcEvent::afterHeuristic:
172  return "afterHeuristic";
173  case CbcEventHandler::CbcEvent::smallBranchAndBound:
174  return "smallBranchAndBound";
175  case CbcEventHandler::CbcEvent::heuristicPass:
176  return "heuristicPass";
177  case CbcEventHandler::CbcEvent::convertToCuts:
178  return "convertToCuts";
179  case CbcEventHandler::CbcEvent::endSearch:
180  return "endSearch";
181  default:
182  return "unknown";
183  }
184  }

Referenced by casadi::CbcInterface::get_stats(), casadi::ClpInterface::get_stats(), casadi::CbcInterface::solve(), and casadi::ClpInterface::solve().

◆ return_status_string() [1/4]

const char* casadi::return_status_string ( Bonmin::TMINLP::SolverReturn  status)
inline

Definition at line 325 of file bonmin_interface.cpp.

325  {
326  switch (status) {
327  case Bonmin::TMINLP::MINLP_ERROR:
328  return "MINLP_ERROR";
329  case Bonmin::TMINLP::SUCCESS:
330  return "SUCCESS";
331  case Bonmin::TMINLP::INFEASIBLE:
332  return "INFEASIBLE";
333  case Bonmin::TMINLP::CONTINUOUS_UNBOUNDED:
334  return "CONTINUOUS_UNBOUNDED";
335  case Bonmin::TMINLP::LIMIT_EXCEEDED:
336  return "LIMIT_EXCEEDED";
337  case Bonmin::TMINLP::USER_INTERRUPT:
338  return "USER_INTERRUPT";
339  }
340  return "Unknown";
341  }

Referenced by casadi::BonminInterface::finalize_solution(), casadi::CbcInterface::get_stats(), casadi::ClpInterface::get_stats(), casadi::GurobiInterface::get_stats(), casadi::CbcInterface::solve(), casadi::ClpInterface::solve(), casadi::GurobiInterface::solve(), and casadi::IpoptInterface::solve().

◆ return_status_string() [2/4]

const char * casadi::return_status_string ( casadi_int  status)
inline

Definition at line 175 of file gurobi_interface.cpp.

175  {
176  switch (status) {
177  case GRB_LOADED:
178  return "LOADED";
179  case GRB_OPTIMAL:
180  return "OPTIMAL";
181  case GRB_INFEASIBLE:
182  return "INFEASIBLE";
183  case GRB_INF_OR_UNBD:
184  return "INF_OR_UNBD";
185  case GRB_UNBOUNDED:
186  return "UNBOUNDED";
187  case GRB_CUTOFF:
188  return "CUTOFF";
189  case GRB_ITERATION_LIMIT:
190  return "ITERATION_LIMIT";
191  case GRB_NODE_LIMIT:
192  return "NODE_LIMIT";
193  case GRB_TIME_LIMIT:
194  return "TIME_LIMIT";
195  case GRB_SOLUTION_LIMIT:
196  return "SOLUTION_LIMIT";
197  case GRB_INTERRUPTED:
198  return "INTERRUPTED";
199  case GRB_NUMERIC:
200  return "NUMERIC";
201  case GRB_SUBOPTIMAL:
202  return "SUBOPTIMAL";
203  case GRB_INPROGRESS:
204  return "INPROGRESS";
205  }
206  return "Unknown";
207  }

◆ return_status_string() [3/4]

std::string casadi::return_status_string ( int  status)
inline

Definition at line 82 of file cbc_interface.cpp.

82  {
83  switch (status) {
84  case -1:
85  return "before branchAndBound";
86  case 0:
87  return "finished";
88  case 1:
89  return "stopped - on maxnodes, maxsols, maxtime";
90  case 2:
91  return "difficulties so run was abandoned";
92  case 5:
93  return "stopped by event handler";
94  default:
95  return "unknown";
96  }
97  }

◆ return_status_string() [4/4]

const char* casadi::return_status_string ( Ipopt::ApplicationReturnStatus  status)
inline

Definition at line 374 of file ipopt_interface.cpp.

374  {
375  switch (status) {
376  case Solve_Succeeded:
377  return "Solve_Succeeded";
378  case Solved_To_Acceptable_Level:
379  return "Solved_To_Acceptable_Level";
380  case Infeasible_Problem_Detected:
381  return "Infeasible_Problem_Detected";
382  case Search_Direction_Becomes_Too_Small:
383  return "Search_Direction_Becomes_Too_Small";
384  case Diverging_Iterates:
385  return "Diverging_Iterates";
386  case User_Requested_Stop:
387  return "User_Requested_Stop";
388  case Maximum_Iterations_Exceeded:
389  return "Maximum_Iterations_Exceeded";
390  case Restoration_Failed:
391  return "Restoration_Failed";
392  case Error_In_Step_Computation:
393  return "Error_In_Step_Computation";
394  case Not_Enough_Degrees_Of_Freedom:
395  return "Not_Enough_Degrees_Of_Freedom";
396  case Invalid_Problem_Definition:
397  return "Invalid_Problem_Definition";
398  case Invalid_Option:
399  return "Invalid_Option";
400  case Invalid_Number_Detected:
401  return "Invalid_Number_Detected";
402  case Unrecoverable_Exception:
403  return "Unrecoverable_Exception";
404  case NonIpopt_Exception_Thrown:
405  return "NonIpopt_Exception_Thrown";
406  case Insufficient_Memory:
407  return "Insufficient_Memory";
408  case Internal_Error:
409  return "Internal_Error";
410  case Maximum_CpuTime_Exceeded:
411  return "Maximum_CpuTime_Exceeded";
412  case Feasible_Point_Found:
413  return "Feasible_Point_Found";
414 #if (IPOPT_VERSION_MAJOR > 3) || (IPOPT_VERSION_MAJOR == 3 && IPOPT_VERSION_MINOR >= 14)
415  case Maximum_WallTime_Exceeded:
416  return "Maximum_WallTime_Exceeded";
417 #endif
418  }
419  return "Unknown";
420  }

◆ reverse()

template<typename T >
std::vector< T > casadi::reverse ( const std::vector< T > &  v)

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

Definition at line 589 of file casadi_misc.hpp.

589  {
590  std::vector<T> ret(v.size());
591  std::reverse_copy(v.begin(), v.end(), ret.begin());
592  return ret;
593  }

Referenced by casadi::Factory< MatType >::calculate_adj(), and casadi::External::get_reverse().

◆ shared_cast() [1/2]

template<class B , class S >
const B casadi::shared_cast ( const S &  A)

cf. dynamic_cast (const)

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

Definition at line 231 of file generic_shared.hpp.

231  {
232  S A_copy = A;
233  return shared_cast<B, S>(A_copy);
234  }

◆ shared_cast() [2/2]

template<class B , class S >
B casadi::shared_cast ( S &  A)

cf. dynamic_cast

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

Get a pointer to the node

Create a return object

Quick return if not allowed

Assign node of B and return

Definition at line 209 of file generic_shared.hpp.

209  {
210 
212  typename S::internal_base_type* ptr = A.get();
213 
215  B ret;
216 
218  if (!B::test_cast(ptr)) return ret;
219 
221  ret.own(ptr);
222  return ret;
223  }

◆ sign()

double casadi::sign ( double  x)
inline

◆ simpleIntegrator()

CASADI_EXPORT Function casadi::simpleIntegrator ( Function  f,
const std::string &  integrator = "cvodes",
const Dict integrator_options = Dict() 
)

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

Definition at line 356 of file integration_tools.cpp.

357  {
358  // Consistency check
359  casadi_assert(f.n_in()==2, "Function must have two inputs: x and p");
360  casadi_assert(f.n_out()==1, "Function must have one outputs: dot(x)");
361 
362  // Sparsities
363  Sparsity x_sp = f.sparsity_in(0);
364  Sparsity p_sp = f.sparsity_in(1);
365 
366  // Wrapper function inputs
367  MX x = MX::sym("x", x_sp);
368  MX u = MX::sym("u", vertcat(Sparsity::scalar(), vec(p_sp))); // augment p with t
369 
370  // Normalized xdot
371  casadi_int u_offset[] = {0, 1, 1+p_sp.size1()};
372  std::vector<MX> pp = vertsplit(u, std::vector<casadi_int>(u_offset, u_offset+3));
373  MX h = pp[0];
374  MX p = reshape(pp[1], p_sp.size());
375  MX f_in[] = {x, p};
376  MX xdot = f(std::vector<MX>(f_in, f_in+2)).at(0);
377  xdot *= h;
378 
379  // Form DAE function
380  MXDict dae = {{"x", x}, {"p", u}, {"ode", xdot}};
381 
382  // Create integrator function with normalized time from 0 to 1
383  Function ifcn = integrator("integrator", plugin, dae, plugin_options);
384 
385  // Inputs of constructed function
386  MX x0 = MX::sym("x0", x_sp);
387  p = MX::sym("p", p_sp);
388  h = MX::sym("h");
389 
390  // State at end
391  MX xf = ifcn(MXDict{{"x0", x0}, {"p", vertcat(h, vec(p))}}).at("xf");
392 
393  // Form discrete-time dynamics
394  return Function("F", {x0, p, h}, {xf}, {"x0", "p", "h"}, {"xf"});
395 }
Function integrator(const std::string &name, const std::string &solver, const SXDict &dae, const Dict &opts)
Definition: integrator.cpp:134

References integrator(), casadi::Function::n_in(), casadi::Function::n_out(), casadi::Sparsity::scalar(), casadi::Sparsity::size(), casadi::Sparsity::size1(), casadi::Function::sparsity_in(), and casadi::GenericMatrix< MX >::sym().

◆ simpleIRK()

CASADI_EXPORT Function casadi::simpleIRK ( Function  f,
casadi_int  N = 10,
casadi_int  order = 4,
const std::string &  scheme = "radau",
const std::string &  solver = "newton",
const Dict solver_options = Dict() 
)

The constructed function has three inputs, corresponding to initial state (x0), parameter (p) and integration time (h) and one output, corresponding to final state (xf).

Parameters
fODE function with two inputs (x and p) and one output (xdot)
NNumber of integrator steps
orderOrder of interpolating polynomials
schemeCollocation scheme, as excepted by collocationPoints function.
solverSolver plugin
solver_optionsOptions to be passed to the solver plugin

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

Definition at line 289 of file integration_tools.cpp.

291  {
292  // Consistency check
293  casadi_assert(N>=1,
294  "Parameter N (number of steps) must be at least 1, but got " + str(N) + ".");
295  casadi_assert(f.n_in()==2, "Function must have two inputs: x and p");
296  casadi_assert(f.n_out()==1, "Function must have one outputs: dot(x)");
297 
298  // Obtain collocation points
299  std::vector<double> tau_root = collocation_points(order, scheme);
300 
301  // Retrieve collocation interpolating matrices
302  std::vector < std::vector <double> > C;
303  std::vector < double > D;
304  collocation_interpolators(tau_root, C, D);
305 
306  // Inputs of constructed function
307  MX x0 = MX::sym("x0", f.sparsity_in(0));
308  MX p = MX::sym("p", f.sparsity_in(1));
309  MX h = MX::sym("h");
310 
311  // Time step
312  MX dt = h/N;
313 
314  // Implicitly defined variables
315  MX v = MX::sym("v", repmat(x0.sparsity(), order));
316  std::vector<MX> x = vertsplit(v, x0.size1());
317  x.insert(x.begin(), x0);
318 
319  // Collect the equations that implicitly define v
320  std::vector<MX> V_eq, f_in(2), f_out;
321  for (casadi_int j=1; j<order+1; ++j) {
322  // Expression for the state derivative at the collocation point
323  MX xp_j = 0;
324  for (casadi_int r=0; r<=order; ++r) xp_j+= C[j][r]*x[r];
325 
326  // Collocation equations
327  f_in[0] = x[j];
328  f_in[1] = p;
329  f_out = f(f_in);
330  V_eq.push_back(dt*f_out.at(0)-xp_j);
331  }
332 
333  // Root-finding function
334  Function rfp("rfp", {v, x0, p, h}, {vertcat(V_eq)});
335 
336  // Create a implicit function instance to solve the system of equations
337  Function ifcn = rootfinder("ifcn", solver, rfp, solver_options);
338 
339  // Get state at end time
340  MX xf = x0;
341  for (casadi_int k=0; k<N; ++k) {
342  std::vector<MX> ifcn_out = ifcn({repmat(xf, order), xf, p, h});
343  x = vertsplit(ifcn_out[0], xf.size1());
344 
345  // State at end of step
346  xf = D[0]*xf;
347  for (casadi_int i=1; i<=order; ++i) {
348  xf += D[i]*x[i-1];
349  }
350  }
351 
352  // Form discrete-time dynamics
353  return Function("F", {x0, p, h}, {xf}, {"x0", "p", "h"}, {"xf"});
354 }
Function rootfinder(const std::string &name, const std::string &solver, const SXDict &rfp, const Dict &opts)
Definition: rootfinder.cpp:111
void collocation_interpolators(const std::vector< double > &tau, std::vector< std::vector< double > > &C, std::vector< double > &D)
Obtain collocation interpolating matrices.
std::vector< double > collocation_points(casadi_int order, const std::string &scheme)
Obtain collocation points of specific order and scheme.

References C, collocation_interpolators(), collocation_points(), D, casadi::Function::n_in(), casadi::Function::n_out(), rootfinder(), casadi::GenericMatrix< MatType >::size1(), casadi::MX::sparsity(), casadi::Function::sparsity_in(), str(), and casadi::GenericMatrix< MX >::sym().

◆ simpleRK()

CASADI_EXPORT Function casadi::simpleRK ( Function  f,
casadi_int  N = 10,
casadi_int  order = 4 
)

The constructed function has three inputs, corresponding to initial state (x0), parameter (p) and integration time (h) and one output, corresponding to final state (xf).

Parameters
fODE function with two inputs (x and p) and one output (xdot)
NNumber of integrator steps
orderOrder of interpolating polynomials

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

Definition at line 128 of file integration_tools.cpp.

128  {
129  // Consistency check
130  casadi_assert(N>=1,
131  "Parameter N (number of steps) must be at least 1, but got " + str(N) + ".");
132  casadi_assert(order==4, "Only RK order 4 is supported now.");
133  casadi_assert(f.n_in()==2, "Function must have two inputs: x and p");
134  casadi_assert(f.n_out()==1, "Function must have one outputs: dot(x)");
135 
136  MX x0 = MX::sym("x0", f.sparsity_in(0));
137  MX p = MX::sym("p", f.sparsity_in(1));
138  MX h = MX::sym("h");
139 
140  std::vector<double> b(order);
141  b[0]=1.0/6;
142  b[1]=1.0/3;
143  b[2]=1.0/3;
144  b[3]=1.0/6;
145 
146  std::vector<double> c(order);
147  c[0]=0;
148  c[1]=1.0/2;
149  c[2]=1.0/2;
150  c[3]=1;
151 
152  std::vector< std::vector<double> > A(order-1);
153  A[0].resize(1);
154  A[0][0]=1.0/2;
155  A[1].resize(2);
156  A[1][0]=0;A[1][1]=1.0/2;
157  A[2].resize(3);
158  A[2][0]=0;
159  A[2][1]=0;A[2][2]=1;
160 
161  // Time step
162  MX dt = h/N;
163 
164  std::vector<MX> k(order);
165  std::vector<MX> f_arg(2);
166 
167  // Integrate
168  MX xf = x0;
169  for (casadi_int i=0; i<N; ++i) {
170  for (casadi_int j=0; j<order; ++j) {
171  MX xL = 0;
172  for (casadi_int jj=0; jj<j; ++jj) {
173  xL += k.at(jj)*A.at(j-1).at(jj);
174  }
175  f_arg[0] = xf+xL;
176  f_arg[1] = p;
177  k[j] = dt*f(f_arg).at(0);
178  }
179 
180  for (casadi_int j=0; j<order; ++j) {
181  xf += b.at(j)*k.at(j);
182  }
183  }
184 
185  // Form discrete-time dynamics
186  return Function("F", {x0, p, h}, {xf}, {"x0", "p", "h"}, {"xf"});
187 }

References casadi::Function::n_in(), casadi::Function::n_out(), casadi::Function::sparsity_in(), str(), and casadi::GenericMatrix< MX >::sym().

◆ simplify()

double casadi::simplify ( double  x)
inline

CasADi additions

Definition at line 271 of file calculus.hpp.

271 { return x;}

Referenced by casadi::FixedStepIntegrator::create_advanced().

◆ slicot_mb03vd()

int casadi::slicot_mb03vd ( int  n,
int  p,
int  ilo,
int  ihi,
double *  a,
int  lda1,
int  lda2,
double *  tau,
int  ldtau,
double *  dwork 
)

Definition at line 51 of file slicot_layer.cpp.

52  {
53  f_int n_ = n;
54  f_int p_ = p;
55  f_int ilo_ = ilo;
56  f_int ihi_ = ihi;
57  f_int lda1_ = lda1;
58  f_int lda2_ = lda2;
59  f_int ldtau_ = ldtau;
60  f_int ret_ = 0;
61 
62  mb03vd_(&n_, &p_, &ilo_, &ihi_, a, &lda1_, &lda2_, tau, &ldtau_, dwork, &ret_);
63  return ret_;
64  }

Referenced by slicot_periodic_schur().

◆ slicot_mb03vy()

int casadi::slicot_mb03vy ( int  n,
int  p,
int  ilo,
int  ihi,
double *  a,
int  lda1,
int  lda2,
const double *  tau,
int  ldtau,
double *  dwork,
int  ldwork 
)

Definition at line 66 of file slicot_layer.cpp.

67  {
68  f_int n_ = n;
69  f_int p_ = p;
70  f_int ilo_ = ilo;
71  f_int ihi_ = ihi;
72  f_int lda1_ = lda1;
73  f_int lda2_ = lda2;
74  f_int ldtau_ = ldtau;
75  f_int ldwork_ = ldwork;
76  f_int ret_=0;
77  mb03vy_(&n_, &p_, &ilo_, &ihi_, a, &lda1_, &lda2_, tau, &ldtau_, dwork, &ldwork_, &ret_);
78 
79  return ret_;
80 
81  }

Referenced by slicot_periodic_schur().

◆ slicot_mb03wd()

int casadi::slicot_mb03wd ( char  job,
char  compz,
int  n,
int  p,
int  ilo,
int  ihi,
int  iloz,
int  ihiz,
double *  h,
int  ldh1,
int  ldh2,
double *  z,
int  ldz1,
int  ldz2,
double *  wr,
double *  wi,
double *  dwork,
int  ldwork 
)

Definition at line 83 of file slicot_layer.cpp.

85  {
86  f_int n_ = n;
87  f_int p_ = p;
88  f_int ilo_ = ilo;
89  f_int ihi_ = ihi;
90  f_int iloz_ = ilo;
91  f_int ihiz_ = ihi;
92  f_int ldh1_ = ldh1;
93  f_int ldh2_ = ldh2;
94  f_int ldz1_ = ldz1;
95  f_int ldz2_ = ldz2;
96  f_int ldwork_ = ldwork;
97  f_int ret_ = 0;
98  mb03wd_(&job, &compz, &n_, &p_, &ilo_, &ihi_, &iloz_, &ihiz_, h, &ldh1_, &ldh2_,
99  z, &ldz1_, &ldz2_, wr, wi, dwork, &ldwork_, &ret_);
100 
101  return ret_;
102  }

Referenced by slicot_periodic_schur().

◆ slicot_mb05nd()

int casadi::slicot_mb05nd ( int  n,
double  delta,
const double *  a,
int  lda,
double *  ex,
int  ldex,
double *  exint,
int  ldexin,
double  tol,
int *  iwork,
double *  dwork,
int  ldwork 
)

Definition at line 105 of file slicot_layer.cpp.

107  {
108  f_int n_ = n;
109  f_int lda_ = lda;
110  f_int ldex_ = ldex;
111  f_int ldexin_ = ldexin;
112  f_int* iwork_ = reinterpret_cast<f_int*>(iwork);
113  f_int ldwork_ = ldwork;
114  f_int ret_ = 0;
115  mb05nd_(&n_, &delta, a, &lda_, ex, &ldex_, exint, &ldexin_,
116  &tol, iwork_, dwork, &ldwork_, &ret_);
117 
118  return ret_;
119  }

Referenced by casadi::SlicotExpm::eval().

◆ slicot_periodic_schur()

void casadi::slicot_periodic_schur ( casadi_int  n,
casadi_int  K,
const double *  a,
double *  t,
double *  z,
double *  dwork,
double *  eig_real,
double *  eig_imag,
double  num_zero 
)

Definition at line 409 of file slicot_dple.cpp.

412  {
413  casadi_int mem_base = std::max(n+K-2, 4*n);
414  casadi_int mem_needed = mem_base+(n-1)*K;
415 
416  // a is immutable, we need a mutable pointer, so we use available buffer
417  std::copy(a, a+n*n*K, z);
418 
419  casadi_int ret;
420 
421  ret = slicot_mb03vd(n, K, 1, n, z, n, n, dwork+mem_base, n-1, dwork);
422  casadi_assert(ret==0, "mb03vd return code " + str(ret));
423  std::copy(z, z+n*n*K, t);
424 
425  ret = slicot_mb03vy(n, K, 1, n, z, n, n, dwork+mem_base, n-1, dwork, mem_needed);
426  casadi_assert(ret==0, "mb03vy return code " + str(ret));
427  // Set numerical zeros to zero
428  if (num_zero>0) {
429  for (casadi_int k = 0;k<n*n*K;++k) {
430  double &r = t[k];
431  if (fabs(r)<num_zero) r = 0.0;
432  }
433  }
434 
435  ret = slicot_mb03wd('S', 'V', n, K, 1, n, 1, n, t, n, n, z, n, n,
436  eig_real, eig_imag, dwork, mem_needed);
437  casadi_assert(ret==0, "mb03wd return code " + str(ret));
438  }
int slicot_mb03wd(char job, char compz, int n, int p, int ilo, int ihi, int iloz, int ihiz, double *h, int ldh1, int ldh2, double *z, int ldz1, int ldz2, double *wr, double *wi, double *dwork, int ldwork)
int slicot_mb03vy(int n, int p, int ilo, int ihi, double *a, int lda1, int lda2, const double *tau, int ldtau, double *dwork, int ldwork)
int slicot_mb03vd(int n, int p, int ilo, int ihi, double *a, int lda1, int lda2, double *tau, int ldtau, double *dwork)

References slicot_mb03vd(), slicot_mb03vy(), slicot_mb03wd(), and str().

Referenced by casadi::SlicotDple::eval().

◆ sort()

template<typename T >
void casadi::sort ( const std::vector< T > &  values,
std::vector< T > &  sorted_values,
std::vector< casadi_int > &  indices,
bool  invert_indices = false 
)
Parameters
[in]valuesthe vector that needs sorting
[out]sorted_valuesthe sorted vector
[out]indicesThe indices such that 'sorted_values= values[indices]'
[in]invert_indicesOutput indices such that 'sorted_values[indices=values'

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

Definition at line 881 of file casadi_misc.hpp.

882  {
883  // Call recursively if indices need to be inverted
884  if (invert_indices) {
885  std::vector<casadi_int> inverted;
886  sort(values, sorted_values, inverted, false);
887  indices.resize(inverted.size());
888  for (size_t i=0; i<inverted.size(); ++i) {
889  indices[inverted[i]] = i;
890  }
891  return;
892  }
893 
894  // Create list of indices
895  indices.resize(values.size());
896  for (size_t i=0; i<indices.size(); ++i) indices[i] = i;
897 
898  // Sort this list by the values
899  std::sort(indices.begin(), indices.end(), sortCompare<T>(values));
900 
901  // Sort the values accordingly
902  sorted_values.resize(values.size());
903  for (size_t i=0; i<values.size(); ++i) {
904  sorted_values[i] = values[indices[i]];
905  }
906  }
void sort(const std::vector< T > &values, std::vector< T > &sorted_values, std::vector< casadi_int > &indices, bool invert_indices=false)
Sort the data in a vector.

Referenced by casadi::MX::extract(), casadi::SparsityInternal::get_nz(), and casadi::SparsityInternal::sub().

◆ sq()

template<typename T >
T casadi::sq ( const T &  x)

Definition at line 331 of file calculus.hpp.

331  {
332  return x*x;
333  }

References T.

Referenced by casadi::UnaryOperation< OP_TAN >::der(), casadi::UnaryOperation< OP_SQ >::fcn(), and casadi::OoqpInterface::solve().

◆ startswith()

CASADI_EXPORT bool casadi::startswith ( const std::string &  s,
const std::string &  p 
)

Definition at line 281 of file casadi_misc.cpp.

281  {
282  if (p.size()>s.size()) return false;
283  for (casadi_int i=0;i<p.size();++i) {
284  if (s[i]!=p[i]) return false;
285  }
286  return true;
287  }

Referenced by casadi::IpoptInterface::codegen_body(), and casadi::IpoptInterface::init_mem().

◆ status_string()

static std::string casadi::status_string ( SLEQP_STATUS  status)
static

Definition at line 248 of file sleqp_interface.cpp.

249  {
250  switch (status) {
251  case SLEQP_STATUS_RUNNING:
252  return "running";
253  case SLEQP_STATUS_OPTIMAL:
254  return "optimal";
255  case SLEQP_STATUS_INFEASIBLE:
256  return "infeasible";
257  case SLEQP_STATUS_UNBOUNDED:
258  return "unbounded";
259  case SLEQP_STATUS_ABORT_DEADPOINT:
260  return "deadpoint";
261  case SLEQP_STATUS_ABORT_ITER:
262  return "iteration limit";
263  case SLEQP_STATUS_ABORT_MANUAL:
264  return "manual abort";
265  case SLEQP_STATUS_ABORT_TIME:
266  return "time limit";
267  default:
268  return "unknown";
269  }
270  }

Referenced by casadi::CplexInterface::get_stats(), casadi::SLEQPInterface::get_stats(), and casadi::CplexInterface::solve().

◆ str() [1/8]

template<typename T , size_t N>
std::string casadi::str ( const std::array< T, N > &  p,
bool  more = false 
)

Definition at line 317 of file casadi_common.hpp.

317  {
318  std::stringstream ss;
319  ss << "[";
320  for (casadi_int i=0; i<N; ++i) {
321  if (i!=0) ss << ", ";
322  ss << v[i];
323  }
324  ss << "]";
325  return ss.str();
326  }

◆ str() [2/8]

template<typename T2 >
std::string casadi::str ( const std::map< std::string, T2 > &  p,
bool  more = false 
)

Definition at line 304 of file casadi_common.hpp.

304  {
305  std::stringstream ss;
306  ss << "{";
307  casadi_int count = 0;
308  for (auto& e : p) {
309  ss << "\"" << e.first << "\": " << e.second;
310  if (++count < p.size()) ss << ", ";
311  }
312  ss << "}";
313  return ss.str();
314  }

◆ str() [3/8]

template<typename T1 , typename T2 >
std::string casadi::str ( const std::map< T1, T2 > &  p,
bool  more = false 
)

Definition at line 291 of file casadi_common.hpp.

291  {
292  std::stringstream ss;
293  ss << "{";
294  casadi_int count = 0;
295  for (auto& e : p) {
296  ss << e.first << ": " << e.second;
297  if (++count < p.size()) ss << ", ";
298  }
299  ss << "}";
300  return ss.str();
301  }

◆ str() [4/8]

template<typename T1 , typename T2 >
std::string casadi::str ( const std::pair< T1, T2 > &  p,
bool  more = false 
)

Definition at line 284 of file casadi_common.hpp.

284  {
285  std::stringstream ss;
286  ss << "[" << p.first << "," << p.second << "]";
287  return ss.str();
288  }

◆ str() [5/8]

template<typename T >
std::string casadi::str ( const std::set< T > &  v,
bool  more = false 
)

Definition at line 271 of file casadi_common.hpp.

271  {
272  std::stringstream ss;
273  ss << "{";
274  casadi_int cnt = 0;
275  for (const auto& e : v) {
276  if (cnt++!=0) ss << ", ";
277  ss << e;
278  }
279  ss << "}";
280  return ss.str();
281  }

◆ str() [6/8]

template<typename T >
std::string casadi::str ( const std::vector< T > &  v,
bool  more = false 
)

Definition at line 259 of file casadi_common.hpp.

259  {
260  std::stringstream ss;
261  ss << "[";
262  for (casadi_int i=0; i<v.size(); ++i) {
263  if (i!=0) ss << ", ";
264  ss << v[i];
265  }
266  ss << "]";
267  return ss.str();
268  }

◆ str() [7/8]

template<typename T >
std::string casadi::str ( const T &  v)

Definition at line 247 of file casadi_common.hpp.

247  {
248  std::stringstream ss;
249  ss << v;
250  return ss.str();
251  }

Referenced by casadi::SparsityInternal::_appendColumns(), casadi::SparsityInternal::_appendVector(), casadi::SparsityInternal::_reshape(), _which_depends(), casadi::MXFunction::ad_forward(), casadi::MXFunction::ad_reverse(), casadi::CodeGenerator::add_dependency(), casadi::Integrator::advance(), casadi::Slice::apply(), casadi::CodeGenerator::arg(), casadi::Function::assert_size_in(), casadi::Function::assert_size_out(), casadi::Function::assert_sparsity_out(), casadi::Integrator::augmented_dae(), casadi::CodeGenerator::axpy(), casadi::CodeGenerator::bound_consistency(), casadi::Function::bspline(), casadi::CodeGenerator::cache_check(), casadi::Factory< MatType >::calculate(), casadi::Call::Call(), casadi_KN_puts(), casadi::FunctionInternal::check_arg(), casadi::Conic::check_inputs(), casadi::Nlpsol::check_inputs(), casadi::FunctionInternal::check_res(), check_sos(), casadi::CodeGenerator::clip_max(), casadi::CodeGenerator::clip_min(), casadi::BlazingSplineFunction::codegen_body(), casadi::FiniteDiff::codegen_body(), casadi::OmpMap::codegen_body(), casadi::MapSum::codegen_body(), casadi::MXFunction::codegen_body(), casadi::Switch::codegen_body(), casadi::SXFunction::codegen_body(), casadi::FatropInterface::codegen_body(), casadi::MadnlpInterface::codegen_body(), casadi::OsqpInterface::codegen_body(), casadi::FastNewton::codegen_body(), casadi::Feasiblesqpmethod::codegen_body(), casadi::Qrqp::codegen_body(), casadi::Sqpmethod::codegen_body(), casadi::Nlpsol::codegen_body_enter(), casadi::Nlpsol::codegen_body_exit(), casadi::Sqpmethod::codegen_calc_gamma_1(), casadi::MXFunction::codegen_declarations(), casadi::SXFunction::codegen_declarations(), casadi::Feasiblesqpmethod::codegen_feasibility_iterations(), casadi::OsqpInterface::codegen_init_mem(), casadi::FunctionInternal::codegen_meta(), casadi::FunctionInternal::codegen_name(), casadi::Sqpmethod::codegen_solve_elastic_mode(), casadi::Feasiblesqpmethod::codegen_tr_update(), codegen_unpack_block(), casadi::CodeGenerator::CodeGenerator(), casadi::Sparsity::colind(), collocation_pointsGen(), casadi::SparsityInternal::combineGen(), casadi::Conic::Conic(), casadi::CodeGenerator::constant(), casadi::CodeGenerator::constant_copy(), casadi::ConstantFile::ConstantFile(), casadi::BSplineInterpolant::construct_graph(), casadi::FunctionInternal::convert_arg(), casadi::FunctionInternal::convert_res(), casadi::CallSX::create(), casadi::BSplineParametric::create(), casadi::BSpline::create(), casadi::MapSum::create(), casadi::Map::create(), casadi::OracleFunction::create_function(), casadi::GenericSharedInternal< Shared, Internal >::debug_repr(), casadi::StringDeserializer::decode(), casadi::CodeGenerator::define_pool_double(), casadi::CodeGenerator::define_rom_double(), casadi::CodeGenerator::define_rom_integer(), casadi::OptiNode::describe(), casadi::MXNode::deserialize(), casadi::SXNode::deserialize(), casadi::DeserializingStream::DeserializingStream(), casadi::Sparsity::diagsplit(), casadi::SparsityInternal::dim(), casadi::OutputNode::disp(), casadi::Dple::Dple(), dplesol(), casadi::CodeGenerator::dump(), casadi::StringSerializer::encode(), casadi::Fmu2::enter_initialization_mode(), casadi::Fmu3::enter_initialization_mode(), casadi::DaeBuilderInternal::eq(), casadi::FunctionInternal::eval(), casadi::Integrator::eval(), casadi::MXFunction::eval(), casadi::SXFunction::eval(), casadi::SlicotDple::eval(), casadi::SlicotExpm::eval(), casadi::FmuInternal::eval_fd(), casadi::FunctionInternal::eval_gen(), casadi::FunctionInternal::eval_mx(), casadi::MXFunction::export_code_body(), casadi::Function::factory(), casadi::External::factory(), casadi::Sparsity::file_format(), casadi::CodeGenerator::file_slurp(), casadi::SnoptInterface::formatSecondaryStatus(), casadi::SnoptInterface::formatStatus(), casadi::FunctionInternal::forward_name(), casadi::CodeGenerator::from_mex(), casadi::GenericType::from_type(), casadi::KinsolInterface::func(), casadi::FunctionInternal::fwd_seed(), casadi::OptiNode::g_describe(), casadi::LinsolQr::generate(), casadi::Input::generate(), casadi::Output::generate(), casadi::HorzRepmat::generate(), casadi::Split::generate(), casadi::CodeGenerator::generate(), casadi::Function::generate_in(), casadi::Function::generate_out(), casadi::Matrix< Scalar >::get(), casadi::MX::get(), casadi::Fmu2::get_aux(), casadi::Fmu3::get_aux(), casadi::MXNode::get_dot(), casadi::Integrator::get_forward(), casadi::MapSum::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::MXNode::get_mac(), casadi::FunctionInternal::get_name_in(), casadi::FunctionInternal::get_name_out(), casadi::SparsityInternal::get_nz(), casadi::MX::get_nz(), casadi::FunctionInternal::get_partition(), casadi::Integrator::get_reverse(), casadi::MapSum::get_reverse(), casadi::MX::graph_substitute(), casadi::Matrix< Scalar >::has_duplicates(), casadi::External::has_forward(), casadi::External::has_reverse(), casadi::MX::horzcat(), casadi::Sparsity::horzsplit(), casadi::SparsityInterface< MatType >::horzsplit_n(), casadi::DaeBuilderInternal::import_binding_equations(), casadi::DaeBuilderInternal::import_dynamic_equations(), casadi::DaeBuilderInternal::import_initial_equations(), casadi::FunctionInternal::index_in(), casadi::FunctionInternal::index_out(), casadi::Conic::init(), casadi::FiniteDiff::init(), casadi::FmuFunction::init(), casadi::FunctionInternal::init(), casadi::Integrator::init(), casadi::MXFunction::init(), casadi::Nlpsol::init(), casadi::Rootfinder::init(), casadi::SXFunction::init(), casadi::XFunction< DerivedType, MatType, NodeType >::init(), casadi::AmplInterface::init(), casadi::Blocksqp::init(), casadi::FatropConicInterface::init(), casadi::FatropInterface::init(), casadi::HpipmInterface::init(), casadi::HpmpcInterface::init(), casadi::ProxqpInterface::init(), casadi::SLEQPInterface::init(), casadi::IdasInterface::init(), casadi::WorhpInterface::init(), init_gen(), casadi::CplexInterface::init_mem(), casadi::GurobiInterface::init_mem(), casadi::WorhpInterface::init_mem(), integrator(), casadi::GenericMatrix< MatType >::interp1d(), casadi::MX::interpn_linear(), interpolant(), is_slice(), casadi::XFunction< DerivedType, MatType, NodeType >::jac(), casadi::FunctionInternal::jacobian(), casadi::CodeGenerator::ldl_solve(), casadi::Low::Low(), casadi::CodeGenerator::low(), casadi::CodeGenerator::lsqr_solve(), casadi::FunctionInternal::map(), casadi::Function::map(), casadi::Integrator::map2oracle(), casadi::Function::mapaccum(), casadi::CodeGenerator::masked_norm_inf(), casadi::CodeGenerator::max_viol(), casadi::CodeGenerator::mmax(), casadi::CodeGenerator::mmin(), casadi::CodeGenerator::mv(), casadi::CsparseInterface::nfact(), casadi::Ma27Interface::nfact(), casadi::LapackLu::nfact(), casadi::LapackQr::nfact(), casadi::NlImporter::NlImporter(), nlpsol(), casadi::CodeGenerator::norm_1(), casadi::CodeGenerator::norm_2(), casadi::CodeGenerator::norm_inf(), casadi::FunctionInternal::nz_in(), casadi::FunctionInternal::nz_out(), std::operator<<(), casadi::DaeBuilderInternal::output(), casadi::OptiNode::parameter(), casadi::ForwardDiff::pert(), casadi::CentralDiff::pert(), casadi::Smoothing::pert(), casadi::CodeGenerator::pool_double(), casadi::Sparsity::postfix_dim(), casadi::Integrator::predict_events(), casadi::MXFunction::print(), casadi::OutputSX::print(), casadi::MXNode::print_compact(), casadi::Matrix< double >::print_dense(), print_vec(), casadi::CodeGenerator::printf(), casadi::Function::proceed_to(), casadi::Call::projectArg(), qpsol_nlp(), casadi::CodeGenerator::qr_solve(), casadi::XmlNode::read(), casadi::DaeBuilderInternal::read_expr(), reduce_index_gen(), register_symbol(), casadi::PluginInterface< Derived >::registerPlugin(), casadi::Scpgen::regularize(), casadi::DaeBuilderInternal::reorder(), report_issue(), casadi::CodeGenerator::res(), casadi::CodeGenerator::reserve_work(), casadi::FunctionInternal::reverse_name(), casadi::CodeGenerator::rom_double(), casadi::CodeGenerator::rom_integer(), rootfinder(), casadi::Sparsity::row(), casadi::CodeGenerator::sanitize_source(), casadi::CodeGenerator::scal(), casadi::Matrix< Scalar >::set(), casadi::MX::set(), casadi::FunctionBuffer::set_arg(), casadi::DaeBuilderInternal::set_attribute(), casadi::Matrix< Scalar >::set_nz(), casadi::MX::set_nz(), casadi::FunctionBuffer::set_res(), casadi::Fmu2::set_values(), casadi::Fmu3::set_values(), casadi::Convexify::setup(), casadi::FunctionInternal::signature_unrolled(), simpleIRK(), simpleRK(), casadi::Slice::Slice(), slicot_periodic_schur(), casadi::CbcInterface::solve(), casadi::GurobiInterface::solve(), casadi::OoqpInterface::solve(), casadi::AlpaqaInterface::solve(), casadi::KnitroInterface::solve(), casadi::WorhpInterface::solve(), casadi::Newton::solve(), casadi::LapackQr::solve_batch(), casadi::Sqpmethod::solve_elastic_mode(), casadi::CodeGenerator::sparsity(), casadi::MX::sparsity_cast(), casadi::MX::stop_diff(), strvec(), casadi::SparsityInternal::sub(), casadi::MX::substitute_inplace(), casadi::CodeGenerator::sum_viol(), casadi::CodeGenerator::sx_work(), casadi::DaeBuilderInternal::tearing_variables(), casadi::OptiNode::to_function(), casadi::DaeBuilderInternal::transition(), casadi::Integrator::trigger_event(), casadi::CodeGenerator::trilsolve(), casadi::Sparsity::triplet(), casadi::CodeGenerator::triusolve(), casadi::SerializerBase::type_to_string(), casadi::DaeBuilderInternal::unique_name(), casadi::SnoptInterface::userfun(), casadi::OptiNode::variable(), casadi::CodeGenerator::vector_fmax(), casadi::CodeGenerator::vector_fmin(), vector_slice(), casadi::DeserializingStream::version(), casadi::MX::vertcat(), casadi::SparsityInterface< MatType >::vertsplit_n(), casadi::CodeGenerator::vfmax(), casadi::CodeGenerator::vfmin(), casadi::DaeBuilderInternal::when(), casadi::CodeGenerator::wrapper(), and casadi::OptiNode::x_describe().

◆ str() [8/8]

template<typename T >
std::string casadi::str ( const T &  v,
bool  more 
)

Definition at line 254 of file casadi_common.hpp.

254  {
255  return v.get_str(more);
256  }

◆ str_bvec()

CASADI_EXPORT std::string casadi::str_bvec ( bvec_t  v)

Definition at line 415 of file casadi_misc.cpp.

415  {
416  std::stringstream ss;
417  for (casadi_int i=0;i<sizeof(bvec_t)*8;++i) {
418  bool bit = v & (bvec_t(1) << i);
419  ss << (bit ? "1" : "0");
420  }
421  return ss.str();
422  }

◆ strategy_to_string()

std::string casadi::strategy_to_string ( casadi_convexify_strategy_t  s)

Definition at line 30 of file convexify.cpp.

30  {
31  switch (s) {
32  case CVX_REGULARIZE: return "regularize";
33  case CVX_EIGEN_REFLECT: return "eigen-reflect";
34  case CVX_EIGEN_CLIP: return "eigen-clip";
35  }
36  return "unknown";
37  }

Referenced by casadi::Convexify::eval_mx().

◆ strvec() [1/7]

std::vector<std::string> casadi::strvec ( )
inline

Definition at line 191 of file casadi_common.hpp.

191  {
192  return {};
193  }

◆ strvec() [2/7]

template<typename T1 >
std::vector<std::string> casadi::strvec ( const T1 &  t1)
inline

Definition at line 197 of file casadi_common.hpp.

197  {
198  return {str(t1)};
199  }

References str().

◆ strvec() [3/7]

template<typename T1 , typename T2 >
std::vector<std::string> casadi::strvec ( const T1 &  t1,
const T2 &  t2 
)
inline

Definition at line 203 of file casadi_common.hpp.

203  {
204  return {str(t1), str(t2)};
205  }

References str().

◆ strvec() [4/7]

template<typename T1 , typename T2 , typename T3 >
std::vector<std::string> casadi::strvec ( const T1 &  t1,
const T2 &  t2,
const T3 &  t3 
)
inline

Definition at line 209 of file casadi_common.hpp.

209  {
210  return {str(t1), str(t2), str(t3)};
211  }

References str().

◆ strvec() [5/7]

template<typename T1 , typename T2 , typename T3 , typename T4 >
std::vector<std::string> casadi::strvec ( const T1 &  t1,
const T2 &  t2,
const T3 &  t3,
const T4 &  t4 
)
inline

Definition at line 215 of file casadi_common.hpp.

216  {
217  return {str(t1), str(t2), str(t3), str(t4)};
218  }

References str().

◆ strvec() [6/7]

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
std::vector<std::string> casadi::strvec ( const T1 &  t1,
const T2 &  t2,
const T3 &  t3,
const T4 &  t4,
const T5 &  t5 
)
inline

Definition at line 222 of file casadi_common.hpp.

223  {
224  return {str(t1), str(t2), str(t3), str(t4), str(t5)};
225  }

References str().

◆ strvec() [7/7]

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
std::vector<std::string> casadi::strvec ( const T1 &  t1,
const T2 &  t2,
const T3 &  t3,
const T4 &  t4,
const T5 &  t5,
const T6 &  t6 
)
inline

Definition at line 229 of file casadi_common.hpp.

230  {
231  return {str(t1), str(t2), str(t3), str(t4), str(t5), str(t6)};
232  }

References str().

◆ sum()

template<typename T >
T casadi::sum ( const std::vector< T > &  values)

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

Definition at line 916 of file casadi_misc.hpp.

916  {
917  T r = 0;
918  for (casadi_int i=0;i<values.size();++i) r+=values[i];
919  return r;
920  }

References T.

Referenced by casadi::FatropInterface::init(), and casadi::GenericMatrix< MatType >::repsum().

◆ temporary_file()

CASADI_EXPORT std::string casadi::temporary_file ( const std::string &  prefix,
const std::string &  suffix 
)

Definition at line 353 of file casadi_misc.cpp.

353  {
354  #ifdef HAVE_MKSTEMPS
355  // Preferred solution
356  std::string ret = prefix + "XXXXXX" + suffix;
357  if (mkstemps(&ret[0], static_cast<int>(suffix.size())) == -1) {
358  casadi_error("Failed to create temporary file: '" + ret + "'");
359  }
360  return ret;
361  #else // HAVE_MKSTEMPS
362  #ifdef HAVE_SIMPLE_MKSTEMPS
363  return simple_mkstemps(prefix, suffix);
364  #else // HAVE_SIMPLE_MKSTEMPS
365  // Fallback, may result in deprecation warnings
366  return prefix + std::string(tmpnam(nullptr)) + suffix;
367  #endif // HAVE_SIMPLE_MKSTEMPS
368  #endif // HAVE_MKSTEMPS
369  }

Referenced by casadi::FunctionInternal::finalize(), casadi::Scpgen::init(), casadi::ShellCompiler::init(), casadi::AmplInterface::solve(), casadi::ZipResource::unpack(), and casadi::ZipMemResource::unpack().

◆ tensor_permute_mapping()

CASADI_EXPORT std::vector< casadi_int > casadi::tensor_permute_mapping ( const std::vector< casadi_int > &  dims,
const std::vector< casadi_int > &  order 
)

Definition at line 188 of file casadi_misc.cpp.

189  {
190 
191  // Get problem dimensions
192  casadi_int N = casadi::product(dims);
193  casadi_int n = dims.size();
194  // Quick return if no elements
195  if (N==0) return std::vector<casadi_int>();
196 
197  // One dimension => null-permutation
198  if (n==1) return range(N);
199 
200  // Allocate space for resulting mapping
201  std::vector<casadi_int> mapping(N);
202  // Quick return if scalar
203  if (n==0) return mapping;
204 
205 
206  // Compute cumulative product
207  std::vector<casadi_int> cumprod(n+1, 1);
208  for (casadi_int k=1;k<dims.size();++k) cumprod[k]=cumprod[k-1]*dims[k-1];
209 
210  // Elementary stride
211  casadi_int stride = cumprod[order[0]];
212 
213  // Split problem in inner and outer part
214  casadi_int N_inner = dims[order[0]];
215  casadi_int N_outer = N/N_inner;
216 
217  // Reorder dims, cumprod
218  std::vector<casadi_int> new_dims(n-1), new_cumprod(n-1, 1);
219  for (casadi_int k=0;k<n-1;++k) {
220  new_dims[k] = dims[order[k+1]];
221  new_cumprod[k] = cumprod[order[k+1]];
222  }
223 
224  // Bank of counters
225  std::vector<casadi_int> index_counters(n-1);
226 
227  // Inex into mapping
228  casadi_int m_ind = 0;
229 
230  for (casadi_int i=0;i<N_outer;++i) {
231  // Compute index
232  casadi_int ind = 0;
233  for (casadi_int k=0;k<n-1;++k) ind+=index_counters[k]*new_cumprod[k];
234 
235  // Fill in mapping
236  for (casadi_int j=0;j<N_inner;++j) {
237  mapping.at(m_ind++) = ind;
238  ind+=stride;
239  }
240 
241  // Bump first counter
242  index_counters[0]++;
243 
244  // Overflow counters when needed
245  for (casadi_int k=0;k<n-2;++k) {
246  if (index_counters[k]==new_dims[k]) {
247  index_counters[k] = 0;
248  index_counters[k+1]++;
249  }
250  }
251  }
252  return mapping;
253  }

References product(), and range().

Referenced by casadi::BSplineCommon::derivative_coeff().

◆ text2set()

template<typename T >
std::set<T> casadi::text2set ( const std::string &  text)

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

Definition at line 62 of file importer.hpp.

62  {
63  std::vector<T> v = text2vector<T>(text);
64  std::set<T> ret;
65  for (auto&& i : v) ret.insert(i);
66  return ret;
67  }

◆ text2type()

template<typename T >
T casadi::text2type ( const std::string &  text)

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

Definition at line 39 of file importer.hpp.

39  {
40  std::istringstream ss(text);
41  T ret;
42  ss >> ret;
43  return ret;
44  }

References T.

◆ text2vector()

template<typename T >
std::vector<T> casadi::text2vector ( const std::string &  text)

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

Definition at line 50 of file importer.hpp.

50  {
51  std::istringstream ss(text);
52  T tmp;
53  std::vector<T> ret;
54  while (ss >> tmp) ret.push_back(tmp);
55  return ret;
56  }

References T.

◆ ThreadsWork()

void casadi::ThreadsWork ( const Function f,
casadi_int  i,
const double **  arg,
double **  res,
casadi_int *  iw,
double *  w,
casadi_int  ind,
int &  ret 
)

Definition at line 427 of file map.cpp.

430  {
431 
432  // Function dimensions
433  casadi_int n_in = f.n_in();
434  casadi_int n_out = f.n_out();
435 
436  // Function work sizes
437  size_t sz_arg, sz_res, sz_iw, sz_w;
438  f.sz_work(sz_arg, sz_res, sz_iw, sz_w);
439 
440  // Input buffers
441  const double** arg1 = arg + n_in + i*sz_arg;
442  for (casadi_int j=0; j<n_in; ++j) {
443  arg1[j] = arg[j] ? arg[j] + i*f.nnz_in(j) : nullptr;
444  }
445 
446  // Output buffers
447  double** res1 = res + n_out + i*sz_res;
448  for (casadi_int j=0; j<n_out; ++j) {
449  res1[j] = res[j] ? res[j] + i*f.nnz_out(j) : nullptr;
450  }
451 
452  try {
453  ret = f(arg1, res1, iw + i*sz_iw, w + i*sz_w, ind);
454  } catch (std::exception& e) {
455  ret = 1;
456  casadi_warning("Exception raised: " + std::string(e.what()));
457  } catch (...) {
458  ret = 1;
459  casadi_warning("Uncaught exception.");
460  }
461  }

References casadi::Function::n_in(), casadi::Function::n_out(), casadi::Function::nnz_in(), casadi::Function::nnz_out(), and casadi::Function::sz_work().

Referenced by casadi::ThreadMap::eval().

◆ to_enum()

template<typename T >
T casadi::to_enum ( const std::string &  s,
const std::string &  s_def = "" 
)

Definition at line 58 of file casadi_enum.hpp.

58  {
59  // Default value, if empty string
60  if (s.empty() && !s_def.empty()) return to_enum<T>(s_def);
61  // Linear search over permitted values
62  for (size_t i = 0; i < enum_traits<T>::n_enum; ++i) {
63  if (s == to_string(static_cast<T>(i))) return static_cast<T>(i);
64  }
65  // Informative error message
66  std::stringstream ss;
67  ss << "No such enum: '" << s << "'. Permitted values: ";
68  for (size_t i = 0; i < enum_traits<T>::n_enum; ++i) {
69  // Separate strings
70  if (i > 0) ss << ", ";
71  // Print enum name
72  ss << "'" << to_string(static_cast<T>(i)) << "'";
73  }
74  casadi_error(ss.str());
75  return static_cast<T>(enum_traits<T>::n_enum); // never reached
76 }

References T, and to_string().

◆ to_fmi2()

CASADI_EXPORT TypeFmi2 casadi::to_fmi2 ( Type  v)

Version mappings

Definition at line 71 of file dae_builder_internal.cpp.

71  {
72  switch (v) {
73  case Type::FLOAT64: return TypeFmi2::REAL;
74  case Type::INT32: return TypeFmi2::INTEGER;
75  case Type::BOOLEAN: return TypeFmi2::BOOLEAN;
76  case Type::STRING: return TypeFmi2::STRING;
77  case Type::ENUMERATION: return TypeFmi2::ENUM;
78  case Type::FLOAT32: // fall-through
79  case Type::INT8: // fall-through
80  case Type::UINT8: // fall-through
81  case Type::INT16: // fall-through
82  case Type::UINT16: // fall-through
83  case Type::UINT32: // fall-through
84  case Type::INT64: // fall-through
85  case Type::UINT64: // fall-through
86  case Type::BINARY: // fall-through
87  case Type::CLOCK: // fall-through
88  casadi_error(to_string(v) + " cannot be converted to FMI 2");
89  default: break;
90  }
91  return TypeFmi2::NUMEL;
92 }

References BINARY, BOOLEAN, CLOCK, ENUM, ENUMERATION, FLOAT32, FLOAT64, INT16, INT32, INT64, INT8, INTEGER, NUMEL, REAL, STRING, to_string(), UINT16, UINT32, UINT64, and UINT8.

Referenced by casadi::Fmu2::init(), casadi::Fmu3::init(), and casadi::DaeBuilder::type().

◆ to_int() [1/3]

CASADI_EXPORT int casadi::to_int ( casadi_int  rhs)

Definition at line 56 of file casadi_misc.cpp.

56  {
57  casadi_assert(rhs<=std::numeric_limits<int>::max(), "Integer overflow detected.");
58  casadi_assert(rhs>=std::numeric_limits<int>::min(), "Integer overflow detected.");
59  return rhs;
60  }

Referenced by casadi::BonminInterface::init(), casadi::CbcInterface::init(), casadi::GurobiInterface::init(), casadi::GenericType::operator casadi_int(), casadi::GenericType::operator int(), casadi::GenericType::operator std::vector< int >(), casadi::ClpInterface::solve(), to_int(), and casadi::GenericType::to_int_type_vector().

◆ to_int() [2/3]

CASADI_EXPORT std::vector< int > casadi::to_int ( const std::vector< casadi_int > &  rhs)

Definition at line 62 of file casadi_misc.cpp.

62  {
63  std::vector<int> ret;
64  ret.reserve(rhs.size());
65  for (casadi_int e : rhs) ret.push_back(to_int(e));
66  return ret;
67  }
int to_int(casadi_int rhs)
Definition: casadi_misc.cpp:56

References to_int().

◆ to_int() [3/3]

CASADI_EXPORT std::vector< std::vector< int > > casadi::to_int ( const std::vector< std::vector< casadi_int > > &  rhs)

Definition at line 69 of file casadi_misc.cpp.

70  {
71  std::vector< std::vector<int> > ret;
72  ret.reserve(rhs.size());
73  for (const std::vector<casadi_int>& e : rhs) ret.push_back(to_int(e));
74  return ret;
75  }

References to_int().

◆ to_slice() [1/2]

Slice CASADI_EXPORT casadi::to_slice ( const IM x,
bool  ind1 = false 
)

◆ to_slice() [2/2]

Slice CASADI_EXPORT casadi::to_slice ( const std::vector< casadi_int > &  v,
bool  ind1 
)

Definition at line 152 of file slice.cpp.

152  {
153  Slice r;
154  casadi_assert(is_slice(v, ind1), "Cannot be represented as a Slice");
155  if (v.empty()) {
156  r.start=r.stop=0;
157  r.step = 1;
158  } else if (v.size()==1) {
159  r.start = v.front()-ind1;
160  r.stop = r.start + 1;
161  r.step = 1;
162  } else {
163  r.start = v[0]-ind1;
164  r.step = v[1]-v[0];
165  r.stop = r.start + r.step*v.size();
166  }
167  return r;
168  }

References is_slice(), casadi::Slice::start, casadi::Slice::step, and casadi::Slice::stop.

◆ to_slice2()

std::pair< Slice, Slice > CASADI_EXPORT casadi::to_slice2 ( const std::vector< casadi_int > &  v)

Definition at line 255 of file slice.cpp.

255  {
256  casadi_assert(is_slice2(v), "Cannot be represented as a nested Slice");
257  Slice inner, outer;
258 
259  // If simple slice
260  if (is_slice(v)) {
261  inner = to_slice(v);
262  outer.start = 0;
263  outer.step = outer.stop = inner.stop;
264  return std::make_pair(inner, outer);
265  }
266 
267  // Get the slices
268  outer.start = 0;
269  outer.step = -1;
270  inner.start = v.front();
271  inner.step = v[1]-v[0];
272  inner.stop = -1;
273  for (casadi_int i=2; i<v.size(); ++i) {
274  casadi_int predicted_v = inner.start+i*inner.step;
275  if (v[i]!=predicted_v) {
276  inner.stop = predicted_v;
277  outer.step = v[i] - inner.start;
278  break;
279  }
280  }
281 
282  // Get the end of the outer slice
283  outer.stop = v.back();
284  do {
285  if (outer.step>0) outer.stop++;
286  else outer.stop--;
287  } while (outer.stop % outer.step!=0);
288  return std::make_pair(inner, outer);
289  }
bool CASADI_EXPORT is_slice2(const std::vector< casadi_int > &v)
Check if an index vector can be represented more efficiently as two nested slices.
Definition: slice.cpp:202

References is_slice(), is_slice2(), casadi::Slice::start, casadi::Slice::step, casadi::Slice::stop, and to_slice().

Referenced by casadi::SetNonzeros< Add >::create(), and casadi::GetNonzeros::create().

◆ to_str() [1/2]

std::string casadi::to_str ( const CoinError &  e)
inline

Definition at line 343 of file bonmin_interface.cpp.

343  {
344  std::stringstream ss;
345  if (e.lineNumber()<0) {
346  ss << e.message()<< " in "<< e.className()<< "::" << e.methodName();
347  } else {
348  ss << e.fileName() << ":" << e.lineNumber() << " method " << e.methodName()
349  << " : assertion \'" << e.message() <<"\' failed.";
350  if (!e.className().empty())
351  ss <<"Possible reason: "<< e.className();
352  }
353  return ss.str();
354  }

Referenced by casadi::BonminInterface::solve().

◆ to_str() [2/2]

std::string casadi::to_str ( TNLPSolver::UnsolvedError &  e)
inline

Definition at line 356 of file bonmin_interface.cpp.

356  {
357  std::stringstream ss;
358  e.printError(ss);
359  return ss.str();
360  }

◆ to_string() [1/16]

CASADI_EXPORT std::string casadi::to_string ( Attribute  v)

Convert to string

Definition at line 164 of file dae_builder_internal.cpp.

164  {
165  switch (v) {
166  case Attribute::MIN: return "min";
167  case Attribute::MAX: return "max";
168  case Attribute::NOMINAL: return "nominal";
169  case Attribute::START: return "start";
170  case Attribute::VALUE: return "value";
171  case Attribute::STRINGVALUE: return "stringvalue";
172  default: break;
173  }
174  return "";
175 }

References MAX, MIN, NOMINAL, START, STRINGVALUE, and VALUE.

◆ to_string() [2/16]

CASADI_EXPORT std::string casadi::to_string ( Category  v)

Convert to string

Definition at line 189 of file dae_builder_internal.cpp.

189  {
190  switch (v) {
191  case Category::T: return "t";
192  case Category::P: return "p";
193  case Category::U: return "u";
194  case Category::X: return "x";
195  case Category::Z: return "z";
196  case Category::Q: return "q";
197  case Category::C: return "c";
198  case Category::D: return "d";
199  case Category::W: return "w";
200  case Category::CALCULATED: return "calculated";
201  default: break;
202  }
203  return "";
204 }

References C, CALCULATED, D, P, Q, T, U, W, X, and Z.

◆ to_string() [3/16]

CASADI_EXPORT std::string casadi::to_string ( Causality  v)

Convert to string

Definition at line 128 of file dae_builder_internal.cpp.

128  {
129  switch (v) {
130  case Causality::PARAMETER: return "parameter";
131  case Causality::CALCULATED_PARAMETER: return "calculatedParameter";
132  case Causality::INPUT: return "input";
133  case Causality::OUTPUT: return "output";
134  case Causality::LOCAL: return "local";
135  case Causality::INDEPENDENT: return "independent";
136  default: break;
137  }
138  return "";
139 }

References CALCULATED_PARAMETER, INDEPENDENT, INPUT, LOCAL, OUTPUT, and PARAMETER.

◆ to_string() [4/16]

CASADI_EXPORT std::string casadi::to_string ( DependenciesKind  v)

Convert to string

Definition at line 177 of file dae_builder_internal.cpp.

177  {
178  switch (v) {
179  case DependenciesKind::DEPENDENT: return "dependent";
180  case DependenciesKind::CONSTANT: return "constant";
181  case DependenciesKind::FIXED: return "fixed";
182  case DependenciesKind::TUNABLE: return "tunable";
183  case DependenciesKind::DISCRETE: return "discrete";
184  default: break;
185  }
186  return "";
187 }

References CONSTANT, DEPENDENT, DISCRETE, FIXED, and TUNABLE.

◆ to_string() [5/16]

CASADI_EXPORT std::string casadi::to_string ( DynIn  v)

Convert to string

Definition at line 31 of file integrator.cpp.

31  {
32  switch (v) {
33  case DYN_T: return "t";
34  case DYN_X: return "x";
35  case DYN_Z: return "z";
36  case DYN_P: return "p";
37  case DYN_U: return "u";
38  default: break;
39  }
40  return "";
41 }

References DYN_P, DYN_T, DYN_U, DYN_X, and DYN_Z.

◆ to_string() [6/16]

CASADI_EXPORT std::string casadi::to_string ( DynOut  v)

Convert to string

Definition at line 43 of file integrator.cpp.

43  {
44  switch (v) {
45  case DYN_ODE: return "ode";
46  case DYN_ALG: return "alg";
47  case DYN_QUAD: return "quad";
48  case DYN_ZERO: return "zero";
49  default: break;
50  }
51  return "";
52 }

References DYN_ALG, DYN_ODE, DYN_QUAD, and DYN_ZERO.

◆ to_string() [7/16]

CASADI_EXPORT std::string casadi::to_string ( EventIn  v)

Convert to string

Definition at line 54 of file integrator.cpp.

54  {
55  switch (v) {
56  case EVENT_INDEX: return "index";
57  case EVENT_T: return "t";
58  case EVENT_X: return "x";
59  case EVENT_Z: return "z";
60  case EVENT_P: return "p";
61  case EVENT_U: return "u";
62  default: break;
63  }
64  return "";
65 }

References EVENT_INDEX, EVENT_P, EVENT_T, EVENT_U, EVENT_X, and EVENT_Z.

◆ to_string() [8/16]

CASADI_EXPORT std::string casadi::to_string ( EventOut  v)

Convert to string

Definition at line 67 of file integrator.cpp.

67  {
68  switch (v) {
69  case EVENT_POST_X: return "post_x";
70  case EVENT_POST_Z: return "post_z";
71  default: break;
72  }
73  return "";
74 }

References EVENT_POST_X, and EVENT_POST_Z.

◆ to_string() [9/16]

CASADI_EXPORT std::string casadi::to_string ( FdMode  v)

Definition at line 30 of file finite_differences.cpp.

30  {
31  switch (v) {
32  case FdMode::FORWARD: return "forward";
33  case FdMode::BACKWARD: return "backward";
34  case FdMode::CENTRAL: return "central";
35  case FdMode::SMOOTHING: return "smoothing";
36  default: break;
37  }
38  return "";
39 }

References BACKWARD, CENTRAL, FORWARD, and SMOOTHING.

◆ to_string() [10/16]

CASADI_EXPORT std::string casadi::to_string ( FmuApi  v)

Definition at line 614 of file fmu.cpp.

614  {
615  switch (v) {
616  case FmuApi::FMI2: return "fmi2";
617  case FmuApi::FMI3: return "fmi3";
618  default: break;
619  }
620  return "";
621 }

References FMI2, and FMI3.

◆ to_string() [11/16]

CASADI_EXPORT std::string casadi::to_string ( Initial  v)

Convert to string

Definition at line 153 of file dae_builder_internal.cpp.

153  {
154  switch (v) {
155  case Initial::EXACT: return "exact";
156  case Initial::APPROX: return "approx";
157  case Initial::CALCULATED: return "calculated";
158  case Initial::NA: return "na";
159  default: break;
160  }
161  return "";
162 }

References APPROX, CALCULATED, EXACT, and NA.

◆ to_string() [12/16]

CASADI_EXPORT std::string casadi::to_string ( OutputCategory  v)

Convert to string

Definition at line 1792 of file dae_builder_internal.cpp.

1792  {
1793  switch (v) {
1794  case OutputCategory::ODE: return "ode";
1795  case OutputCategory::ALG: return "alg";
1796  case OutputCategory::QUAD: return "quad";
1797  case OutputCategory::ZERO: return "zero";
1798  case OutputCategory::DDEF: return "ddef";
1799  case OutputCategory::WDEF: return "wdef";
1800  case OutputCategory::Y: return "y";
1801  default: break;
1802  }
1803  return "";
1804 }

References ALG, DDEF, ODE, QUAD, WDEF, Y, and ZERO.

◆ to_string() [13/16]

CASADI_EXPORT std::string casadi::to_string ( Parallelization  v)

Definition at line 1353 of file fmu_function.cpp.

1353  {
1354  switch (v) {
1355  case Parallelization::SERIAL: return "serial";
1356  case Parallelization::OPENMP: return "openmp";
1357  case Parallelization::THREAD: return "thread";
1358  default: break;
1359  }
1360  return "";
1361 }

References OPENMP, SERIAL, and THREAD.

◆ to_string() [14/16]

CASADI_EXPORT std::string casadi::to_string ( Type  v)

Convert to string

Definition at line 106 of file dae_builder_internal.cpp.

106  {
107  switch (v) {
108  case Type::FLOAT32: return "Float32";
109  case Type::FLOAT64: return "Float64";
110  case Type::INT8: return "Int8";
111  case Type::UINT8: return "UInt8";
112  case Type::INT16: return "Int16";
113  case Type::UINT16: return "UInt16";
114  case Type::INT32: return "Int32";
115  case Type::UINT32: return "UInt32";
116  case Type::INT64: return "Int64";
117  case Type::UINT64: return "UInt64";
118  case Type::BOOLEAN: return "Boolean";
119  case Type::STRING: return "String";
120  case Type::BINARY: return "Binary";
121  case Type::ENUMERATION: return "Enumeration";
122  case Type::CLOCK: return "Clock";
123  default: break;
124  }
125  return "";
126 }

References BINARY, BOOLEAN, CLOCK, ENUMERATION, FLOAT32, FLOAT64, INT16, INT32, INT64, INT8, STRING, UINT16, UINT32, UINT64, and UINT8.

◆ to_string() [15/16]

CASADI_EXPORT std::string casadi::to_string ( TypeFmi2  v)

Convert to string

Definition at line 94 of file dae_builder_internal.cpp.

94  {
95  switch (v) {
96  case TypeFmi2::REAL: return "real";
97  case TypeFmi2::INTEGER: return "integer";
98  case TypeFmi2::BOOLEAN: return "boolean";
99  case TypeFmi2::STRING: return "string";
100  case TypeFmi2::ENUM: return "enum";
101  default: break;
102  }
103  return "";
104 }

References BOOLEAN, ENUM, INTEGER, REAL, and STRING.

Referenced by casadi::DaeBuilderInternal::add(), casadi::DaeBuilder::category(), casadi::DaeBuilder::causality(), dependent_definition(), casadi::DaeBuilderInternal::disp(), dyn_in(), dyn_out(), casadi::DaeBuilderInternal::eliminate(), enum_names(), casadi::FmuFunction::eval_all(), casadi::FmuInternal::eval_fd(), casadi::Variable::export_xml(), casadi::FmuFunction::factory(), finite_diff(), casadi::Fmu::Fmu(), casadi::DaeBuilderInternal::gather_eq(), casadi::Variable::get_attribute(), casadi::FmuFunction::get_forward(), casadi::FmuFunction::get_jacobian(), casadi::FmuFunction::get_reverse(), has_enum(), casadi::DaeBuilderInternal::import_model_variables(), casadi::Fmu2::init(), casadi::Fmu3::init(), casadi::FmuFunction::init(), casadi::DaeBuilder::initial(), casadi::DaeBuilderInternal::input(), input_category(), is_input_category(), casadi::GenericType::operator std::string(), casadi::DaeBuilderInternal::oracle(), casadi::DaeBuilderInternal::prune(), casadi::DaeBuilderInternal::read_identifier(), casadi::DaeBuilderInternal::reorder(), casadi::DaeBuilderInternal::set_attribute(), casadi::Variable::set_attribute(), casadi::DaeBuilderInternal::set_category(), casadi::DaeBuilderInternal::set_causality(), casadi::DaeBuilderInternal::set_variability(), casadi::DaeBuilderInternal::sort(), to_enum(), to_fmi2(), casadi::DaeBuilder::type(), and casadi::DaeBuilder::variability().

◆ to_string() [16/16]

CASADI_EXPORT std::string casadi::to_string ( Variability  v)

Convert to string

Definition at line 141 of file dae_builder_internal.cpp.

141  {
142  switch (v) {
143  case Variability::CONSTANT: return "constant";
144  case Variability::FIXED: return "fixed";
145  case Variability::TUNABLE: return "tunable";
146  case Variability::DISCRETE: return "discrete";
147  case Variability::CONTINUOUS: return "continuous";
148  default: break;
149  }
150  return "";
151 }

References CONSTANT, CONTINUOUS, DISCRETE, FIXED, and TUNABLE.

◆ trim_empty()

std::vector<MX> casadi::trim_empty ( const std::vector< MX > &  x,
bool  both = false 
)

Definition at line 1045 of file mx.cpp.

1045  {
1046  std::vector<MX> ret;
1047  for (auto&& i : x) {
1048  if (!i.is_empty(both)) ret.push_back(i);
1049  }
1050  return ret;
1051  }

Referenced by casadi::MX::diagcat(), casadi::MX::horzcat(), and casadi::MX::vertcat().

◆ trim_path()

std::string casadi::trim_path ( const std::string &  full_path)
inline

Definition at line 107 of file exception.hpp.

107  {
108  size_t found = full_path.rfind("/casadi/");
109  if (found == std::string::npos) {
110  return full_path;
111  } else {
112  std::string ret = full_path;
113  ret.replace(0, found, "...");
114  return ret;
115  }
116 }

◆ twice()

template<typename T >
T casadi::twice ( const T &  x)

Definition at line 326 of file calculus.hpp.

326  {
327  return x+x;
328  }

References T.

Referenced by casadi::UnaryOperation< OP_SQRT >::der(), and casadi::UnaryOperation< OP_SQ >::der().

◆ uerr()

CASADI_EXPORT std::ostream & casadi::uerr ( )

Definition at line 67 of file casadi_logger.cpp.

67  {
68  // Singleton pattern, lazily instantiated
69  static Logger::Stream<true> instance;
70  return instance;
71  }

Referenced by add_file_to_zip(), casadi::KinsolInterface::bjac_wrapper(), calc_function(), casadi::KnitroInterface::callback(), callback_stderr(), casadi_func_cons_jac(), casadi_func_cons_val(), casadi_func_hess_prod(), casadi_func_obj_grad(), casadi_func_obj_val(), casadi::KinsolInterface::djac_wrapper(), casadi::IdasInterface::ehfun(), casadi::KinsolInterface::ehfun(), casadi::CvodesInterface::ehfun(), extract_zip_internal(), casadi::BonminInterface::finalize_solution(), casadi::IpoptInterface::finalize_solution(), casadi::KinsolInterface::func_wrapper(), casadi::BonminInterface::get_bounds_info(), casadi::IpoptInterface::get_bounds_info(), casadi::BonminInterface::get_list_of_nonlinear_variables(), casadi::IpoptInterface::get_list_of_nonlinear_variables(), casadi::BonminInterface::get_nlp_info(), casadi::IpoptInterface::get_nlp_info(), casadi::BonminInterface::get_number_of_nonlinear_variables(), casadi::IpoptInterface::get_number_of_nonlinear_variables(), casadi::BonminInterface::get_starting_point(), casadi::IpoptInterface::get_starting_point(), casadi::ClangCompiler::init(), casadi::BonminInterface::intermediate_callback(), casadi::IpoptInterface::intermediate_callback(), casadi::KinsolInterface::jtimes_wrapper(), casadi::IdasInterface::jtimesB(), casadi::CvodesInterface::jtimesB(), casadi::IdasInterface::jtimesF(), casadi::CvodesInterface::jtimesF(), casadi::PluginInterface< Derived >::load_plugin(), casadi::KinsolInterface::lsetup(), casadi::CvodesInterface::lsetupB(), casadi::IdasInterface::lsetupB(), casadi::CvodesInterface::lsetupF(), casadi::KinsolInterface::lsolve(), casadi::CvodesInterface::lsolveB(), casadi::IdasInterface::lsolveB(), casadi::CvodesInterface::lsolveF(), casadi::IdasInterface::lsolveF(), casadi::Function::operator()(), casadi::KinsolInterface::psetup_wrapper(), casadi::CvodesInterface::psetupB(), casadi::IdasInterface::psetupB(), casadi::CvodesInterface::psetupF(), casadi::IdasInterface::psetupF(), casadi::KinsolInterface::psolve_wrapper(), casadi::CvodesInterface::psolveB(), casadi::IdasInterface::psolveB(), casadi::CvodesInterface::psolveF(), casadi::IdasInterface::psolveF(), casadi::IdasInterface::resB(), casadi::IdasInterface::resF(), casadi::CvodesInterface::rhsB(), casadi::CvodesInterface::rhsF(), casadi::CvodesInterface::rhsQB(), casadi::IdasInterface::rhsQB(), casadi::CvodesInterface::rhsQF(), casadi::IdasInterface::rhsQF(), casadi::SnoptInterface::userfun(), worhp_disp(), zip_to_path(), zip_to_path2(), zip_to_stream(), and casadi::CplexMemory::~CplexMemory().

◆ unpack_block()

void casadi::unpack_block ( const std::vector< casadi_int > &  p,
std::vector< casadi_ocp_block > &  blocks 
)

Definition at line 783 of file fatrop_interface.cpp.

783  {
784  const casadi_int* packed = get_ptr(p);
785  casadi_int N = *packed++;
786  blocks.resize(N);
787  for (casadi_int i=0;i<N;++i) {
788  blocks[i].offset_r = *packed++;
789  blocks[i].offset_c = *packed++;
790  blocks[i].rows = *packed++;
791  blocks[i].cols = *packed++;
792  }
793  }

References get_ptr().

Referenced by casadi::FatropInterface::FatropInterface().

◆ uout()

CASADI_EXPORT std::ostream & casadi::uout ( )

Definition at line 61 of file casadi_logger.cpp.

61  {
62  // Singleton pattern, lazily instantiated
63  static Logger::Stream<false> instance;
64  return instance;
65  }

Referenced by casadi::OptiCallback::call(), callback_stdout(), casadi_KN_puts(), casadi_log_output(), casadi::Monitor::eval(), casadi::Conic::eval(), casadi::MXFunction::eval(), casadi::FunctionInternal::eval_gen(), casadi::Feasiblesqpmethod::feasibility_iterations(), casadi::KinsolInterface::func(), casadi::SqicInterface::generateNativeCode(), casadi::KinsolInterface::ihfun(), casadi::DaeBuilderInternal::import_binding_equations(), casadi::DaeBuilderInternal::import_dynamic_equations(), casadi::DaeBuilderInternal::import_initial_equations(), casadi::DaeBuilderInternal::import_model_variables(), casadi::FatropConicInterface::init(), casadi::Feasiblesqpmethod::init(), casadi::Scpgen::init(), casadi::IpoptInterface::init_mem(), casadi::PluginInterface< Derived >::load_plugin(), casadi::Fmu3::log_message_callback(), casadi::Fmu2::logger(), casadi::CsparseInterface::nfact(), casadi::LapackLu::nfact(), casadi::ProtoFunction::print(), print_vec(), printme(), casadi::SundialsInterface::printvar(), casadi::QpoasesInterface::qpoases_printf(), casadi::OptiNode::show_infeasibilities(), casadi::FatropConicInterface::solve(), casadi::GurobiInterface::solve(), casadi::HpipmInterface::solve(), casadi::HpmpcInterface::solve(), casadi::Ipqp::solve(), casadi::Qrqp::solve(), casadi::AlpaqaInterface::solve(), casadi::AmplInterface::solve(), casadi::BonminInterface::solve(), casadi::Feasiblesqpmethod::solve(), casadi::Newton::solve(), casadi::Scpgen::solve(), casadi::Feasiblesqpmethod::step_update(), and worhp_disp().

◆ update_dict() [1/2]

CASADI_EXPORT void casadi::update_dict ( Dict target,
const Dict source,
bool  recurse = false 
)

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

Definition at line 804 of file generic_type.cpp.

804  {
805  for (auto&& e : source) {
806  if (recurse) {
807  auto it = target.find(e.first);
808  if (it!=target.end() && it->second.is_dict()) {
809  Dict local = it->second;
810  casadi_assert(e.second.is_dict(),
811  "update_dict error: Key '" + it->first + "' exists in target, "
812  "but source value is not a dict");
813  update_dict(local, e.second, recurse);
814  it->second = local;
815  continue;
816  }
817  }
818  target[e.first] = e.second;
819  }
820  }

Referenced by combine(), casadi::FixedStepIntegrator::create_advanced(), casadi::Function::expand(), casadi::XFunction< DerivedType, MatType, NodeType >::factory(), casadi::Options::sanitize(), and update_dict().

◆ update_dict() [2/2]

CASADI_EXPORT void casadi::update_dict ( Dict target,
const std::string &  key,
const GenericType value,
bool  recurse 
)

Definition at line 823 of file generic_type.cpp.

824  {
825  auto it = target.find(key);
826  if (it==target.end()) {
827  target[key] = value;
828  } else {
829  // value.is_dict()
830  casadi_assert(it->second.is_dict() && value.is_dict(),
831  "update_dict error: Key '" + key + "' exists in target, but values are not dicts");
832  Dict orig = it->second;
833  update_dict(orig, value, recurse);
834  target[key] = orig;
835  }
836  }

References casadi::GenericType::is_dict(), and update_dict().

◆ vector_init()

template<typename T >
std::vector< T > casadi::vector_init ( const std::vector< T > &  v)

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

Definition at line 582 of file casadi_misc.hpp.

582  {
583  std::vector<T> ret;
584  ret.insert(ret.begin(), v.begin(), v.begin()+v.size()-1);
585  return ret;
586  }

Referenced by casadi::BlazingSplineFunction::merge().

◆ vector_select()

template<typename T >
std::vector< T > casadi::vector_select ( const std::vector< T > &  v,
const std::vector< bool > &  s,
bool  invert = false 
)
Parameters
vVector to slice
sSelect?

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

Definition at line 559 of file casadi_misc.hpp.

559  {
560  std::vector<T> ret;
561  casadi_assert(v.size()==s.size(), "Dimension mismatch.");
562  if (invert) {
563  for (casadi_int k=0;k<s.size();++k) {
564  if (!s[k]) ret.push_back(v[k]);
565  }
566  } else {
567  for (casadi_int k=0;k<s.size();++k) {
568  if (s[k]) ret.push_back(v[k]);
569  }
570  }
571  return ret;
572  }

Referenced by construct_nlpsol().

◆ vector_slice()

template<typename T >
std::vector< T > casadi::vector_slice ( const std::vector< T > &  v,
const std::vector< casadi_int > &  i 
)
Parameters
vVector to slice
iList of indices

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

Definition at line 542 of file casadi_misc.hpp.

542  {
543  std::vector<T> ret;
544  ret.reserve(i.size());
545  for (casadi_int k=0;k<i.size();++k) {
546  casadi_int j = i[k];
547  casadi_assert(j>=0,
548  "vector_slice: Indices should be larger than zero."
549  "You have " + str(j) + " at location " + str(k) + ".");
550  casadi_assert(j<v.size(),
551  "vector_slice: Indices should be larger than zero."
552  "You have " + str(j) + " at location " + str(k) + ".");
553  ret.push_back(v[j]);
554  }
555  return ret;
556  }

References str().

Referenced by permute(), and reduce_index_gen().

◆ vector_static_cast()

template<typename T , typename S >
std::vector< T > casadi::vector_static_cast ( const std::vector< S > &  rhs)

Definition at line 534 of file casadi_misc.hpp.

534  {
535  std::vector<T> ret;
536  ret.reserve(rhs.size());
537  for (auto e : rhs) ret.push_back(static_cast<T>(e));
538  return ret;
539  }

References T.

◆ vector_tail()

template<typename T >
std::vector< T > casadi::vector_tail ( const std::vector< T > &  v)

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

Definition at line 575 of file casadi_misc.hpp.

575  {
576  std::vector<T> ret;
577  ret.insert(ret.begin(), v.begin()+1, v.end());
578  return ret;
579  }

Referenced by casadi::External::serialize_body().

◆ worhp_disp()

void casadi::worhp_disp ( int  mode,
const char  message[] 
)

Definition at line 138 of file worhp_interface.cpp.

138  {
139  if (mode & WORHP_PRINT_MESSAGE) {
140  uout() << message << std::endl;
141  }
142  if (mode & WORHP_PRINT_WARNING) {
143  uerr() << message << std::endl;
144  }
145  if (mode & WORHP_PRINT_ERROR) {
146  uerr() << message << std::endl;
147  }
148  }

References uerr(), and uout().

Referenced by casadi::WorhpInterface::init_mem().

◆ write_matlab() [1/2]

template<typename T >
void casadi::write_matlab ( std::ostream &  stream,
const std::vector< std::vector< T > > &  v 
)

Definition at line 789 of file casadi_misc.hpp.

789  {
790  for (casadi_uint i=0; i<v.size(); ++i) {
791  std::copy(v[i].begin(), v[i].end(), std::ostream_iterator<T>(stream, " "));
792  stream << std::endl;
793  }
794  }

◆ write_matlab() [2/2]

template<typename T >
void casadi::write_matlab ( std::ostream &  stream,
const std::vector< T > &  v 
)

Definition at line 784 of file casadi_misc.hpp.

784  {
785  std::copy(v.begin(), v.end(), std::ostream_iterator<T>(stream, " "));
786  }

◆ zip()

template<typename T >
std::vector<std::pair<std::string, T> > casadi::zip ( const std::vector< std::string > &  id,
const std::vector< T > &  mat 
)

Definition at line 55 of file function_internal.hpp.

56  {
57  casadi_assert_dev(id.size()==mat.size());
58  std::vector<std::pair<std::string, T>> r(id.size());
59  for (casadi_uint i=0; i<r.size(); ++i) r[i] = std::make_pair(id[i], mat[i]);
60  return r;
61  }

◆ zip_to_path()

bool casadi::zip_to_path ( const std::string &  dir_path,
const std::string &  zip_path 
)

Definition at line 297 of file libzip.cpp.

297  {
298  std::ofstream ofs(zip_path, std::ios::binary);
299  if (!ofs) {
300  uerr() << "Failed to open output file: " << zip_path << std::endl;
301  return false;
302  }
303 
304  return zip_to_stream(dir_path, ofs);
305  }

References uerr(), and zip_to_stream().

Referenced by casadi_register_archiver_libzip().

◆ zip_to_path2()

bool casadi::zip_to_path2 ( const std::string &  dir_path,
const std::string &  zip_path 
)

Definition at line 307 of file libzip.cpp.

307  {
308  int errorp;
309  zip_t* archive = zip_open(zip_path.c_str(), ZIP_CREATE | ZIP_TRUNCATE, &errorp);
310  if (!archive) {
311  zip_error_t ziperror;
312  zip_error_init_with_code(&ziperror, errorp);
313  uerr() << "Error: Cannot open zip archive " << zip_path << ": "
314  << zip_error_strerror(&ziperror) << std::endl;
315  zip_error_fini(&ziperror);
316  return false;
317  }
318 
319  try {
320  add_directory_recursive(archive, dir_path, dir_path, "");
321  } catch (const std::exception& e) {
322  uerr() << "Exception while zipping directory: " << e.what() << std::endl;
323  zip_discard(archive);
324  return false;
325  }
326 
327  if (zip_close(archive) < 0) {
328  uerr() << "Error: Cannot finalize zip archive: " << zip_strerror(archive) << std::endl;
329  zip_discard(archive);
330  return false;
331  }
332 
333  return true;
334  }

References add_directory_recursive(), and uerr().

◆ zip_to_stream()

bool casadi::zip_to_stream ( const std::string &  dir,
std::ostream &  output 
)

Definition at line 186 of file libzip.cpp.

186  {
187  zip_error_t error;
188  zip_error_init(&error);
189 
190  zip_source_t* src = zip_source_buffer_create(nullptr, 0, 0, &error);
191  if (!src) {
192  uerr() << "Failed to create zip source buffer: "
193  << zip_error_strerror(&error) << std::endl;
194  zip_error_fini(&error);
195  return false;
196  }
197 
198  // Prevent zip_close from destroying the source
199  zip_source_keep(src);
200 
201  zip_t* archive = zip_open_from_source(src, ZIP_TRUNCATE, &error);
202  if (!archive) {
203  uerr() << "Failed to open zip archive from source: "
204  << zip_error_strerror(&error) << std::endl;
205  zip_source_free(src);
206  zip_error_fini(&error);
207  return false;
208  }
209 
210  try {
211  add_directory_recursive(archive, dir, dir, "");
212  } catch (const std::exception& e) {
213  uerr() << "Exception while zipping directory: " << e.what() << std::endl;
214  zip_discard(archive); // also frees src
215  zip_error_fini(&error);
216  return false;
217  }
218 
219  if (zip_close(archive) != 0) {
220  uerr() << "Failed to finalize zip archive: "
221  << zip_error_strerror(&error) << std::endl;
222  zip_source_free(src);
223  zip_error_fini(&error);
224  return false;
225  }
226 
227  // At this point, src contains the archive in memory.
228  if (zip_source_open(src) < 0) {
229  uerr() << "Failed to open zip source for reading." << std::endl;
230  zip_source_free(src);
231  zip_error_fini(&error);
232  return false;
233  }
234 
235  // Seek to end to get size
236  if (zip_source_seek(src, 0, SEEK_END) < 0) {
237  uerr() << "Failed to seek to end of zip source." << std::endl;
238  zip_source_close(src);
239  zip_source_free(src);
240  zip_error_fini(&error);
241  return false;
242  }
243 
244  zip_int64_t size = zip_source_tell(src);
245  if (size < 0) {
246  uerr() << "Failed to get size of zip source." << std::endl;
247  zip_source_close(src);
248  zip_source_free(src);
249  zip_error_fini(&error);
250  return false;
251  }
252 
253  if (zip_source_seek(src, 0, SEEK_SET) < 0) {
254  uerr() << "Failed to rewind zip source." << std::endl;
255  zip_source_close(src);
256  zip_source_free(src);
257  zip_error_fini(&error);
258  return false;
259  }
260 
261  if (zip_source_seek(src, 0, SEEK_SET) < 0) {
262  uerr() << "Failed to rewind zip source." << std::endl;
263  zip_source_close(src);
264  zip_source_free(src);
265  zip_error_fini(&error);
266  return false;
267  }
268 
269  // Efficient streaming read/write
270  char buf[8192];
271  zip_int64_t bytes_read;
272 
273  while ((bytes_read = zip_source_read(src, buf, sizeof(buf))) > 0) {
274  output.write(buf, bytes_read);
275  if (!output) {
276  uerr() << "Write error while streaming zip data to output." << std::endl;
277  zip_source_close(src);
278  zip_source_free(src);
279  zip_error_fini(&error);
280  return false;
281  }
282  }
283 
284  zip_source_close(src);
285  zip_source_free(src);
286  zip_error_fini(&error);
287 
288  if (bytes_read < 0) {
289  uerr() << "Error reading from zip source." << std::endl;
290  return false;
291  }
292 
293  return true;
294  }

References add_directory_recursive(), and uerr().

Referenced by casadi_register_archiver_libzip(), and zip_to_path().

Variable Documentation

◆ bvec_size

const int casadi::bvec_size = CHAR_BIT*sizeof(bvec_t)

◆ casadi_limits< double >

template class CASADI_EXPORT casadi::casadi_limits< double >

Definition at line 388 of file dm_instantiator.cpp.

◆ eps

const double casadi::eps = std::numeric_limits<double>::epsilon()

◆ GenericShared< SharedObject, SharedObjectInternal >

template class CASADI_EXPORT casadi::GenericShared< SharedObject, SharedObjectInternal >

Definition at line 59 of file shared_object.cpp.

◆ GenericShared< SharedSXElem, OutputSX >

template class CASADI_EXPORT casadi::GenericShared< SharedSXElem, OutputSX >

Definition at line 34 of file output_sx.cpp.

◆ GenericWeakRef< SharedObject, SharedObjectInternal >

template class CASADI_EXPORT casadi::GenericWeakRef< SharedObject, SharedObjectInternal >

Definition at line 60 of file shared_object.cpp.

◆ GenericWeakRef< SharedSXElem, OutputSX >

template class CASADI_EXPORT casadi::GenericWeakRef< SharedSXElem, OutputSX >

Definition at line 35 of file output_sx.cpp.

◆ inf

const double casadi::inf = std::numeric_limits<double>::infinity()

◆ legendre_points

const long double* casadi::legendre_points[]
Initial value:
=
const long double legendre_points8[]
const long double legendre_points2[]
const long double legendre_points4[]
const long double legendre_points6[]
const long double legendre_points9[]
const long double legendre_points5[]
const long double legendre_points1[]
const long double legendre_points3[]
const long double legendre_points7[]

Definition at line 63 of file integration_tools.cpp.

Referenced by collocation_pointsGen().

◆ legendre_points1

const long double casadi::legendre_points1[] = { 0.50000000000000000000 }

Definition at line 34 of file integration_tools.cpp.

◆ legendre_points2

const long double casadi::legendre_points2[]
Initial value:
=
{ 0.21132486540518713447, 0.78867513459481286553 }

Definition at line 35 of file integration_tools.cpp.

◆ legendre_points3

const long double casadi::legendre_points3[]
Initial value:
=
{ 0.11270166537925824235, 0.50000000000000000000,
0.88729833462074170214 }

Definition at line 37 of file integration_tools.cpp.

◆ legendre_points4

const long double casadi::legendre_points4[]
Initial value:
=
{ 0.06943184420297354720, 0.33000947820757187134,
0.66999052179242823968, 0.93056815579702623076 }

Definition at line 40 of file integration_tools.cpp.

◆ legendre_points5

const long double casadi::legendre_points5[]
Initial value:
=
{ 0.04691007703066807366, 0.23076534494715861268,
0.49999999999999994449, 0.76923465505284149835, 0.95308992296933192634 }

Definition at line 43 of file integration_tools.cpp.

◆ legendre_points6

const long double casadi::legendre_points6[]
Initial value:
=
{ 0.03376524289842347537, 0.16939530676686742616,
0.38069040695840172805, 0.61930959304159849399, 0.83060469323313235179,
0.96623475710157580298 }

Definition at line 46 of file integration_tools.cpp.

◆ legendre_points7

const long double casadi::legendre_points7[]
Initial value:
=
{ 0.02544604382862047931, 0.12923440720030288098,
0.29707742431130129690, 0.50000000000000000000, 0.70292257568869853657,
0.87076559279969734106, 0.97455395617137896558 }

Definition at line 50 of file integration_tools.cpp.

◆ legendre_points8

const long double casadi::legendre_points8[]
Initial value:
=
{ 0.01985507175123157886, 0.10166676129318691357,
0.23723379504183561561, 0.40828267875217505445, 0.59171732124782483453,
0.76276620495816449541, 0.89833323870681347501, 0.98014492824876797705 }

Definition at line 54 of file integration_tools.cpp.

◆ legendre_points9

const long double casadi::legendre_points9[]
Initial value:
=
{ 0.01591988024618706810, 0.08198444633668211523,
0.19331428364970504319, 0.33787328829809543107, 0.49999999999999988898,
0.66212671170190451342, 0.80668571635029517886, 0.91801555366331766272,
0.98408011975381259884 }

Definition at line 58 of file integration_tools.cpp.

◆ LOOKUP_BINARY

constexpr casadi_int casadi::LOOKUP_BINARY = 2
constexpr

◆ LOOKUP_EXACT

constexpr casadi_int casadi::LOOKUP_EXACT = 1
constexpr

◆ LOOKUP_LINEAR

constexpr casadi_int casadi::LOOKUP_LINEAR = 0
constexpr

◆ Matrix< casadi_int >

template class CASADI_EXPORT casadi::Matrix< casadi_int >

◆ Matrix< double >

template class CASADI_EXPORT casadi::Matrix< double >

Definition at line 393 of file dm_instantiator.cpp.

Referenced by casadi::Constant< Value >::get_DM().

◆ Matrix< SXElem >

template class CASADI_EXPORT casadi::Matrix< SXElem >

Definition at line 1581 of file sx_instantiator.cpp.

◆ nan

const double casadi::nan = std::numeric_limits<double>::quiet_NaN()

◆ NL_INPUTS

const std::vector<std::string> casadi::NL_INPUTS = {"x", "p"}

Definition at line 178 of file nlpsol.hpp.

Referenced by casadi::Nlpsol::create_oracle().

◆ NL_OUTPUTS

const std::vector<std::string> casadi::NL_OUTPUTS = {"f", "g"}

Definition at line 191 of file nlpsol.hpp.

Referenced by casadi::Nlpsol::create_oracle().

◆ pi

const double casadi::pi = 3.14159265358979323846

◆ radau_points

const long double* casadi::radau_points[]
Initial value:
=
const long double radau_points9[]
const long double radau_points3[]
const long double radau_points1[]
const long double radau_points2[]
const long double radau_points6[]
const long double radau_points7[]
const long double radau_points5[]
const long double radau_points8[]
const long double radau_points4[]

Definition at line 98 of file integration_tools.cpp.

Referenced by collocation_pointsGen().

◆ radau_points1

const long double casadi::radau_points1[]
Initial value:
=
{ 1.00000000000000000000 }

Definition at line 68 of file integration_tools.cpp.

◆ radau_points2

const long double casadi::radau_points2[]
Initial value:
=
{ 0.33333333333333337034, 1.00000000000000000000 }

Definition at line 70 of file integration_tools.cpp.

◆ radau_points3

const long double casadi::radau_points3[]
Initial value:
=
{ 0.15505102572168222297, 0.64494897427831787695,
1.00000000000000000000 }

Definition at line 72 of file integration_tools.cpp.

◆ radau_points4

const long double casadi::radau_points4[]
Initial value:
=
{ 0.08858795951270420632, 0.40946686444073465694,
0.78765946176084700170, 1.00000000000000000000 }

Definition at line 75 of file integration_tools.cpp.

◆ radau_points5

const long double casadi::radau_points5[]
Initial value:
=
{ 0.05710419611451822419, 0.27684301363812369168,
0.58359043236891683382, 0.86024013565621926247, 1.00000000000000000000 }

Definition at line 78 of file integration_tools.cpp.

◆ radau_points6

const long double casadi::radau_points6[]
Initial value:
=
{ 0.03980985705146905529, 0.19801341787360787761,
0.43797481024738621480, 0.69546427335363603106, 0.90146491420117347282,
1.00000000000000000000 }

Definition at line 81 of file integration_tools.cpp.

◆ radau_points7

const long double casadi::radau_points7[]
Initial value:
=
{ 0.02931642715978521885, 0.14807859966848435640,
0.33698469028115418666, 0.55867151877155019069, 0.76923386203005450490,
0.92694567131974103802, 1.00000000000000000000 }

Definition at line 85 of file integration_tools.cpp.

◆ radau_points8

const long double casadi::radau_points8[]
Initial value:
=
{ 0.02247938643871305597, 0.11467905316090415413,
0.26578982278458951338, 0.45284637366944457959, 0.64737528288683043876,
0.81975930826310761113, 0.94373743946307731001, 1.00000000000000000000 }

Definition at line 89 of file integration_tools.cpp.

◆ radau_points9

const long double casadi::radau_points9[]
Initial value:
=
{ 0.01777991514736393386, 0.09132360789979432347,
0.21430847939563035798, 0.37193216458327238438, 0.54518668480342658000,
0.71317524285556954666, 0.85563374295785443735, 0.95536604471003006012,
1.00000000000000000000 }

Definition at line 93 of file integration_tools.cpp.

◆ serialization_check

casadi_int casadi::serialization_check = 123456789012345
static

◆ serialization_protocol_version

casadi_int casadi::serialization_protocol_version = 3
static