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  Blas
 Pluggable dense BLAS backend, dispatched per-call by shorthand. 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  NonnegativeChecker< OP_FABS >
 
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  ThreadLocalStorage
 Thread-local storage wrapper that avoids destructor calls. 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
 
class  StreamStateGuard
 
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  Dump
 Dump. 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  RevWeakCache
 
class  SimpleCache
 
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  GraphBuilder
 A mutable, format-neutral interface to a computational-graph model. More...
 
struct  Node
 Metadata for one graph tensor (graph input or output) More...
 
class  GraphBuilderInternal
 Internal class for GraphBuilder. More...
 
class  GraphModel
 Format-agnostic handle to a parsed computational-graph model. More...
 
class  GraphModelInternal
 Base interface for format-specific graph-model backends. 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  Kron
 Kronecker product. More...
 
class  DenseKron
 Kron specialization: both operands dense. More...
 
class  DenseSparseKron
 Kron specialization: dense a + sparse b. More...
 
class  SparseDenseKron
 Kron specialization: sparse a + dense b. More...
 
class  KronContract
 Kronecker contraction. More...
 
class  DenseKronContract
 KronContract specialization: M dense, X dense (=> Y dense) More...
 
class  DenseSparseKronContract
 KronContract specialization: M dense, X sparse (=> Y dense) More...
 
class  SparseDenseKronContract
 KronContract specialization: M sparse, X dense. More...
 
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  ModelicaParser
 Modelica parser. More...
 
class  ModelicaParserInternal
 
class  Monitor
 Monitor. More...
 
class  MultipleOutput
 
class  OutputNode
 
class  Multiplication
 An MX atomic for matrix-matrix product,. More...
 
class  DenseMultiplication
 Dense * Dense -> Dense matrix product. More...
 
class  DenseSparseMultiplication
 Dense * Sparse -> Dense matrix product. More...
 
class  PseudoDenseMultiplication
 Compactible * Compactible -> Compactible 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  OnnxTensorInfo
 Metadata for a single ONNX tensor (input or output); shape is resolved by the builder. More...
 
struct  OnnxMemory
 
class  OnnxFunction
 Black-box ONNX function base; backends (e.g. onnxruntime) derive from this. 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  TemporaryDirResource
 Base class for resources that use a temporary directory. More...
 
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...
 
class  BlasClassic
 'classic' plugin for Blas More...
 
class  BlasBlasfeo
 'blasfeo' plugin for Blas 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...
 
struct  MadmpecMemory
 
class  MadmpecInterface
 'ccopt' plugin for Nlpsol 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  LazyCallbackMemory
 
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...
 
class  LaceModelica
 'lacemodelica' plugin for ModelicaParser 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  MosekMemory
 
class  MosekInterface
 'mosek' plugin for Conic More...
 
struct  MumpsMemory
 
class  MumpsInterface
 'mumps' plugin for Linsol More...
 
class  Onnx
 'onnx' plugin for GraphModel More...
 
struct  OpMapping
 Operation mapping between CasADi and ONNX. More...
 
struct  OoqpMemory
 
class  OoqpInterface
 'ooqp' plugin for Conic More...
 
struct  OnnxRuntimeMemory
 Per-checkout ONNX Runtime state (session + reusable eval scaffolding) More...
 
class  OnnxRuntimeInterface
 'ort' plugin for Onnx More...
 
struct  OsqpMemory
 
class  OsqpInterface
 'osqp' plugin for Conic More...
 
struct  PiqpMemory
 
class  PiqpInterface
 'piqp' 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  UnoMemory
 
class  UnoInterface
 'uno' plugin for Nlpsol More...
 
struct  WorhpMemory
 
class  WorhpInterface
 'worhp' plugin for Nlpsol More...
 
struct  XpressMemory
 
class  XpressInterface
 'xpress' plugin for Conic 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 void * handle_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_BOOLVECTOR, std::vector< bool > > BoolVectorType
 
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)
 
using AddNodeFn = std::function< onnx::NodeProto *()>
 Callback type for adding nodes to a container (GraphProto or FunctionProto) More...
 
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  { CASADI_BLAS_NO_TRANS = 111 , CASADI_BLAS_TRANS = 112 }
 
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 , OP_DUMP , OP_KRON ,
  OP_KRON_CONTRACT
}
 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 , 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...
 
bool has_blas (const std::string &name)
 
void load_blas (const std::string &name)
 
std::string doc_blas (const std::string &name)
 
static void handle_pedantic (const std::string &mode, const std::string &opt_name, const std::string &msg)
 
static bool is_pow2_ge8 (casadi_int n)
 
static void scan_prefix_pow2 (std::vector< std::string > &offenders, const std::vector< casadi_int > &ext, const std::string &tag)
 
static std::vector< casadi_int > knot_offsets (const std::vector< casadi_int > &knot_dims)
 
template<typename M >
static M compute_knots_cache (const M &K, const std::vector< casadi_int > &offsets)
 
static MX derivative_coeff_mx (casadi_int i, const std::vector< MX > &knots_per_dim, const std::vector< casadi_int > &degree, const std::vector< casadi_int > &coeffs_dims, const MX &coeffs)
 
Function blazing_spline (const std::string &name, const std::vector< std::vector< double > > &knots, const Dict &opts=Dict())
 Construct a specialized parametric BSpline. More...
 
Function blazing_spline (const std::string &name, const std::vector< casadi_int > &knot_dims, const Dict &opts=Dict())
 Construct a parametric-knots blazing_spline. More...
 
void get_boor (const MX &x, const MX &knots, casadi_int degree, casadi_int lookup_mode, MX &start, MX &boor)
 
static casadi_int knot_size (const std::vector< double > &k)
 
static casadi_int knot_size (const MX &k)
 
template<typename K >
MX do_inline (const MX &x, const std::vector< K > &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<class T , typename SU >
common_simp_unary (casadi_int op, const T &x, casadi_int depth, SU &&gen_unary, bool unique, bool &hit)
 
template<class T , typename SU , typename SB >
common_simp_binary (casadi_int op, const T &x, const T &y, casadi_int depth, SU &&gen_unary, SB &&gen_binary, bool unique_x, bool unique_y, bool &hit)
 
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...
 
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...
 
bool version_gt (const std::string &version_left, const std::string &version_right)
 Compare versions: returns true if version_left > version_right. More...
 
bool version_ge (const std::string &version_left, const std::string &version_right)
 Compare versions: returns true if version_left >= version_right. More...
 
bool version_lt (const std::string &version_left, const std::string &version_right)
 Compare versions: returns true if version_left < version_right. More...
 
bool version_le (const std::string &version_left, const std::string &version_right)
 Compare versions: returns true if version_left <= version_right. More...
 
std::string temporary_file (const std::string &prefix, const std::string &suffix, const std::string &directory)
 
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<typename T >
std::ostream & operator<< (std::ostream &stream, const std::vector< T > &v)
 Enables flushing an std::vector to a stream (prints representation) More...
 
template<typename T , size_t N>
std::ostream & operator<< (std::ostream &stream, const std::array< T, N > &v)
 Enables flushing an std::array to a stream (prints representation) More...
 
template<typename T >
std::ostream & operator<< (std::ostream &stream, const std::set< T > &v)
 Enables flushing an std::set to a stream (prints representation) More...
 
template<typename T1 , typename T2 >
std::ostream & operator<< (std::ostream &stream, const std::pair< T1, T2 > &p)
 
template<typename T1 , typename T2 >
std::ostream & operator<< (std::ostream &stream, const std::map< T1, T2 > &p)
 
template<typename T2 >
std::ostream & operator<< (std::ostream &stream, const std::map< std::string, T2 > &p)
 
template<typename T >
bool mul_overflows (const T &a, const T &b)
 
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)
 
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<>
size_t hash_value (double v)
 Hash value of a double. More...
 
char pathsep ()
 
std::string filesep ()
 
std::vector< std::string > get_search_paths ()
 
std::unique_ptr< std::istream > ifstream_compat (const std::string &utf8_path, std::ios::openmode mode)
 
std::unique_ptr< std::ostream > ofstream_compat (const std::string &utf8_path, std::ios::openmode mode)
 
CASADI_EXPORT std::ifstream * new_ifstream_compat (const std::string &utf8_path, std::ios::openmode mode=std::ios::in)
 
static std::string next_quoted_token (const std::string &line, size_t &pos)
 
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_output_category (Category cat)
 
bool is_acyclic (Category cat)
 
Category dependent_definition (Category cat)
 
std::vector< Categoryinput_categories ()
 
std::vector< Categoryoutput_categories ()
 
static Resource open_resource (const std::string &path)
 
Category input_category (Category cat)
 
template<typename T >
std::vector< T > read_list (const XmlNode &n)
 
template<>
void CASADI_EXPORT mtimes_dense_dispatch< double > (const std::string &blas, const double *A, casadi_int m, casadi_int k, const double *B, casadi_int n, double *C)
 
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...
 
void ensure_directory_exists (const std::string &dir)
 
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)
 
std::string transform_token_str (const GenericType &g)
 
std::string transform_passes_str (const std::vector< std::vector< GenericType > > &ps)
 
std::string transform_stats (const Function &f)
 
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)
 
static std::string format_from_path (const std::string &path)
 
bool has_graphmodel (const std::string &name)
 Check if a graph-model format plugin is available. More...
 
void load_graphmodel (const std::string &name)
 Explicitly load a graph-model format plugin. More...
 
std::string doc_graphmodel (const std::string &name)
 Get format-specific documentation. More...
 
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...
 
template<bool Fwd>
static int kron_sp_gen (const Sparsity &sp_a, const Sparsity &sp_b, typename KronSpTraits< Fwd >::arg_t arg, typename KronSpTraits< Fwd >::res_t res)
 
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_modelicaparser (const std::string &name)
 Check if a particular plugin is available. More...
 
void load_modelicaparser (const std::string &name)
 Explicitly load a plugin dynamically. More...
 
std::string doc_modelicaparser (const std::string &name)
 Get solver specific documentation. More...
 
static void codegen_copy_z (CodeGenerator &g, casadi_int nnz, const std::vector< casadi_int > &arg, const std::vector< casadi_int > &res, const std::vector< bool > &arg_is_ref)
 
bool has_empty (const std::vector< MX > &x, bool both=false)
 
std::vector< MXtrim_empty (const std::vector< MX > &x, bool both=false)
 
bool simplify_const_folding_order (std::vector< MX > &arg, std::vector< MX > &res, const Dict &opts)
 
MX get_const (const Sparsity &sp, const double *v, std::unordered_multimap< std::size_t, std::pair< MX, DM > > &cache)
 
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)
 
MX kron_contract (const MX &m, const MX &x, bool inner)
 Kronecker contraction. More...
 
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...
 
bool name_has_g (const std::string &name)
 
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 has_onnxbackend (const std::string &solver)
 Check if a given ONNX runtime backend is available. More...
 
void load_onnxbackend (const std::string &solver)
 Load an ONNX runtime backend. More...
 
std::vector< std::string > onnxbackend_solvers ()
 List available ONNX runtime backends. More...
 
std::string onnxbackend_doc (const std::string &solver)
 Get documentation for an ONNX runtime backend. More...
 
std::string onnx_dtype_name (casadi_int elem_type)
 Human-readable name of an ONNX element-type enum (1=FLOAT, 11=DOUBLE, 7=INT64, ...) More...
 
casadi_int onnx_dtype_enum (const std::string &name)
 ONNX element-type enum for a human-readable name (inverse of onnx_dtype_name; 0 if unknown) More...
 
static std::vector< OnnxTensorInfoselect_tensors (const std::vector< OnnxTensorInfo > &all, const std::vector< std::string > &req)
 
static void pack_tensors (SerializingStream &s, const std::string &d, const std::vector< OnnxTensorInfo > &v)
 
static void unpack_tensors (DeserializingStream &s, const std::string &d, std::vector< OnnxTensorInfo > &v)
 
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_mtimes_dense (const T1 *x, casadi_int nrow_x, casadi_int ncol_x, const T1 *y, casadi_int ncol_y, T1 *z, casadi_int tr)
 Dense matrix-matrix multiplication: z <- z + x*y (column-major) More...
 
template<typename T1 >
void casadi_mtimes_dense_sparse (const T1 *x, casadi_int nrow_x, const T1 *y, const casadi_int *sp_y, T1 *z)
 Dense * sparse matrix multiplication: z <- z + x*y (z, x dense col-major) 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_kron_dense (const T1 *a, casadi_int mA, casadi_int nA, const T1 *b, casadi_int mB, casadi_int nB, T1 *r)
 
template<typename T1 >
void casadi_kron_dense_sparse (const T1 *a, casadi_int mA, casadi_int nA, const T1 *b, const casadi_int *sp_b, T1 *r)
 
template<typename T1 >
void casadi_kron_sparse_dense (const T1 *a, const casadi_int *sp_a, const T1 *b, casadi_int mB, casadi_int nB, T1 *r)
 
template<typename T1 >
void casadi_kron_contract_inner (const T1 *m, const casadi_int *sp_m, const T1 *b, const casadi_int *sp_b, T1 *y, const casadi_int *sp_y, T1 *w)
 
template<typename T1 >
void casadi_kron_contract_inner_dense (const T1 *m, casadi_int mA, casadi_int nA, const T1 *b, casadi_int mB, casadi_int nB, T1 *y)
 
template<typename T1 >
void casadi_kron_contract_inner_dense_sparse (const T1 *m, casadi_int mA, casadi_int nA, const T1 *b, const casadi_int *sp_b, T1 *y)
 
template<typename T1 >
void casadi_kron_contract_inner_sparse_dense (const T1 *m, const casadi_int *sp_m, const T1 *b, casadi_int mB, casadi_int nB, T1 *y, const casadi_int *sp_y)
 
template<typename T1 >
void casadi_kron_contract_outer (const T1 *m, const casadi_int *sp_m, const T1 *a, const casadi_int *sp_a, T1 *y, const casadi_int *sp_y, T1 *w)
 
template<typename T1 >
void casadi_kron_contract_outer_dense (const T1 *m, casadi_int mB, casadi_int nB, const T1 *a, casadi_int mA, casadi_int nA, T1 *y)
 
template<typename T1 >
void casadi_kron_contract_outer_dense_sparse (const T1 *m, casadi_int mB, casadi_int nB, const T1 *a, const casadi_int *sp_a, T1 *y)
 
template<typename T1 >
void casadi_kron_contract_outer_sparse_dense (const T1 *m, const casadi_int *sp_m, const T1 *a, casadi_int mA, casadi_int nA, T1 *y, const casadi_int *sp_y)
 
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_tensor_ttv (T1 *ret, casadi_int dim, casadi_int n_dims, const T1 *all_w, const casadi_int *w_offset, const casadi_int *starts, const casadi_int *strides, const T1 *c, casadi_int m, T1 weight, casadi_int offset)
 
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<bool COMBINE_AND>
static void mul_bvec_fwd (const bvec_t *x, const Sparsity &x_sp, const bvec_t *y, const Sparsity &y_sp, bvec_t *z, const Sparsity &z_sp, bvec_t *w)
 
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 ()
 
static void classic_dgemm (int transa, int transb, casadi_int m, casadi_int n, casadi_int k, double alpha, const double *A, casadi_int lda, const double *B, casadi_int ldb, double beta, double *C, casadi_int ldc)
 
static void classic_daxpy (casadi_int n, double alpha, const double *x, double *y)
 
static double classic_ddot (casadi_int n, const double *x, const double *y)
 
static void classic_dscal (casadi_int n, double alpha, double *x)
 
static double classic_dnrm2 (casadi_int n, const double *x)
 
static double classic_dasum (casadi_int n, const double *x)
 
static void classic_dcopy (const double *x, casadi_int n, double *y)
 
static void classic_codegen_mtimes (CodeGenerator &g, const std::string &A, casadi_int m, casadi_int k, const std::string &B, casadi_int n, const std::string &C)
 
static void classic_codegen_axpy_aux (CodeGenerator &g, const std::vector< std::string > &inst)
 
static void classic_codegen_scal_aux (CodeGenerator &g, const std::vector< std::string > &inst)
 
static void classic_codegen_dot_aux (CodeGenerator &g, const std::vector< std::string > &inst)
 
static void classic_codegen_nrm2_aux (CodeGenerator &g, const std::vector< std::string > &inst)
 
static void classic_codegen_asum_aux (CodeGenerator &g, const std::vector< std::string > &inst)
 
int CASADI_BLAS_CLASSIC_EXPORT casadi_register_blas_classic (Blas::Plugin *plugin)
 
void CASADI_BLAS_CLASSIC_EXPORT casadi_load_blas_classic ()
 
static void blasfeo_dgemm (int transa, int transb, casadi_int m, casadi_int n, casadi_int k, double alpha, const double *A, casadi_int lda, const double *B, casadi_int ldb, double beta, double *C, casadi_int ldc)
 
static void blasfeo_daxpy (casadi_int n, double alpha, const double *x, double *y)
 
static double blasfeo_ddot (casadi_int n, const double *x, const double *y)
 
static void blasfeo_codegen_mtimes (CodeGenerator &g, const std::string &A, casadi_int m, casadi_int k, const std::string &B, casadi_int n, const std::string &C)
 
static void blasfeo_codegen_axpy_aux (CodeGenerator &g, const std::vector< std::string > &inst)
 
static void blasfeo_codegen_dot_aux (CodeGenerator &g, const std::vector< std::string > &inst)
 
int CASADI_BLAS_BLASFEO_EXPORT casadi_register_blas_blasfeo (Blas::Plugin *plugin)
 
void CASADI_BLAS_BLASFEO_EXPORT casadi_load_blas_blasfeo ()
 
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_NLPSOL_CCOPT_EXPORT casadi_register_nlpsol_ccopt (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_CCOPT_EXPORT casadi_load_nlpsol_ccopt ()
 
void flatten_opts (Dict &ret, const Dict &opts, const std::string &prefix)
 
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 ()
 
char sense_to_gurobi (const std::string &sense)
 
static int gurobi_callback_function (GRBmodel *model, void *cbdata, int where, void *usrdata)
 
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_MODELICAPARSER_LACEMODELICA_EXPORT casadi_register_modelicaparser_lacemodelica (ModelicaParserInternal::Plugin *plugin)
 
void CASADI_MODELICAPARSER_LACEMODELICA_EXPORT casadi_load_modelicaparser_lacemodelica ()
 
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)
 
bool zip_entries_to_path (const std::vector< std::pair< std::string, std::string > > &entries, 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 ()
 
int CASADI_CONIC_MOSEK_EXPORT casadi_register_conic_mosek (Conic::Plugin *plugin)
 
void CASADI_CONIC_MOSEK_EXPORT casadi_load_conic_mosek ()
 
static void codegen_int_field (CodeGenerator &g, const std::string &prob_field, const std::string &local_name, const std::vector< int > &v)
 
static void mosek_stream_cb (void *, const char *s)
 
int CASADI_LINSOL_MUMPS_EXPORT casadi_register_linsol_mumps (LinsolInternal::Plugin *plugin)
 
void CASADI_LINSOL_MUMPS_EXPORT casadi_load_linsol_mumps ()
 
std::string onnx_input_name (const Function &f, casadi_int i)
 Function input/output name, or a generated fallback when unnamed. More...
 
std::string onnx_output_name (const Function &f, casadi_int i)
 
static void prefix_graph_names (onnx::GraphProto *g, const std::string &prefix)
 
static std::vector< casadi_int > constant_ints (const MX &m)
 
int CASADI_GRAPHMODEL_ONNX_EXPORT casadi_register_graphmodel_onnx (GraphModelInternal::Plugin *plugin)
 
void CASADI_GRAPHMODEL_ONNX_EXPORT casadi_load_graphmodel_onnx ()
 
static Node io_node (const onnx::ValueInfoProto &vi, const std::string &io)
 
const OpMappingget_op_mapping (casadi_int op)
 Lookup operation mapping by CasADi opcode (for export) More...
 
const OpMappingget_op_mapping_by_name (const std::string &onnx_name)
 Lookup operation mapping by ONNX name (for import) More...
 
casadi_int get_int_attribute (const onnx::NodeProto &node, const std::string &name, casadi_int default_value)
 Read an integer node attribute by name, or default_value if absent. More...
 
double get_float_attribute (const onnx::NodeProto &node, const std::string &name, double default_value)
 Read a float node attribute by name, or default_value if absent. More...
 
std::string get_string_attribute (const onnx::NodeProto &node, const std::string &name)
 Read a string node attribute by name, or "" if absent. More...
 
const onnx::GraphProto * get_graph_attribute (const onnx::NodeProto &node, const std::string &name)
 Read a subgraph (GraphProto) node attribute by name, or nullptr if absent. More...
 
void add_int_attribute (onnx::NodeProto *node, const std::string &name, casadi_int value)
 Add an integer attribute (e.g. axis) to a node. More...
 
void add_ints_attribute (onnx::NodeProto *node, const std::string &name, const std::vector< casadi_int > &values)
 Add an integer-list attribute (e.g. scan_input_axes) to a node. More...
 
void add_int_constant (onnx::GraphProto *graph, const std::string &name, const std::vector< casadi_int > &data, std::vector< casadi_int > dims={})
 Add a Constant node holding an INT64 tensor to a graph (default shape: 1-D) More...
 
onnx::NodeProto * create_binary_node (AddNodeFn add_node, const std::string &op_type, const std::string &input1, const std::string &input2, const std::string &output)
 Create binary operation ONNX node (callback-based) More...
 
onnx::NodeProto * create_unary_node (AddNodeFn add_node, const std::string &op_type, const std::string &input, const std::string &output)
 Create unary operation ONNX node (callback-based) More...
 
onnx::NodeProto * create_binary_node (onnx::GraphProto *graph, const std::string &op_type, const std::string &input1, const std::string &input2, const std::string &output)
 Create binary operation ONNX node (GraphProto convenience wrapper) More...
 
onnx::NodeProto * create_unary_node (onnx::GraphProto *graph, const std::string &op_type, const std::string &input, const std::string &output)
 Create unary operation ONNX node (GraphProto convenience wrapper) More...
 
onnx::TensorProto * create_constant_tensor (AddNodeFn add_node, const std::string &output_name, onnx::TensorProto::DataType data_type)
 
void add_int_constant (AddNodeFn add_node, const std::string &name, const std::vector< casadi_int > &data, std::vector< casadi_int > dims={})
 
onnx::NodeProto * create_gather_node (AddNodeFn add_node, const std::string &data, const std::string &indices, const std::string &output, casadi_int axis=0)
 
onnx::NodeProto * create_slice_node (AddNodeFn add_node, const std::string &uniq, const std::string &data, const std::vector< casadi_int > &starts, const std::vector< casadi_int > &ends, const std::vector< casadi_int > &axes, const std::vector< casadi_int > &steps, const std::string &output)
 
void emit_colmajor_reshape (AddNodeFn add_node, const std::string &data, const std::vector< casadi_int > &dims, const std::string &output, const std::string &uniq)
 
onnx::NodeProto * create_cast_node (AddNodeFn add_node, const std::string &input, const std::string &output, onnx::TensorProto::DataType to_type)
 
onnx::NodeProto * create_gemm_node (AddNodeFn add_node, const std::string &A, const std::string &B, const std::string &C, const std::string &output, bool transA=false, bool transB=false)
 
onnx::NodeProto * create_where_node (AddNodeFn add_node, const std::string &cond, const std::string &if_true, const std::string &if_false, const std::string &output)
 
template<typename T >
static bool load_raw (DM &dm, casadi_int n, const onnx::TensorProto &tensor, const char *type_name)
 
int CASADI_CONIC_OOQP_EXPORT casadi_register_conic_ooqp (Conic::Plugin *plugin)
 
void CASADI_CONIC_OOQP_EXPORT casadi_load_conic_ooqp ()
 
int CASADI_ONNX_ORT_EXPORT casadi_register_onnx_ort (OnnxFunction::Plugin *plugin)
 
void CASADI_ONNX_ORT_EXPORT casadi_load_onnx_ort ()
 
int CASADI_CONIC_OSQP_EXPORT casadi_register_conic_osqp (Conic::Plugin *plugin)
 
void CASADI_CONIC_OSQP_EXPORT casadi_load_conic_osqp ()
 
int CASADI_CONIC_PIQP_EXPORT casadi_register_conic_piqp (Conic::Plugin *plugin)
 
void CASADI_CONIC_PIQP_EXPORT casadi_load_conic_piqp ()
 
piqp::KKTSolver kkt_solver_from_string (const std::string &s)
 
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_UNO_EXPORT casadi_register_nlpsol_uno (Nlpsol::Plugin *plugin)
 
void CASADI_NLPSOL_UNO_EXPORT casadi_load_nlpsol_uno ()
 
static void set_uno_option (void *solver, const std::string &name, const GenericType &value)
 
static void insert_casadi_options (void *solver, Dict opts)
 
static uno_int casadi_uno_term_cb_cpp (uno_int, uno_int, const double *primals, const double *lower_mult, const double *upper_mult, const double *constraint_mult, double, double, double, double, void *user_data)
 
static void codegen_int_array (CodeGenerator &g, const std::string &name, const std::vector< uno_int > &v)
 
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[])
 
static void xpress_global_init ()
 
int CASADI_CONIC_XPRESS_EXPORT casadi_register_conic_xpress (Conic::Plugin *plugin)
 
void CASADI_CONIC_XPRESS_EXPORT casadi_load_conic_xpress ()
 
static void codegen_int_field (CodeGenerator &g, const std::string &prob_field, const std::string &local_name, const std::vector< int > &v)
 
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 ()
 
static double permutation_sign (const std::vector< casadi_int > &p)
 
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)
 
static double permutation_sign (const std::vector< casadi_int > &p)
 
static SX qr_block_det (const SX &B, bool amd)
 
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 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

static const char * REFERENCE_DOC
 
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
 
static const std::set< std::string > empty_mutex_set_
 
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 >
 
static const char * CLASSIC_DECL
 
static const char * CLASSIC_DAXPY_DECL
 
static const char * CLASSIC_DDOT_DECL
 
static const char * CLASSIC_DSCAL_DECL
 
static const char * CLASSIC_DNRM2_DECL
 
static const char * CLASSIC_DASUM_DECL
 
static const char * BLASFEO_DECL
 
static const char * BLASFEO_DAXPY_DECL
 
static const char * BLASFEO_DDOT_DECL
 
static const OpMapping op_map []
 
static std::once_flag s_xpress_init_flag
 
static int s_xpress_init_rc = 0
 

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

◆ AddNodeFn

using casadi::AddNodeFn = typedef std::function<onnx::NodeProto*()>

Definition at line 48 of file onnx_model.hpp.

◆ BoolType

Definition at line 40 of file generic_type.cpp.

◆ BoolVectorType

Definition at line 45 of file generic_type.cpp.

◆ bvec_t

typedef unsigned long long casadi::bvec_t

Definition at line 126 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 146 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 147 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 139 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 142 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 53 of file generic_type.cpp.

◆ DictVectorType

Definition at line 54 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 145 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 150 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 51 of file generic_type.cpp.

◆ FunctionVectorType

Definition at line 52 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 141 of file casadi_common.hpp.

◆ handle_t

typedef void* casadi::handle_t

Definition at line 109 of file casadi_os.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 47 of file generic_type.cpp.

◆ MXDict

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

Readability typedefs

Definition at line 1110 of file mx.hpp.

◆ MXIList

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

Readability typedefs

Definition at line 1108 of file mx.hpp.

◆ MXVector

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

Readability typedefs

Definition at line 1107 of file mx.hpp.

◆ MXVectorVector

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

Readability typedefs

Definition at line 1109 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 143 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 140 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 144 of file casadi_common.hpp.

◆ SpDict

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

Readability typedefs

Definition at line 1524 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 1027 of file casadi_misc.hpp.

◆ StringVectorType

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

Definition at line 48 of file generic_type.cpp.

◆ StringVectorVectorType

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

Definition at line 50 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 57 of file generic_type.cpp.

◆ VectorVectorType

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

Definition at line 56 of file generic_type.cpp.

◆ VoidPointerType

Definition at line 58 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 148 of file casadi_common.hpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CASADI_BLAS_NO_TRANS 
CASADI_BLAS_TRANS 

Definition at line 40 of file blas_impl.hpp.

40  {
42  CASADI_BLAS_TRANS = 112
43  };
@ CASADI_BLAS_TRANS
Definition: blas_impl.hpp:42
@ CASADI_BLAS_NO_TRANS
Definition: blas_impl.hpp:41

◆ Attribute

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

Definition at line 70 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 
ODE 
ALG 
QUAD 
ZERO 
DDEF 
WDEF 
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 73 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 47 of file fmu.hpp.

◆ Initial

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

Definition at line 67 of file dae_builder_internal.hpp.

◆ InputType

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

Definition at line 91 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 
OP_DUMP 
OP_KRON 
OP_KRON_CONTRACT 

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 
210  OP_REMAINDER,
211 
212  OP_DUMP,
213 
214  OP_KRON,
215 
217 
218  };
@ 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_KRON_CONTRACT
Definition: calculus.hpp:216
@ OP_BSPLINE
Definition: calculus.hpp:195
@ OP_ATAN
Definition: calculus.hpp:69
@ OP_KRON
Definition: calculus.hpp:214
@ 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_DUMP
Definition: calculus.hpp:212
@ 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

◆ OutputType

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

Definition at line 106 of file fmu_function.hpp.

◆ Parallelization

Enumerator
SERIAL 
OPENMP 
THREAD 
NUMEL 

Definition at line 85 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 2227 of file function.cpp.

2227  {
2228  static_cast<FunctionBuffer*>(raw)->_eval();
2229  }

◆ _jacobian_sparsity()

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

Definition at line 1346 of file x_function.hpp.

1346  {
1347  Dict opts{{"max_io", 0}, {"allow_free", true}};
1348  Function f = Function("tmp_jacobian_sparsity", {var}, {expr}, opts);
1349  return f.jac_sparsity(0, 0, false);
1350  }
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.

References casadi::Function::jac_sparsity().

Referenced by casadi::MX::jacobian_sparsity().

◆ _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 1353 of file x_function.hpp.

1354  {
1355  // Short-circuit
1356  if (expr.is_empty() || var.is_empty()) {
1357  return std::vector<bool>(tr? expr.numel() : var.numel(), false);
1358  }
1359 
1360  MatType e = expr;
1361 
1362  // Create a function for calculating a forward-mode derivative
1363  casadi_assert(order==1 || order==2,
1364  "which_depends: order argument must be 1 or 2, got " + str(order) + " instead.");
1365 
1366  MatType v = MatType::sym("v", var.sparsity());
1367  for (casadi_int i=1;i<order;++i) {
1368  e = jtimes(e, var, v);
1369  }
1370 
1371  Dict opts{{"max_io", 0}, {"allow_free", true}};
1372  Function f = Function("tmp_which_depends", {var}, {e}, opts);
1373  // Propagate sparsities backwards seeding all outputs
1374  std::vector<bvec_t> seed(tr? f.nnz_in(0) : f.nnz_out(0), 1);
1375  std::vector<bvec_t> sens(tr? f.nnz_out(0) : f.nnz_in(0), 0);
1376 
1377  if (tr)
1378  f({get_ptr(seed)}, {get_ptr(sens)});
1379  else
1380  f.rev({get_ptr(sens)}, {get_ptr(seed)});
1381  // Temporaries for evaluation
1382  std::vector<bool> ret(sens.size());
1383  std::copy(sens.begin(), sens.end(), ret.begin());
1384 
1385  // Project the result back on the original sparsity
1386  if (tr && e.sparsity()!=expr.sparsity()) {
1387  // std::vector<bool> is not accessible as bool*
1388  // bool -> casadi_int
1389  std::vector<casadi_int> source(sens.size());
1390  std::copy(ret.begin(), ret.end(), source.begin());
1391  std::vector<casadi_int> target(expr.nnz());
1392 
1393  // project
1394  std::vector<casadi_int> scratch(expr.size1());
1395  casadi_project(get_ptr(source), e.sparsity(), get_ptr(target), expr.sparsity(),
1396  get_ptr(scratch));
1397 
1398  // casadi_int -> bool
1399  ret.resize(expr.nnz());
1400  std::copy(target.begin(), target.end(), ret.begin());
1401  }
1402 
1403  return ret;
1404  }
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().

◆ 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 501 of file sleqp_interface.cpp.

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

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 170 of file libzip.cpp.

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

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 126 of file libzip.cpp.

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

References casadi::Filesystem::ifstream_ptr(), and uerr().

Referenced by add_directory_recursive(), and zip_entries_to_path().

◆ add_int_attribute()

void casadi::add_int_attribute ( onnx::NodeProto *  node,
const std::string &  name,
casadi_int  value 
)

Definition at line 176 of file onnx_operations.cpp.

176  {
177  onnx::AttributeProto* attr = node->add_attribute();
178  attr->set_name(name);
179  attr->set_type(onnx::AttributeProto::INT);
180  attr->set_i(value);
181  }

Referenced by create_gather_node(), create_gemm_node(), and casadi::Onnx::load().

◆ add_int_constant() [1/2]

void casadi::add_int_constant ( AddNodeFn  add_node,
const std::string &  name,
const std::vector< casadi_int > &  data,
std::vector< casadi_int >  dims = {} 
)

Definition at line 110 of file onnx_operations.cpp.

112  {}) {
113  onnx::TensorProto* t = create_constant_tensor(add_node, name, onnx::TensorProto::INT64);
114  if (dims.empty()) dims = {static_cast<casadi_int>(data.size())};
115  for (casadi_int d : dims) t->add_dims(d);
116  for (casadi_int v : data) t->add_int64_data(v);
117  }
onnx::TensorProto * create_constant_tensor(AddNodeFn add_node, const std::string &output_name, onnx::TensorProto::DataType data_type)

◆ add_int_constant() [2/2]

void casadi::add_int_constant ( onnx::GraphProto *  graph,
const std::string &  name,
const std::vector< casadi_int > &  data,
std::vector< casadi_int >  dims = {} 
)

Definition at line 193 of file onnx_operations.cpp.

194  {
195  add_int_constant([graph]() { return graph->add_node(); }, name, data, dims);
196  }
void add_int_constant(onnx::GraphProto *graph, const std::string &name, const std::vector< casadi_int > &data, std::vector< casadi_int > dims={})
Add a Constant node holding an INT64 tensor to a graph (default shape: 1-D)

Referenced by create_slice_node(), and emit_colmajor_reshape().

◆ add_ints_attribute()

void casadi::add_ints_attribute ( onnx::NodeProto *  node,
const std::string &  name,
const std::vector< casadi_int > &  values 
)

Definition at line 184 of file onnx_operations.cpp.

185  {
186  onnx::AttributeProto* attr = node->add_attribute();
187  attr->set_name(name);
188  attr->set_type(onnx::AttributeProto::INTS);
189  for (casadi_int v : values) attr->add_ints(v);
190  }

◆ all()

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

◆ any()

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

◆ 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 653 of file casadi_misc.hpp.

653  {
654  std::vector<T> ret(comp.size());
655  std::transform(comp.begin(), comp.end(), ret.begin(), f);
656  return ret;
657  }

◆ 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 660 of file casadi_misc.hpp.

660  {
661  std::for_each(comp.begin(), comp.end(), f);
662  }

◆ assert_read()

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

Definition at line 2351 of file function_internal.cpp.

2351  {
2352  casadi_int n = s.size();
2353  char c;
2354  std::stringstream ss;
2355  for (casadi_int i=0;i<n;++i) {
2356  stream >> c;
2357  ss << c;
2358  }
2359  casadi_assert_dev(s==ss.str());
2360  }

◆ assign_vector()

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

Definition at line 671 of file casadi_misc.hpp.

671  {
672  casadi_assert(d.empty(), "Receiving vector must be empty");
673  d.resize(s.size());
674  std::copy(s.begin(), s.end(), d.begin());
675  }

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

◆ blasfeo_codegen_axpy_aux()

static void casadi::blasfeo_codegen_axpy_aux ( CodeGenerator g,
const std::vector< std::string > &  inst 
)
static

Definition at line 117 of file blas_blasfeo.cpp.

118  {
119  static const char* SRC =
120  "// SYMBOL \"axpy\"\n"
121  "void casadi_axpy(casadi_int n, casadi_real alpha,\n"
122  " const casadi_real* x, casadi_real* y) {\n"
123  " int n_ = (int)n, inc = 1;\n"
124  " blasfeo_blas_daxpy(&n_, &alpha, (double*)x, &inc, y, &inc);\n"
125  "}\n";
126  g.auxiliaries << BLASFEO_DAXPY_DECL << "\n";
127  g.auxiliaries << g.sanitize_source(SRC, inst);
128  }
static const char * BLASFEO_DAXPY_DECL

References casadi::CodeGenerator::auxiliaries, BLASFEO_DAXPY_DECL, and casadi::CodeGenerator::sanitize_source().

Referenced by casadi_register_blas_blasfeo().

◆ blasfeo_codegen_dot_aux()

static void casadi::blasfeo_codegen_dot_aux ( CodeGenerator g,
const std::vector< std::string > &  inst 
)
static

Definition at line 134 of file blas_blasfeo.cpp.

135  {
136  static const char* SRC =
137  "// SYMBOL \"dot\"\n"
138  "casadi_real casadi_dot(casadi_int n,\n"
139  " const casadi_real* x, const casadi_real* y) {\n"
140  " int n_ = (int)n, inc = 1;\n"
141  " return blasfeo_blas_ddot(&n_, (double*)x, &inc, (double*)y, &inc);\n"
142  "}\n";
143  g.auxiliaries << BLASFEO_DDOT_DECL << "\n";
144  g.auxiliaries << g.sanitize_source(SRC, inst);
145  }
static const char * BLASFEO_DDOT_DECL

References casadi::CodeGenerator::auxiliaries, BLASFEO_DDOT_DECL, and casadi::CodeGenerator::sanitize_source().

Referenced by casadi_register_blas_blasfeo().

◆ blasfeo_codegen_mtimes()

static void casadi::blasfeo_codegen_mtimes ( CodeGenerator g,
const std::string &  A,
casadi_int  m,
casadi_int  k,
const std::string &  B,
casadi_int  n,
const std::string &  C 
)
static

Definition at line 98 of file blas_blasfeo.cpp.

100  {
101  g.add_external(BLASFEO_DECL);
102  g.local("blas_tn", "char"); g.init_local("blas_tn", "'N'");
103  g.local("blas_one", "double"); g.init_local("blas_one", "1.0");
104  g.local("blas_m", "int");
105  g.local("blas_n", "int");
106  g.local("blas_k", "int");
107  g << "blas_m = " << m << "; blas_n = " << n << "; blas_k = " << k << ";\n";
108  g << "blasfeo_blas_dgemm(&blas_tn, &blas_tn, &blas_m, &blas_n, &blas_k, "
109  "&blas_one, (double*)" << A << ", &blas_m, (double*)" << B
110  << ", &blas_k, &blas_one, " << C << ", &blas_m);\n";
111  }

References casadi::CodeGenerator::add_external(), BLASFEO_DECL, C, casadi::CodeGenerator::init_local(), and casadi::CodeGenerator::local().

Referenced by casadi_register_blas_blasfeo().

◆ blasfeo_daxpy()

static void casadi::blasfeo_daxpy ( casadi_int  n,
double  alpha,
const double *  x,
double *  y 
)
static

Definition at line 59 of file blas_blasfeo.cpp.

60  {
61  casadi_assert(n <= INT_MAX,
62  "BLAS 'blasfeo' plugin: vector length exceeds 32-bit BLAS ABI.");
63  int n_ = static_cast<int>(n), inc = 1;
64  blasfeo_blas_daxpy(&n_, &alpha,
65  const_cast<double*>(x), &inc, y, &inc);
66  }

Referenced by casadi_register_blas_blasfeo().

◆ blasfeo_ddot()

static double casadi::blasfeo_ddot ( casadi_int  n,
const double *  x,
const double *  y 
)
static

Definition at line 68 of file blas_blasfeo.cpp.

69  {
70  casadi_assert(n <= INT_MAX,
71  "BLAS 'blasfeo' plugin: vector length exceeds 32-bit BLAS ABI.");
72  int n_ = static_cast<int>(n), inc = 1;
73  return blasfeo_blas_ddot(&n_,
74  const_cast<double*>(x), &inc,
75  const_cast<double*>(y), &inc);
76  }

Referenced by casadi_register_blas_blasfeo(), and eval_L().

◆ blasfeo_dgemm()

static void casadi::blasfeo_dgemm ( int  transa,
int  transb,
casadi_int  m,
casadi_int  n,
casadi_int  k,
double  alpha,
const double *  A,
casadi_int  lda,
const double *  B,
casadi_int  ldb,
double  beta,
double *  C,
casadi_int  ldc 
)
static

Definition at line 33 of file blas_blasfeo.cpp.

39  {
40  casadi_assert(m <= INT_MAX && n <= INT_MAX && k <= INT_MAX
41  && lda <= INT_MAX && ldb <= INT_MAX && ldc <= INT_MAX,
42  "BLAS 'blasfeo' plugin: matrix dimension exceeds 32-bit BLAS ABI.");
43 
44  char ta = (transa == CASADI_BLAS_TRANS) ? 'T' : 'N';
45  char tb = (transb == CASADI_BLAS_TRANS) ? 'T' : 'N';
46  int m_ = static_cast<int>(m), n_ = static_cast<int>(n), k_ = static_cast<int>(k);
47  int lda_ = static_cast<int>(lda), ldb_ = static_cast<int>(ldb), ldc_ = static_cast<int>(ldc);
48 
49  // BLASFEO header takes non-const pointers; semantics are still read-only
50  // for A, B, alpha, beta. const_cast is safe here.
51  blasfeo_blas_dgemm(&ta, &tb, &m_, &n_, &k_, &alpha,
52  const_cast<double*>(A), &lda_,
53  const_cast<double*>(B), &ldb_,
54  &beta, C, &ldc_);
55  }

References C, and CASADI_BLAS_TRANS.

Referenced by casadi_register_blas_blasfeo().

◆ blazing_spline() [1/2]

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

Like blazing_spline, but the knot values are provided as a symbolic input at evaluation time instead of being fixed at construction time. Only knot vector sizes (per dimension) are needed at construction.

The resulting Function has inputs (x, C, knots) where knots is the stacked knot vector. Supports the same precompute_coeff and precompute_grid options as the fixed-knots variant.

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

Definition at line 181 of file blazing_spline.cpp.

183  {
184  bool precompute_coeff = false, precompute_grid = false;
185  auto it = opts.find("precompute_coeff");
186  if (it != opts.end()) precompute_coeff = it->second;
187  it = opts.find("precompute_grid");
188  if (it != opts.end()) precompute_grid = it->second;
189  bool use_inv = precompute_grid;
190  Function F_inner = Function::create(
191  new BlazingSplineFunction(name, knot_dims, 0,
192  precompute_coeff, precompute_grid, use_inv), opts);
193  if (!use_inv) return F_inner;
194 
195  // Wrap: user sees (x, C, knots), wrapper computes inv and calls inner
196  std::vector<casadi_int> offsets = knot_offsets(knot_dims);
197  casadi_int nd = knot_dims.size();
198  casadi_int nk = offsets.back();
199  MX x = MX::sym("x", nd);
200  MX C = MX::sym("C", F_inner.size_in(1));
201  MX knots = MX::sym("knots", nk);
202  MX inv = compute_knots_cache(knots, offsets);
203  std::vector<MX> ret = F_inner(std::vector<MX>{x, C, knots, inv});
204  return Function(name, {x, C, knots}, ret,
205  {"x", "C", "knots"}, F_inner.name_out(),
206  {{"always_inline", true}});
207  }
static std::vector< casadi_int > knot_offsets(const std::vector< casadi_int > &knot_dims)
static M compute_knots_cache(const M &K, const std::vector< casadi_int > &offsets)

References C, compute_knots_cache(), casadi::Function::create(), casadi::FunctionInternal::find(), knot_offsets(), casadi::Function::name_out(), casadi::Function::size_in(), and casadi::GenericMatrix< MX >::sym().

◆ blazing_spline() [2/2]

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 5 supported
  • a single scalar output (m=1)

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

Definition at line 175 of file blazing_spline.cpp.

177  {
178  return Function::create(new BlazingSplineFunction(name, knots, 0), opts);
179  }

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 395 of file casadi_misc.cpp.

395  {
396  casadi_assert(lhs.size()==rhs.size(), "Size mismatch.");
397  std::vector<bool> ret(lhs.size());
398  std::transform(lhs.begin(), lhs.end(), rhs.begin(), ret.begin(),
399  [](bool a, bool b) -> bool { return a && b; });
400  return ret;
401  }

◆ boolvec_not()

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

Definition at line 388 of file casadi_misc.cpp.

388  {
389  std::vector<bool> ret(v.size());
390  std::transform(v.begin(), v.end(), ret.begin(),
391  [](bool v) -> bool { return !v; });
392  return ret;
393  }

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 403 of file casadi_misc.cpp.

403  {
404  casadi_assert(lhs.size()==rhs.size(), "Size mismatch.");
405  std::vector<bool> ret(lhs.size());
406  std::transform(lhs.begin(), lhs.end(), rhs.begin(), ret.begin(),
407  [](bool a, bool b) -> bool { return a || b; });
408  return ret;
409  }

◆ boolvec_to_index()

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

Definition at line 412 of file casadi_misc.cpp.

412  {
413  std::vector<casadi_int> ret;
414  for (casadi_int i=0;i<v.size();++i) {
415  if (v[i]) ret.push_back(i);
416  }
417  return ret;
418  }

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 1219 of file function_internal.cpp.

1219  {
1220  for (casadi_int i=begin; i<end; ++i) {
1221  s[i] = 0;
1222  }
1223  }

◆ bvec_or() [1/2]

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

Definition at line 453 of file casadi_misc.cpp.

453  {
454  bvec_t acc = 0;
455  // vacuous truth
456  if (n==0) {
457  return~acc;
458  }
459  for (casadi_int i=0;i<n;++i) {
460  acc |= arg[i];
461  }
462  return acc;
463  }
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 1226 of file function_internal.cpp.

1226  {
1227  r = 0;
1228  for (casadi_int i=begin; i<end; ++i) r |= s[i];
1229  }

◆ bvec_toggle()

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

Definition at line 1213 of file function_internal.cpp.

1213  {
1214  for (casadi_int i=begin; i<end; ++i) {
1215  s[i] ^= (bvec_t(1) << j);
1216  }
1217  }

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 280 of file oracle_function.hpp.

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

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 40 of file tools.cpp.

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

References uerr().

Referenced by external_transform().

◆ callback_stdout()

void casadi::callback_stdout ( const char *  s)

Definition at line 36 of file tools.cpp.

36  {
37  uout() << s << std::flush;
38 }
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 148 of file mapsum.cpp.

148  {
149  casadi_int i;
150  if (!x || !y) return;
151  for (i=0; i<n; ++i) *y++ |= *x++;
152  }

◆ casadi_add() [2/2]

template<typename T1 >
void casadi::casadi_add ( casadi_int  n,
const T1 *  x,
T1 *  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  }

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 336 of file casadi_runtime.hpp.

336  {
337  casadi_clear(x, n);
338  }

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_uno_term_cb_cpp(), casadi::Blocksqp::computeNextHessian(), casadi::FunctionInternal::eval(), casadi::Nlpsol::eval(), casadi::FiniteDiff::eval(), casadi::FmuFunction::eval(), casadi::FmuInternal::eval_fd(), casadi::Rank1::eval_gen(), casadi::Scpgen::eval_mat(), casadi::CallSX::eval_sx(), casadi::Feasiblesqpmethod::feasibility_iterations(), casadi::FmuFunction::finalize_hessian(), 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::LinsolQr::nfact(), casadi::Integrator::predict_events(), casadi::CvodesInterface::psolveB(), casadi::CvodesInterface::psolveF(), casadi::IdasInterface::psolveF(), 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::PiqpInterface::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 331 of file casadi_runtime.hpp.

331  {
332  casadi_fill(x, n, alpha);
333  }

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

Referenced by casadi::Kron::eval_kernel().

◆ casadi_kron_contract_inner()

template<typename T1 >
void casadi::casadi_kron_contract_inner ( const T1 *  m,
const casadi_int *  sp_m,
const T1 *  b,
const casadi_int *  sp_b,
T1 *  y,
const casadi_int *  sp_y,
T1 *  w 
)

Kron contraction (inner): contract M's inner block axes against b

Referenced by casadi::KronContract::eval_kernel().

◆ casadi_kron_contract_inner_dense()

template<typename T1 >
void casadi::casadi_kron_contract_inner_dense ( const T1 *  m,
casadi_int  mA,
casadi_int  nA,
const T1 *  b,
casadi_int  mB,
casadi_int  nB,
T1 *  y 
)

Kron contraction (inner), all dense

Referenced by casadi::DenseKronContract::eval_kernel().

◆ casadi_kron_contract_inner_dense_sparse()

template<typename T1 >
void casadi::casadi_kron_contract_inner_dense_sparse ( const T1 *  m,
casadi_int  mA,
casadi_int  nA,
const T1 *  b,
const casadi_int *  sp_b,
T1 *  y 
)

Kron contraction (inner), m dense + b sparse

Referenced by casadi::DenseSparseKronContract::eval_kernel().

◆ casadi_kron_contract_inner_sparse_dense()

template<typename T1 >
void casadi::casadi_kron_contract_inner_sparse_dense ( const T1 *  m,
const casadi_int *  sp_m,
const T1 *  b,
casadi_int  mB,
casadi_int  nB,
T1 *  y,
const casadi_int *  sp_y 
)

Kron contraction (inner), m sparse + b dense

Referenced by casadi::SparseDenseKronContract::eval_kernel().

◆ casadi_kron_contract_outer()

template<typename T1 >
void casadi::casadi_kron_contract_outer ( const T1 *  m,
const casadi_int *  sp_m,
const T1 *  a,
const casadi_int *  sp_a,
T1 *  y,
const casadi_int *  sp_y,
T1 *  w 
)

Kron contraction (outer): contract M's outer block axes against a

Referenced by casadi::KronContract::eval_kernel().

◆ casadi_kron_contract_outer_dense()

template<typename T1 >
void casadi::casadi_kron_contract_outer_dense ( const T1 *  m,
casadi_int  mB,
casadi_int  nB,
const T1 *  a,
casadi_int  mA,
casadi_int  nA,
T1 *  y 
)

Kron contraction (outer), all dense

Referenced by casadi::DenseKronContract::eval_kernel().

◆ casadi_kron_contract_outer_dense_sparse()

template<typename T1 >
void casadi::casadi_kron_contract_outer_dense_sparse ( const T1 *  m,
casadi_int  mB,
casadi_int  nB,
const T1 *  a,
const casadi_int *  sp_a,
T1 *  y 
)

Kron contraction (outer), m dense + a sparse

Referenced by casadi::DenseSparseKronContract::eval_kernel().

◆ casadi_kron_contract_outer_sparse_dense()

template<typename T1 >
void casadi::casadi_kron_contract_outer_sparse_dense ( const T1 *  m,
const casadi_int *  sp_m,
const T1 *  a,
casadi_int  mA,
casadi_int  nA,
T1 *  y,
const casadi_int *  sp_y 
)

Kron contraction (outer), m sparse + a dense

Referenced by casadi::SparseDenseKronContract::eval_kernel().

◆ casadi_kron_dense()

template<typename T1 >
void casadi::casadi_kron_dense ( const T1 *  a,
casadi_int  mA,
casadi_int  nA,
const T1 *  b,
casadi_int  mB,
casadi_int  nB,
T1 *  r 
)

Kron, both operands dense

Referenced by casadi::DenseKron::eval_kernel().

◆ casadi_kron_dense_sparse()

template<typename T1 >
void casadi::casadi_kron_dense_sparse ( const T1 *  a,
casadi_int  mA,
casadi_int  nA,
const T1 *  b,
const casadi_int *  sp_b,
T1 *  r 
)

Kron, dense a + sparse b

Referenced by casadi::DenseSparseKron::eval_kernel().

◆ casadi_kron_sparse_dense()

template<typename T1 >
void casadi::casadi_kron_sparse_dense ( const T1 *  a,
const casadi_int *  sp_a,
const T1 *  b,
casadi_int  mB,
casadi_int  nB,
T1 *  r 
)

Kron, sparse a + dense b

Referenced by casadi::SparseDenseKron::eval_kernel().

◆ casadi_load_archiver_libzip()

void CASADI_ARCHIVER_LIBZIP_EXPORT casadi::casadi_load_archiver_libzip ( )

Definition at line 382 of file libzip.cpp.

382  {
383  Archiver::registerPlugin(casadi_register_archiver_libzip);
384  }

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

◆ casadi_load_blas_blasfeo()

void CASADI_BLAS_BLASFEO_EXPORT casadi::casadi_load_blas_blasfeo ( )

Definition at line 171 of file blas_blasfeo.cpp.

171  {
172  Blas::registerPlugin(casadi_register_blas_blasfeo);
173  }

References casadi_register_blas_blasfeo(), and casadi::PluginInterface< Blas >::registerPlugin().

◆ casadi_load_blas_classic()

void CASADI_BLAS_CLASSIC_EXPORT casadi::casadi_load_blas_classic ( )

Definition at line 257 of file blas_classic.cpp.

257  {
258  Blas::registerPlugin(casadi_register_blas_classic);
259  }

References casadi_register_blas_classic(), and casadi::PluginInterface< Blas >::registerPlugin().

Referenced by casadi::Blas::shorthand_for().

◆ 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 126 of file gurobi_interface.cpp.

126  {
127  Conic::registerPlugin(casadi_register_conic_gurobi);
128  }

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_mosek()

void CASADI_CONIC_MOSEK_EXPORT casadi::casadi_load_conic_mosek ( )

Definition at line 57 of file mosek_interface.cpp.

57  {
58  Conic::registerPlugin(casadi_register_conic_mosek);
59  }

References casadi_register_conic_mosek(), 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 61 of file osqp_interface.cpp.

61  {
62  Conic::registerPlugin(casadi_register_conic_osqp);
63  }

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

◆ casadi_load_conic_piqp()

void CASADI_CONIC_PIQP_EXPORT casadi::casadi_load_conic_piqp ( )

Definition at line 46 of file piqp_interface.cpp.

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

References casadi_load_conic_piqp(), and casadi_register_conic_piqp().

Referenced by casadi_load_conic_piqp().

◆ 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_conic_xpress()

void CASADI_CONIC_XPRESS_EXPORT casadi::casadi_load_conic_xpress ( )

Definition at line 57 of file xpress_interface.cpp.

57  {
58  Conic::registerPlugin(casadi_register_conic_xpress);
59  }

References casadi_register_conic_xpress(), 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_graphmodel_onnx()

void CASADI_GRAPHMODEL_ONNX_EXPORT casadi::casadi_load_graphmodel_onnx ( )

Definition at line 45 of file onnx_model.cpp.

45  {
46  GraphModelInternal::registerPlugin(casadi_register_graphmodel_onnx);
47  }

References casadi_register_graphmodel_onnx(), and casadi::PluginInterface< GraphModelInternal >::registerPlugin().

◆ casadi_load_importer_clang()

void CASADI_IMPORTER_CLANG_EXPORT casadi::casadi_load_importer_clang ( )

Definition at line 56 of file clang_compiler.cpp.

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

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 45 of file csparse_interface.cpp.

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

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 100 of file symbolic_qr.cpp.

100  {
101  LinsolInternal::registerPlugin(casadi_register_linsol_symbolicqr);
102  }

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_modelicaparser_lacemodelica()

void CASADI_MODELICAPARSER_LACEMODELICA_EXPORT casadi::casadi_load_modelicaparser_lacemodelica ( )

Definition at line 42 of file lace_modelica.cpp.

42  {
43  ModelicaParserInternal::registerPlugin(casadi_register_modelicaparser_lacemodelica);
44 }

References casadi_register_modelicaparser_lacemodelica(), and casadi::PluginInterface< ModelicaParserInternal >::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 46 of file ampl_interface.cpp.

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

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_ccopt()

void CASADI_NLPSOL_CCOPT_EXPORT casadi::casadi_load_nlpsol_ccopt ( )

Definition at line 57 of file ccopt_interface.cpp.

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

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

◆ casadi_load_nlpsol_fatrop()

void CASADI_NLPSOL_FATROP_EXPORT casadi::casadi_load_nlpsol_fatrop ( )

Definition at line 64 of file fatrop_interface.cpp.

64  {
65  Nlpsol::registerPlugin(casadi_register_nlpsol_fatrop);
66  }

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 57 of file madnlp_interface.cpp.

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

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_uno()

void CASADI_NLPSOL_UNO_EXPORT casadi::casadi_load_nlpsol_uno ( )

Definition at line 50 of file uno_interface.cpp.

50  {
51  Nlpsol::registerPlugin(casadi_register_nlpsol_uno);
52  }

References casadi_register_nlpsol_uno(), 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_onnx_ort()

void CASADI_ONNX_ORT_EXPORT casadi::casadi_load_onnx_ort ( )

Definition at line 42 of file ort_interface.cpp.

42  {
43  OnnxFunction::registerPlugin(casadi_register_onnx_ort);
44  }

References casadi_register_onnx_ort(), and casadi::PluginInterface< OnnxFunction >::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_max()

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

CasADi additions

Definition at line 291 of file calculus.hpp.

291 { 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 292 of file calculus.hpp.

292 { 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_mtimes_dense()

template<typename T1 >
void casadi::casadi_mtimes_dense ( const T1 *  x,
casadi_int  nrow_x,
casadi_int  ncol_x,
const T1 *  y,
casadi_int  ncol_y,
T1 *  z,
casadi_int  tr 
)

◆ casadi_mtimes_dense_sparse()

template<typename T1 >
void casadi::casadi_mtimes_dense_sparse ( const T1 *  x,
casadi_int  nrow_x,
const T1 *  y,
const casadi_int *  sp_y,
T1 *  z 
)

◆ 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 369 of file libzip.cpp.

369  {
370  plugin->name = "libzip";
371  plugin->doc = Libzip::meta_doc.c_str();
372  plugin->version = CASADI_VERSION;
373  plugin->exposed.unpack = &extract_zip_from_path;
374  plugin->exposed.unpack_from_stringstream = &extract_zip_from_stringstream;
375  plugin->exposed.pack = &zip_to_path;
376  plugin->exposed.pack_to_stream = &zip_to_stream;
377  plugin->exposed.pack_entries = &zip_entries_to_path;
378  return 0;
379  }
bool zip_to_path(const std::string &dir_path, const std::string &zip_path)
Definition: libzip.cpp:299
bool extract_zip_from_path(const std::string &zip_path, const std::string &output_dir)
Definition: libzip.cpp:57
bool zip_entries_to_path(const std::vector< std::pair< std::string, std::string > > &entries, const std::string &zip_path)
Definition: libzip.cpp:339
bool zip_to_stream(const std::string &dir, std::ostream &output)
Definition: libzip.cpp:188
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_entries_to_path(), zip_to_path(), and zip_to_stream().

Referenced by casadi_load_archiver_libzip().

◆ casadi_register_blas_blasfeo()

int CASADI_BLAS_BLASFEO_EXPORT casadi::casadi_register_blas_blasfeo ( Blas::Plugin *  plugin)

Definition at line 148 of file blas_blasfeo.cpp.

148  {
149  plugin->name = "blasfeo";
150  plugin->doc = BlasBlasfeo::meta_doc.c_str();
151  plugin->version = CASADI_VERSION;
152  plugin->exposed.dgemm = &blasfeo_dgemm;
153  plugin->exposed.codegen_mtimes = &blasfeo_codegen_mtimes;
154  plugin->exposed.daxpy = &blasfeo_daxpy;
155  plugin->exposed.ddot = &blasfeo_ddot;
156  plugin->exposed.dscal = nullptr;
157  plugin->exposed.dnrm2 = nullptr;
158  plugin->exposed.dasum = nullptr;
159  plugin->exposed.dcopy = nullptr;
160  plugin->exposed.codegen_axpy_aux = &blasfeo_codegen_axpy_aux;
161  plugin->exposed.codegen_dot_aux = &blasfeo_codegen_dot_aux;
162  plugin->exposed.codegen_scal_aux = nullptr;
163  plugin->exposed.codegen_nrm2_aux = nullptr;
164  plugin->exposed.codegen_asum_aux = nullptr;
165  plugin->options = nullptr;
166  plugin->deserialize = nullptr;
167  plugin->creator = nullptr;
168  return 0;
169  }
static void blasfeo_daxpy(casadi_int n, double alpha, const double *x, double *y)
static void blasfeo_codegen_dot_aux(CodeGenerator &g, const std::vector< std::string > &inst)
static void blasfeo_codegen_mtimes(CodeGenerator &g, const std::string &A, casadi_int m, casadi_int k, const std::string &B, casadi_int n, const std::string &C)
static void blasfeo_dgemm(int transa, int transb, casadi_int m, casadi_int n, casadi_int k, double alpha, const double *A, casadi_int lda, const double *B, casadi_int ldb, double beta, double *C, casadi_int ldc)
static void blasfeo_codegen_axpy_aux(CodeGenerator &g, const std::vector< std::string > &inst)
static double blasfeo_ddot(casadi_int n, const double *x, const double *y)

References blasfeo_codegen_axpy_aux(), blasfeo_codegen_dot_aux(), blasfeo_codegen_mtimes(), blasfeo_daxpy(), blasfeo_ddot(), blasfeo_dgemm(), and casadi::BlasBlasfeo::meta_doc.

Referenced by casadi_load_blas_blasfeo().

◆ casadi_register_blas_classic()

int CASADI_BLAS_CLASSIC_EXPORT casadi::casadi_register_blas_classic ( Blas::Plugin *  plugin)

Definition at line 234 of file blas_classic.cpp.

234  {
235  plugin->name = "classic";
236  plugin->doc = BlasClassic::meta_doc.c_str();
237  plugin->version = CASADI_VERSION;
238  plugin->exposed.dgemm = &classic_dgemm;
239  plugin->exposed.codegen_mtimes = &classic_codegen_mtimes;
240  plugin->exposed.daxpy = &classic_daxpy;
241  plugin->exposed.ddot = &classic_ddot;
242  plugin->exposed.dscal = &classic_dscal;
243  plugin->exposed.dnrm2 = &classic_dnrm2;
244  plugin->exposed.dasum = &classic_dasum;
245  plugin->exposed.dcopy = &classic_dcopy;
246  plugin->exposed.codegen_axpy_aux = &classic_codegen_axpy_aux;
247  plugin->exposed.codegen_dot_aux = &classic_codegen_dot_aux;
248  plugin->exposed.codegen_scal_aux = &classic_codegen_scal_aux;
249  plugin->exposed.codegen_nrm2_aux = &classic_codegen_nrm2_aux;
250  plugin->exposed.codegen_asum_aux = &classic_codegen_asum_aux;
251  plugin->options = nullptr;
252  plugin->deserialize = nullptr;
253  plugin->creator = nullptr;
254  return 0;
255  }
static void classic_codegen_nrm2_aux(CodeGenerator &g, const std::vector< std::string > &inst)
static void classic_codegen_asum_aux(CodeGenerator &g, const std::vector< std::string > &inst)
static void classic_codegen_dot_aux(CodeGenerator &g, const std::vector< std::string > &inst)
static double classic_dasum(casadi_int n, const double *x)
static void classic_codegen_mtimes(CodeGenerator &g, const std::string &A, casadi_int m, casadi_int k, const std::string &B, casadi_int n, const std::string &C)
static void classic_dcopy(const double *x, casadi_int n, double *y)
static void classic_dgemm(int transa, int transb, casadi_int m, casadi_int n, casadi_int k, double alpha, const double *A, casadi_int lda, const double *B, casadi_int ldb, double beta, double *C, casadi_int ldc)
static double classic_ddot(casadi_int n, const double *x, const double *y)
static void classic_codegen_axpy_aux(CodeGenerator &g, const std::vector< std::string > &inst)
static void classic_daxpy(casadi_int n, double alpha, const double *x, double *y)
static void classic_codegen_scal_aux(CodeGenerator &g, const std::vector< std::string > &inst)
static void classic_dscal(casadi_int n, double alpha, double *x)
static double classic_dnrm2(casadi_int n, const double *x)

References classic_codegen_asum_aux(), classic_codegen_axpy_aux(), classic_codegen_dot_aux(), classic_codegen_mtimes(), classic_codegen_nrm2_aux(), classic_codegen_scal_aux(), classic_dasum(), classic_daxpy(), classic_dcopy(), classic_ddot(), classic_dgemm(), classic_dnrm2(), classic_dscal(), and casadi::BlasClassic::meta_doc.

Referenced by casadi_load_blas_classic().

◆ 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 107 of file gurobi_interface.cpp.

107  {
108  plugin->creator = GurobiInterface::creator;
109  plugin->name = "gurobi";
110  plugin->doc = GurobiInterface::meta_doc.c_str();
111  plugin->version = CASADI_VERSION;
112  plugin->options = &GurobiInterface::options_;
113  plugin->deserialize = &GurobiInterface::deserialize;
114  #ifdef GUROBI_ADAPTOR
115  char buffer[400];
116  int ret = gurobi_adaptor_load(buffer, sizeof(buffer));
117  if (ret!=0) {
118  casadi_warning("Failed to load Gurobi adaptor: " + std::string(buffer) + ".");
119  return 1;
120  }
121  #endif
122  return 0;
123  }

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_mosek()

int CASADI_CONIC_MOSEK_EXPORT casadi::casadi_register_conic_mosek ( Conic::Plugin *  plugin)

Definition at line 38 of file mosek_interface.cpp.

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

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

Referenced by casadi_load_conic_mosek().

◆ 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 50 of file osqp_interface.cpp.

50  {
51  plugin->creator = OsqpInterface::creator;
52  plugin->name = "osqp";
53  plugin->doc = OsqpInterface::meta_doc.c_str();
54  plugin->version = CASADI_VERSION;
55  plugin->options = &OsqpInterface::options_;
56  plugin->deserialize = &OsqpInterface::deserialize;
57  return 0;
58  }

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

Referenced by casadi_load_conic_osqp().

◆ casadi_register_conic_piqp()

int CASADI_CONIC_PIQP_EXPORT casadi::casadi_register_conic_piqp ( Conic::Plugin *  plugin)

Definition at line 35 of file piqp_interface.cpp.

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

References casadi_register_conic_piqp().

Referenced by casadi_load_conic_piqp(), and casadi_register_conic_piqp().

◆ 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_conic_xpress()

int CASADI_CONIC_XPRESS_EXPORT casadi::casadi_register_conic_xpress ( Conic::Plugin *  plugin)

Definition at line 46 of file xpress_interface.cpp.

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

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

Referenced by casadi_load_conic_xpress().

◆ 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_graphmodel_onnx()

int CASADI_GRAPHMODEL_ONNX_EXPORT casadi::casadi_register_graphmodel_onnx ( GraphModelInternal::Plugin *  plugin)

Definition at line 35 of file onnx_model.cpp.

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

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

Referenced by casadi_load_graphmodel_onnx().

◆ casadi_register_importer_clang()

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

Definition at line 46 of file clang_compiler.cpp.

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

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 34 of file csparse_interface.cpp.

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

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  plugin->exposed.det = &SymbolicQr::det;
44  return 0;
45  }

References casadi::SymbolicQr::creator(), casadi::SymbolicQr::deserialize(), casadi::SymbolicQr::det(), 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_modelicaparser_lacemodelica()

int CASADI_MODELICAPARSER_LACEMODELICA_EXPORT casadi::casadi_register_modelicaparser_lacemodelica ( ModelicaParserInternal::Plugin *  plugin)

Definition at line 33 of file lace_modelica.cpp.

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

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

Referenced by casadi_load_modelicaparser_lacemodelica().

◆ 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 36 of file ampl_interface.cpp.

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

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_ccopt()

int CASADI_NLPSOL_CCOPT_EXPORT casadi::casadi_register_nlpsol_ccopt ( Nlpsol::Plugin *  plugin)

Definition at line 46 of file ccopt_interface.cpp.

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

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

Referenced by casadi_load_nlpsol_ccopt().

◆ casadi_register_nlpsol_fatrop()

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

Definition at line 53 of file fatrop_interface.cpp.

53  {
54  plugin->creator = FatropInterface::creator;
55  plugin->name = "fatrop";
56  plugin->doc = FatropInterface::meta_doc.c_str();
57  plugin->version = CASADI_VERSION;
58  plugin->options = &FatropInterface::options_;
59  plugin->deserialize = &FatropInterface::deserialize;
60  return 0;
61  }

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 46 of file madnlp_interface.cpp.

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

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_uno()

int CASADI_NLPSOL_UNO_EXPORT casadi::casadi_register_nlpsol_uno ( Nlpsol::Plugin *  plugin)

Definition at line 39 of file uno_interface.cpp.

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

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

Referenced by casadi_load_nlpsol_uno().

◆ 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_onnx_ort()

int CASADI_ONNX_ORT_EXPORT casadi::casadi_register_onnx_ort ( OnnxFunction::Plugin *  plugin)

Definition at line 31 of file ort_interface.cpp.

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

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

Referenced by casadi_load_onnx_ort().

◆ 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_tensor_ttv()

template<typename T1 >
void casadi::casadi_tensor_ttv ( T1 *  ret,
casadi_int  dim,
casadi_int  n_dims,
const T1 *  all_w,
const casadi_int *  w_offset,
const casadi_int *  starts,
const casadi_int *  strides,
const T1 *  c,
casadi_int  m,
T1  weight,
casadi_int  offset 
)

◆ 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_uno_term_cb_cpp()

static uno_int casadi::casadi_uno_term_cb_cpp ( uno_int  ,
uno_int  ,
const double *  primals,
const double *  lower_mult,
const double *  upper_mult,
const double *  constraint_mult,
double  ,
double  ,
double  ,
double  ,
void *  user_data 
)
static

Definition at line 187 of file uno_interface.cpp.

189  {
190  constexpr uno_int CONTINUE = 1;
191  constexpr uno_int TERMINATE = 0;
192  auto* m = static_cast<UnoMemory*>(user_data); // wired in init_mem
193  const UnoInterface& self = m->self;
194  if (self.fcallback_.is_null()) return CONTINUE;
195 
196  auto* d_nlp = &m->d_nlp;
197  casadi_copy(primals, self.nx_, d_nlp->z);
198  for (casadi_int i = 0; i < self.nx_; ++i) {
199  // Negative sign convention: bound multipliers are added (cf casadi_uno_solve).
200  d_nlp->lam[i] = lower_mult[i] + upper_mult[i];
201  }
202  if (self.ng_ > 0) {
203  casadi_copy(constraint_mult, self.ng_, d_nlp->lam + self.nx_);
204  }
205  std::fill_n(m->arg, self.fcallback_.n_in(), nullptr);
206  m->arg[NLPSOL_X] = d_nlp->z;
207  m->arg[NLPSOL_LAM_X] = d_nlp->lam;
208  m->arg[NLPSOL_LAM_G] = d_nlp->lam + self.nx_;
209  std::fill_n(m->res, self.fcallback_.n_out(), nullptr);
210  double ret_double = 0;
211  m->res[0] = &ret_double;
212  try {
213  self.fcallback_(m->arg, m->res, m->iw, m->w, 0);
214  } catch (KeyboardInterruptException&) {
215  return TERMINATE;
216  } catch (std::exception& ex) {
217  casadi_warning(std::string("intermediate_callback: ") + ex.what());
218  return self.iteration_callback_ignore_errors_ ? CONTINUE : TERMINATE;
219  }
220  return static_cast<casadi_int>(ret_double) ? TERMINATE : CONTINUE;
221  }

References casadi_copy(), NLPSOL_LAM_G, NLPSOL_LAM_X, NLPSOL_X, and casadi::FunctionInternal::self().

Referenced by casadi::UnoInterface::init_mem().

◆ 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(), casadi::GurobiInterface::init(), and casadi::XpressInterface::init().

◆ classic_codegen_asum_aux()

static void casadi::classic_codegen_asum_aux ( CodeGenerator g,
const std::vector< std::string > &  inst 
)
static

Definition at line 219 of file blas_classic.cpp.

220  {
221  // Match casadi_norm_1<T>'s null-pointer semantics: returns 0 on x==NULL.
222  static const char* SRC =
223  "// SYMBOL \"norm_1\"\n"
224  "casadi_real casadi_norm_1(casadi_int n, const casadi_real* x) {\n"
225  " int n_ = (int)n, inc = 1;\n"
226  " if (!x) return 0;\n"
227  " return CASADI_BLAS_DASUM(&n_, x, &inc);\n"
228  "}\n";
229  g.auxiliaries << CLASSIC_DASUM_DECL << "\n";
230  g.auxiliaries << g.sanitize_source(SRC, inst);
231  }
static const char * CLASSIC_DASUM_DECL

References casadi::CodeGenerator::auxiliaries, CLASSIC_DASUM_DECL, and casadi::CodeGenerator::sanitize_source().

Referenced by casadi_register_blas_classic().

◆ classic_codegen_axpy_aux()

static void casadi::classic_codegen_axpy_aux ( CodeGenerator g,
const std::vector< std::string > &  inst 
)
static

Definition at line 169 of file blas_classic.cpp.

170  {
171  static const char* SRC =
172  "// SYMBOL \"axpy\"\n"
173  "void casadi_axpy(casadi_int n, casadi_real alpha,\n"
174  " const casadi_real* x, casadi_real* y) {\n"
175  " int n_ = (int)n, inc = 1;\n"
176  " CASADI_BLAS_DAXPY(&n_, &alpha, x, &inc, y, &inc);\n"
177  "}\n";
178  g.auxiliaries << CLASSIC_DAXPY_DECL << "\n";
179  g.auxiliaries << g.sanitize_source(SRC, inst);
180  }
static const char * CLASSIC_DAXPY_DECL

References casadi::CodeGenerator::auxiliaries, CLASSIC_DAXPY_DECL, and casadi::CodeGenerator::sanitize_source().

Referenced by casadi_register_blas_classic().

◆ classic_codegen_dot_aux()

static void casadi::classic_codegen_dot_aux ( CodeGenerator g,
const std::vector< std::string > &  inst 
)
static

Definition at line 194 of file blas_classic.cpp.

195  {
196  static const char* SRC =
197  "// SYMBOL \"dot\"\n"
198  "casadi_real casadi_dot(casadi_int n,\n"
199  " const casadi_real* x, const casadi_real* y) {\n"
200  " int n_ = (int)n, inc = 1;\n"
201  " return CASADI_BLAS_DDOT(&n_, x, &inc, y, &inc);\n"
202  "}\n";
203  g.auxiliaries << CLASSIC_DDOT_DECL << "\n";
204  g.auxiliaries << g.sanitize_source(SRC, inst);
205  }
static const char * CLASSIC_DDOT_DECL

References casadi::CodeGenerator::auxiliaries, CLASSIC_DDOT_DECL, and casadi::CodeGenerator::sanitize_source().

Referenced by casadi_register_blas_classic().

◆ classic_codegen_mtimes()

static void casadi::classic_codegen_mtimes ( CodeGenerator g,
const std::string &  A,
casadi_int  m,
casadi_int  k,
const std::string &  B,
casadi_int  n,
const std::string &  C 
)
static

Definition at line 150 of file blas_classic.cpp.

152  {
153  g.add_external(CLASSIC_DECL);
154  // Locals shared with other Fortran-ABI BLAS plugins. g.local is
155  // idempotent on (name,type) match, so multiple plugins coexisting in
156  // the same Function reuse the same locals safely.
157  g.local("blas_tn", "char"); g.init_local("blas_tn", "'N'");
158  g.local("blas_one", "double"); g.init_local("blas_one", "1.0");
159  g.local("blas_m", "int");
160  g.local("blas_n", "int");
161  g.local("blas_k", "int");
162  g << "blas_m = " << m << "; blas_n = " << n << "; blas_k = " << k << ";\n";
163  g << "CASADI_BLAS_DGEMM(&blas_tn, &blas_tn, &blas_m, &blas_n, &blas_k, "
164  "&blas_one, " << A << ", &blas_m, " << B << ", &blas_k, "
165  "&blas_one, " << C << ", &blas_m);\n";
166  }

References casadi::CodeGenerator::add_external(), C, CLASSIC_DECL, casadi::CodeGenerator::init_local(), and casadi::CodeGenerator::local().

Referenced by casadi_register_blas_classic().

◆ classic_codegen_nrm2_aux()

static void casadi::classic_codegen_nrm2_aux ( CodeGenerator g,
const std::vector< std::string > &  inst 
)
static

Definition at line 207 of file blas_classic.cpp.

208  {
209  static const char* SRC =
210  "// SYMBOL \"norm_2\"\n"
211  "casadi_real casadi_norm_2(casadi_int n, const casadi_real* x) {\n"
212  " int n_ = (int)n, inc = 1;\n"
213  " return CASADI_BLAS_DNRM2(&n_, x, &inc);\n"
214  "}\n";
215  g.auxiliaries << CLASSIC_DNRM2_DECL << "\n";
216  g.auxiliaries << g.sanitize_source(SRC, inst);
217  }
static const char * CLASSIC_DNRM2_DECL

References casadi::CodeGenerator::auxiliaries, CLASSIC_DNRM2_DECL, and casadi::CodeGenerator::sanitize_source().

Referenced by casadi_register_blas_classic().

◆ classic_codegen_scal_aux()

static void casadi::classic_codegen_scal_aux ( CodeGenerator g,
const std::vector< std::string > &  inst 
)
static

Definition at line 182 of file blas_classic.cpp.

183  {
184  static const char* SRC =
185  "// SYMBOL \"scal\"\n"
186  "void casadi_scal(casadi_int n, casadi_real alpha, casadi_real* x) {\n"
187  " int n_ = (int)n, inc = 1;\n"
188  " CASADI_BLAS_DSCAL(&n_, &alpha, x, &inc);\n"
189  "}\n";
190  g.auxiliaries << CLASSIC_DSCAL_DECL << "\n";
191  g.auxiliaries << g.sanitize_source(SRC, inst);
192  }
static const char * CLASSIC_DSCAL_DECL

References casadi::CodeGenerator::auxiliaries, CLASSIC_DSCAL_DECL, and casadi::CodeGenerator::sanitize_source().

Referenced by casadi_register_blas_classic().

◆ classic_dasum()

static double casadi::classic_dasum ( casadi_int  n,
const double *  x 
)
static

Definition at line 88 of file blas_classic.cpp.

88  {
89  casadi_assert(n <= INT_MAX,
90  "BLAS 'classic' plugin: vector length exceeds 32-bit BLAS ABI.");
91  int n_ = static_cast<int>(n), inc = 1;
92  return dasum_(&n_, x, &inc);
93  }

Referenced by casadi_register_blas_classic().

◆ classic_daxpy()

static void casadi::classic_daxpy ( casadi_int  n,
double  alpha,
const double *  x,
double *  y 
)
static

Definition at line 58 of file blas_classic.cpp.

59  {
60  casadi_assert(n <= INT_MAX,
61  "BLAS 'classic' plugin: vector length exceeds 32-bit BLAS ABI.");
62  int n_ = static_cast<int>(n), inc = 1;
63  daxpy_(&n_, &alpha, x, &inc, y, &inc);
64  }

Referenced by casadi_register_blas_classic().

◆ classic_dcopy()

static void casadi::classic_dcopy ( const double *  x,
casadi_int  n,
double *  y 
)
static

Definition at line 95 of file blas_classic.cpp.

95  {
96  if (!y) return;
97  if (x) std::memcpy(y, x, n * sizeof(double));
98  else std::memset(y, 0, n * sizeof(double));
99  }

Referenced by casadi_register_blas_classic().

◆ classic_ddot()

static double casadi::classic_ddot ( casadi_int  n,
const double *  x,
const double *  y 
)
static

Definition at line 66 of file blas_classic.cpp.

67  {
68  casadi_assert(n <= INT_MAX,
69  "BLAS 'classic' plugin: vector length exceeds 32-bit BLAS ABI.");
70  int n_ = static_cast<int>(n), inc = 1;
71  return ddot_(&n_, x, &inc, y, &inc);
72  }

Referenced by casadi_register_blas_classic().

◆ classic_dgemm()

static void casadi::classic_dgemm ( int  transa,
int  transb,
casadi_int  m,
casadi_int  n,
casadi_int  k,
double  alpha,
const double *  A,
casadi_int  lda,
const double *  B,
casadi_int  ldb,
double  beta,
double *  C,
casadi_int  ldc 
)
static

Definition at line 35 of file blas_classic.cpp.

41  {
42  // Fortran BLAS-32 takes int by reference. Guard against ILP64 / huge
43  // problems before silently truncating.
44  casadi_assert(m <= INT_MAX && n <= INT_MAX && k <= INT_MAX
45  && lda <= INT_MAX && ldb <= INT_MAX && ldc <= INT_MAX,
46  "BLAS 'classic' plugin: matrix dimension exceeds 32-bit BLAS ABI. "
47  "Rebuild against an ILP64 BLAS or use the \"reference\" plugin.");
48 
49  const char ta = (transa == CASADI_BLAS_TRANS) ? 'T' : 'N';
50  const char tb = (transb == CASADI_BLAS_TRANS) ? 'T' : 'N';
51  int m_ = static_cast<int>(m), n_ = static_cast<int>(n), k_ = static_cast<int>(k);
52  int lda_ = static_cast<int>(lda), ldb_ = static_cast<int>(ldb), ldc_ = static_cast<int>(ldc);
53 
54  dgemm_(&ta, &tb, &m_, &n_, &k_, &alpha,
55  A, &lda_, B, &ldb_, &beta, C, &ldc_);
56  }

References C, and CASADI_BLAS_TRANS.

Referenced by casadi_register_blas_classic().

◆ classic_dnrm2()

static double casadi::classic_dnrm2 ( casadi_int  n,
const double *  x 
)
static

Definition at line 81 of file blas_classic.cpp.

81  {
82  casadi_assert(n <= INT_MAX,
83  "BLAS 'classic' plugin: vector length exceeds 32-bit BLAS ABI.");
84  int n_ = static_cast<int>(n), inc = 1;
85  return dnrm2_(&n_, x, &inc);
86  }

Referenced by casadi_register_blas_classic().

◆ classic_dscal()

static void casadi::classic_dscal ( casadi_int  n,
double  alpha,
double *  x 
)
static

Definition at line 74 of file blas_classic.cpp.

74  {
75  casadi_assert(n <= INT_MAX,
76  "BLAS 'classic' plugin: vector length exceeds 32-bit BLAS ABI.");
77  int n_ = static_cast<int>(n), inc = 1;
78  dscal_(&n_, &alpha, x, &inc);
79  }

Referenced by casadi_register_blas_classic().

◆ codegen_copy_z()

static void casadi::codegen_copy_z ( CodeGenerator g,
casadi_int  nnz,
const std::vector< casadi_int > &  arg,
const std::vector< casadi_int > &  res,
const std::vector< bool > &  arg_is_ref 
)
static

Definition at line 142 of file multiplication.cpp.

145  {
146  if (arg[0]!=res[0] || arg_is_ref[0]) {
147  g << g.copy(g.work(arg[0], nnz, arg_is_ref[0]),
148  nnz,
149  g.work(res[0], nnz, false)) << '\n';
150  }
151  }

References casadi::CodeGenerator::copy(), and casadi::CodeGenerator::work().

Referenced by casadi::Multiplication::generate(), casadi::DenseMultiplication::generate(), casadi::DenseSparseMultiplication::generate(), and casadi::PseudoDenseMultiplication::generate().

◆ codegen_int_array()

static void casadi::codegen_int_array ( CodeGenerator g,
const std::string &  name,
const std::vector< uno_int > &  v 
)
static

Definition at line 398 of file uno_interface.cpp.

399  {
400  if (v.empty()) {
401  g << "p." << name << " = 0;\n";
402  return;
403  }
404  g << g.array("static const int", "p_" + name, v.size(),
405  g.initializer(vector_static_cast<casadi_int>(v)));
406  g << "p." << name << " = p_" << name << ";\n";
407  }

References casadi::CodeGenerator::array(), and casadi::CodeGenerator::initializer().

◆ codegen_int_field() [1/2]

static void casadi::codegen_int_field ( CodeGenerator g,
const std::string &  prob_field,
const std::string &  local_name,
const std::vector< int > &  v 
)
static

Definition at line 165 of file mosek_interface.cpp.

166  {
167  if (v.empty()) {
168  g << "p." << prob_field << " = 0;\n";
169  } else {
170  g.constant_copy(local_name, vector_static_cast<casadi_int>(v), "int");
171  g << "p." << prob_field << " = " << local_name << ";\n";
172  }
173  }

References casadi::CodeGenerator::constant_copy().

Referenced by casadi::MosekInterface::set_mosek_prob(), and casadi::XpressInterface::set_xpress_prob().

◆ codegen_int_field() [2/2]

static void casadi::codegen_int_field ( CodeGenerator g,
const std::string &  prob_field,
const std::string &  local_name,
const std::vector< int > &  v 
)
static

Definition at line 226 of file xpress_interface.cpp.

227  {
228  if (v.empty()) {
229  g << "p." << prob_field << " = 0;\n";
230  } else {
231  g.constant_copy(local_name, vector_static_cast<casadi_int>(v), "int");
232  g << "p." << prob_field << " = " << local_name << ";\n";
233  }
234  }

References casadi::CodeGenerator::constant_copy().

◆ 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::DaqpInterface::set_daqp_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 813 of file fatrop_interface.cpp.

814  {
815  casadi_int sz = blocks.size();
816  if (sz==0) sz++;
817  std::string n = "block_" + name + "[" + str(sz) + "]";
818  g.local(n, "static struct casadi_ocp_block");
819  g << "p." << name << " = block_" + name + ";\n";
820  g << "casadi_unpack_ocp_blocks(" << "p." << name
821  << ", " << g.constant(fatrop_blocks_pack(blocks)) << ");\n";
822  }
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 827 of file generic_type.cpp.

827  {
828  if (first.empty()) return second;
829  if (second.empty()) return first;
830  Dict ret = second;
831  update_dict(ret, first, recurse);
832  return ret;
833  }
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().

◆ common_simp_binary()

template<class T , typename SU , typename SB >
T casadi::common_simp_binary ( casadi_int  op,
const T &  x,
const T &  y,
casadi_int  depth,
SU &&  gen_unary,
SB &&  gen_binary,
bool  unique_x,
bool  unique_y,
bool &  hit 
)

Definition at line 1871 of file calculus.hpp.

1876  {
1877  hit = true;
1878  switch (op) {
1879  case OP_ADD:
1880  if (x.is_zero())
1881  return y;
1882  else if (y->is_zero()) // term2 is zero
1883  return x;
1884  else if (y.is_op(OP_NEG)) // x + (-y) -> x - y
1885  return x - (-y);
1886  else if (x.is_op(OP_NEG)) // (-x) + y -> y - x
1887  return y - x.dep();
1888  else if (is_equal(x, y, depth))
1889  return 2*x; // x+x -> 2*x
1890  else if (x.is_op(OP_MUL) && y.is_op(OP_MUL) &&
1891  x.dep(0).is_constant() && static_cast<double>(x.dep(0))==0.5 &&
1892  y.dep(0).is_constant() && static_cast<double>(y.dep(0))==0.5 &&
1893  is_equal(y.dep(1), x.dep(1), depth)) // 0.5x+0.5x = x
1894  return x.dep(1);
1895  else if (x.is_op(OP_DIV) && y.is_op(OP_DIV) &&
1896  x.dep(1).is_constant() && static_cast<double>(x.dep(1))==2 &&
1897  y.dep(1).is_constant() && static_cast<double>(y.dep(1))==2 &&
1898  is_equal(y.dep(0), x.dep(0), depth)) // x/2+x/2 = x
1899  return x.dep(0);
1900  else if (x.is_op(OP_MUL) && y.is_op(OP_MUL) &&
1901  x.dep(0).is_constant() && y.dep(0).is_constant() &&
1902  static_cast<double>(x.dep(0))+static_cast<double>(y.dep(0))==1 &&
1903  is_equal(y.dep(1), x.dep(1), depth)
1904  )
1905  return x.dep(1);
1906  else if (x.is_op(OP_SUB) && is_equal(x.dep(1), y, depth))
1907  return x.dep(0);
1908  else if (y.is_op(OP_SUB) && is_equal(x, y.dep(1), depth))
1909  return y.dep(0);
1910  else if (x.is_op(OP_SQ) && y.is_op(OP_SQ) &&
1911  ((x.dep().is_op(OP_SIN) && y.dep().is_op(OP_COS))
1912  || (x.dep().is_op(OP_COS) && y.dep().is_op(OP_SIN)))
1913  && is_equal(x.dep().dep(), y.dep().dep(), depth))
1914  return 1; // sin^2 + cos^2 -> 1
1915  else if (x.is_doubled() && is_equal(x.dep(0), y, depth))
1916  return 3*x.dep(0);
1917  else if (y.is_doubled() && is_equal(y.dep(0), x, depth))
1918  return 3*y.dep(0);
1919  else if (x.is_op(OP_MUL) && y.is_op(OP_MUL) &&
1920  is_equal(x.dep(0), y.dep(0), depth) && (x.dep(1)+y.dep(1)).is_one())
1921  return x.dep(0);
1922  break;
1923  case OP_SUB:
1924  if (y.is_zero()) // term2 is zero
1925  return x;
1926  if (x.is_zero()) // term1 is zero
1927  return -y;
1928  if (is_equal(x, y, depth)) // the terms are equal
1929  return 0;
1930  else if (y.is_op(OP_NEG)) // x - (-y) -> x + y
1931  return x + y.dep();
1932  else if (x.is_op(OP_ADD) && is_equal(x.dep(1), y, depth))
1933  return x.dep(0);
1934  else if (x.is_op(OP_ADD) && is_equal(x.dep(0), y, depth))
1935  return x.dep(1);
1936  else if (y.is_op(OP_ADD) && is_equal(x, y.dep(1), depth))
1937  return -y.dep(0);
1938  else if (y.is_op(OP_ADD) && is_equal(x, y.dep(0), depth))
1939  return -y.dep(1);
1940  else if (x.is_op(OP_NEG))
1941  return -(x.dep() + y);
1942  else if (x.is_op(OP_MUL) && y.is_op(OP_MUL) &&
1943  x.dep(0).is_constant() && y.dep(0).is_constant() &&
1944  static_cast<double>(x.dep(0))-static_cast<double>(y.dep(0))==1 &&
1945  is_equal(y.dep(1), x.dep(1), depth)
1946  )
1947  return x.dep(1);
1948  else if (x.is_doubled() && is_equal(x.dep(0), y, depth))
1949  return y;
1950  else if (y.is_doubled() && is_equal(y.dep(0), x, depth))
1951  return -x;
1952  break;
1953  case OP_MUL:
1954  if (is_equal(y, x, depth))
1955  return sq(x);
1956  else if (!x.is_constant() && y.is_constant())
1957  return y * x;
1958  else if (x.is_zero() || y->is_zero()) // one of the terms is zero
1959  return 0;
1960  else if (x.is_one()) // term1 is one
1961  return y;
1962  else if (y.is_one()) // term2 is one
1963  return x;
1964  else if (y.is_minus_one())
1965  return -x;
1966  else if (x.is_minus_one())
1967  return -y;
1968  else if (y.is_op(OP_INV))
1969  return x/y.inv();
1970  else if (x.is_op(OP_INV))
1971  return y / x.inv();
1972  else if (x.is_constant() && y.is_op(OP_MUL) && y.dep(0).is_constant() &&
1973  static_cast<double>(x)*static_cast<double>(y.dep(0))==1) // 5*(0.2*x) = x
1974  return y.dep(1);
1975  else if (x.is_constant() && y.is_doubled() &&
1976  static_cast<double>(x)*2==1) // 0.5*(2*x) = x
1977  return y.dep(0);
1978  else if (x.is_constant() && y.is_op(OP_DIV) && y.dep(1).is_constant() &&
1979  static_cast<double>(x)==static_cast<double>(y.dep(1))) // 5*(x/5) = x
1980  return y.dep(0);
1981  else if (x.is_constant() && static_cast<double>(x)==2)
1982  return gen_unary(OP_TWICE, y);
1983  else if (y.is_constant() && static_cast<double>(y)==2)
1984  return gen_unary(OP_TWICE, x);
1985  else if (x.is_op(OP_DIV) && is_equal(x.dep(1), y, depth)) // ((2/x)*x)
1986  return x.dep(0);
1987  else if (y.is_op(OP_DIV) &&
1988  is_equal(y.dep(1), x, depth)) // ((2/x)*x)
1989  return y.dep(0);
1990  else if (x.is_op(OP_NEG))
1991  return -(x.dep() * y);
1992  else if (y.is_op(OP_NEG))
1993  return -(x * y.dep());
1994  else if (unique_x && x.is_op(OP_ADD) && x.dep(1).is_op(OP_DIV) &&
1995  is_equal(x.dep(1).dep(1), y, depth))
1996  return x.dep(0)*y + x.dep(1).dep(0); // (a + b/c)*c -> a*c + b
1997  else if (unique_x && x.is_op(OP_ADD) && x.dep(0).is_op(OP_DIV) &&
1998  is_equal(x.dep(0).dep(1), y, depth))
1999  return x.dep(0).dep(0)+x.dep(1)*y; // (a/c + b)*c -> a*c + b
2000  else if (unique_y && y.is_op(OP_ADD) && y.dep(1).is_op(OP_DIV) &&
2001  is_equal(y.dep(1).dep(1), x, depth))
2002  return x*y.dep(0) + y.dep(1).dep(0); // c*(a + b/c) -> c*a + b
2003  else if (unique_y && y.is_op(OP_ADD) && y.dep(0).is_op(OP_DIV) &&
2004  is_equal(y.dep(0).dep(1), x, depth))
2005  return y.dep(0).dep(0) + x*y.dep(1); // c*(a/c + b) -> a + c*b
2006  else if (unique_x && x.is_op(OP_SUB) && x.dep(1).is_op(OP_DIV) &&
2007  is_equal(x.dep(1).dep(1), y, depth))
2008  return x.dep(0)*y - x.dep(1).dep(0); // (a - b/c)*c -> a*c - b
2009  else if (unique_x && x.is_op(OP_SUB) && x.dep(0).is_op(OP_DIV) &&
2010  is_equal(x.dep(0).dep(1), y, depth))
2011  return x.dep(0).dep(0)-x.dep(1)*y; // (a/c - b)*c -> a*c - b
2012  else if (unique_y && y.is_op(OP_SUB) && y.dep(1).is_op(OP_DIV) &&
2013  is_equal(y.dep(1).dep(1), x, depth))
2014  return x*y.dep(0) - y.dep(1).dep(0); // c*(a - b/c) -> c*a - b
2015  else if (unique_y && y.is_op(OP_SUB) && y.dep(0).is_op(OP_DIV) &&
2016  is_equal(y.dep(0).dep(1), x, depth))
2017  return y.dep(0).dep(0) - x*y.dep(1); // c*(a/c - b) -> a - c*b
2018  else if (x.is_constant() && y.is_op(OP_MUL) && y.dep(0).is_constant())
2019  return x*y.dep(0)*y.dep(1); // a*(b*x) -> (a*b)*x
2020  else if (y.is_constant() && x.is_op(OP_MUL) && x.dep(0).is_constant())
2021  return y*x.dep(0)*x.dep(1); // (a*x)*b -> (a*b)*x
2022  break;
2023  case OP_DIV:
2024  if (y.is_zero()) // term2 is zero
2025  return std::numeric_limits<double>::infinity();
2026  else if (x.is_zero()) // term1 is zero
2027  return 0;
2028  else if (y.is_one()) // term2 is one
2029  return x;
2030  else if (y.is_minus_one())
2031  return -x;
2032  else if (y.is_half())
2033  return 2*x;
2034  else if (is_equal(x, y, depth)) // terms are equal
2035  return 1;
2036  else if (x.is_doubled() && y.is_constant() && static_cast<double>(y)==2)
2037  return x.dep(0);
2038  else if (x.is_doubled() && is_equal(y, x.dep(0), depth))
2039  return 2;
2040  else if (x.is_op(OP_MUL) && is_equal(y, x.dep(0), depth))
2041  return x.dep(1);
2042  else if (x.is_op(OP_MUL) && is_equal(y, x.dep(1), depth))
2043  return x.dep(0);
2044  else if (x.is_one())
2045  return y.inv();
2046  else if (y.is_op(OP_INV))
2047  return x*y.inv();
2048  else if (x.is_doubled() && y.is_doubled())
2049  return x.dep(0) / y->dep(0);
2050  else if (y.is_constant() && x.is_op(OP_DIV) && x.dep(1).is_constant() &&
2051  static_cast<double>(y)*static_cast<double>(x.dep(1))==1) // (x/5)/0.2
2052  return x.dep(0);
2053  else if (y.is_op(OP_MUL) &&
2054  is_equal(y.dep(1), x, depth)) // x/(2*x) = 1/2
2055  return 1/y.dep(0); //BinarySX::create(OP_DIV, 1, y.dep(0));
2056  else if (y.is_doubled() &&
2057  is_equal(y.dep(0), x, depth)) // x/(2*x) = 1/2
2058  return 0.5;
2059  else if (x.is_op(OP_NEG) &&
2060  is_equal(x.dep(0), y, depth)) // (-x)/x = -1
2061  return -1;
2062  else if (y.is_op(OP_NEG) &&
2063  is_equal(y.dep(0), x, depth)) // x/(-x) = 1
2064  return -1;
2065  else if (y.is_op(OP_NEG) && x.is_op(OP_NEG) &&
2066  is_equal(x.dep(0), y.dep(0), depth)) // (-x)/(-x) = 1
2067  return 1;
2068  else if (x.is_op(OP_DIV) && is_equal(y, x.dep(0), depth))
2069  return x.dep(1).inv();
2070  else if (x.is_op(OP_NEG))
2071  return -(x.dep() / y);
2072  else if (y.is_op(OP_NEG))
2073  return -(x / y.dep());
2074  break;
2075  case OP_POW:
2076  if (y.is_constant()) {
2077  if (y.is_integer()) {
2078  casadi_int nn = y->to_int();
2079  if (nn == 0) {
2080  return 1;
2081  } else if (nn>100 || nn<-100) { // maximum depth
2082  return gen_binary(OP_CONSTPOW, x, nn);
2083  } else if (nn<0) { // negative power
2084  return 1/pow(x, -nn);
2085  } else if (nn%2 == 1) { // odd power
2086  return x*pow(x, nn-1);
2087  } else { // even power
2088  T rt = pow(x, static_cast<casadi_int>(nn/2));
2089  return rt*rt;
2090  }
2091  } else if (y->to_double()==0.5) {
2092  return sqrt(x);
2093  } else {
2094  return gen_binary(OP_CONSTPOW, x, y);
2095  }
2096  }
2097  break;
2098  case OP_LE:
2099  if ((y-x).is_nonnegative())
2100  return 1;
2101  break;
2102  case OP_FMIN:
2103  if (x.is_inf()) return y;
2104  if (y.is_inf()) return x;
2105  if (x.is_minus_inf() || y.is_minus_inf()) return -std::numeric_limits<double>::infinity();
2106  if (is_equal(x, y, depth)) return x;
2107  break;
2108  case OP_FMAX:
2109  if (x.is_minus_inf()) return y;
2110  if (y.is_minus_inf()) return x;
2111  if (x.is_inf() || y.is_inf()) return std::numeric_limits<double>::infinity();
2112  if (is_equal(x, y, depth)) return x;
2113  break;
2114  case OP_LT:
2115  if (((x)-y).is_nonnegative())
2116  return 0;
2117  break;
2118  case OP_EQ:
2119  if (is_equal(x, y, depth))
2120  return 1;
2121  break;
2122  case OP_NE:
2123  if (is_equal(x, y, depth))
2124  return 0;
2125  break;
2126  case OP_IF_ELSE_ZERO:
2127  if (y.is_zero()) {
2128  return y;
2129  } else if (x.is_constant()) {
2130  if (static_cast<double>(x)!=0) {
2131  return y;
2132  } else {
2133  return 0;
2134  }
2135  }
2136  }
2137  hit = false;
2138  return 0;
2139  }
bool is_equal(double x, double y, casadi_int depth=0)
Definition: calculus.hpp:287
T sq(const T &x)
Definition: calculus.hpp:337

References is_equal(), OP_ADD, OP_CONSTPOW, OP_COS, OP_DIV, OP_EQ, OP_FMAX, OP_FMIN, OP_IF_ELSE_ZERO, OP_INV, OP_LE, OP_LT, OP_MUL, OP_NE, OP_NEG, OP_POW, OP_SIN, OP_SQ, OP_SUB, OP_TWICE, sq(), and T.

Referenced by casadi::MXNode::_get_binary(), and casadi::SXElem::binary().

◆ common_simp_unary()

template<class T , typename SU >
T casadi::common_simp_unary ( casadi_int  op,
const T &  x,
casadi_int  depth,
SU &&  gen_unary,
bool  unique,
bool &  hit 
)

Definition at line 1813 of file calculus.hpp.

1816  {
1817  hit = true;
1818  switch (op) {
1819  case OP_TWICE:
1820  if (x.is_op(OP_MUL) && x.dep(0).is_constant() &&
1821  x.dep(0).is_half())
1822  return x.dep(1); // 2*(0.5*x) = x
1823  else if (x.is_op(OP_MUL) && x.dep(1).is_constant() &&
1824  x.dep(1).is_half())
1825  return x.dep(0); // 2*(x*0.5) = x
1826  break;
1827  case OP_SQ:
1828  if (x.is_op(OP_SQRT))
1829  return x.dep(); // sqrt(x)^2 = x
1830  else if (x.is_op(OP_NEG))
1831  return sq(x.dep()); // (-x)^2 = x^2
1832  else if (x.is_op(OP_FABS))
1833  return sq(x.dep()); // |x|^2 = x^2
1834  break;
1835  case OP_FABS:
1836  if (x.is_nonnegative())
1837  return x;
1838  else if (x.is_op(OP_NEG))
1839  return fabs(x.dep()); // fabs(-x) = fabs(x)
1840  break;
1841  case OP_LOG:
1842  if (x.is_op(OP_EXP))
1843  return x.dep(); // log(exp(x)) = x
1844  break;
1845  case OP_INV:
1846  if (x.is_op(OP_INV))
1847  return x.dep(); // 1/(1/x) = x
1848  break;
1849  case OP_SQRT:
1850  if (x.is_op(OP_SQ))
1851  return fabs(x.dep()); // sqrt(x^2) = x
1852  break;
1853  case OP_COS:
1854  if (x.is_op(OP_NEG))
1855  return cos(x.dep()); // cos(-x) = cos(x)
1856  else if (x.is_op(OP_FABS))
1857  return cos(x.dep()); // cos(|x|) = cos(x)
1858  break;
1859  case OP_NEG:
1860  if (x.is_op(OP_NEG))
1861  return x.dep(); // -(-x) = x
1862  else if (unique && x.is_op(OP_SUB))
1863  return x.dep(1) - x.dep(0); // -(x-y) = y-x
1864  }
1865  hit = false;
1866  return 0;
1867  }

References OP_COS, OP_EXP, OP_FABS, OP_INV, OP_LOG, OP_MUL, OP_NEG, OP_SQ, OP_SQRT, OP_SUB, OP_TWICE, sq(), and T.

Referenced by casadi::MXNode::get_unary(), and casadi::SXElem::unary().

◆ 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 141 of file casadi_misc.cpp.

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

References in_range().

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

◆ compute_knots_cache()

template<typename M >
static M casadi::compute_knots_cache ( const M &  K,
const std::vector< casadi_int > &  offsets 
)
static

Definition at line 92 of file blazing_spline.cpp.

92  {
93  casadi_int nd = offsets.size() - 1;
94  casadi_int degree = 3;
95  std::vector<M> parts;
96  for (casadi_int d = 0; d < nd; ++d) {
97  casadi_int off = offsets[d];
98  casadi_int n_k = offsets[d + 1] - off;
99  M t = K(Slice(off, off + n_k));
100 
101  // {intercept, slope} for 'exact' lookup. ng is the length of the
102  // searched grid (K[degree : n_k-degree]).
103  casadi_int ng = n_k - 2*degree;
104  M slope, intercept;
105  if (ng >= 2) {
106  M g0 = t(degree);
107  M dg = t(n_k - degree - 1) - g0;
108  // dg=0 would mean a degenerate grid; guard the divide.
109  slope = if_else_zero(dg, static_cast<double>(ng-1) / (dg + 1e-100));
110  intercept = -g0 * slope;
111  } else {
112  slope = M::zeros(1, 1);
113  intercept = M::zeros(1, 1);
114  }
115  parts.push_back(intercept);
116  parts.push_back(slope);
117 
118  // Existing inv1/inv2/inv3 spans.
119  for (casadi_int span = 1; span <= 3; ++span) {
120  M inv_span;
121  if (span < n_k) {
122  M diff = t(Slice(span, n_k)) - t(Slice(0, n_k - span));
123  diff = vertcat(diff, M::zeros(span, 1));
124  inv_span = if_else_zero(diff, 1.0 / (diff + 1e-100));
125  } else {
126  inv_span = M::zeros(n_k, 1);
127  }
128  parts.push_back(inv_span);
129  }
130  }
131  return vertcat(parts);
132  }
double if_else_zero(double x, double y)
Conditional assignment.
Definition: calculus.hpp:295
std::vector< T > diff(const std::vector< T > &values)
diff

References diff(), and if_else_zero().

Referenced by blazing_spline(), casadi::BlazingSplineFunction::get_jacobian(), and casadi::BlazingSplineFunction::init_derived_members().

◆ constant_ints()

static std::vector<casadi_int> casadi::constant_ints ( const MX m)
static

Definition at line 472 of file onnx_import.cpp.

472  {
473  casadi_assert(m.is_constant(), "Expected a constant integer tensor");
474  DM dm = static_cast<DM>(m);
475  std::vector<casadi_int> v;
476  for (casadi_int k = 0; k < dm.numel(); ++k)
477  v.push_back(static_cast<casadi_int>(dm(k).scalar()));
478  return v;
479  }

References casadi::MX::is_constant(), and casadi::GenericMatrix< MatType >::numel().

◆ ConstantSX_deserialize()

SXNode* casadi::ConstantSX_deserialize ( DeserializingStream s)
inline

Definition at line 506 of file constant_sx.hpp.

506  {
507  char type;
508  s.unpack("ConstantSX::type", type);
509  switch (type) {
510  case '1': return casadi_limits<SXElem>::one.get();
511  case '0': return casadi_limits<SXElem>::zero.get();
512  case 'r': {
513  double value;
514  s.unpack("ConstantSX::value", value);
515  return RealtypeSX::create(value);
516  }
517  case 'i': {
518  int value;
519  s.unpack("ConstantSX::value", value);
520  if (value==2) return casadi_limits<SXElem>::two.get();
521  return IntegerSX::create(value);
522  }
523  case 'n': return casadi_limits<SXElem>::nan.get();
524  case 'f': return casadi_limits<SXElem>::minus_inf.get();
525  case 'F': return casadi_limits<SXElem>::inf.get();
526  case 'm': return casadi_limits<SXElem>::minus_one.get();
527  default: casadi_error("ConstantSX::deserialize error");
528  }
529 }

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 278 of file calculus.hpp.

278 { 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 63 of file nlpsol.cpp.

64  {
65 
66  if (get_from_dict(opts, "detect_simple_bounds", false)) {
67  X x = get_from_dict(nlp, "x", X(0, 1));
68  X p = get_from_dict(nlp, "p", X(0, 1));
69  X f = get_from_dict(nlp, "f", X(0));
70  X g = get_from_dict(nlp, "g", X(0, 1));
71 
72  if (g.size1()>0 || g.size2()>0) {
73  // Dimension checks
74  casadi_assert(g.is_dense() && g.is_vector(),
75  "Expected a dense vector 'g', but got " + g.dim(true) + ".");
76  }
77 
78  // Read dimensions
79  casadi_int ng = g.size1();
80  casadi_int nx = x.size1();
81 
82  // Get constraint Jacobian sparsity
83  Sparsity sp = jacobian_sparsity(g, x).T();
84 
85  // Reset result vector
86  std::vector<bool> is_simple(ng, true);
87 
88  // Check nonlinearity
89  std::vector<bool> is_nonlin = which_depends(g, x, 2, true);
90 
91  const casadi_int* row = sp.colind();
92  for (casadi_int i=0;i<ng;++i) {
93  // Check if each row of jac_g_x only depends on one column
94  bool single_dependency = row[i+1]-row[i]==1;
95  is_simple[i] = single_dependency && !is_nonlin[i];
96  }
97 
98  // Full-indices of all simple constraints
99  std::vector<casadi_int> sgi = boolvec_to_index(is_simple);
100  std::vector<casadi_int> gi = boolvec_to_index(boolvec_not(is_simple));
101  X g_bounds = g(sgi);
102 
103  // Detect f2(p)x+f1(p)==0
104  Function gf = Function("gf", std::vector<X>{x, p},
105  std::vector<X>{jtimes(g_bounds, x, X::ones(nx, 1)), g_bounds});
106  casadi_assert_dev(!gf.has_free());
107 
108  std::vector<casadi_int> target_x;
109  // Loop over all constraints
110  for (casadi_int i=0;i<ng;++i) {
111  // Only treat simple ones
112  if (!is_simple[i]) continue;
113  target_x.push_back(sp.row()[row[i]]);
114  }
115 
116  Dict nlpsol_opts = opts;
117  nlpsol_opts["detect_simple_bounds_is_simple"] = is_simple;
118  nlpsol_opts["detect_simple_bounds_parts"] = gf;
119  nlpsol_opts["detect_simple_bounds_target_x"] = target_x;
120 
121  // Check for cache entries
122  Dict cache = get_from_dict(opts, "cache", Dict());
123  for (auto&& e : cache) {
124  const Function& f = e.second;
125 
126  // Check for cached Functions where g appears in in/out
127  bool needs_update = false;
128  for (casadi_int i=0;i<f.n_in();++i) {
129  // Does name contain 'g'?
130  if (name_has_g(f.name_in(i))) {
131  // Already has compated size
132  if (f.size1_in(i)==gi.size()) continue;
133  // Needs to be compacted
134  if (f.size1_in(i)==ng) needs_update = true;
135  // Structure not understood, fallback to higher-level sanity checking
136  }
137  }
138  for (casadi_int i=0;i<f.n_out();++i) {
139  if (name_has_g(f.name_out(i))) {
140  if (f.size1_out(i)==gi.size()) continue;
141  // Needs to be compacted
142  if (f.size1_out(i)==ng) needs_update = true;
143  // Structure not understood, fallback to higher-level sanity checking
144  }
145  }
146 
147  if (!needs_update) continue;
148 
149  // Arguments to create a wrapper
150  std::vector<X> args = f.sym_in<X>();
151  // Arguments to pass to the cached function
152  std::vector<X> f_args = args;
153 
154  for (casadi_int i=0;i<f.n_in();++i) {
155  if (name_has_g(f.name_in(i))) {
156  // Needs a compacted symbol
157  args[i] = X::sym(f.name_in(i), gi.size());
158 
159  // Perform projects
160  f_args[i] = X::zeros(ng);
161  f_args[i](gi) = args[i];
162  }
163  }
164 
165  // Peform call
166  std::vector<X> res;
167  f.call(f_args, res, false, false);
168 
169  for (casadi_int i=0;i<f.n_out();++i) {
170  if (name_has_g(f.name_out(i))) {
171  // Select compacted rows out of result
172  res[i] = res[i](gi, casadi::Slice());
173  }
174  }
175 
176  // Create wrapper
177  cache[e.first] = Function(f.name(), args, res, f.name_in(), f.name_out());
178  }
179  // Pass along potentially updated cache
180  nlpsol_opts["cache"] = cache;
181 
182  if (opts.find("equality")!=opts.end()) {
183  std::vector<bool> equality = opts.find("equality")->second;
184  nlpsol_opts["equality"] = vector_select(equality, is_simple, true);
185  }
186 
187  std::map<std::string, X> nlpsol_nlp = nlp;
188  nlpsol_nlp["g"] = g(gi);
189  return nlpsol(name, solver, Nlpsol::create_oracle(nlpsol_nlp, opts), nlpsol_opts);
190  } else {
191  return nlpsol(name, solver, Nlpsol::create_oracle(nlp, opts), opts);
192  }
193  }
Class representing a Slice.
Definition: slice.hpp:48
Function nlpsol(const std::string &name, const std::string &solver, const Function &nlp, const Dict &opts)
Definition: nlpsol.cpp:270
bool name_has_g(const std::string &name)
Definition: nlpsol.cpp:47
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::Function::call(), casadi::Sparsity::colind(), casadi::Nlpsol::create_oracle(), get_from_dict(), casadi::Function::has_free(), casadi::Function::n_in(), casadi::Function::n_out(), casadi::Function::name(), name_has_g(), casadi::Function::name_in(), casadi::Function::name_out(), nlpsol(), casadi::Sparsity::row(), casadi::Function::size1_in(), casadi::Function::size1_out(), casadi::Function::sym_in(), 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 65 of file alpaqa_problem.cpp.

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

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 678 of file casadi_misc.hpp.

678  {
679  for (casadi_int i=0;i<d.size();++i) {
680  d[i] = static_cast<D>(s[i]);
681  }
682  }

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_binary_node() [1/2]

onnx::NodeProto * casadi::create_binary_node ( AddNodeFn  add_node,
const std::string &  op_type,
const std::string &  input1,
const std::string &  input2,
const std::string &  output 
)

Definition at line 245 of file onnx_operations.cpp.

250  {
251  onnx::NodeProto* node = add_node();
252  node->set_op_type(op_type);
253  node->add_input(input1);
254  node->add_input(input2);
255  node->add_output(output);
256  return node;
257  }

Referenced by create_binary_node().

◆ create_binary_node() [2/2]

onnx::NodeProto * casadi::create_binary_node ( onnx::GraphProto *  graph,
const std::string &  op_type,
const std::string &  input1,
const std::string &  input2,
const std::string &  output 
)

Definition at line 324 of file onnx_operations.cpp.

329  {
330  return create_binary_node([graph]() { return graph->add_node(); },
331  op_type, input1, input2, output);
332  }
onnx::NodeProto * create_binary_node(AddNodeFn add_node, const std::string &op_type, const std::string &input1, const std::string &input2, const std::string &output)
Create binary operation ONNX node (callback-based)

References create_binary_node().

◆ create_cast_node()

onnx::NodeProto* casadi::create_cast_node ( AddNodeFn  add_node,
const std::string &  input,
const std::string &  output,
onnx::TensorProto::DataType  to_type 
)

Definition at line 272 of file onnx_operations.cpp.

276  {
277  onnx::NodeProto* node = add_node();
278  node->set_op_type("Cast");
279  node->add_input(input);
280  node->add_output(output);
281  onnx::AttributeProto* attr = node->add_attribute();
282  attr->set_name("to");
283  attr->set_type(onnx::AttributeProto::INT);
284  attr->set_i(to_type);
285  return node;
286  }

◆ create_constant_tensor()

onnx::TensorProto* casadi::create_constant_tensor ( AddNodeFn  add_node,
const std::string &  output_name,
onnx::TensorProto::DataType  data_type 
)

Definition at line 94 of file onnx_operations.cpp.

97  {
98  onnx::NodeProto* node = add_node();
99  node->set_op_type("Constant");
100  node->add_output(output_name);
101  onnx::AttributeProto* attr = node->add_attribute();
102  attr->set_name("value");
103  attr->set_type(onnx::AttributeProto::TENSOR); // Required for ONNX Runtime
104  onnx::TensorProto* tensor = attr->mutable_t();
105  tensor->set_data_type(data_type);
106  return tensor;
107  }

◆ 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().

◆ create_gather_node()

onnx::NodeProto* casadi::create_gather_node ( AddNodeFn  add_node,
const std::string &  data,
const std::string &  indices,
const std::string &  output,
casadi_int  axis = 0 
)

Definition at line 199 of file onnx_operations.cpp.

201  {
202  onnx::NodeProto* node = add_node();
203  node->set_op_type("Gather");
204  node->add_input(data);
205  node->add_input(indices);
206  node->add_output(output);
207  add_int_attribute(node, "axis", axis);
208  return node;
209  }
void add_int_attribute(onnx::NodeProto *node, const std::string &name, casadi_int value)
Add an integer attribute (e.g. axis) to a node.

References add_int_attribute().

◆ create_gemm_node()

onnx::NodeProto* casadi::create_gemm_node ( AddNodeFn  add_node,
const std::string &  A,
const std::string &  B,
const std::string &  C,
const std::string &  output,
bool  transA = false,
bool  transB = false 
)

Definition at line 292 of file onnx_operations.cpp.

295  {
296  onnx::NodeProto* node = add_node();
297  node->set_op_type("Gemm");
298  node->add_input(B);
299  node->add_input(A);
300  if (!C.empty()) node->add_input(C);
301  node->add_output(output);
302  if (transB) add_int_attribute(node, "transA", 1);
303  if (transA) add_int_attribute(node, "transB", 1);
304  return node;
305  }

References add_int_attribute(), and C.

◆ create_slice_node()

onnx::NodeProto* casadi::create_slice_node ( AddNodeFn  add_node,
const std::string &  uniq,
const std::string &  data,
const std::vector< casadi_int > &  starts,
const std::vector< casadi_int > &  ends,
const std::vector< casadi_int > &  axes,
const std::vector< casadi_int > &  steps,
const std::string &  output 
)

Definition at line 212 of file onnx_operations.cpp.

215  {
216  add_int_constant(add_node, uniq + "_starts", starts);
217  add_int_constant(add_node, uniq + "_ends", ends);
218  add_int_constant(add_node, uniq + "_axes", axes);
219  // before the Slice node
220  if (!steps.empty()) add_int_constant(add_node, uniq + "_steps", steps);
221  onnx::NodeProto* node = add_node();
222  node->set_op_type("Slice");
223  node->add_input(data);
224  node->add_input(uniq + "_starts");
225  node->add_input(uniq + "_ends");
226  node->add_input(uniq + "_axes");
227  if (!steps.empty()) node->add_input(uniq + "_steps"); // omit -> ONNX defaults steps to 1
228  node->add_output(output);
229  return node;
230  }

References add_int_constant().

◆ create_unary_node() [1/2]

onnx::NodeProto * casadi::create_unary_node ( AddNodeFn  add_node,
const std::string &  op_type,
const std::string &  input,
const std::string &  output 
)

Definition at line 259 of file onnx_operations.cpp.

263  {
264  onnx::NodeProto* node = add_node();
265  node->set_op_type(op_type);
266  node->add_input(input);
267  node->add_output(output);
268  return node;
269  }

Referenced by create_unary_node(), and emit_colmajor_reshape().

◆ create_unary_node() [2/2]

onnx::NodeProto * casadi::create_unary_node ( onnx::GraphProto *  graph,
const std::string &  op_type,
const std::string &  input,
const std::string &  output 
)

Definition at line 334 of file onnx_operations.cpp.

338  {
339  return create_unary_node([graph]() { return graph->add_node(); },
340  op_type, input, output);
341  }
onnx::NodeProto * create_unary_node(AddNodeFn add_node, const std::string &op_type, const std::string &input, const std::string &output)
Create unary operation ONNX node (callback-based)

References create_unary_node().

◆ create_where_node()

onnx::NodeProto* casadi::create_where_node ( AddNodeFn  add_node,
const std::string &  cond,
const std::string &  if_true,
const std::string &  if_false,
const std::string &  output 
)

Definition at line 308 of file onnx_operations.cpp.

313  {
314  onnx::NodeProto* node = add_node();
315  node->set_op_type("Where");
316  node->add_input(cond);
317  node->add_input(if_true);
318  node->add_input(if_false);
319  node->add_output(output);
320  return node;
321  }

◆ 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 948 of file casadi_misc.hpp.

948  {
949  std::vector<T> ret(values.size());
950  T acc = 0;
951  for (casadi_int i=0;i<values.size();++i) {
952  acc+= values[i];
953  ret[i] = acc;
954  }
955  return ret;
956  }

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 959 of file casadi_misc.hpp.

959  {
960  std::vector<T> ret(values.size()+1, 0);
961  T acc = 0;
962  for (casadi_int i=0;i<values.size();++i) {
963  acc+= values[i];
964  ret[i+1] = acc;
965  }
966  return ret;
967  }

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 Category casadi::dependent_definition ( Category  cat)

Definition at line 280 of file dae_builder_internal.cpp.

280  {
281  switch (cat) {
282  case Category::D:
283  return Category::DDEF;
284  case Category::W:
285  return Category::WDEF;
286  default:
287  break;
288  }
289  casadi_error("No dependent definition category for: " + to_string(cat));
290 }
std::string to_string(TypeFmi2 v)

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

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

◆ derivative_coeff_mx()

static MX casadi::derivative_coeff_mx ( casadi_int  i,
const std::vector< MX > &  knots_per_dim,
const std::vector< casadi_int > &  degree,
const std::vector< casadi_int > &  coeffs_dims,
const MX coeffs 
)
static

Definition at line 137 of file blazing_spline.cpp.

141  {
142  casadi_int n_k = knots_per_dim[i].size1();
143  casadi_int n = n_k - degree[i] - 1;
144 
145  MX K_i = knots_per_dim[i];
146  MX delta_knots = K_i(range(1+degree[i], n_k-1))
147  - K_i(range(1, n_k-degree[i]-1));
148  MX d = static_cast<double>(degree[i]) / delta_knots; // length n-1
149 
150  // T = diag(-d) + upper_band(+d) is a scaled finite-difference operator.
151  // Apply via slice-subtract + broadcast-multiply — no T, no kron, no densify.
152  std::vector<casadi_int> coeffs_dims_new = coeffs_dims;
153  coeffs_dims_new[i+1] = n - 1;
154 
155  casadi_int L = 1, R = 1;
156  for (casadi_int k=0; k<=i; ++k) L *= coeffs_dims[k];
157  for (casadi_int k=i+2; k<(casadi_int)coeffs_dims.size(); ++k) R *= coeffs_dims[k];
158  casadi_int K = coeffs_dims[i+1];
159  casadi_int Kp = n - 1;
160 
161  MX M_coeffs = reshape(coeffs, L*K, R);
162  MX top = M_coeffs(Slice(L, L*K), Slice());
163  MX bot = M_coeffs(Slice(0, L*(K-1)), Slice());
164  MX diffed = top - bot;
165 
166  std::vector<casadi_int> dims{L, Kp, R};
167  std::vector<casadi_int> a{-1, -2, -3};
168  std::vector<casadi_int> b{-2};
169  std::vector<casadi_int> c{-1, -2, -3};
170  return MX::einstein(vec(diffed), d,
171  dims, std::vector<casadi_int>{Kp}, dims,
172  a, b, c);
173  }
std::vector< casadi_int > range(casadi_int start, casadi_int stop, casadi_int step, casadi_int len)
Range function.

References casadi::MX::einstein(), range(), and casadi::GenericMatrix< MatType >::size1().

Referenced by casadi::BlazingSplineFunction::get_jacobian().

◆ description()

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

Get description

Definition at line 217 of file dae_builder_internal.cpp.

217  {
218  switch (v) {
219  case Category::T: return "independent variable";
220  case Category::P: return "parameter";
221  case Category::U: return "control";
222  case Category::X: return "differential state";
223  case Category::Z: return "algebraic variable";
224  case Category::Q: return "quadrature state";
225  case Category::C: return "constant";
226  case Category::D: return "dependent parameter";
227  case Category::W: return "dependent variable";
228  case Category::CALCULATED: return "calculated variable";
229  default: break;
230  }
231  return "";
232 }

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 665 of file nlpsol.cpp.

666  {
667  Function* f = static_cast<Function*>(callback_data);
668  return f->operator()(arg, res, iw, w);
669  }

◆ 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 > 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 970 of file casadi_misc.hpp.

970  {
971  casadi_assert(!values.empty(), "Array must be non-empty");
972  std::vector<T> ret(values.size()-1);
973  for (casadi_int i=0;i<values.size()-1;++i) {
974  ret[i] = values[i+1]-values[i];
975  }
976  return ret;
977  }

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

◆ do_inline()

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

Definition at line 216 of file bspline.cpp.

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

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

Definition at line 260 of file blas.cpp.

260  {
261  if (name == "reference") return REFERENCE_DOC;
262  return Blas::getPlugin(name).doc;
263 }
static const char * REFERENCE_DOC
Definition: blas.cpp:127

References casadi::PluginInterface< Blas >::getPlugin(), and REFERENCE_DOC.

◆ 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_graphmodel()

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

Definition at line 79 of file graph_model.cpp.

79 { return GraphModel::doc(name); }

References casadi::GraphModel::doc().

◆ doc_linsol()

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

Definition at line 237 of file linsol.cpp.

237  {
238  return Linsol::doc(name);
239  }

References casadi::Linsol::doc().

◆ doc_modelicaparser()

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

Definition at line 68 of file modelica_parser.cpp.

68  {
69  return ModelicaParser::doc(name);
70 }

References casadi::ModelicaParser::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().

◆ emit_colmajor_reshape()

void casadi::emit_colmajor_reshape ( AddNodeFn  add_node,
const std::string &  data,
const std::vector< casadi_int > &  dims,
const std::string &  output,
const std::string &  uniq 
)

Definition at line 236 of file onnx_operations.cpp.

238  {
239  std::vector<casadi_int> rev(dims.rbegin(), dims.rend());
240  add_int_constant(add_node, uniq + "_s", rev);
241  create_unary_node(add_node, "Reshape", data, output)->add_input(uniq + "_s");
242  }

References add_int_constant(), and create_unary_node().

◆ ensure_directory_exists()

void casadi::ensure_directory_exists ( const std::string &  dir)

Definition at line 46 of file dump.cpp.

46  {
47  if (Filesystem::is_enabled()) {
48  std::string effective_dir = Filesystem::ensure_trailing_slash(dir);
49  casadi_assert(Filesystem::ensure_directory_exists(effective_dir),
50  "Unable to create the required directory for '" + effective_dir + "'.");
51  }
52  }

References casadi::Filesystem::ensure_directory_exists(), casadi::Filesystem::ensure_trailing_slash(), and casadi::Filesystem::is_enabled().

Referenced by casadi::Dump::add_dependency(), and casadi::Dump::finalize().

◆ 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 300 of file calculus.hpp.

300  {
301  // Approximation found in Sourceforge and modified: Not very efficient
302  if (x>=1) {
303  return x==1 ? inf : nan;
304  } else if (x<=-1) {
305  return x==-1 ? -inf : nan;
306  } else if (x<-0.7) {
307  double z = sqrt(-log((1.0+x)/2.0));
308  return -(((1.641345311*z+3.429567803)*z-1.624906493)*z-1.970840454)/
309  ((1.637067800*z+3.543889200)*z+1.0);
310  } else {
311  double y;
312  if (x<0.7) {
313  double z = x*x;
314  y = x*(((-0.140543331*z+0.914624893)*z-1.645349621)*z+0.886226899)/
315  ((((-0.329097515*z+0.012229801)*z+1.442710462)*z-2.118377725)*z+1.0);
316  } else {
317  double z = sqrt(-log((1.0-x)/2.0));
318  y = (((1.641345311*z+3.429567803)*z-1.624906493)*z-1.970840454)/
319  ((1.637067800*z+3.543889200)*z+1.0);
320  }
321 
322  //polish x to full accuracy
323  y = y - (erf(y) - x) / (2.0/sqrt(pi) * exp(-y*y));
324  y = y - (erf(y) - x) / (2.0/sqrt(pi) * exp(-y*y));
325  return y;
326  }
327  }
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 blasfeo_ddot(), and 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 44 of file tools.cpp.

47  {
48  std::string signature = "f";
49  Importer li(name + CasadiMeta::shared_library_suffix(), "dll");
50  std::string op_full = op + "__" + signature;
51  external_transform_t t = (external_transform_t) li.get_function(op_full);
52  if (!t) {
53  casadi_error("Transformation '" + op + "' not defined in library '" + name +
54  "' for the following signature: " + signature);
55  }
56 
57  StringSerializer ss;
58  ss.pack(f);
59  ss.pack(opts);
60 
61  char api_version = 0;
62  std::string casadi_version = CasadiMeta::version();
63 
64  std::string s = ss.encode();
65  const char* out = t(api_version, casadi_version.c_str(), s.c_str(),
66  callback_stdout, callback_stderr);
67  if (!out) {
68  casadi_error("Transformation '" + op + "' defined in library '" + name +
69  "' failed.");
70  }
71 
72  StringDeserializer sd(out);
73  Function r = sd.unpack_function();
74 
75  return r;
76 }
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::CasadiMeta::shared_library_suffix(), casadi::DeserializerBase::unpack_function(), and casadi::CasadiMeta::version().

Referenced by casadi::Function::construct(), and casadi::Function::transform().

◆ 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 >::has_duplicates(), casadi::Matrix< double >::has_output(), casadi::MX::jacobian(), 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  auto out_file_ptr = Filesystem::ofstream_ptr(full_path, std::ios::binary);
100  std::ostream& out_file = *out_file_ptr;
101  if (!out_file) {
102  uerr() << "Error: Cannot write file: " << full_path << std::endl;
103  zip_fclose(zf);
104  continue;
105  }
106 
107  char buffer[8192];
108  zip_int64_t bytes_read;
109  while ((bytes_read = zip_fread(zf, buffer, sizeof(buffer))) > 0) {
110  out_file.write(buffer, bytes_read);
111  }
112 
113  if (bytes_read < 0) {
114  uerr() << "Error: Read failed for file in ZIP: " << name << std::endl;
115  }
116 
117  out_file_ptr.reset();
118  zip_fclose(zf);
119  }
120  }
121 
122  zip_close(za);
123  return true;
124  }

References casadi::Filesystem::assert_enabled(), casadi::PluginInterface< Filesystem >::getPlugin(), casadi::Filesystem::ofstream_ptr(), 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:
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 71 of file casadi_os.cpp.

71  {
72  #ifdef _WIN32
73  return "\\";
74  #else
75  return "/";
76  #endif
77 }

Referenced by casadi::Dump::eval(), and 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 643 of file casadi_misc.hpp.

643  {
644  std::vector<casadi_int> ret;
645  for (casadi_int i=0;i<v.size();++i) {
646  if (v[i]) ret.push_back(i);
647  }
648  return ret;
649  }

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 706 of file casadi_misc.hpp.

707  {
708  // Count total elements in nested
709  casadi_int N = 0;
710  for (const auto& e : nested) {
711  N += e.size();
712  }
713 
714  // Populate flat, one nested section at a time
715  flat.clear();
716  flat.reserve(N);
717  for (const auto& e : nested) {
718  flat.insert(flat.end(), e.begin(), e.end());
719  }
720  }

Referenced by flatten_nested_vector(), casadi::CplexInterface::init(), casadi::GurobiInterface::init(), and casadi::XpressInterface::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 723 of file casadi_misc.hpp.

725  {
726  // Delegate
727  flatten_nested_vector(nested, flat);
728 
729  // Build up indices
730  casadi_int N = nested.size();
731  indices.resize(1, 0);
732  indices.reserve(N+1);
733  casadi_int offset = 0;
734  for (const auto& e : nested) {
735  offset += e.size();
736  indices.push_back(offset);
737  }
738  }
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().

◆ flatten_opts()

void casadi::flatten_opts ( Dict ret,
const Dict opts,
const std::string &  prefix 
)

Definition at line 96 of file ccopt_interface.cpp.

96  {
97  for (const auto& kv : opts) {
98  switch (kv.second.getType()) {
99  case OT_DICT:
100  flatten_opts(ret, kv.second, prefix + kv.first + ".");
101  break;
102  default:
103  ret[prefix + kv.first] = kv.second;
104  }
105  }
106 }
void flatten_opts(Dict &ret, const Dict &opts, const std::string &prefix)

References OT_DICT.

Referenced by casadi::MadmpecInterface::init(), and casadi::MadnlpInterface::init().

◆ fmtstr()

std::string casadi::fmtstr ( const std::string &  fmt,
const std::vector< std::string > &  args 
)
inline

Definition at line 236 of file casadi_common.hpp.

236  {
237  std::string s = fmt;
238  for (auto&& e : args) {
239  std::string::size_type n = s.find("%s");
240  if (n==std::string::npos) return "** Ill-formatted string ** " + fmt;
241  s.replace(n, 2, e);
242  }
243  return s;
244  }

◆ format_from_path()

static std::string casadi::format_from_path ( const std::string &  path)
static

Definition at line 53 of file graph_builder.cpp.

53  {
54  auto dot = path.find_last_of('.');
55  std::string suffix = dot == std::string::npos ? "" : path.substr(dot + 1);
56  if (suffix == "onnx") return "onnx";
57  casadi_error("GraphBuilder: cannot infer format from '" + path + "'");
58  }
T dot(const std::vector< T > &a, const std::vector< T > &b)
std::vector< casadi_int > path(const std::vector< casadi_int > &map, casadi_int i_start)

References dot(), and path().

Referenced by casadi::GraphBuilder::GraphBuilder().

◆ from_fmi2()

CASADI_EXPORT Type casadi::from_fmi2 ( TypeFmi2  v)

Version mappings

Definition at line 63 of file dae_builder_internal.cpp.

63  {
64  switch (v) {
65  case TypeFmi2::REAL: return Type::FLOAT64;
66  case TypeFmi2::INTEGER: return Type::INT32;
67  case TypeFmi2::BOOLEAN: return Type::BOOLEAN;
68  case TypeFmi2::STRING: return Type::STRING;
69  case TypeFmi2::ENUM: return Type::ENUMERATION;
70  default: break;
71  }
72  return Type::NUMEL;
73 }

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  }

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 200 of file casadi_misc.cpp.

200  {
201  if (v.empty()) {
202  return nullptr;
203  } else {
204  return reinterpret_cast<const bvec_t*>(&v.front());
205  }
206  }

◆ get_bvec_t() [2/4]

template<typename T >
const bvec_t * casadi::get_bvec_t ( const std::vector< T > &  v)

Definition at line 1021 of file casadi_misc.hpp.

1021  {
1022  casadi_assert(0, "get_bvec_t only supported for double");
1023  }

◆ 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 191 of file casadi_misc.cpp.

191  {
192  if (v.empty()) {
193  return nullptr;
194  } else {
195  return reinterpret_cast<bvec_t*>(&v.front());
196  }
197  }

◆ get_bvec_t() [4/4]

template<typename T >
bvec_t * casadi::get_bvec_t ( std::vector< T > &  v)

Definition at line 1016 of file casadi_misc.hpp.

1016  {
1017  casadi_assert(0, "get_bvec_t only supported for double");
1018  }

◆ get_const()

MX casadi::get_const ( const Sparsity sp,
const double *  v,
std::unordered_multimap< std::size_t, std::pair< MX, DM > > &  cache 
)

Definition at line 2360 of file mx.cpp.

2361  {
2362  // Compute hash from sparsity and double values
2363  std::size_t h = sp.hash();
2364  hash_combine(h, v, sp.nnz());
2365 
2366  // Loop over tentative matches
2367  auto r = cache.equal_range(h);
2368  for (auto it = r.first; it != r.second; ++it) {
2369  const DM& d = it->second.second;
2370  if (d.sparsity()==sp && std::equal(d.ptr(), d.ptr()+sp.nnz(), v)) {
2371  // Found match
2372  return it->second.first;
2373  }
2374  }
2375 
2376  // fallthrough: failed to find a match
2377 
2378  // Create a <MX,DM> pair and store in cache
2379  std::vector<double> vec(v, v+sp.nnz());
2380  DM m(sp, vec);
2381  MX ret = m;
2382  cache.emplace(h, std::make_pair(ret, m));
2383 
2384  // Return the MX
2385  return ret;
2386  }
void hash_combine(std::size_t &seed, T v)
Generate a hash value incrementally (function taken from boost)

References casadi::Sparsity::hash(), hash_combine(), casadi::Sparsity::nnz(), casadi::Matrix< Scalar >::ptr(), and casadi::Matrix< Scalar >::sparsity().

Referenced by casadi::MX::simplify_const_folding().

◆ 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_float_attribute()

double casadi::get_float_attribute ( const onnx::NodeProto &  node,
const std::string &  name,
double  default_value 
)

Definition at line 48 of file onnx_utilities.cpp.

49  {
50  for (int a = 0; a < node.attribute_size(); ++a) {
51  if (node.attribute(a).name() == name) return node.attribute(a).f();
52  }
53  return default_value;
54  }

◆ 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::get_jit_directory(), init_gen(), map_semi_expl(), qpsol_nlp(), reduce_index_gen(), and casadi::OptiNode::stats().

◆ get_graph_attribute()

const onnx::GraphProto * casadi::get_graph_attribute ( const onnx::NodeProto &  node,
const std::string &  name 
)

Definition at line 63 of file onnx_utilities.cpp.

64  {
65  for (int a = 0; a < node.attribute_size(); ++a) {
66  if (node.attribute(a).name() == name) return &node.attribute(a).g();
67  }
68  return nullptr;
69  }

◆ 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_int_attribute()

casadi_int casadi::get_int_attribute ( const onnx::NodeProto &  node,
const std::string &  name,
casadi_int  default_value 
)

Definition at line 40 of file onnx_utilities.cpp.

41  {
42  for (int a = 0; a < node.attribute_size(); ++a) {
43  if (node.attribute(a).name() == name) return node.attribute(a).i();
44  }
45  return default_value;
46  }

◆ 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_op_mapping()

const OpMapping * casadi::get_op_mapping ( casadi_int  op)

Returns nullptr if not a simple mapped operation.

Definition at line 75 of file onnx_operations.cpp.

75  {
76  for (const auto& entry : op_map) {
77  if (entry.casadi_op == op) return &entry;
78  }
79  return nullptr;
80  }

References op_map.

◆ get_op_mapping_by_name()

const OpMapping * casadi::get_op_mapping_by_name ( const std::string &  onnx_name)

Returns nullptr if not a simple mapped operation.

Definition at line 83 of file onnx_operations.cpp.

83  {
84  for (const auto& entry : op_map) {
85  if (entry.onnx_name == onnx_name) return &entry;
86  }
87  return nullptr;
88  }

References op_map.

◆ 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 890 of file casadi_misc.hpp.

890  {
891  if (v.empty())
892  return nullptr;
893  else
894  return &v.front();
895  }

References T.

◆ get_ptr() [2/2]

template<typename T >
T * casadi::get_ptr ( std::vector< T > &  v)

Definition at line 882 of file casadi_misc.hpp.

882  {
883  if (v.empty())
884  return nullptr;
885  else
886  return &v.front();
887  }

References T.

Referenced by casadi::FunctionBuffer::_eval(), _which_depends(), casadi::Function::activity(), 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::Convexify::deserialize(), casadi::LinsolQr::det(), 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::FmuInternal::get_all(), casadi::Fmu2::get_aux_impl(), casadi::Fmu3::get_aux_impl(), casadi::Matrix< double >::get_input(), casadi::FunctionInternal::get_jac_sparsity_gen(), casadi::FunctionInternal::get_jac_sparsity_hierarchical(), casadi::FunctionInternal::get_jac_sparsity_hierarchical_symm(), casadi::Fmu2::get_real(), casadi::FmuFunction::get_stats(), hash_combine(), hash_sparsity(), hpipm_blocks_pack(), casadi::FmuFunction::init(), casadi::SXFunction::init(), casadi::MadmpecInterface::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::BSplineCommon::jac(), 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::SXFunction::print_arg(), casadi::SXFunction::print_res(), casadi::QpoasesInterface::qpoases_nfact(), casadi::QpoasesInterface::qpoases_sfact(), casadi::QpoasesInterface::qpoases_solve(), qr_block_det(), casadi::Sparsity::qr_sparse(), casadi::Function::rev(), casadi::Blocksqp::secondOrderCorrection(), casadi::FmuInternal::set_all(), casadi::ClarabelInterface::set_clarabel_prob(), casadi::DaqpInterface::set_daqp_prob(), casadi::FatropConicInterface::set_fatrop_conic_prob(), casadi::FatropInterface::set_fatrop_prob(), casadi::HighsInterface::set_highs_prob(), casadi::HpipmInterface::set_hpipm_prob(), casadi::MosekInterface::set_mosek_prob(), casadi::Fmu2::set_values(), casadi::Fmu3::set_values(), casadi::FastNewton::set_work(), casadi::XpressInterface::set_xpress_prob(), casadi::Convexify::setup(), casadi::MX::simplify_const_folding(), casadi::CbcInterface::solve(), casadi::ClpInterface::solve(), casadi::CplexInterface::solve(), casadi::FatropConicInterface::solve(), casadi::GurobiInterface::solve(), casadi::HpmpcInterface::solve(), casadi::OoqpInterface::solve(), casadi::PiqpInterface::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 79 of file casadi_os.cpp.

79  {
80 
81  // Build up search paths;
82  std::vector<std::string> search_paths;
83 
84  // Search path: CASADI_PLUGIN_SEARCH_PATH env variable
85  // (highest priority; takes precedence over the bundled install dir
86  // that the Python wrapper writes into GlobalOptions::casadipath)
87  char* pPLUGIN = getenv("CASADI_PLUGIN_SEARCH_PATH");
88  if (pPLUGIN!=nullptr) {
89  std::stringstream pluginpaths(pPLUGIN);
90  std::string pluginpath;
91  while (std::getline(pluginpaths, pluginpath, pathsep())) {
92  search_paths.push_back(pluginpath);
93  }
94  }
95 
96  // Search path: global casadipath option
97  std::stringstream casadipaths(GlobalOptions::getCasadiPath());
98  std::string casadipath;
99  while (std::getline(casadipaths, casadipath, pathsep())) {
100  search_paths.push_back(casadipath);
101  }
102 
103  // Search path: CASADIPATH env variable
104  char* pLIBDIR;
105  pLIBDIR = getenv("CASADIPATH");
106 
107  if (pLIBDIR!=nullptr) {
108  std::stringstream casadipaths(pLIBDIR);
109  std::string casadipath;
110  while (std::getline(casadipaths, casadipath, pathsep())) {
111  search_paths.push_back(casadipath);
112  }
113  }
114 
115  // Search path: bare
116  search_paths.push_back("");
117 
118  // Search path : PLUGIN_EXTRA_SEARCH_PATH
119  #ifdef PLUGIN_EXTRA_SEARCH_PATH
120  search_paths.push_back(
121  std::string("") + PLUGIN_EXTRA_SEARCH_PATH);
122  #endif // PLUGIN_EXTRA_SEARCH_PATH
123 
124  // Search path : current directory
125  search_paths.push_back(".");
126 
127  return search_paths;
128 }
char pathsep()
Definition: casadi_os.cpp:64

References casadi::GlobalOptions::getCasadiPath(), and pathsep().

Referenced by casadi::ShellCompiler::init(), casadi::DllLibrary::init_handle(), and casadi::PluginInterface< Derived >::load_library().

◆ get_string_attribute()

std::string casadi::get_string_attribute ( const onnx::NodeProto &  node,
const std::string &  name 
)

Definition at line 56 of file onnx_utilities.cpp.

56  {
57  for (int a = 0; a < node.attribute_size(); ++a) {
58  if (node.attribute(a).name() == name) return node.attribute(a).s();
59  }
60  return "";
61  }

◆ 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 128 of file generic_shared_internal.hpp.

130  {
131  A ret;
132  if (!a.is_null()) {
133  auto it =
134  already_copied.find(const_cast<typename A::base_type*>(a.get()));
135  if (it!=already_copied.end()) {
136  ret.own(it->second.get());
137  }
138  }
139  return ret;
140  }

◆ gurobi_callback_function()

static int casadi::gurobi_callback_function ( GRBmodel *  model,
void *  cbdata,
int  where,
void *  usrdata 
)
static

Definition at line 92 of file gurobi_interface.cpp.

92  {
93  try {
94  if (where == GRB_CB_MIPSOL && usrdata) {
95  GurobiMemory* mem = static_cast<GurobiMemory*>(usrdata);
96  mem->interface->handle_lazy_constraints_callback(mem, model, cbdata, where);
97  }
98  } catch (const std::exception& e) {
99  // Don't let exceptions escape to C code
100  casadi_warning("Exception in Gurobi callback: " + std::string(e.what()));
101  }
102  return 0; // Continue optimization
103  }

References casadi::GurobiInterface::handle_lazy_constraints_callback(), and casadi::GurobiMemory::interface.

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

◆ handle_pedantic()

static void casadi::handle_pedantic ( const std::string &  mode,
const std::string &  opt_name,
const std::string &  msg 
)
static

Definition at line 38 of file blazing_spline.cpp.

40  {
41  if (mode == "ignore") return;
42  std::string full = msg + "\n(Controlled by option '" + opt_name +
43  "'; set to 'ignore' to silence, 'warn' to demote, 'error' to escalate.)";
44  if (mode == "warn") {
45  casadi_warning(full);
46  } else if (mode == "error") {
47  casadi_error(full);
48  } else {
49  casadi_error("Option '" + opt_name + "' must be one of "
50  "'ignore', 'warn', 'error'; got '" + mode + "'.");
51  }
52  }

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

◆ 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_blas()

CASADI_EXPORT bool casadi::has_blas ( const std::string &  name)

Definition at line 250 of file blas.cpp.

250  {
251  if (name == "reference") return true;
252  return Blas::has_plugin(name);
253 }

References casadi::PluginInterface< Blas >::has_plugin().

◆ has_empty()

bool casadi::has_empty ( const std::vector< MX > &  x,
bool  both = false 
)

Definition at line 1104 of file mx.cpp.

1104  {
1105  for (auto&& i : x) {
1106  if (i.is_empty(both)) return true;
1107  }
1108  return false;
1109  }

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_graphmodel()

CASADI_EXPORT bool casadi::has_graphmodel ( const std::string &  name)

Definition at line 77 of file graph_model.cpp.

77 { return GraphModel::has_plugin(name); }

References casadi::GraphModel::has_plugin().

◆ has_linsol()

CASADI_EXPORT bool casadi::has_linsol ( const std::string &  name)

Definition at line 229 of file linsol.cpp.

229  {
230  return Linsol::has_plugin(name);
231  }

References casadi::Linsol::has_plugin().

◆ has_modelicaparser()

CASADI_EXPORT bool casadi::has_modelicaparser ( const std::string &  name)

Definition at line 60 of file modelica_parser.cpp.

60  {
61  return ModelicaParserInternal::has_plugin(name);
62 }

References casadi::PluginInterface< ModelicaParserInternal >::has_plugin().

◆ has_negative()

template<typename T >
bool casadi::has_negative ( const std::vector< T > &  v)

Definition at line 801 of file casadi_misc.hpp.

801  {
802  for (std::size_t i=0; i<v.size(); ++i) {
803  if (v[i]<0) return true;
804  }
805  return false;
806  }

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 1056 of file casadi_misc.hpp.

1056  {
1057  hash_combine(seed, get_ptr(v), v.size());
1058  }

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 1048 of file casadi_misc.hpp.

1048  {
1049  for (casadi_int i=0; i<sz; ++i) hash_combine(seed, v[i]);
1050  }

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 1040 of file casadi_misc.hpp.

1040  {
1041  seed ^= hash_value(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
1042  }
size_t hash_value(T v)
Hash value of an integer.

References hash_value().

Referenced by get_const(), 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 1017 of file sparsity.cpp.

1018  {
1019  // Condense the sparsity pattern to a single, deterministric number
1020  std::size_t ret=0;
1021  hash_combine(ret, nrow);
1022  hash_combine(ret, ncol);
1023  hash_combine(ret, colind, ncol+1);
1024  hash_combine(ret, row, colind[ncol]);
1025  return ret;
1026  }

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 1012 of file sparsity.cpp.

1013  {
1014  return hash_sparsity(nrow, ncol, get_ptr(colind), get_ptr(row));
1015  }
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:1012

References get_ptr().

Referenced by casadi::SparsityInternal::hash().

◆ hash_value() [1/3]

template<>
size_t casadi::hash_value ( double  v)
inline

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

Definition at line 1071 of file casadi_misc.hpp.

1071  {
1072  std::uint64_t u;
1073  std::memcpy(&u, &v, sizeof(double));
1074 
1075  if (sizeof(size_t) == 8) {
1076  // 64-bit: keep all bits
1077  return static_cast<size_t>(u);
1078  } else {
1079  // 32-bit: fold with hash_combine
1080  size_t seed = 0;
1081  hash_combine(seed, static_cast<std::uint32_t>(u));
1082  hash_combine(seed, static_cast<std::uint32_t>(u >> 32));
1083  return seed;
1084  }
1085  }

References hash_combine().

◆ hash_value() [2/3]

template<>
size_t casadi::hash_value ( std::string  v)
inline

Definition at line 1061 of file casadi_misc.hpp.

1061  {
1062  size_t seed = 0;
1063  hash_combine(seed, v.c_str(), v.size());
1064  return seed;
1065  }

References hash_combine().

◆ hash_value() [3/3]

template<typename T >
size_t casadi::hash_value ( v)
inline

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

Definition at line 1034 of file casadi_misc.hpp.

1034 { 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

◆ ifstream_compat()

CASADI_EXPORT std::unique_ptr< std::istream > casadi::ifstream_compat ( const std::string &  utf8_path,
std::ios::openmode  mode 
)

Definition at line 497 of file casadi_os.cpp.

498  {
499 #ifdef _WIN32
500  std::wstring utf16_path = utf8_to_utf16(utf8_path);
501  DWORD access = 0;
502  access |= GENERIC_READ;
503  if (mode & std::ios::out) access |= GENERIC_WRITE;
504 
505  HANDLE h = CreateFileW(utf16_path.c_str(), access,
506  FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
507  OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
508  if (h == INVALID_HANDLE_VALUE) return {};
509 
510  int flags = (mode & std::ios::out) ? _O_RDWR : _O_RDONLY;
511  if (mode & std::ios::binary) flags |= _O_BINARY;
512 
513  int fd = _open_osfhandle(reinterpret_cast<intptr_t>(h), flags);
514  if (fd == -1) {
515  CloseHandle(h);
516  return {};
517  }
518  auto owned = std::make_shared<OwnedIStream>(fd);
519  return std::unique_ptr<StreamWithOwnedBuffer>(new StreamWithOwnedBuffer(std::move(owned)));
520 #else
521  auto ifs = std::unique_ptr<std::ifstream>(new std::ifstream(utf8_path, mode));
522  if (!*ifs) return {};
523  return std::unique_ptr<std::istream>(std::move(ifs));
524 #endif
525 }

Referenced by casadi::Filesystem::exists(), and casadi::Filesystem::ifstream_ptr().

◆ 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 697 of file casadi_misc.hpp.

697  {
698  if (v.empty()) return true;
699  casadi_int max = *std::max_element(v.begin(), v.end());
700  if (max >= upper) return false;
701  casadi_int min = *std::min_element(v.begin(), v.end());
702  return (min >= lower);
703  }

◆ in_range() [2/2]

template<typename T >
bool casadi::in_range ( const std::vector< T > &  v,
casadi_int  upper 
)

Definition at line 692 of file casadi_misc.hpp.

692  {
693  return in_range(v, 0, upper);
694  }

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:195
std::map< std::string, MX > MXDict
Definition: mx.hpp:1110

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 685 of file casadi_misc.hpp.

685  {
686  d.resize(s.size());
687  std::copy(s.begin(), s.end(), d.begin());
688  }

Referenced by casadi::HpmpcInterface::init_mem().

◆ input_categories()

CASADI_EXPORT std::vector< Category > casadi::input_categories ( )

Definition at line 292 of file dae_builder_internal.cpp.

292  {
293  std::vector<Category> ret;
294  for (casadi_int i = 0; i != enum_traits<Category>::n_enum; ++i) {
295  auto cat = static_cast<Category>(i);
296  if (is_input_category(cat)) ret.push_back(cat);
297  }
298  return ret;
299 }
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 ( Category  cat)

Definition at line 2225 of file dae_builder_internal.cpp.

2225  {
2226  switch (cat) {
2227  case Category::ODE: return Category::X;
2228  case Category::QUAD: return Category::Q;
2229  case Category::DDEF: return Category::D;
2230  case Category::WDEF: return Category::W;
2231  default: break;
2232  }
2233  casadi_error("No input category for " + to_string(cat));
2234 }

References D, DDEF, ODE, Q, QUAD, to_string(), W, WDEF, and X.

Referenced by casadi::DaeBuilderInternal::outputs().

◆ insert_casadi_options()

static void casadi::insert_casadi_options ( void *  solver,
Dict  opts 
)
static

Definition at line 172 of file uno_interface.cpp.

172  {
173  Dict casadi_options = Options::sanitize(opts);
174  // Apply the preset first: it overwrites some options (e.g. it would reset
175  // the Hessian model to exact, clobbering an explicit hessian_model=LBFGS).
176  for (auto&& op : casadi_options) {
177  if (op.first == "preset") {
178  uno_set_solver_preset(solver, op.second.to_string().c_str());
179  break;
180  }
181  }
182  for (auto&& op : casadi_options) {
183  if (op.first != "preset") set_uno_option(solver, op.first, op.second);
184  }
185  }
static void set_uno_option(void *solver, const std::string &name, const GenericType &value)

References casadi::Options::sanitize(), and set_uno_option().

Referenced by casadi::UnoInterface::init_mem().

◆ 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 3115 of file mx.cpp.

3122  {
3123  if (i==0) {
3124  MX ret;
3125  v.get_nz(ret, false, offset, I);
3126  return ret;
3127  } else {
3128  casadi_int j = xis.size()-i;
3129  MX offsetL, offsetR;
3130  if (strides[j]==1) {
3131  offsetL = offset+L[j];
3132  offsetR = offset+Lp[j];
3133  } else {
3134  offsetL = offset+L[j]*strides[j];
3135  offsetR = offsetL+strides[j];
3136  }
3137  MX vl = interpn_G(i-1, v, xis, L, Lp, strides, I, offsetL);
3138  MX vu = interpn_G(i-1, v, xis, L, Lp, strides, I, offsetR);
3139 
3140  // Perform interpolation between vl and vu
3141  return vl + xis[j]*(vu-vl);
3142  }
3143  }
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:3115

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 182 of file casadi_misc.cpp.

182  {
183  casadi_assert(is_permutation(a), "Not a permutation");
184  std::vector<casadi_int> ret(a.size());
185  for (casadi_int i=0;i<a.size();++i) {
186  ret[a[i]] = i;
187  }
188  return ret;
189  }
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().

◆ io_node()

static Node casadi::io_node ( const onnx::ValueInfoProto &  vi,
const std::string &  io 
)
static

Definition at line 87 of file onnx_model.cpp.

87  {
88  Node n;
89  n.name = vi.name();
90  n.io = io;
91  const onnx::TypeProto::Tensor& tt = vi.type().tensor_type();
92  n.dtype = onnx_dtype_name(tt.elem_type());
93  const onnx::TensorShapeProto& sh = tt.shape();
94  for (int k = 0; k < sh.dim_size(); ++k) {
95  const auto& d = sh.dim(k);
96  if (d.has_dim_value()) {
97  n.dimension.push_back(static_cast<casadi_int>(d.dim_value()));
98  n.dim_params.push_back("");
99  } else { // symbolic or unspecified -> dynamic
100  n.dimension.push_back(-1);
101  n.dim_params.push_back(d.has_dim_param() ? d.dim_param() : "");
102  }
103  }
104  return n;
105  }
std::string onnx_dtype_name(casadi_int t)
Human-readable name of an ONNX element-type enum (1=FLOAT, 11=DOUBLE, 7=INT64, ......

References casadi::Node::dim_params, casadi::Node::dimension, casadi::Node::dtype, casadi::Node::io, casadi::Node::name, and onnx_dtype_name().

Referenced by casadi::Onnx::fill_metadata().

◆ is_acyclic()

CASADI_EXPORT bool casadi::is_acyclic ( Category  cat)

Definition at line 268 of file dae_builder_internal.cpp.

268  {
269  switch (cat) {
270  case Category::C: // Fall-through
271  case Category::D: // Fall-through
272  case Category::W:
273  // Acyclic category
274  return true;
275  default:
276  return false;
277  }
278 }

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 758 of file casadi_misc.hpp.

758  {
759  if (v.empty()) return true;
760  T el = v[0];
761  for (casadi_int i=1;i<v.size();++i) {
762  if (!(v[i] < el)) return false;
763  el = v[i];
764  }
765  return el==el; // nan -> false
766  }

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 122 of file casadi_misc.cpp.

122  {
123  // Quick return if 2 or less entries
124  if (v.size()<=2) return true;
125  // Permitted error margin
126  // NOTE(@jaeandersson) 1e-14 good idea?
127  double margin = (v.back()-v.front())*1e-14;
128  // Make sure spacing is consistent throughout
129  double spacing = v[1]-v[0];
130  for (size_t i=2; i<v.size(); ++i) {
131  if (fabs(v[i]-v[i-1]-spacing)>margin) return false;
132  }
133  // Equal if reached this point
134  return true;
135  }

Referenced by casadi::Interpolant::interpret_lookup_mode().

◆ is_increasing()

template<typename T >
bool casadi::is_increasing ( const std::vector< T > &  v)

Definition at line 747 of file casadi_misc.hpp.

747  {
748  if (v.empty()) return true;
749  T el = v[0];
750  for (casadi_int i=1;i<v.size();++i) {
751  if (!(v[i] > el)) return false;
752  el = v[i];
753  }
754  return el==el; // nan -> false
755  }

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 234 of file dae_builder_internal.cpp.

234  {
235  switch (cat) {
236  case Category::T: // Fall-through
237  case Category::P: // Fall-through
238  case Category::U: // Fall-through
239  case Category::X: // Fall-through
240  case Category::Z: // Fall-through
241  case Category::Q: // Fall-through
242  case Category::C: // Fall-through
243  case Category::D: // Fall-through
244  case Category::W:
245  // Input category
246  return true;
247  default: break;
248  }
249  return false;
250 }

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

Referenced by input_categories(), casadi::DaeBuilderInternal::inputs(), and casadi::DaeBuilder::set_all().

◆ is_monotone()

template<typename T >
bool casadi::is_monotone ( const std::vector< T > &  v)

Definition at line 791 of file casadi_misc.hpp.

791  {
792  return is_nondecreasing(v) || is_nonincreasing(v);
793  }
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 780 of file casadi_misc.hpp.

780  {
781  if (v.empty()) return true;
782  T el = v[0];
783  for (casadi_int i=1;i<v.size();++i) {
784  if (!(v[i] >= el)) return false;
785  el = v[i];
786  }
787  return el==el; // nan -> false
788  }

References T.

Referenced by casadi::SparsityInternal::_erase(), casadi::BlazingSplineFunction::init(), and is_monotone().

◆ is_nonincreasing()

template<typename T >
bool casadi::is_nonincreasing ( const std::vector< T > &  v)

Definition at line 769 of file casadi_misc.hpp.

769  {
770  if (v.empty()) return true;
771  T el = v[0];
772  for (casadi_int i=1;i<v.size();++i) {
773  if (!(v[i] <= el)) return false;
774  el = v[i];
775  }
776  return el==el; // nan -> false
777  }

References T.

Referenced by is_monotone().

◆ is_output_category()

CASADI_EXPORT bool casadi::is_output_category ( Category  cat)

Definition at line 252 of file dae_builder_internal.cpp.

252  {
253  switch (cat) {
254  case Category::ODE: // Fall-through
255  case Category::ALG: // Fall-through
256  case Category::QUAD: // Fall-through
257  case Category::ZERO: // Fall-through
258  case Category::DDEF: // Fall-through
259  case Category::WDEF: // Fall-through
260  case Category::Y:
261  // Output category
262  return true;
263  default: break;
264  }
265  return false;
266 }

References ALG, DDEF, ODE, QUAD, WDEF, Y, and ZERO.

Referenced by output_categories(), and casadi::DaeBuilder::set_all().

◆ 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 175 of file casadi_misc.cpp.

175  {
176  std::set<casadi_int> order_set(order.begin(), order.end());
177  return (order_set.size()==order.size()) &&
178  (*order_set.begin()==0) &&
179  (*order_set.rbegin()==order.size()-1);
180  }

Referenced by invert_permutation(), casadi::Sparsity::permutation(), and permute().

◆ is_pow2_ge8()

static bool casadi::is_pow2_ge8 ( casadi_int  n)
static

Definition at line 54 of file blazing_spline.cpp.

54  {
55  return n >= 8 && (n & (n - 1)) == 0;
56  }

Referenced by casadi::BlazingSplineFunction::init(), and scan_prefix_pow2().

◆ 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 95 of file casadi_misc.cpp.

96  {
97  casadi_int nret = (stop-start)/step + ((stop-start)%step!=0);
98  if (v.size()!=nret) return false;
99  casadi_int ind = start;
100  for (casadi_int e : v) {
101  if (e!=ind) return false;
102  ind += step;
103  }
104  return true;
105  }

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 428 of file casadi_misc.hpp.

428  {
429  for (auto&& vk : v) {
430  if (vk!=vk || vk==std::numeric_limits<T>::infinity() ||
431  vk==-std::numeric_limits<T>::infinity()) return false;
432  }
433  return true;
434  }

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  // Calculate based on actual number of groups in the data
231  casadi_int inner_size = (stop_inner - start_inner) / step_inner;
232  casadi_int num_groups = v.size() / inner_size;
233  casadi_int stop_outer = start_outer + num_groups * step_outer;
234 
235  // Check consistency
236  std::vector<casadi_int>::const_iterator it=v.begin();
237  for (casadi_int i=start_outer; i!=stop_outer; i+=step_outer) {
238  for (casadi_int j=i+start_inner; j!=i+stop_inner; j+=step_inner) {
239  // False if we've reached the end
240  if (it==v.end()) return false;
241 
242  // Check if value matches
243  if (*it++ != j) return false;
244  }
245  }
246 
247  // False if there are still elements not accounted for
248  if (it!=v.end()) return false; // NOLINT
249 
250  // True if reached this point
251  return true;
252  }

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 796 of file casadi_misc.hpp.

796  {
797  return is_decreasing(v) || is_increasing(v);
798  }
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 741 of file casadi_misc.hpp.

741  {
742  std::set<T> s(v.begin(), v.end());
743  return v.size()==s.size();
744  }

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 621 of file casadi_misc.hpp.

621  {
622  std::vector<T> ret = a;
623  ret.insert(ret.end(), b.begin(), b.end());
624  return ret;
625  }

◆ 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 628 of file casadi_misc.hpp.

628  {
629  std::vector<T> ret = a;
630  ret.insert(ret.end(), b.begin(), b.end());
631  ret.insert(ret.end(), c.begin(), c.end());
632  return ret;
633  }

◆ kkt_solver_from_string()

piqp::KKTSolver casadi::kkt_solver_from_string ( const std::string &  s)
inline

Definition at line 51 of file piqp_interface.cpp.

51  {
52  if (s == "dense_cholesky") return piqp::KKTSolver::dense_cholesky;
53  if (s == "sparse_ldlt") return piqp::KKTSolver::sparse_ldlt;
54  if (s == "sparse_ldlt_eq_cond") return piqp::KKTSolver::sparse_ldlt_eq_cond;
55  if (s == "sparse_ldlt_ineq_cond") return piqp::KKTSolver::sparse_ldlt_ineq_cond;
56  if (s == "sparse_ldlt_cond") return piqp::KKTSolver::sparse_ldlt_cond;
57  if (s == "sparse_multistage") return piqp::KKTSolver::sparse_multistage;
58  casadi_error("Unknown kkt_solver '" + s + "'. Choose one of: dense_cholesky, "
59  "sparse_ldlt, sparse_ldlt_eq_cond, sparse_ldlt_ineq_cond, sparse_ldlt_cond, "
60  "sparse_multistage.");
61  return piqp::KKTSolver::sparse_ldlt;
62  }

References kkt_solver_from_string().

Referenced by casadi::PiqpInterface::init(), kkt_solver_from_string(), and casadi::PiqpInterface::PiqpInterface().

◆ knot_offsets()

static std::vector<casadi_int> casadi::knot_offsets ( const std::vector< casadi_int > &  knot_dims)
static

Definition at line 74 of file blazing_spline.cpp.

74  {
75  std::vector<casadi_int> offsets(knot_dims.size() + 1);
76  offsets[0] = 0;
77  for (size_t i = 0; i < knot_dims.size(); ++i)
78  offsets[i + 1] = offsets[i] + knot_dims[i];
79  return offsets;
80  }

Referenced by blazing_spline().

◆ knot_size() [1/2]

static casadi_int casadi::knot_size ( const MX k)
static

Definition at line 213 of file bspline.cpp.

213 { return k.size1(); }

References casadi::GenericMatrix< MatType >::size1().

◆ knot_size() [2/2]

static casadi_int casadi::knot_size ( const std::vector< double > &  k)
static

Definition at line 212 of file bspline.cpp.

212 { return k.size(); }

Referenced by do_inline().

◆ kron_contract()

MX casadi::kron_contract ( const MX m,
const MX x,
bool  inner 
)
inline

inner = true: Y[i, j] = sum over (r, s) of M[i*mB+r, j*nB+s] * X[r, s] inner = false: Y[r, s] = sum over (i, j) of X[i, j] * M[i*mB+r, j*nB+s]

Closes the AD algebra of kron under arbitrary-order differentiation.

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

Definition at line 1121 of file mx.hpp.

1121  {
1122  return MX::kron_contract(m, x, inner);
1123  }

References casadi::MX::kron_contract().

Referenced by casadi::KronContract::ad_forward(), casadi::Kron::ad_reverse(), casadi::KronContract::ad_reverse(), and casadi::KronContract::eval_mx().

◆ kron_sp_gen()

template<bool Fwd>
static int casadi::kron_sp_gen ( const Sparsity sp_a,
const Sparsity sp_b,
typename KronSpTraits< Fwd >::arg_t  arg,
typename KronSpTraits< Fwd >::res_t  res 
)
static

Definition at line 61 of file kron.cpp.

63  {
64  const casadi_int* a_colind = sp_a.colind();
65  const casadi_int* b_colind = sp_b.colind();
66  const casadi_int a_ncol = sp_a.size2();
67  const casadi_int b_ncol = sp_b.size2();
68  casadi_int k = 0;
69  for (casadi_int a_cc=0; a_cc<a_ncol; ++a_cc) {
70  for (casadi_int b_cc=0; b_cc<b_ncol; ++b_cc) {
71  for (casadi_int a_el=a_colind[a_cc]; a_el<a_colind[a_cc+1]; ++a_el) {
72  for (casadi_int b_el=b_colind[b_cc]; b_el<b_colind[b_cc+1]; ++b_el) {
73  KronSpTraits<Fwd>::step(arg, res, a_el, b_el, k);
74  ++k;
75  }
76  }
77  }
78  }
79  return 0;
80  }

References casadi::Sparsity::colind(), and casadi::Sparsity::size2().

◆ linspace()

template<typename T , typename F , typename L >
void casadi::linspace ( std::vector< T > &  v,
const F &  first,
const L &  last 
)

Definition at line 868 of file casadi_misc.hpp.

868  {
869  if (v.size()<2)
870  throw CasadiException("std::linspace: vector must contain at least two elements");
871 
872  // Increment
873  T increment = (last-first)/T(v.size()-1);
874 
875  v[0] = first;
876  for (unsigned i=1; i<v.size()-1; ++i)
877  v[i] = v[i-1] + increment;
878  v[v.size()-1] = last;
879  }

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_blas()

CASADI_EXPORT void casadi::load_blas ( const std::string &  name)

Definition at line 255 of file blas.cpp.

255  {
256  if (name == "reference") return;
257  Blas::load_plugin(name);
258 }

References casadi::PluginInterface< Blas >::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_graphmodel()

CASADI_EXPORT void casadi::load_graphmodel ( const std::string &  name)

Definition at line 78 of file graph_model.cpp.

78 { GraphModel::load_plugin(name); }

References casadi::GraphModel::load_plugin().

◆ load_linsol()

CASADI_EXPORT void casadi::load_linsol ( const std::string &  name)

Definition at line 233 of file linsol.cpp.

233  {
234  Linsol::load_plugin(name);
235  }

References casadi::Linsol::load_plugin().

◆ load_modelicaparser()

CASADI_EXPORT void casadi::load_modelicaparser ( const std::string &  name)

Definition at line 64 of file modelica_parser.cpp.

64  {
65  ModelicaParser::load_plugin(name);
66 }

References casadi::ModelicaParser::load_plugin().

◆ load_raw()

template<typename T >
static bool casadi::load_raw ( DM dm,
casadi_int  n,
const onnx::TensorProto &  tensor,
const char *  type_name 
)
static

Definition at line 100 of file onnx_utilities.cpp.

101  {
102  if (!(tensor.has_raw_data() && tensor.raw_data().size() > 0)) return false;
103  const std::string& raw = tensor.raw_data();
104  casadi_assert(raw.size() == static_cast<size_t>(n) * sizeof(T),
105  std::string("Raw data size mismatch for ") + type_name);
106  const T* p = reinterpret_cast<const T*>(raw.data());
107  for (casadi_int i = 0; i < n; ++i) dm(i) = static_cast<double>(p[i]);
108  return true;
109  }

References T.

◆ 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 170 of file casadi_misc.cpp.

170  {
171  casadi_assert_dev(!has_negative(v));
172  return lookupvector(v, (*std::max_element(v.begin(), v.end()))+1);
173  }
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 159 of file casadi_misc.cpp.

159  {
160  casadi_assert(in_range(v, size),
161  "lookupvector: out of bounds. Some elements in v fall out of [0, size[");
162  std::vector<casadi_int> lookup(size, -1);
163 
164  for (casadi_int i=0;i<v.size();i++) {
165  lookup[v[i]] = i;
166  }
167  return lookup;
168  }

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 479 of file sleqp_interface.cpp.

480  {
481  switch (status) {
482  case SLEQP_STATUS_OPTIMAL:
483  return SOLVER_RET_SUCCESS;
484  case SLEQP_STATUS_INFEASIBLE:
485  return SOLVER_RET_INFEASIBLE;
486 
487  case SLEQP_STATUS_ABORT_ITER:
488  case SLEQP_STATUS_ABORT_MANUAL:
489  case SLEQP_STATUS_ABORT_TIME:
490  return SOLVER_RET_LIMITED;
491  default:
492  // case SLEQP_STATUS_UNKNOWN:
493  // case SLEQP_STATUS_RUNNING:
494  // case SLEQP_STATUS_UNBOUNDED:
495  // case SLEQP_STATUS_ABORT_DEADPOINT:
496  return SOLVER_RET_UNKNOWN;
497  }
498  }

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 }

◆ mosek_stream_cb()

static void casadi::mosek_stream_cb ( void *  ,
const char *  s 
)
static

Definition at line 295 of file mosek_interface.cpp.

295 { std::fputs(s, stderr); }

Referenced by casadi::MosekInterface::init_mem().

◆ 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 1265 of file sx_instantiator.cpp.

1268  {
1269  SX result = substitute(ex, x, a)*current_dx/current_denom;
1270  for (casadi_int i=0;i<x.nnz();i++) {
1271  if (order_contributions[i]<=order) {
1272  result += mtaylor_recursive(SX::jacobian(ex, x->at(i)),
1273  x, a,
1274  order-order_contributions[i],
1275  order_contributions,
1276  current_dx*(x->at(i)-a->at(i)),
1277  current_denom*static_cast<double>(current_order),
1278  current_order+1);
1279  }
1280  }
1281  return result;
1282  }
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().

◆ mtimes_dense_dispatch< double >()

template<>
void CASADI_EXPORT casadi::mtimes_dense_dispatch< double > ( const std::string &  blas,
const double *  A,
casadi_int  m,
casadi_int  k,
const double *  B,
casadi_int  n,
double *  C 
)

Definition at line 401 of file dm_instantiator.cpp.

404  {
405  Blas::mtimes(Blas::shorthand_for(blas), A, m, k, B, n, C);
406  }

References C.

◆ mul_bvec_fwd()

template<bool COMBINE_AND>
static void casadi::mul_bvec_fwd ( const bvec_t x,
const Sparsity x_sp,
const bvec_t y,
const Sparsity y_sp,
bvec_t z,
const Sparsity z_sp,
bvec_t w 
)
static

Definition at line 1824 of file sparsity.cpp.

1826  {
1827  // Assert dimensions
1828  casadi_assert(z_sp.size1()==x_sp.size1() && x_sp.size2()==y_sp.size1()
1829  && y_sp.size2()==z_sp.size2(),
1830  "Dimension error. Got x=" + x_sp.dim() + ", y=" + y_sp.dim()
1831  + " and z=" + z_sp.dim() + ".");
1832 
1833  // Direct access to the arrays
1834  const casadi_int* y_colind = y_sp.colind();
1835  const casadi_int* y_row = y_sp.row();
1836  const casadi_int* x_colind = x_sp.colind();
1837  const casadi_int* x_row = x_sp.row();
1838  const casadi_int* z_colind = z_sp.colind();
1839  const casadi_int* z_row = z_sp.row();
1840 
1841  // Loop over the columns of y and z
1842  casadi_int ncol = z_sp.size2();
1843  for (casadi_int cc=0; cc<ncol; ++cc) {
1844  // Get the dense column of z
1845  for (casadi_int kk=z_colind[cc]; kk<z_colind[cc+1]; ++kk) {
1846  w[z_row[kk]] = z[kk];
1847  }
1848 
1849  // Loop over the nonzeros of y
1850  for (casadi_int kk=y_colind[cc]; kk<y_colind[cc+1]; ++kk) {
1851  casadi_int rr = y_row[kk];
1852 
1853  // Loop over corresponding columns of x
1854  bvec_t yy = y[kk];
1855  for (casadi_int kk1=x_colind[rr]; kk1<x_colind[rr+1]; ++kk1) {
1856  w[x_row[kk1]] |= COMBINE_AND ? (x[kk1] & yy) : (x[kk1] | yy);
1857  }
1858  }
1859 
1860  // Get the sparse column of z
1861  for (casadi_int kk=z_colind[cc]; kk<z_colind[cc+1]; ++kk) {
1862  z[kk] = w[z_row[kk]];
1863  }
1864  }
1865  }

References casadi::Sparsity::colind(), casadi::Sparsity::dim(), casadi::Sparsity::row(), casadi::Sparsity::size1(), and casadi::Sparsity::size2().

◆ mul_overflows()

template<typename T >
bool casadi::mul_overflows ( const T &  a,
const T &  b 
)

Definition at line 553 of file casadi_misc.hpp.

553  {
554  if (a==0 || b==0) return false;
555  return std::abs(std::numeric_limits<T>::max()/a) < std::abs(b);
556  }

Referenced by casadi::SparsityInternal::find().

◆ 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:
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().

◆ name_has_g()

bool casadi::name_has_g ( const std::string &  name)

Definition at line 47 of file nlpsol.cpp.

47  {
48  size_t pos = name.find("g");
49 
50  // 'g' does not occur
51  if (pos == std::string::npos) return false;
52 
53  // Check if 'g' has a word boundary on the left
54  bool left = pos==0 || !isalnum(name[pos-1]);
55 
56  // Check if 'g' has a word boundary on the right
57  bool right = pos+1 == name.size() || !isalnum(name[pos+1]);
58 
59  return left && right;
60  }

Referenced by construct_nlpsol().

◆ new_ifstream_compat()

CASADI_EXPORT std::ifstream* casadi::new_ifstream_compat ( const std::string &  utf8_path,
std::ios::openmode  mode = std::ios::in 
)

◆ next_quoted_token()

static std::string casadi::next_quoted_token ( const std::string &  line,
size_t &  pos 
)
static

Definition at line 2638 of file code_generator.cpp.

2638  {
2639  size_t n1 = line.find('"', pos);
2640  casadi_assert(n1 != std::string::npos, "Missing quoted token in: " + line);
2641  std::string r;
2642  size_t i = n1 + 1;
2643  for (; i < line.size(); ++i) {
2644  if (line[i] == '\\' && i + 1 < line.size()) {
2645  r += line[++i];
2646  } else if (line[i] == '"') {
2647  break;
2648  } else {
2649  r += line[i];
2650  }
2651  }
2652  casadi_assert(i < line.size(), "Unterminated quoted token in: " + line);
2653  pos = i + 1;
2654  return r;
2655  }

Referenced by casadi::CodeGenerator::sanitize_source().

◆ norm_1()

template<typename T >
T casadi::norm_1 ( const std::vector< T > &  x)

Definition at line 998 of file casadi_misc.hpp.

998  {
999  T ret = 0;
1000  for (casadi_int k=0; k<x.size(); ++k) {
1001  ret += fabs(x[k]);
1002  }
1003  return ret;
1004  }

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 1007 of file casadi_misc.hpp.

1007  {
1008  T ret = 0;
1009  for (casadi_int k=0; k<x.size(); ++k) {
1010  ret += x[k]*x[k];
1011  }
1012  return sqrt(ret);
1013  }

References T.

◆ norm_inf()

template<typename T >
T casadi::norm_inf ( const std::vector< T > &  x)

Definition at line 989 of file casadi_misc.hpp.

989  {
990  T ret = 0;
991  for (casadi_int k=0; k<x.size(); ++k) {
992  ret = fmax(ret, fabs(x[k]));
993  }
994  return ret;
995  }

References T.

◆ normalized_in()

int casadi::normalized_in ( std::istream &  stream,
double &  ret 
)
inline

Definition at line 469 of file casadi_misc.hpp.

469  {
470  std::streampos start = stream.tellg();
471  stream >> ret;
472  // Failed to interpret as double?
473  if (stream.fail()) {
474  // Clear error flag
475  stream.clear();
476  // Reset stream position
477  // Need to parse e.g "-inf"
478  stream.seekg(start);
479  // Might be a inf/nan
480  std::string non_reg;
481  stream >> non_reg;
482  // Break on trailing whitespace
483  if (stream.fail()) {
484  if (stream.eof()) {
485  ret = std::numeric_limits<double>::quiet_NaN();
486  return -1; // End of stream
487  } else {
488  ret = std::numeric_limits<double>::quiet_NaN();
489  return 1; // Failed to parse to string
490  }
491  }
492  if (non_reg=="inf") {
493  ret = std::numeric_limits<double>::infinity();
494  } else if (non_reg=="-inf") {
495  ret = -std::numeric_limits<double>::infinity();
496  } else if (non_reg=="nan" || non_reg=="-nan") {
497  ret = std::numeric_limits<double>::quiet_NaN();
498  } else {
499  ret = std::numeric_limits<double>::quiet_NaN();
500  return 2; // Failed to interpret as number
501  }
502  }
503  return 0;
504  }

◆ normalized_out()

void casadi::normalized_out ( std::ostream &  stream,
double  val 
)
inline

Definition at line 458 of file casadi_misc.hpp.

458  {
459  if (val==std::numeric_limits<double>::infinity()) {
460  stream << "inf";
461  } else if (val==-std::numeric_limits<double>::infinity()) {
462  stream << "-inf";
463  } else if (val!=val) {
464  stream << "nan";
465  } else {
466  stream << val;
467  }
468  }

Referenced by casadi::FunctionInternal::generate_in(), casadi::Function::generate_in(), casadi::Function::generate_out(), casadi::FunctionInternal::generate_out(), and casadi::FunctionInternal::print_canonical().

◆ normalized_setup() [1/2]

CASADI_EXPORT void casadi::normalized_setup ( std::istream &  stream)

◆ normalized_setup() [2/2]

CASADI_EXPORT void casadi::normalized_setup ( std::ostream &  stream)

Definition at line 424 of file casadi_misc.cpp.

424  {
425  stream.imbue(std::locale("C"));
426  stream << std::scientific;
427  stream << std::setprecision(std::numeric_limits<double>::digits10 + 1);
428  }

◆ ofstream_compat()

CASADI_EXPORT std::unique_ptr< std::ostream > casadi::ofstream_compat ( const std::string &  utf8_path,
std::ios::openmode  mode 
)

Definition at line 527 of file casadi_os.cpp.

528  {
529 #ifdef _WIN32
530  std::wstring utf16_path = utf8_to_utf16(utf8_path);
531 
532  DWORD access = 0;
533  access |= GENERIC_WRITE;
534  if (mode & std::ios::in) access |= GENERIC_READ;
535 
536  DWORD creation = (mode & std::ios::app) ? OPEN_ALWAYS : CREATE_ALWAYS;
537 
538  HANDLE h = CreateFileW(utf16_path.c_str(), access,
539  FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
540  creation, FILE_ATTRIBUTE_NORMAL, nullptr);
541  if (h == INVALID_HANDLE_VALUE) return {};
542 
543  int flags = (mode & std::ios::in) ? _O_RDWR : _O_WRONLY;
544  if (mode & std::ios::app) flags |= _O_APPEND;
545  if (mode & std::ios::binary) {
546  flags |= _O_BINARY;
547  } else {
548  flags |= _O_TEXT;
549  }
550 
551  int fd = _open_osfhandle(reinterpret_cast<intptr_t>(h), flags);
552  if (fd == -1) {
553  CloseHandle(h);
554  return {};
555  }
556 
557  auto owned = std::make_shared<OwnedOStream>(fd);
558  return std::unique_ptr<StreamWithOwnedOBuffer>(new StreamWithOwnedOBuffer(std::move(owned)));
559 #else
560  auto ofs = std::unique_ptr<std::ofstream>(new std::ofstream(utf8_path, mode));
561  if (!*ofs) return {};
562  return std::unique_ptr<std::ostream>(std::move(ofs));
563 #endif
564 }

Referenced by casadi::Filesystem::ofstream_ptr().

◆ onnx_dtype_enum()

CASADI_EXPORT casadi_int casadi::onnx_dtype_enum ( const std::string &  name)

Definition at line 87 of file onnx_function.cpp.

87  {
88  static const std::map<std::string, casadi_int> m = {
89  {"FLOAT", 1}, {"UINT8", 2}, {"INT8", 3}, {"UINT16", 4}, {"INT16", 5},
90  {"INT32", 6}, {"INT64", 7}, {"STRING", 8}, {"BOOL", 9}, {"FLOAT16", 10},
91  {"DOUBLE", 11}, {"UINT32", 12}, {"UINT64", 13}, {"BFLOAT16", 16}};
92  auto it = m.find(name);
93  return it != m.end() ? it->second : 0;
94  }

Referenced by casadi::OnnxFunction::OnnxFunction().

◆ onnx_dtype_name()

std::string casadi::onnx_dtype_name ( casadi_int  t)

Definition at line 76 of file onnx_function.cpp.

76  {
77  switch (t) {
78  case 1: return "FLOAT"; case 2: return "UINT8"; case 3: return "INT8";
79  case 4: return "UINT16"; case 5: return "INT16"; case 6: return "INT32";
80  case 7: return "INT64"; case 8: return "STRING"; case 9: return "BOOL";
81  case 10: return "FLOAT16"; case 11: return "DOUBLE"; case 12: return "UINT32";
82  case 13: return "UINT64"; case 16: return "BFLOAT16";
83  default: return "TYPE" + str(t);
84  }
85  }

References str().

Referenced by io_node().

◆ onnx_input_name()

std::string casadi::onnx_input_name ( const Function f,
casadi_int  i 
)

Definition at line 34 of file onnx_export.cpp.

34  {
35  std::string n = f.name_in(i);
36  return n.empty() ? "input_" + std::to_string(i) : n;
37  }

References casadi::Function::name_in().

Referenced by casadi::Onnx::load().

◆ onnx_output_name()

std::string casadi::onnx_output_name ( const Function f,
casadi_int  i 
)

Definition at line 39 of file onnx_export.cpp.

39  {
40  std::string n = f.name_out(i);
41  return n.empty() ? "output_" + std::to_string(i) : n;
42  }

References casadi::Function::name_out().

Referenced by casadi::Onnx::load().

◆ open_resource()

static Resource casadi::open_resource ( const std::string &  path)
static

Definition at line 642 of file dae_builder_internal.cpp.

642  {
643  // Check for .bmo extension (Lace Modelica binary model)
644  if (path.size() >= 4 && path.substr(path.size() - 4) == ".bmo") {
645  // Create temporary directory resource
646  std::string bmo_file = Filesystem::filename(path);
647  TemporaryDirResource* res = new TemporaryDirResource(bmo_file, "temp");
648 
649  // Use Lace Modelica plugin to process BMO and populate the directory
650  ModelicaParser parser("lacemodelica");
651  parser.parse(path, res->path());
652 
653  return Resource::create(res);
654  }
655 
656  // Default: treat as FMU (zip file or directory)
657  return Resource(path);
658 }

References casadi::Resource::create(), casadi::Filesystem::filename(), casadi::ModelicaParser::parse(), casadi::TemporaryDirResource::path(), and path().

◆ operation_checker()

template<template< casadi_int > class F>
bool casadi::operation_checker ( casadi_int  op)

Definition at line 1129 of file calculus.hpp.

1129  {
1130  return operation_getter<F, bool>(op);
1131  }

◆ operation_getter()

template<template< casadi_int > class F, typename T >
T casadi::operation_getter ( casadi_int  op)

Definition at line 1021 of file calculus.hpp.

1021  {
1022  switch (static_cast<Operation>(op)) {
1023  case OP_ASSIGN: return F<OP_ASSIGN>::check;
1024  case OP_ADD: return F<OP_ADD>::check;
1025  case OP_SUB: return F<OP_SUB>::check;
1026  case OP_MUL: return F<OP_MUL>::check;
1027  case OP_DIV: return F<OP_DIV>::check;
1028  case OP_NEG: return F<OP_NEG>::check;
1029  case OP_EXP: return F<OP_EXP>::check;
1030  case OP_LOG: return F<OP_LOG>::check;
1031  case OP_POW: return F<OP_POW>::check;
1032  case OP_CONSTPOW: return F<OP_CONSTPOW>::check;
1033  case OP_SQRT: return F<OP_SQRT>::check;
1034  case OP_SQ: return F<OP_SQ>::check;
1035  case OP_TWICE: return F<OP_TWICE>::check;
1036  case OP_SIN: return F<OP_SIN>::check;
1037  case OP_COS: return F<OP_COS>::check;
1038  case OP_TAN: return F<OP_TAN>::check;
1039  case OP_ASIN: return F<OP_ASIN>::check;
1040  case OP_ACOS: return F<OP_ACOS>::check;
1041  case OP_ATAN: return F<OP_ATAN>::check;
1042  case OP_LT: return F<OP_LT>::check;
1043  case OP_LE: return F<OP_LE>::check;
1044  case OP_EQ: return F<OP_EQ>::check;
1045  case OP_NE: return F<OP_NE>::check;
1046  case OP_NOT: return F<OP_NOT>::check;
1047  case OP_AND: return F<OP_AND>::check;
1048  case OP_OR: return F<OP_OR>::check;
1049  case OP_FLOOR: return F<OP_FLOOR>::check;
1050  case OP_CEIL: return F<OP_CEIL>::check;
1051  case OP_FMOD: return F<OP_FMOD>::check;
1052  case OP_REMAINDER: return F<OP_REMAINDER>::check;
1053  case OP_FABS: return F<OP_FABS>::check;
1054  case OP_SIGN: return F<OP_SIGN>::check;
1055  case OP_COPYSIGN: return F<OP_COPYSIGN>::check;
1056  case OP_IF_ELSE_ZERO: return F<OP_IF_ELSE_ZERO>::check;
1057  case OP_ERF: return F<OP_ERF>::check;
1058  case OP_FMIN: return F<OP_FMIN>::check;
1059  case OP_FMAX: return F<OP_FMAX>::check;
1060  case OP_INV: return F<OP_INV>::check;
1061  case OP_SINH: return F<OP_SINH>::check;
1062  case OP_COSH: return F<OP_COSH>::check;
1063  case OP_TANH: return F<OP_TANH>::check;
1064  case OP_ASINH: return F<OP_ASINH>::check;
1065  case OP_ACOSH: return F<OP_ACOSH>::check;
1066  case OP_ATANH: return F<OP_ATANH>::check;
1067  case OP_ATAN2: return F<OP_ATAN2>::check;
1068  case OP_CONST: return F<OP_CONST>::check;
1069  case OP_INPUT: return F<OP_INPUT>::check;
1070  case OP_OUTPUT: return F<OP_OUTPUT>::check;
1071  case OP_PARAMETER: return F<OP_PARAMETER>::check;
1072  case OP_CALL: return F<OP_CALL>::check;
1073  case OP_FIND: return F<OP_FIND>::check;
1074  case OP_LOW: return F<OP_LOW>::check;
1075  case OP_MAP: return F<OP_MAP>::check;
1076  case OP_MTIMES: return F<OP_MTIMES>::check;
1077  case OP_SOLVE: return F<OP_SOLVE>::check;
1078  case OP_TRANSPOSE: return F<OP_TRANSPOSE>::check;
1079  case OP_DETERMINANT: return F<OP_DETERMINANT>::check;
1080  case OP_INVERSE: return F<OP_INVERSE>::check;
1081  case OP_DOT: return F<OP_DOT>::check;
1082  case OP_BILIN: return F<OP_BILIN>::check;
1083  case OP_RANK1: return F<OP_RANK1>::check;
1084  case OP_HORZCAT: return F<OP_HORZCAT>::check;
1085  case OP_VERTCAT: return F<OP_VERTCAT>::check;
1086  case OP_DIAGCAT: return F<OP_DIAGCAT>::check;
1087  case OP_HORZSPLIT: return F<OP_HORZSPLIT>::check;
1088  case OP_VERTSPLIT: return F<OP_VERTSPLIT>::check;
1089  case OP_DIAGSPLIT: return F<OP_DIAGSPLIT>::check;
1090  case OP_RESHAPE: return F<OP_RESHAPE>::check;
1091  case OP_SPARSITY_CAST: return F<OP_SPARSITY_CAST>::check;
1092  case OP_SUBREF: return F<OP_SUBREF>::check;
1093  case OP_SUBASSIGN: return F<OP_SUBASSIGN>::check;
1094  case OP_GETNONZEROS: return F<OP_GETNONZEROS>::check;
1095  case OP_GETNONZEROS_PARAM: return F<OP_GETNONZEROS_PARAM>::check;
1096  case OP_ADDNONZEROS: return F<OP_ADDNONZEROS>::check;
1097  case OP_ADDNONZEROS_PARAM: return F<OP_ADDNONZEROS>::check;
1098  case OP_SETNONZEROS: return F<OP_SETNONZEROS>::check;
1099  case OP_SETNONZEROS_PARAM: return F<OP_SETNONZEROS>::check;
1100  case OP_PROJECT: return F<OP_PROJECT>::check;
1101  case OP_ASSERTION: return F<OP_ASSERTION>::check;
1102  case OP_MONITOR: return F<OP_MONITOR>::check;
1103  case OP_DUMP: return F<OP_DUMP>::check;
1104  case OP_NORM2: return F<OP_NORM2>::check;
1105  case OP_NORM1: return F<OP_NORM1>::check;
1106  case OP_NORMINF: return F<OP_NORMINF>::check;
1107  case OP_NORMF: return F<OP_NORMF>::check;
1108  case OP_MMIN: return F<OP_MMIN>::check;
1109  case OP_MMAX: return F<OP_MMAX>::check;
1110  case OP_HORZREPMAT: return F<OP_HORZREPMAT>::check;
1111  case OP_HORZREPSUM: return F<OP_HORZREPSUM>::check;
1112  case OP_ERFINV: return F<OP_ERFINV>::check;
1113  case OP_PRINTME: return F<OP_PRINTME>::check;
1114  case OP_LIFT: return F<OP_LIFT>::check;
1115  case OP_EINSTEIN: return F<OP_EINSTEIN>::check;
1116  case OP_BSPLINE: return F<OP_BSPLINE>::check;
1117  case OP_CONVEXIFY: return F<OP_CONVEXIFY>::check;
1118  case OP_LOG1P: return F<OP_LOG1P>::check;
1119  case OP_EXPM1: return F<OP_EXPM1>::check;
1120  case OP_HYPOT: return F<OP_HYPOT>::check;
1121  case OP_LOGSUMEXP: return F<OP_LOGSUMEXP>::check;
1122  case OP_KRON: return F<OP_KRON>::check;
1123  case OP_KRON_CONTRACT: return F<OP_KRON_CONTRACT>::check;
1124  }
1125  return T();
1126  }
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_DUMP, 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_KRON, OP_KRON_CONTRACT, 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<<() [1/7]

template<typename T , size_t N>
std::ostream& casadi::operator<< ( std::ostream &  stream,
const std::array< T, N > &  v 
)

Definition at line 522 of file casadi_misc.hpp.

522  {
523  stream << casadi::str(v);
524  return stream;
525  }

References str().

◆ operator<<() [2/7]

template<typename T2 >
std::ostream& casadi::operator<< ( std::ostream &  stream,
const std::map< std::string, T2 > &  p 
)

Definition at line 547 of file casadi_misc.hpp.

547  {
548  stream << casadi::str(p);
549  return stream;
550  }

References str().

◆ operator<<() [3/7]

template<typename T1 , typename T2 >
std::ostream& casadi::operator<< ( std::ostream &  stream,
const std::map< T1, T2 > &  p 
)

Definition at line 541 of file casadi_misc.hpp.

541  {
542  stream << casadi::str(p);
543  return stream;
544  }

References str().

◆ operator<<() [4/7]

template<typename T1 , typename T2 >
std::ostream& casadi::operator<< ( std::ostream &  stream,
const std::pair< T1, T2 > &  p 
)

Definition at line 535 of file casadi_misc.hpp.

535  {
536  stream << casadi::str(p);
537  return stream;
538  }

References str().

◆ operator<<() [5/7]

template<typename T >
std::ostream& casadi::operator<< ( std::ostream &  stream,
const std::set< T > &  v 
)

Definition at line 529 of file casadi_misc.hpp.

529  {
530  stream << casadi::str(v);
531  return stream;
532  }

References str().

◆ operator<<() [6/7]

template<typename T >
std::ostream& casadi::operator<< ( std::ostream &  stream,
const std::vector< T > &  v 
)

Definition at line 515 of file casadi_misc.hpp.

515  {
516  stream << casadi::str(v);
517  return stream;
518  }

References str().

◆ operator<<() [7/7]

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 65 of file repmat.cpp.

65 { return x | y; }

Referenced by casadi::HorzRepsum::sp_forward(), casadi::HorzRepmat::sp_reverse(), and casadi::HorzRepsum::sp_reverse().

◆ output_categories()

CASADI_EXPORT std::vector< Category > casadi::output_categories ( )

Definition at line 301 of file dae_builder_internal.cpp.

301  {
302  std::vector<Category> ret;
303  for (casadi_int i = 0; i != enum_traits<Category>::n_enum; ++i) {
304  auto cat = static_cast<Category>(i);
305  if (is_output_category(cat)) ret.push_back(cat);
306  }
307  return ret;
308 }
bool is_output_category(Category cat)

References is_output_category().

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 1391 of file optistack_internal.cpp.

1391  {
1392  // Override when values are supplied
1393  auto it = temp.find(i);
1394  if (it==temp.end()) {
1395  return true;
1396  } else {
1397  Slice all;
1398  DM t = static_cast<DM>(it->second);
1399  num.back().set(t, false, all, all);
1400  }
1401  return false;
1402 }
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:81

References all(), and casadi::Matrix< Scalar >::set().

Referenced by casadi::OptiNode::value().

◆ pack_tensors()

static void casadi::pack_tensors ( SerializingStream s,
const std::string &  d,
const std::vector< OnnxTensorInfo > &  v 
)
static

Definition at line 143 of file onnx_function.cpp.

144  {
145  std::vector<std::string> names;
146  std::vector<std::vector<casadi_int>> shapes;
147  std::vector<casadi_int> elem_types, numels;
148  for (const OnnxTensorInfo& t : v) {
149  names.push_back(t.name);
150  shapes.push_back(t.shape);
151  elem_types.push_back(t.elem_type);
152  numels.push_back(t.numel);
153  }
154  s.pack(d + "::names", names);
155  s.pack(d + "::shapes", shapes);
156  s.pack(d + "::elem_types", elem_types);
157  s.pack(d + "::numels", numels);
158  }

References casadi::SerializingStream::pack().

Referenced by casadi::OnnxFunction::serialize_body().

◆ 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 64 of file casadi_os.cpp.

64  {
65  #ifdef _WIN32
66  return ';';
67  #else
68  return ':';
69  #endif
70 }

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

◆ permutation_sign() [1/2]

static double casadi::permutation_sign ( const std::vector< casadi_int > &  p)
static

Definition at line 87 of file linsol_qr.cpp.

87  {
88  std::vector<bool> seen(p.size(), false);
89  casadi_int ncycle = 0;
90  for (casadi_int i=0; i<static_cast<casadi_int>(p.size()); ++i) {
91  if (!seen[i]) {
92  ncycle++;
93  for (casadi_int j=i; !seen[j]; j=p[j]) seen[j] = true;
94  }
95  }
96  return (static_cast<casadi_int>(p.size())-ncycle) % 2 ? -1 : 1;
97  }

Referenced by casadi::SymbolicQr::det(), casadi::LinsolQr::finalize(), and qr_block_det().

◆ permutation_sign() [2/2]

static double casadi::permutation_sign ( const std::vector< casadi_int > &  p)
static

Definition at line 48 of file symbolic_qr.cpp.

48  {
49  std::vector<bool> seen(p.size(), false);
50  casadi_int ncycle = 0;
51  for (casadi_int i=0; i<static_cast<casadi_int>(p.size()); ++i) {
52  if (!seen[i]) {
53  ncycle++;
54  for (casadi_int j=i; !seen[j]; j=p[j]) seen[j] = true;
55  }
56  }
57  return (static_cast<casadi_int>(p.size())-ncycle) % 2 ? -1.0 : 1.0;
58  }

◆ 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 636 of file casadi_misc.hpp.

636  {
637  casadi_assert_dev(order.size()==a.size());
638  casadi_assert_dev(is_permutation(order));
639  return vector_slice(a, order);
640  }
std::vector< T > vector_slice(const std::vector< T > &v, const std::vector< casadi_int > &i)
Slicing vector.

References is_permutation(), and vector_slice().

◆ pop_prefix()

CASADI_EXPORT std::string casadi::pop_prefix ( const std::string &  s,
std::string *  rem 
)

Definition at line 1496 of file fmu_function.cpp.

1496  {
1497  // Get prefix
1498  casadi_assert_dev(!s.empty());
1499  size_t pos = s.find('_');
1500  casadi_assert(pos < s.size(), "Cannot process \"" + s + "\"");
1501  // Get prefix
1502  std::string r = s.substr(0, pos);
1503  // Remainder, if requested (note that rem == &s is possible)
1504  if (rem) *rem = s.substr(pos+1, std::string::npos);
1505  // Return prefix
1506  return r;
1507 }

Referenced by casadi::InputStruct::parse(), and casadi::OutputStruct::parse().

◆ prefix_graph_names()

static void casadi::prefix_graph_names ( onnx::GraphProto *  g,
const std::string &  prefix 
)
static

Definition at line 413 of file onnx_export.cpp.

413  {
414  std::set<std::string> defined;
415  for (int i = 0; i < g->input_size(); ++i) defined.insert(g->input(i).name());
416  for (int i = 0; i < g->initializer_size(); ++i) defined.insert(g->initializer(i).name());
417  for (int n = 0; n < g->node_size(); ++n) {
418  for (int j = 0; j < g->node(n).output_size(); ++j) defined.insert(g->node(n).output(j));
419  }
420  for (int n = 0; n < g->node_size(); ++n) {
421  onnx::NodeProto* nd = g->mutable_node(n);
422  for (int i = 0; i < nd->input_size(); ++i) {
423  if (defined.count(nd->input(i))) nd->set_input(i, prefix + nd->input(i));
424  }
425  for (int i = 0; i < nd->output_size(); ++i) nd->set_output(i, prefix + nd->output(i));
426  }
427  for (int i = 0; i < g->input_size(); ++i) {
428  g->mutable_input(i)->set_name(prefix + g->input(i).name());
429  }
430  for (int i = 0; i < g->output_size(); ++i) {
431  g->mutable_output(i)->set_name(prefix + g->output(i).name());
432  }
433  }

◆ 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 279 of file calculus.hpp.

279  {
280  std::ios::fmtflags f(uout().flags());
281  uout() << "|> " << y << " : ";
282  uout() << std::setprecision(std::numeric_limits<double>::digits10 + 1) << std::scientific;
283  uout() << x << std::endl;
284  uout().flags(f);
285  return x;
286  }

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 934 of file casadi_misc.hpp.

934  {
935  T r = 1;
936  for (casadi_int i=0;i<values.size();++i) r*=values[i];
937  return r;
938  }

References T.

Referenced by casadi_func_hess_prod(), casadi::Matrix< Scalar >::einstein(), casadi::MX::einstein(), einstein_process(), casadi::MX::interpn_linear(), and interpolant().

◆ 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 111 of file conic.cpp.

112  {
113  // We have: minimize f(x) = 1/2 * x' H x + c'x
114  // subject to lbx <= x <= ubx
115  // lbg <= g(x) = A x + b <= ubg
116  // h(x) >=0 (psd)
117 
118  // Extract 'expand' option
119  bool expand = false;
120  Dict opt = opts;
121  extract_from_dict_inplace(opt, "expand", expand);
122  bool postpone_expand = false;
123  extract_from_dict_inplace(opt, "postpone_expand", postpone_expand);
124  bool error_on_fail = get_from_dict(opts, "error_on_fail", true);
125 
126  if (expand && !postpone_expand && M::type_name()=="MX") {
127  Function f = Function("f", qp, {"x", "p"}, {"f", "g", "h"});
128  std::vector<SX> arg = f.sx_in();
129  std::vector<SX> res = f(arg);
130  SXDict qp_mod;
131  for (casadi_int i=0;i<f.n_in();++i) qp_mod[f.name_in(i)] = arg[i];
132  for (casadi_int i=0;i<f.n_out();++i) qp_mod[f.name_out(i)] = res[i];
133  return qpsol_nlp(name, solver, qp_mod, opt);
134  }
135 
136  M x, p, f, g, h;
137  for (auto&& i : qp) {
138  if (i.first=="x") {
139  x = i.second;
140  } else if (i.first=="p") {
141  p = i.second;
142  } else if (i.first=="f") {
143  f = i.second;
144  } else if (i.first=="g") {
145  g = i.second;
146  } else if (i.first=="h") {
147  h = i.second;
148  } else {
149  casadi_error("No such field: " + i.first);
150  }
151  }
152 
153  if (f.is_empty()) f = 0;
154  if (g.is_empty()) g = M(0, 1);
155 
156  // Dimension checks
157  casadi_assert(g.is_dense() && g.is_vector(),
158  "Expected a dense vector 'g', but got " + g.dim() + ".");
159 
160  casadi_assert(f.is_dense() && f.is_scalar(),
161  "Expected a dense scalar 'f', but got " + f.dim() + ".");
162 
163  casadi_assert(x.is_dense() && x.is_vector(),
164  "Expected a dense vector 'x', but got " + x.dim() + ".");
165 
166  casadi_assert(h.is_square(),
167  "Expected a symmetric matrix 'h', but got " + h.dim() + ".");
168 
169  if (g.is_empty(true)) g = M(0, 1); // workaround
170 
171  // Gradient of the objective: gf == Hx + g
172  M gf = M::gradient(f, x);
173 
174  // Identify the linear term in the objective
175  M c = substitute(gf, x, M::zeros(x.sparsity()));
176 
177  // Identify the quadratic term in the objective
178  M H = M::jacobian(gf, x, {{"symmetric", true}});
179 
180  // Identify constant term in the objective
181  Function r("constant_qp", {x, p}, {substitute(f, x, M::zeros(x.sparsity()))});
182 
183  // Identify the constant term in the constraints
184  M b = substitute(g, x, M::zeros(x.sparsity()));
185 
186  // Identify the linear term in the constraints
187  M A = M::jacobian(g, x);
188 
189  // Identify the constant term in the psd constraints
190  M P = substitute(h, x, M::zeros(x.sparsity()));
191 
192  // Identify the linear term in the psd constraints
193  M Q = M::jacobian(h, x);
194 
195  // Create a function for calculating the required matrices vectors
196  Function prob(name + "_qp", {x, p}, {H, c, A, b, Q, P},
197  {"x", "p"}, {"H", "c", "A", "b", "Q", "P"});
198  if (expand && postpone_expand) prob = prob.expand();
199 
200  // Make sure that the problem is sound
201  casadi_assert(!prob.has_free(), "Cannot create '" + prob.name() + "' "
202  "since " + str(prob.get_free()) + " are free.");
203 
204  // Create the QP solver
205  Function conic_f = conic(name + "_qpsol", solver,
206  {{"h", H.sparsity()}, {"a", A.sparsity()},
207  {"p", P.sparsity()}, {"q", Q.sparsity()}}, opt);
208 
209  // Create an MXFunction with the right signature
210  std::vector<MX> ret_in(NLPSOL_NUM_IN);
211  ret_in[NLPSOL_X0] = MX::sym("x0", x.sparsity());
212  ret_in[NLPSOL_P] = MX::sym("p", p.sparsity());
213  ret_in[NLPSOL_LBX] = MX::sym("lbx", x.sparsity());
214  ret_in[NLPSOL_UBX] = MX::sym("ubx", x.sparsity());
215  ret_in[NLPSOL_LBG] = MX::sym("lbg", g.sparsity());
216  ret_in[NLPSOL_UBG] = MX::sym("ubg", g.sparsity());
217  ret_in[NLPSOL_LAM_X0] = MX::sym("lam_x0", x.sparsity());
218  ret_in[NLPSOL_LAM_G0] = MX::sym("lam_g0", g.sparsity());
219  std::vector<MX> ret_out(NLPSOL_NUM_OUT);
220 
221 
222  std::vector<MX> v(NL_NUM_IN);
223  v[NL_X] = ret_in[NLPSOL_X0];
224  v[NL_P] = ret_in[NLPSOL_P];
225  // Evaluate constant part of objective
226  MX rv = r(v)[0];
227  // Get expressions for the QP matrices and vectors
228  v = prob(v);
229 
230  // Call the QP solver
231  std::vector<MX> w(CONIC_NUM_IN);
232  w[CONIC_H] = v.at(0);
233  w[CONIC_G] = v.at(1);
234  w[CONIC_A] = v.at(2);
235  w[CONIC_Q] = v.at(4);
236  w[CONIC_P] = v.at(5);
237  w[CONIC_LBX] = ret_in[NLPSOL_LBX];
238  w[CONIC_UBX] = ret_in[NLPSOL_UBX];
239  w[CONIC_LBA] = ret_in[NLPSOL_LBG] - v.at(3);
240  w[CONIC_UBA] = ret_in[NLPSOL_UBG] - v.at(3);
241  w[CONIC_X0] = ret_in[NLPSOL_X0];
242  w[CONIC_LAM_X0] = ret_in[NLPSOL_LAM_X0];
243  w[CONIC_LAM_A0] = ret_in[NLPSOL_LAM_G0];
244  w = conic_f(w);
245 
246  // Get expressions for the solution
247  ret_out[NLPSOL_X] = reshape(w[CONIC_X], x.size());
248  ret_out[NLPSOL_F] = rv + w[CONIC_COST];
249  ret_out[NLPSOL_G] = reshape(mtimes(v.at(2), w[CONIC_X]), g.size()) + v.at(3);
250  ret_out[NLPSOL_LAM_X] = reshape(w[CONIC_LAM_X], x.size());
251  ret_out[NLPSOL_LAM_G] = reshape(w[CONIC_LAM_A], g.size());
252  ret_out[NLPSOL_LAM_P] = MX::nan(p.sparsity());
253 
254  Dict fun_opts;
255  fun_opts["default_in"] = nlpsol_default_in();
256  fun_opts["error_on_fail"] = error_on_fail;
257 
258  return Function(name, ret_in, ret_out, nlpsol_in(), nlpsol_out(), fun_opts);
259  }
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:279
std::vector< std::string > nlpsol_out()
Get NLP solver output scheme of NLP solvers.
Definition: nlpsol.cpp:285
double nlpsol_default_in(casadi_int ind)
Default input for an NLP solver.
Definition: nlpsol.cpp:291
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:111

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().

◆ qr_block_det()

static SX casadi::qr_block_det ( const SX B,
bool  amd 
)
static

Definition at line 62 of file symbolic_qr.cpp.

62  {
63  if (B.is_scalar()) return B;
64  SX V, R, beta;
65  std::vector<casadi_int> prinv, pc;
66  SX::qr_sparse(B, V, R, beta, prinv, pc, amd);
67  SXElem d = casadi_det(V.sparsity(), get_ptr(V.nonzeros()),
68  R.sparsity(), get_ptr(R.nonzeros()), get_ptr(beta.nonzeros()));
69  return permutation_sign(prinv) * permutation_sign(pc) * d;
70  }
static double permutation_sign(const std::vector< casadi_int > &p)
Definition: symbolic_qr.cpp:48

References get_ptr(), casadi::GenericMatrix< MatType >::is_scalar(), casadi::Matrix< Scalar >::nonzeros(), permutation_sign(), casadi::Matrix< Scalar >::qr_sparse(), and casadi::Matrix< Scalar >::sparsity().

Referenced by casadi::SymbolicQr::det().

◆ 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 108 of file casadi_misc.cpp.

109  {
110  start = std::min(start, len);
111  stop = std::min(stop, len);
112  casadi_int nret = (stop-start)/step + ((stop-start)%step!=0);
113  std::vector<casadi_int> ret(nret);
114  casadi_int ind = start;
115  for (std::vector<casadi_int>::iterator it=ret.begin(); it!=ret.end(); ++it) {
116  *it = ind;
117  ind += step;
118  }
119  return ret;
120  }

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(), derivative_coeff_mx(), casadi::SymbolicQr::det(), 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(), 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 137 of file casadi_misc.cpp.

137  {
138  return range(0, stop);
139  }

References range().

◆ read_list()

template<typename T >
std::vector<T> casadi::read_list ( const XmlNode n)

Definition at line 3811 of file dae_builder_internal.cpp.

3811  {
3812  // Number of elements
3813  size_t sz = n.size();
3814  // Read the elements
3815  std::vector<T> r;
3816  r.reserve(sz);
3817  for (size_t i = 0; i < sz; ++i) {
3818  r.push_back(T(n[i]));
3819  }
3820  return r;
3821 }

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 842 of file casadi_misc.hpp.

842  {
843  v.clear();
844  std::string line;
845  while (!getline(file, line, '\n').eof()) {
846  std::istringstream reader(line);
847  std::vector<T> lineData;
848 
849  while (!reader.eof()) {
850  T val;
851  reader >> val;
852  if (reader.fail()) {
853  reader.clear();
854  std::string s;
855  reader >> s;
856  if (s=="inf")
857  val = std::numeric_limits<T>::infinity();
858  else
859  break;
860  }
861  lineData.push_back(val);
862  }
863  v.push_back(lineData);
864  }
865  }

References T.

◆ read_matlab() [2/2]

template<typename T >
void casadi::read_matlab ( std::istream &  stream,
std::vector< T > &  v 
)

Definition at line 822 of file casadi_misc.hpp.

822  {
823  v.clear();
824 
825  while (!stream.eof()) {
826  T val;
827  stream >> val;
828  if (stream.fail()) {
829  stream.clear();
830  std::string s;
831  stream >> s;
832  if (s=="inf")
833  val = std::numeric_limits<T>::infinity();
834  else
835  break;
836  }
837  v.push_back(val);
838  }
839  }

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.

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 2780 of file mx.cpp.

2783  {
2784  // Check if a symbol is already registered
2785  auto it = symbol_map.find(node.get());
2786 
2787  // Ignore trivial expressions if applicable
2788  bool is_trivial = node.is_symbolic();
2789  if (is_trivial && !extract_trivial) {
2790  return node;
2791  }
2792 
2793  if (it==symbol_map.end()) {
2794  // Create a symbol and register
2795  MX sym = MX::sym(v_prefix + str(symbol_map.size()+v_offset) + v_suffix, node.sparsity());
2796  symbol_map[node.get()] = sym;
2797 
2798  // Make the (symbol,parametric expression) pair available
2799  symbol_v.push_back(sym);
2800  parametric_v.push_back(node);
2801 
2802  // Use the new symbol
2803  return sym;
2804  } else {
2805  // Just use the registered symbol
2806  return it->second;
2807  }
2808  }

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 630 of file sx_instantiator.cpp.

633  {
634 
635  // Check if a symbol is already registered
636  auto it = symbol_map.find(node.get());
637 
638  // Ignore trivial expressions if applicable
639  bool is_trivial = node.is_symbolic();
640  if (is_trivial && !extract_trivial) {
641  return node;
642  }
643 
644  if (it==symbol_map.end()) {
645  // Create a symbol and register
646  SXElem sym = SXElem::sym(v_prefix + str(symbol_map.size()+v_offset) + v_suffix);
647  symbol_map[node.get()] = sym;
648 
649  // Make the (symbol,parametric expression) pair available
650  symbol_v.push_back(sym);
651  parametric_v.push_back(node);
652 
653  // Overwrite the argument
654  return sym;
655  } else {
656  // Just use the registered symbol
657  return it->second;
658  }
659  }

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 225 of file casadi_misc.cpp.

226  {
227  std::string ret = s;
228  std::string::size_type n = 0;
229  while ((n = ret.find(p, n)) != std::string::npos) {
230  ret.replace(n, p.size(), r);
231  n += r.size();
232  }
233  return ret;
234  }

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 1821 of file function_internal.hpp.

1821  {
1822  if (arg.size()==inp.size()) {
1823  // Matching dimensions already
1824  return arg;
1825  } else if (arg.is_scalar()) {
1826  // Scalar assign means set all
1827  return M(inp, arg);
1828  } else if (arg.is_vector() && inp.size()==std::make_pair(arg.size2(), arg.size1())) {
1829  // Transpose vector
1830  return arg.T();
1831  } else if (arg.size1()==inp.size1() && arg.size2()>0 && inp.size2()>0
1832  && inp.size2()%arg.size2()==0) {
1833  // Horizontal repmat
1834  return repmat(arg, 1, inp.size2()/arg.size2());
1835  } else if (npar!=-1 && arg.size1()==inp.size1() && arg.size2()>0 && inp.size2()>0
1836  && (npar*inp.size2())%arg.size2()==0) {
1837  // Multiple evaluation: grow argument horizontally to npar*inp columns
1838  return repmat(arg, 1, (npar*inp.size2())/arg.size2());
1839  } else {
1840  // Empty matrix means set zero (kept last so a 0-by-N argument is first given the
1841  // chance to be recognised as a parallel/repmat call above)
1842  casadi_assert_dev(arg.is_empty());
1843  return M(inp.size());
1844  }
1845  }

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 92 of file fatrop_interface.cpp.

92  {
93  casadi_int idx = i+GlobalOptions::start_index;
94  casadi_warning("Structure detection error on row " + str(idx) + ". " + msg);
95  }

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(), casadi::IpoptInterface::solve(), and casadi::UnoInterface::solve().

◆ return_status_string() [2/4]

const char * casadi::return_status_string ( casadi_int  status)
inline

Definition at line 330 of file gurobi_interface.cpp.

330  {
331  switch (status) {
332  case GRB_LOADED:
333  return "LOADED";
334  case GRB_OPTIMAL:
335  return "OPTIMAL";
336  case GRB_INFEASIBLE:
337  return "INFEASIBLE";
338  case GRB_INF_OR_UNBD:
339  return "INF_OR_UNBD";
340  case GRB_UNBOUNDED:
341  return "UNBOUNDED";
342  case GRB_CUTOFF:
343  return "CUTOFF";
344  case GRB_ITERATION_LIMIT:
345  return "ITERATION_LIMIT";
346  case GRB_NODE_LIMIT:
347  return "NODE_LIMIT";
348  case GRB_TIME_LIMIT:
349  return "TIME_LIMIT";
350  case GRB_SOLUTION_LIMIT:
351  return "SOLUTION_LIMIT";
352  case GRB_INTERRUPTED:
353  return "INTERRUPTED";
354  case GRB_NUMERIC:
355  return "NUMERIC";
356  case GRB_SUBOPTIMAL:
357  return "SUBOPTIMAL";
358  case GRB_INPROGRESS:
359  return "INPROGRESS";
360  }
361  return "Unknown";
362  }

◆ return_status_string() [3/4]

const char * 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 385 of file ipopt_interface.cpp.

385  {
386  switch (status) {
387  case Solve_Succeeded:
388  return "Solve_Succeeded";
389  case Solved_To_Acceptable_Level:
390  return "Solved_To_Acceptable_Level";
391  case Infeasible_Problem_Detected:
392  return "Infeasible_Problem_Detected";
393  case Search_Direction_Becomes_Too_Small:
394  return "Search_Direction_Becomes_Too_Small";
395  case Diverging_Iterates:
396  return "Diverging_Iterates";
397  case User_Requested_Stop:
398  return "User_Requested_Stop";
399  case Maximum_Iterations_Exceeded:
400  return "Maximum_Iterations_Exceeded";
401  case Restoration_Failed:
402  return "Restoration_Failed";
403  case Error_In_Step_Computation:
404  return "Error_In_Step_Computation";
405  case Not_Enough_Degrees_Of_Freedom:
406  return "Not_Enough_Degrees_Of_Freedom";
407  case Invalid_Problem_Definition:
408  return "Invalid_Problem_Definition";
409  case Invalid_Option:
410  return "Invalid_Option";
411  case Invalid_Number_Detected:
412  return "Invalid_Number_Detected";
413  case Unrecoverable_Exception:
414  return "Unrecoverable_Exception";
415  case NonIpopt_Exception_Thrown:
416  return "NonIpopt_Exception_Thrown";
417  case Insufficient_Memory:
418  return "Insufficient_Memory";
419  case Internal_Error:
420  return "Internal_Error";
421  case Maximum_CpuTime_Exceeded:
422  return "Maximum_CpuTime_Exceeded";
423  case Feasible_Point_Found:
424  return "Feasible_Point_Found";
425 #if (IPOPT_VERSION_MAJOR > 3) || (IPOPT_VERSION_MAJOR == 3 && IPOPT_VERSION_MINOR >= 14)
426  case Maximum_WallTime_Exceeded:
427  return "Maximum_WallTime_Exceeded";
428 #endif
429  }
430  return "Unknown";
431  }

◆ 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 614 of file casadi_misc.hpp.

614  {
615  std::vector<T> ret(v.size());
616  std::reverse_copy(v.begin(), v.end(), ret.begin());
617  return ret;
618  }

Referenced by casadi::Factory< MatType >::calculate_adj(), and casadi::External::get_reverse().

◆ scan_prefix_pow2()

static void casadi::scan_prefix_pow2 ( std::vector< std::string > &  offenders,
const std::vector< casadi_int > &  ext,
const std::string &  tag 
)
static

Definition at line 61 of file blazing_spline.cpp.

63  {
64  casadi_int p = 1;
65  for (size_t i = 0; i < ext.size(); ++i) {
66  p *= ext[i];
67  if (i >= 1 && is_pow2_ge8(p)) {
68  offenders.push_back("prefix product over dims 0.." + str(i)
69  + " = " + str(p) + tag);
70  }
71  }
72  }
static bool is_pow2_ge8(casadi_int n)

References is_pow2_ge8(), and str().

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

◆ select_tensors()

static std::vector<OnnxTensorInfo> casadi::select_tensors ( const std::vector< OnnxTensorInfo > &  all,
const std::vector< std::string > &  req 
)
static

Definition at line 97 of file onnx_function.cpp.

98  {
99  if (req.empty()) return all;
100  std::vector<OnnxTensorInfo> sel;
101  for (const std::string& name : req) {
102  bool found = false;
103  for (const OnnxTensorInfo& t : all)
104  if (t.name == name) { sel.push_back(t); found = true; break; }
105  casadi_assert(found, "ONNX tensor '" + name + "' not found in model");
106  }
107  return sel;
108  }

References all().

Referenced by casadi::OnnxFunction::OnnxFunction().

◆ sense_to_gurobi()

char casadi::sense_to_gurobi ( const std::string &  sense)

Definition at line 43 of file gurobi_interface.cpp.

43  {
44  if (sense == "<=") return GRB_LESS_EQUAL;
45  if (sense == ">=") return GRB_GREATER_EQUAL;
46  if (sense == "=") return GRB_EQUAL;
47  return GRB_LESS_EQUAL; // default
48  }

Referenced by casadi::GurobiInterface::handle_lazy_constraints_callback().

◆ set_uno_option()

static void casadi::set_uno_option ( void *  solver,
const std::string &  name,
const GenericType value 
)
static

Definition at line 158 of file uno_interface.cpp.

158  {
159  if (value.is_bool()) {
160  uno_set_solver_bool_option(solver, name.c_str(), value.to_bool());
161  } else if (value.is_int()) {
162  uno_set_solver_integer_option(solver, name.c_str(), static_cast<uno_int>(value.to_int()));
163  } else if (value.is_double()) {
164  uno_set_solver_double_option(solver, name.c_str(), value.to_double());
165  } else if (value.is_string()) {
166  uno_set_solver_string_option(solver, name.c_str(), value.to_string().c_str());
167  } else {
168  casadi_assert(false, "Unsupported UNO option type for " + name);
169  }
170  }

References casadi::GenericType::is_bool(), casadi::GenericType::is_double(), casadi::GenericType::is_int(), casadi::GenericType::is_string(), casadi::GenericType::to_bool(), casadi::GenericType::to_double(), casadi::GenericType::to_int(), and casadi::GenericType::to_string().

Referenced by insert_casadi_options().

◆ 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 230 of file generic_shared.hpp.

230  {
231  S A_copy = A;
232  return shared_cast<B, S>(A_copy);
233  }

◆ 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 208 of file generic_shared.hpp.

208  {
209 
211  typename S::internal_base_type* ptr = A.get();
212 
214  B ret;
215 
217  if (!B::test_cast(ptr)) return ret;
218 
220  ret.own(ptr);
221  return ret;
222  }

◆ 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 277 of file calculus.hpp.

277 { return x;}

Referenced by casadi::FixedStepIntegrator::create_advanced().

◆ simplify_const_folding_order()

bool casadi::simplify_const_folding_order ( std::vector< MX > &  arg,
std::vector< MX > &  res,
const Dict opts 
)

Definition at line 2261 of file mx.cpp.

2263  {
2264  Dict temp_opts = {{"live_variables", false},
2265  {"max_io", 0},
2266  {"cse", false},
2267  {"allow_free", true}};
2268  Function f("temp", arg, res, temp_opts);
2269  MXFunction *ff = f.get<MXFunction>();
2270  const std::vector<casadi_int>& workloc_ = ff->workloc_;
2271  const auto& algorithm_ = ff->algorithm_;
2272 
2273  // Is the work vector entry numeric?
2274  std::vector<bool> is_numeric(workloc_.size()-1);
2275  // Symbolic work, non-differentiated
2276  std::vector<MX> swork(workloc_.size()-1);
2277 
2278  // Split up inputs analogous to symbolic primitives
2279  std::vector<std::vector<MX> > arg_split(arg.size());
2280  for (casadi_int i=0; i<arg.size(); ++i) arg_split[i] = arg[i].split_primitives(arg[i]);
2281 
2282  // Allocate storage for split outputs
2283  std::vector<std::vector<MX> > res_split(res.size());
2284  for (casadi_int i=0; i<res.size(); ++i) res_split[i].resize(res[i].n_primitives());
2285 
2286  std::vector<MX> arg1, res1;
2287 
2288  std::unordered_map<const MXNode*, bool> numeric_node;
2289  // Loop over computational nodes in forward order
2290  for (auto it=algorithm_.begin(); it!=algorithm_.end(); ++it) {
2291  if (it->op == OP_INPUT) {
2292  swork[it->res.front()] = project(arg_split.at(it->data->ind()).at(it->data->segment()),
2293  it->data.sparsity(), true);
2294  is_numeric[it->res.front()] = false;
2295  } else if (it->op==OP_OUTPUT) {
2296  // Collect the results
2297  res_split.at(it->data->ind()).at(it->data->segment()) = swork[it->arg.front()];
2298  } else if (it->op==OP_PARAMETER) {
2299  // Fetch parameter
2300  swork[it->res.front()] = it->data;
2301  is_numeric[it->res.front()] = false;
2302  } else {
2303  // Arguments of the operation
2304  arg1.resize(it->arg.size());
2305 
2306 
2307  bool numeric = true;
2308 
2309  for (casadi_int i=0; i<arg1.size(); ++i) {
2310  casadi_int el = it->arg[i];
2311  if (el<0) {
2312  arg1[i] = MX(it->data->dep(i).size());
2313  } else {
2314  arg1[i] = swork[el];
2315  numeric = numeric && is_numeric[el];
2316  }
2317  }
2318 
2319  numeric_node[it->data.get()] = numeric;
2320 
2321  // Perform the operation
2322  res1.resize(it->res.size());
2323 
2324  bool matched = false;
2325  // Rules to promote constant folding
2326  // A*(B*X)
2327  if (it->op == OP_MUL && is_numeric[it->arg[0]] &&
2328  !is_numeric[it->arg[1]] && arg1[1].is_op(OP_MUL)) {
2329  if (numeric_node[arg1[1].dep(0).get()]) {
2330  matched = true;
2331  res1[0] = (arg1[0]*arg1[1].dep(0))*arg1[1].dep(1);
2332  }
2333  }
2334 
2335  if (!matched) it->data->eval_mx(arg1, res1);
2336 
2337  for (casadi_int i=0; i<res1.size(); ++i) {
2338  casadi_int el = it->res[i]; // index of the output
2339  if (el>=0) {
2340  is_numeric[el] = numeric;
2341  }
2342  }
2343 
2344  // Get the result
2345  for (casadi_int i=0; i<res1.size(); ++i) {
2346  casadi_int el = it->res[i]; // index of the output
2347  if (el>=0) {
2348  swork[el] = res1[i];
2349  }
2350  }
2351  }
2352  }
2353 
2354  // Join split outputs
2355  for (casadi_int i=0; i<res.size(); ++i) res[i] = res[i].join_primitives(res_split[i]);
2356 
2357  return true;
2358  }

References casadi::MXFunction::algorithm_, casadi::Function::get(), OP_INPUT, OP_MUL, OP_OUTPUT, OP_PARAMETER, and casadi::MXFunction::workloc_.

Referenced by casadi::MX::simplify_const_folding().

◆ 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 906 of file casadi_misc.hpp.

907  {
908  // Call recursively if indices need to be inverted
909  if (invert_indices) {
910  std::vector<casadi_int> inverted;
911  sort(values, sorted_values, inverted, false);
912  indices.resize(inverted.size());
913  for (size_t i=0; i<inverted.size(); ++i) {
914  indices[inverted[i]] = i;
915  }
916  return;
917  }
918 
919  // Create list of indices
920  indices.resize(values.size());
921  for (size_t i=0; i<indices.size(); ++i) indices[i] = i;
922 
923  // Sort this list by the values
924  std::sort(indices.begin(), indices.end(), sortCompare<T>(values));
925 
926  // Sort the values accordingly
927  sorted_values.resize(values.size());
928  for (size_t i=0; i<values.size(); ++i) {
929  sorted_values[i] = values[indices[i]];
930  }
931  }
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)

◆ startswith()

CASADI_EXPORT bool casadi::startswith ( const std::string &  s,
const std::string &  p 
)

Definition at line 217 of file casadi_misc.cpp.

217  {
218  if (p.size()>s.size()) return false;
219  for (casadi_int i=0;i<p.size();++i) {
220  if (s[i]!=p[i]) return false;
221  }
222  return true;
223  }

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 318 of file casadi_common.hpp.

318  {
319  std::stringstream ss;
320  ss << "[";
321  for (casadi_int i=0; i<N; ++i) {
322  if (i!=0) ss << ", ";
323  ss << str(v[i]);
324  }
325  ss << "]";
326  return ss.str();
327  }

References str().

◆ str() [2/8]

template<typename T2 >
std::string casadi::str ( const std::map< std::string, T2 > &  p,
bool  more = false 
)

Definition at line 305 of file casadi_common.hpp.

305  {
306  std::stringstream ss;
307  ss << "{";
308  casadi_int count = 0;
309  for (auto& e : p) {
310  ss << "\"" << e.first << "\": " << str(e.second);
311  if (++count < p.size()) ss << ", ";
312  }
313  ss << "}";
314  return ss.str();
315  }

References str().

◆ str() [3/8]

template<typename T1 , typename T2 >
std::string casadi::str ( const std::map< T1, T2 > &  p,
bool  more = false 
)

Definition at line 292 of file casadi_common.hpp.

292  {
293  std::stringstream ss;
294  ss << "{";
295  casadi_int count = 0;
296  for (auto& e : p) {
297  ss << str(e.first) << ": " << str(e.second);
298  if (++count < p.size()) ss << ", ";
299  }
300  ss << "}";
301  return ss.str();
302  }

References str().

◆ str() [4/8]

template<typename T1 , typename T2 >
std::string casadi::str ( const std::pair< T1, T2 > &  p,
bool  more = false 
)

Definition at line 285 of file casadi_common.hpp.

285  {
286  std::stringstream ss;
287  ss << "[" << str(p.first) << "," << str(p.second) << "]";
288  return ss.str();
289  }

References str().

◆ str() [5/8]

template<typename T >
std::string casadi::str ( const std::set< T > &  v,
bool  more = false 
)

Definition at line 272 of file casadi_common.hpp.

272  {
273  std::stringstream ss;
274  ss << "{";
275  casadi_int cnt = 0;
276  for (const auto& e : v) {
277  if (cnt++!=0) ss << ", ";
278  ss << str(e);
279  }
280  ss << "}";
281  return ss.str();
282  }

References str().

◆ str() [6/8]

template<typename T >
std::string casadi::str ( const std::vector< T > &  v,
bool  more = false 
)

Definition at line 260 of file casadi_common.hpp.

260  {
261  std::stringstream ss;
262  ss << "[";
263  for (casadi_int i=0; i<v.size(); ++i) {
264  if (i!=0) ss << ", ";
265  ss << str(v[i]);
266  }
267  ss << "]";
268  return ss.str();
269  }

References str().

◆ str() [7/8]

template<typename T >
std::string casadi::str ( const T &  v)

Definition at line 248 of file casadi_common.hpp.

248  {
249  std::stringstream ss;
250  ss << v;
251  return ss.str();
252  }

Referenced by casadi::SparsityInternal::_appendColumns(), casadi::SparsityInternal::_appendVector(), casadi::SparsityInternal::_reshape(), _which_depends(), casadi::Function::activity(), 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::OnnxFunction::build_io_map(), 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::ThreadMap::codegen_body(), casadi::MapSum::codegen_body(), casadi::MXFunction::codegen_body(), casadi::Switch::codegen_body(), casadi::SXFunction::codegen_body(), casadi::FatropInterface::codegen_body(), casadi::OsqpInterface::codegen_body(), casadi::XpressInterface::codegen_body(), casadi::FastNewton::codegen_body(), casadi::Feasiblesqpmethod::codegen_body(), casadi::Qrqp::codegen_body(), casadi::Sqpmethod::codegen_body(), casadi::Sqpmethod::codegen_calc_gamma_1(), casadi::MXFunction::codegen_declarations(), casadi::SXFunction::codegen_declarations(), casadi::Feasiblesqpmethod::codegen_feasibility_iterations(), casadi::MadmpecInterface::codegen_init_mem(), casadi::MadnlpInterface::codegen_init_mem(), casadi::OsqpInterface::codegen_init_mem(), casadi::FunctionInternal::codegen_meta(), casadi::FunctionInternal::codegen_name(), casadi::MadmpecInterface::codegen_options(), casadi::Nlpsol::codegen_post_solve(), casadi::Nlpsol::codegen_setup_per_call(), 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::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::Input::generate(), casadi::Output::generate(), casadi::HorzRepmat::generate(), casadi::Split::generate(), casadi::CodeGenerator::generate(), casadi::CodeGenerator::generate_dump(), casadi::LinsolQr::generate_factorize(), casadi::Function::generate_in(), casadi::Function::generate_out(), casadi::CodeGenerator::generate_print(), casadi::Matrix< Scalar >::get(), casadi::MX::get(), casadi::Fmu2::get_aux_impl(), casadi::Fmu3::get_aux_impl(), 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::BlazingSplineFunction::init(), 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::MadmpecInterface::init(), casadi::FatropConicInterface::init(), casadi::FatropInterface::init(), casadi::HpipmInterface::init(), casadi::HpmpcInterface::init(), casadi::IpoptInterface::init(), casadi::ProxqpInterface::init(), casadi::SLEQPInterface::init(), casadi::IdasInterface::init(), casadi::WorhpInterface::init(), init_gen(), casadi::CplexInterface::init_mem(), casadi::GurobiInterface::init_mem(), casadi::UnoInterface::init_mem(), casadi::WorhpInterface::init_mem(), casadi::XpressInterface::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::mtimes(), casadi::CodeGenerator::mtimes_dense_sparse(), 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(), onnx_dtype_name(), operator<<(), casadi::DaeBuilderInternal::outputs(), casadi::OptiNode::parameter(), casadi::CodeGenerator::pool_double(), casadi::Sparsity::postfix_dim(), casadi::Integrator::predict_events(), casadi::MXFunction::print(), casadi::OutputSX::print(), casadi::MXFunction::print_arg(), casadi::SXFunction::print_arg(), casadi::MXNode::print_compact(), casadi::MXFunction::print_res(), casadi::SXFunction::print_res(), print_vec(), casadi::Matrix< double >::print_vector(), 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(), scan_prefix_pow2(), 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::MosekInterface::set_work(), casadi::XpressInterface::set_work(), casadi::DeserializingStream::setup(), 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::SparsityInternal::star_coloring_new(), casadi::MX::stop_diff(), str(), strvec(), casadi::SparsityInternal::sub(), casadi::MX::substitute_inplace(), casadi::CodeGenerator::sum_viol(), casadi::CodeGenerator::sx_work(), casadi::DaeBuilderInternal::tearing_variables(), casadi::OptiNode::to_function(), transform_stats(), transform_token_str(), 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 255 of file casadi_common.hpp.

255  {
256  return v.get_str(more);
257  }

◆ str_bvec()

CASADI_EXPORT std::string casadi::str_bvec ( bvec_t  v)

Definition at line 444 of file casadi_misc.cpp.

444  {
445  std::stringstream ss;
446  for (casadi_int i=0;i<sizeof(bvec_t)*8;++i) {
447  bool bit = v & (bvec_t(1) << i);
448  ss << (bit ? "1" : "0");
449  }
450  return ss.str();
451  }

◆ 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 192 of file casadi_common.hpp.

192  {
193  return {};
194  }

◆ strvec() [2/7]

template<typename T1 >
std::vector<std::string> casadi::strvec ( const T1 &  t1)
inline

Definition at line 198 of file casadi_common.hpp.

198  {
199  return {str(t1)};
200  }

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 204 of file casadi_common.hpp.

204  {
205  return {str(t1), str(t2)};
206  }

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 210 of file casadi_common.hpp.

210  {
211  return {str(t1), str(t2), str(t3)};
212  }

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 216 of file casadi_common.hpp.

217  {
218  return {str(t1), str(t2), str(t3), str(t4)};
219  }

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 223 of file casadi_common.hpp.

224  {
225  return {str(t1), str(t2), str(t3), str(t4), str(t5)};
226  }

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 230 of file casadi_common.hpp.

231  {
232  return {str(t1), str(t2), str(t3), str(t4), str(t5), str(t6)};
233  }

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 941 of file casadi_misc.hpp.

941  {
942  T r = 0;
943  for (casadi_int i=0;i<values.size();++i) r+=values[i];
944  return r;
945  }

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,
const std::string &  directory 
)

Definition at line 354 of file casadi_misc.cpp.

356  {
357 
358  std::string temp_dir = Filesystem::ensure_trailing_slash(directory);
359  if (temp_dir.empty()) temp_dir = GlobalOptions::getTempWorkDir();
360 
361  if (Filesystem::is_enabled()) {
362  casadi_assert(Filesystem::ensure_directory_exists(temp_dir),
363  "Unable to create the required directory for '" + temp_dir + "'.");
364  }
365 
366  #ifdef HAVE_MKSTEMPS
367  // Preferred solution
368  std::string ret = temp_dir + prefix + "XXXXXX" + suffix;
369  if (mkstemps(&ret[0], static_cast<int>(suffix.size())) == -1) {
370  casadi_error("Failed to create temporary file: '" + ret + "'. "
371  + (Filesystem::is_enabled() ? "" : "Does the directory exits? "
372  "Note that CasADi needs to be compiled with WITH_GHC_FILESYSTEM=ON "
373  "for directories to be automatically created."));
374  }
375  return ret;
376  #else // HAVE_MKSTEMPS
377  #ifdef HAVE_SIMPLE_MKSTEMPS
378  return simple_mkstemps(temp_dir + prefix, suffix);
379  #else // HAVE_SIMPLE_MKSTEMPS
380  casadi_assert(temp_dir=="./", "tmpnam fallback not compatible with custom temporary directory");
381  // Fallback, may result in deprecation warnings
382  return std::string(tmpnam(nullptr)) + suffix;
383  #endif // HAVE_SIMPLE_MKSTEMPS
384  #endif // HAVE_MKSTEMPS
385  }

References casadi::Filesystem::ensure_directory_exists(), casadi::Filesystem::ensure_trailing_slash(), casadi::GlobalOptions::getTempWorkDir(), and casadi::Filesystem::is_enabled().

Referenced by casadi::FunctionInternal::finalize(), casadi::Scpgen::init(), casadi::ShellCompiler::init(), casadi::TemporaryDirResource::setup_temp_dir(), and casadi::AmplInterface::solve().

◆ 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 450 of file map.cpp.

453  {
454 
455  // Function dimensions
456  casadi_int n_in = f.n_in();
457  casadi_int n_out = f.n_out();
458 
459  // Function work sizes
460  size_t sz_arg, sz_res, sz_iw, sz_w;
461  f.sz_work(sz_arg, sz_res, sz_iw, sz_w);
462 
463  // Input buffers
464  const double** arg1 = arg + n_in + i*sz_arg;
465  for (casadi_int j=0; j<n_in; ++j) {
466  arg1[j] = arg[j] ? arg[j] + i*f.nnz_in(j) : nullptr;
467  }
468 
469  // Output buffers
470  double** res1 = res + n_out + i*sz_res;
471  for (casadi_int j=0; j<n_out; ++j) {
472  res1[j] = res[j] ? res[j] + i*f.nnz_out(j) : nullptr;
473  }
474 
475  try {
476  ret = f(arg1, res1, iw + i*sz_iw, w + i*sz_w, ind);
477  } catch (std::exception& e) {
478  ret = 1;
479  casadi_warning("Exception raised: " + std::string(e.what()));
480  } catch (...) {
481  ret = 1;
482  casadi_warning("Uncaught exception.");
483  }
484  }

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 75 of file dae_builder_internal.cpp.

75  {
76  switch (v) {
77  case Type::FLOAT64: return TypeFmi2::REAL;
78  case Type::INT32: return TypeFmi2::INTEGER;
79  case Type::BOOLEAN: return TypeFmi2::BOOLEAN;
80  case Type::STRING: return TypeFmi2::STRING;
81  case Type::ENUMERATION: return TypeFmi2::ENUM;
82  case Type::FLOAT32: // fall-through
83  case Type::INT8: // fall-through
84  case Type::UINT8: // fall-through
85  case Type::INT16: // fall-through
86  case Type::UINT16: // fall-through
87  case Type::UINT32: // fall-through
88  case Type::INT64: // fall-through
89  case Type::UINT64: // fall-through
90  case Type::BINARY: // fall-through
91  case Type::CLOCK: // fall-through
92  casadi_error(to_string(v) + " cannot be converted to FMI 2");
93  default: break;
94  }
95  return TypeFmi2::NUMEL;
96 }

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 60 of file casadi_misc.cpp.

60  {
61  casadi_assert(rhs<=std::numeric_limits<int>::max(), "Integer overflow detected.");
62  casadi_assert(rhs>=std::numeric_limits<int>::min(), "Integer overflow detected.");
63  return rhs;
64  }

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 66 of file casadi_misc.cpp.

66  {
67  std::vector<int> ret;
68  ret.reserve(rhs.size());
69  for (casadi_int e : rhs) ret.push_back(to_int(e));
70  return ret;
71  }
int to_int(casadi_int rhs)
Definition: casadi_misc.cpp:60

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 73 of file casadi_misc.cpp.

74  {
75  std::vector< std::vector<int> > ret;
76  ret.reserve(rhs.size());
77  for (const std::vector<casadi_int>& e : rhs) ret.push_back(to_int(e));
78  return ret;
79  }

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 254 of file slice.cpp.

254  {
255  casadi_assert(is_slice2(v), "Cannot be represented as a nested Slice");
256  Slice inner, outer;
257 
258  // If simple slice
259  if (is_slice(v)) {
260  inner = to_slice(v);
261  outer.start = 0;
262  outer.step = outer.stop = inner.stop;
263  return std::make_pair(inner, outer);
264  }
265 
266  // Get the slices
267  outer.start = 0;
268  outer.step = -1;
269  inner.start = v.front();
270  inner.step = v[1]-v[0];
271  inner.stop = -1;
272  for (casadi_int i=2; i<v.size(); ++i) {
273  casadi_int predicted_v = inner.start+i*inner.step;
274  if (v[i]!=predicted_v) {
275  inner.stop = predicted_v;
276  outer.step = v[i] - inner.start;
277  break;
278  }
279  }
280 
281  // Get the end of the outer slice
282  // Calculate based on actual number of groups in the data
283  casadi_int inner_size = (inner.stop - inner.start) / inner.step;
284  casadi_int num_groups = v.size() / inner_size;
285  outer.stop = outer.start + num_groups * outer.step;
286  return std::make_pair(inner, outer);
287  }
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/15]

CASADI_EXPORT std::string casadi::to_string ( Attribute  v)

Convert to string

Definition at line 168 of file dae_builder_internal.cpp.

168  {
169  switch (v) {
170  case Attribute::MIN: return "min";
171  case Attribute::MAX: return "max";
172  case Attribute::NOMINAL: return "nominal";
173  case Attribute::START: return "start";
174  case Attribute::VALUE: return "value";
175  case Attribute::STRINGVALUE: return "stringvalue";
176  default: break;
177  }
178  return "";
179 }

References MAX, MIN, NOMINAL, START, STRINGVALUE, and VALUE.

◆ to_string() [2/15]

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

Convert to string

Definition at line 193 of file dae_builder_internal.cpp.

193  {
194  switch (v) {
195  case Category::T: return "t";
196  case Category::P: return "p";
197  case Category::U: return "u";
198  case Category::X: return "x";
199  case Category::Z: return "z";
200  case Category::Q: return "q";
201  case Category::C: return "c";
202  case Category::D: return "d";
203  case Category::W: return "w";
204  case Category::CALCULATED: return "calculated";
205  case Category::ODE: return "ode";
206  case Category::ALG: return "alg";
207  case Category::QUAD: return "quad";
208  case Category::ZERO: return "zero";
209  case Category::DDEF: return "ddef";
210  case Category::WDEF: return "wdef";
211  case Category::Y: return "y";
212  default: break;
213  }
214  return "";
215 }

References ALG, C, CALCULATED, D, DDEF, ODE, P, Q, QUAD, T, U, W, WDEF, X, Y, Z, and ZERO.

◆ to_string() [3/15]

CASADI_EXPORT std::string casadi::to_string ( Causality  v)

Convert to string

Definition at line 132 of file dae_builder_internal.cpp.

132  {
133  switch (v) {
134  case Causality::PARAMETER: return "parameter";
135  case Causality::CALCULATED_PARAMETER: return "calculatedParameter";
136  case Causality::INPUT: return "input";
137  case Causality::OUTPUT: return "output";
138  case Causality::LOCAL: return "local";
139  case Causality::INDEPENDENT: return "independent";
140  default: break;
141  }
142  return "";
143 }

References CALCULATED_PARAMETER, INDEPENDENT, INPUT, LOCAL, OUTPUT, and PARAMETER.

◆ to_string() [4/15]

CASADI_EXPORT std::string casadi::to_string ( DependenciesKind  v)

Convert to string

Definition at line 181 of file dae_builder_internal.cpp.

181  {
182  switch (v) {
183  case DependenciesKind::DEPENDENT: return "dependent";
184  case DependenciesKind::CONSTANT: return "constant";
185  case DependenciesKind::FIXED: return "fixed";
186  case DependenciesKind::TUNABLE: return "tunable";
187  case DependenciesKind::DISCRETE: return "discrete";
188  default: break;
189  }
190  return "";
191 }

References CONSTANT, DEPENDENT, DISCRETE, FIXED, and TUNABLE.

◆ to_string() [5/15]

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/15]

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/15]

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/15]

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/15]

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/15]

CASADI_EXPORT std::string casadi::to_string ( FmuApi  v)

Definition at line 656 of file fmu.cpp.

656  {
657  switch (v) {
658  case FmuApi::FMI2: return "fmi2";
659  case FmuApi::FMI3: return "fmi3";
660  default: break;
661  }
662  return "";
663 }

References FMI2, and FMI3.

◆ to_string() [11/15]

CASADI_EXPORT std::string casadi::to_string ( Initial  v)

Convert to string

Definition at line 157 of file dae_builder_internal.cpp.

157  {
158  switch (v) {
159  case Initial::EXACT: return "exact";
160  case Initial::APPROX: return "approx";
161  case Initial::CALCULATED: return "calculated";
162  case Initial::NA: return "na";
163  default: break;
164  }
165  return "";
166 }

References APPROX, CALCULATED, EXACT, and NA.

◆ to_string() [12/15]

CASADI_EXPORT std::string casadi::to_string ( Parallelization  v)

Definition at line 1482 of file fmu_function.cpp.

1482  {
1483  switch (v) {
1484  case Parallelization::SERIAL: return "serial";
1485  case Parallelization::OPENMP: return "openmp";
1486  case Parallelization::THREAD: return "thread";
1487  default: break;
1488  }
1489  return "";
1490 }

References OPENMP, SERIAL, and THREAD.

◆ to_string() [13/15]

CASADI_EXPORT std::string casadi::to_string ( Type  v)

Convert to string

Definition at line 110 of file dae_builder_internal.cpp.

110  {
111  switch (v) {
112  case Type::FLOAT32: return "Float32";
113  case Type::FLOAT64: return "Float64";
114  case Type::INT8: return "Int8";
115  case Type::UINT8: return "UInt8";
116  case Type::INT16: return "Int16";
117  case Type::UINT16: return "UInt16";
118  case Type::INT32: return "Int32";
119  case Type::UINT32: return "UInt32";
120  case Type::INT64: return "Int64";
121  case Type::UINT64: return "UInt64";
122  case Type::BOOLEAN: return "Boolean";
123  case Type::STRING: return "String";
124  case Type::BINARY: return "Binary";
125  case Type::ENUMERATION: return "Enumeration";
126  case Type::CLOCK: return "Clock";
127  default: break;
128  }
129  return "";
130 }

References BINARY, BOOLEAN, CLOCK, ENUMERATION, FLOAT32, FLOAT64, INT16, INT32, INT64, INT8, STRING, UINT16, UINT32, UINT64, and UINT8.

◆ to_string() [14/15]

CASADI_EXPORT std::string casadi::to_string ( TypeFmi2  v)

Convert to string

Definition at line 98 of file dae_builder_internal.cpp.

98  {
99  switch (v) {
100  case TypeFmi2::REAL: return "real";
101  case TypeFmi2::INTEGER: return "integer";
102  case TypeFmi2::BOOLEAN: return "boolean";
103  case TypeFmi2::STRING: return "string";
104  case TypeFmi2::ENUM: return "enum";
105  default: break;
106  }
107  return "";
108 }

References BOOLEAN, ENUM, INTEGER, REAL, and STRING.

Referenced by casadi::DaeBuilderInternal::add(), casadi::Variable::categories(), casadi::DaeBuilder::categories(), 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(), input_category(), casadi::DaeBuilderInternal::inputs(), 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(), casadi::DaeBuilderInternal::update_dependencies(), and casadi::DaeBuilder::variability().

◆ to_string() [15/15]

CASADI_EXPORT std::string casadi::to_string ( Variability  v)

Convert to string

Definition at line 145 of file dae_builder_internal.cpp.

145  {
146  switch (v) {
147  case Variability::CONSTANT: return "constant";
148  case Variability::FIXED: return "fixed";
149  case Variability::TUNABLE: return "tunable";
150  case Variability::DISCRETE: return "discrete";
151  case Variability::CONTINUOUS: return "continuous";
152  default: break;
153  }
154  return "";
155 }

References CONSTANT, CONTINUOUS, DISCRETE, FIXED, and TUNABLE.

◆ transform_passes_str()

std::string casadi::transform_passes_str ( const std::vector< std::vector< GenericType > > &  ps)

Definition at line 338 of file function.cpp.

338  {
339  std::string s = "[";
340  for (size_t i=0; i<ps.size(); ++i) {
341  if (i) s += ", ";
342  s += "[";
343  for (size_t j=0; j<ps[i].size(); ++j) {
344  if (j) s += ", ";
345  s += transform_token_str(ps[i][j]);
346  }
347  s += "]";
348  }
349  return s + "]";
350  }
std::string transform_token_str(const GenericType &g)
Definition: function.cpp:331

References transform_token_str().

Referenced by casadi::Function::transform().

◆ transform_stats()

std::string casadi::transform_stats ( const Function f)

Definition at line 352 of file function.cpp.

352  {
353  std::string s;
354  try { s += "n_nodes=" + str(f.n_nodes()); } catch (...) { s += "n_nodes=?"; }
355  try { s += ", n_instructions=" + str(f.n_instructions()); } catch (...) {}
356  return s;
357  }

References casadi::Function::n_instructions(), casadi::Function::n_nodes(), and str().

Referenced by casadi::Function::transform().

◆ transform_token_str()

std::string casadi::transform_token_str ( const GenericType g)

Definition at line 331 of file function.cpp.

331  {
332  if (g.is_int()) return str(g.to_int());
333  if (g.is_string()) return "\"" + g.to_string() + "\"";
334  if (g.is_dict()) return str(g.to_dict());
335  return "?";
336  }

References casadi::GenericType::is_dict(), casadi::GenericType::is_int(), casadi::GenericType::is_string(), str(), casadi::GenericType::to_dict(), casadi::GenericType::to_int(), and casadi::GenericType::to_string().

Referenced by transform_passes_str().

◆ trim_empty()

std::vector<MX> casadi::trim_empty ( const std::vector< MX > &  x,
bool  both = false 
)

Definition at line 1111 of file mx.cpp.

1111  {
1112  std::vector<MX> ret;
1113  for (auto&& i : x) {
1114  if (!i.is_empty(both)) ret.push_back(i);
1115  }
1116  return ret;
1117  }

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 332 of file calculus.hpp.

332  {
333  return x+x;
334  }

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 70 of file casadi_logger.cpp.

70  {
71  // Thread-local stream: each thread gets its own instance
72  // ThreadLocalStorage avoids MinGW thread_local destructor ordering bug
73  static thread_local ThreadLocalStorage<Logger::Stream<true>> instance;
74  return instance.get();
75  }

References casadi::ThreadLocalStorage< T >::get().

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_entries_to_path(), 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 824 of file fatrop_interface.cpp.

824  {
825  const casadi_int* packed = get_ptr(p);
826  casadi_int N = *packed++;
827  blocks.resize(N);
828  for (casadi_int i=0;i<N;++i) {
829  blocks[i].offset_r = *packed++;
830  blocks[i].offset_c = *packed++;
831  blocks[i].rows = *packed++;
832  blocks[i].cols = *packed++;
833  }
834  }

References get_ptr().

Referenced by casadi::FatropInterface::FatropInterface().

◆ unpack_tensors()

static void casadi::unpack_tensors ( DeserializingStream s,
const std::string &  d,
std::vector< OnnxTensorInfo > &  v 
)
static

Definition at line 159 of file onnx_function.cpp.

160  {
161  std::vector<std::string> names;
162  std::vector<std::vector<casadi_int>> shapes;
163  std::vector<casadi_int> elem_types, numels;
164  s.unpack(d + "::names", names);
165  s.unpack(d + "::shapes", shapes);
166  s.unpack(d + "::elem_types", elem_types);
167  s.unpack(d + "::numels", numels);
168  v.clear();
169  for (size_t k = 0; k < names.size(); ++k)
170  v.push_back(OnnxTensorInfo{names[k], shapes[k], elem_types[k], numels[k]});
171  }

References casadi::DeserializingStream::unpack().

Referenced by casadi::OnnxFunction::OnnxFunction().

◆ uout()

CASADI_EXPORT std::ostream & casadi::uout ( )

Definition at line 61 of file casadi_logger.cpp.

61  {
62  // Thread-local stream: each thread gets its own instance
63  // This prevents data races on stream state (width, fill, flags, etc.)
64  // while WriteFunThreadSafe still protects actual I/O with mutex
65  // ThreadLocalStorage avoids MinGW thread_local destructor ordering bug
66  static thread_local ThreadLocalStorage<Logger::Stream<false>> instance;
67  return instance.get();
68  }

References casadi::ThreadLocalStorage< T >::get().

Referenced by casadi::OptiCallback::call(), callback_stdout(), casadi_KN_puts(), casadi_log_output(), casadi::Dump::eval(), casadi::Monitor::eval(), casadi::Conic::eval(), casadi::MXFunction::eval(), casadi::SXFunction::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::Onnx::load(), 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::Onnx::set_dimension(), 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(), casadi::Function::transform(), 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 835 of file generic_type.cpp.

835  {
836  for (auto&& e : source) {
837  if (recurse) {
838  auto it = target.find(e.first);
839  if (it!=target.end() && it->second.is_dict()) {
840  Dict local = it->second;
841  casadi_assert(e.second.is_dict(),
842  "update_dict error: Key '" + it->first + "' exists in target, "
843  "but source value is not a dict");
844  update_dict(local, e.second, recurse);
845  it->second = local;
846  continue;
847  }
848  }
849  target[e.first] = e.second;
850  }
851  }

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 854 of file generic_type.cpp.

855  {
856  auto it = target.find(key);
857  if (it==target.end()) {
858  target[key] = value;
859  } else {
860  // value.is_dict()
861  casadi_assert(it->second.is_dict() && value.is_dict(),
862  "update_dict error: Key '" + key + "' exists in target, but values are not dicts");
863  Dict orig = it->second;
864  update_dict(orig, value, recurse);
865  target[key] = orig;
866  }
867  }

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 607 of file casadi_misc.hpp.

607  {
608  std::vector<T> ret;
609  ret.insert(ret.begin(), v.begin(), v.begin()+v.size()-1);
610  return ret;
611  }

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 584 of file casadi_misc.hpp.

584  {
585  std::vector<T> ret;
586  casadi_assert(v.size()==s.size(), "Dimension mismatch.");
587  if (invert) {
588  for (casadi_int k=0;k<s.size();++k) {
589  if (!s[k]) ret.push_back(v[k]);
590  }
591  } else {
592  for (casadi_int k=0;k<s.size();++k) {
593  if (s[k]) ret.push_back(v[k]);
594  }
595  }
596  return ret;
597  }

Referenced by construct_nlpsol(), and casadi::XFunction< DerivedType, MatType, NodeType >::get_jacobian().

◆ 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 567 of file casadi_misc.hpp.

567  {
568  std::vector<T> ret;
569  ret.reserve(i.size());
570  for (casadi_int k=0;k<i.size();++k) {
571  casadi_int j = i[k];
572  casadi_assert(j>=0,
573  "vector_slice: Indices should be larger than zero."
574  "You have " + str(j) + " at location " + str(k) + ".");
575  casadi_assert(j<v.size(),
576  "vector_slice: Indices should be larger than zero."
577  "You have " + str(j) + " at location " + str(k) + ".");
578  ret.push_back(v[j]);
579  }
580  return ret;
581  }

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 559 of file casadi_misc.hpp.

559  {
560  std::vector<T> ret;
561  ret.reserve(rhs.size());
562  for (auto e : rhs) ret.push_back(static_cast<T>(e));
563  return ret;
564  }

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 600 of file casadi_misc.hpp.

600  {
601  std::vector<T> ret;
602  ret.insert(ret.begin(), v.begin()+1, v.end());
603  return ret;
604  }

Referenced by casadi::XFunction< DerivedType, MatType, NodeType >::jac(), and casadi::External::serialize_body().

◆ version_ge()

CASADI_EXPORT bool casadi::version_ge ( const std::string &  version_left,
const std::string &  version_right 
)

Definition at line 263 of file casadi_misc.cpp.

263  {
264  std::vector<casadi_int> left_parts, right_parts;
265 
266  // Parse left version
267  std::stringstream left_stream(version_left);
268  std::string part;
269  while (std::getline(left_stream, part, '.')) {
270  left_parts.push_back(std::stoi(part));
271  }
272 
273  // Parse right version
274  std::stringstream right_stream(version_right);
275  while (std::getline(right_stream, part, '.')) {
276  right_parts.push_back(std::stoi(part));
277  }
278 
279  // Compare component by component
280  casadi_int min_size = std::min(left_parts.size(), right_parts.size());
281  for (casadi_int i = 0; i < min_size; ++i) {
282  if (left_parts[i] > right_parts[i]) return true;
283  if (left_parts[i] < right_parts[i]) return false;
284  }
285 
286  // If all components are equal, the longer version is greater or equal
287  return left_parts.size() >= right_parts.size();
288  }

Referenced by casadi::OsqpInterface::deps_version_check(), and version_le().

◆ version_gt()

CASADI_EXPORT bool casadi::version_gt ( const std::string &  version_left,
const std::string &  version_right 
)

Definition at line 236 of file casadi_misc.cpp.

236  {
237  std::vector<casadi_int> left_parts, right_parts;
238 
239  // Parse left version
240  std::stringstream left_stream(version_left);
241  std::string part;
242  while (std::getline(left_stream, part, '.')) {
243  left_parts.push_back(std::stoi(part));
244  }
245 
246  // Parse right version
247  std::stringstream right_stream(version_right);
248  while (std::getline(right_stream, part, '.')) {
249  right_parts.push_back(std::stoi(part));
250  }
251 
252  // Compare component by component
253  casadi_int min_size = std::min(left_parts.size(), right_parts.size());
254  for (casadi_int i = 0; i < min_size; ++i) {
255  if (left_parts[i] > right_parts[i]) return true;
256  if (left_parts[i] < right_parts[i]) return false;
257  }
258 
259  // If all components are equal, the longer version is greater
260  return left_parts.size() > right_parts.size();
261  }

Referenced by version_lt().

◆ version_le()

CASADI_EXPORT bool casadi::version_le ( const std::string &  version_left,
const std::string &  version_right 
)

Definition at line 294 of file casadi_misc.cpp.

294  {
295  return version_ge(version_right, version_left);
296  }
bool version_ge(const std::string &version_left, const std::string &version_right)
Compare versions: returns true if version_left >= version_right.

References version_ge().

◆ version_lt()

CASADI_EXPORT bool casadi::version_lt ( const std::string &  version_left,
const std::string &  version_right 
)

Definition at line 290 of file casadi_misc.cpp.

290  {
291  return version_gt(version_right, version_left);
292  }
bool version_gt(const std::string &version_left, const std::string &version_right)
Compare versions: returns true if version_left > version_right.

References version_gt().

◆ 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 814 of file casadi_misc.hpp.

814  {
815  for (casadi_uint i=0; i<v.size(); ++i) {
816  std::copy(v[i].begin(), v[i].end(), std::ostream_iterator<T>(stream, " "));
817  stream << std::endl;
818  }
819  }

◆ write_matlab() [2/2]

template<typename T >
void casadi::write_matlab ( std::ostream &  stream,
const std::vector< T > &  v 
)

Definition at line 809 of file casadi_misc.hpp.

809  {
810  std::copy(v.begin(), v.end(), std::ostream_iterator<T>(stream, " "));
811  }

◆ xpress_global_init()

static void casadi::xpress_global_init ( )
static

Definition at line 40 of file xpress_interface.cpp.

40  {
41  s_xpress_init_rc = XPRSinit(nullptr);
42  }
static int s_xpress_init_rc

References s_xpress_init_rc.

Referenced by casadi::XpressInterface::init_mem().

◆ 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_entries_to_path()

bool casadi::zip_entries_to_path ( const std::vector< std::pair< std::string, std::string > > &  entries,
const std::string &  zip_path 
)

Definition at line 339 of file libzip.cpp.

341  {
342  int errorp;
343  zip_t* archive = zip_open(zip_path.c_str(), ZIP_CREATE | ZIP_TRUNCATE, &errorp);
344  if (!archive) {
345  zip_error_t ziperror;
346  zip_error_init_with_code(&ziperror, errorp);
347  uerr() << "Error: Cannot open zip archive " << zip_path << ": "
348  << zip_error_strerror(&ziperror) << std::endl;
349  zip_error_fini(&ziperror);
350  return false;
351  }
352  // Add each file at its archive-relative name (libzip creates parent entries implicitly)
353  for (const auto& e : entries) {
354  if (!add_file_to_zip(archive, e.first, e.second)) {
355  zip_discard(archive);
356  return false;
357  }
358  }
359  if (zip_close(archive) < 0) {
360  uerr() << "Error: Cannot finalize zip archive: " << zip_strerror(archive) << std::endl;
361  zip_discard(archive);
362  return false;
363  }
364  return true;
365  }

References add_file_to_zip(), and uerr().

Referenced by casadi_register_archiver_libzip().

◆ zip_to_path()

bool casadi::zip_to_path ( const std::string &  dir_path,
const std::string &  zip_path 
)

Definition at line 299 of file libzip.cpp.

299  {
300  auto ofs_ptr = Filesystem::ofstream_ptr(zip_path, std::ios::binary);
301  std::ostream& ofs = *ofs_ptr;
302  if (!ofs) {
303  uerr() << "Failed to open output file: " << zip_path << std::endl;
304  return false;
305  }
306 
307  return zip_to_stream(dir_path, ofs);
308  }

References casadi::Filesystem::ofstream_ptr(), 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 310 of file libzip.cpp.

310  {
311  int errorp;
312  zip_t* archive = zip_open(zip_path.c_str(), ZIP_CREATE | ZIP_TRUNCATE, &errorp);
313  if (!archive) {
314  zip_error_t ziperror;
315  zip_error_init_with_code(&ziperror, errorp);
316  uerr() << "Error: Cannot open zip archive " << zip_path << ": "
317  << zip_error_strerror(&ziperror) << std::endl;
318  zip_error_fini(&ziperror);
319  return false;
320  }
321 
322  try {
323  add_directory_recursive(archive, dir_path, dir_path, "");
324  } catch (const std::exception& e) {
325  uerr() << "Exception while zipping directory: " << e.what() << std::endl;
326  zip_discard(archive);
327  return false;
328  }
329 
330  if (zip_close(archive) < 0) {
331  uerr() << "Error: Cannot finalize zip archive: " << zip_strerror(archive) << std::endl;
332  zip_discard(archive);
333  return false;
334  }
335 
336  return true;
337  }

References add_directory_recursive(), and uerr().

◆ zip_to_stream()

bool casadi::zip_to_stream ( const std::string &  dir,
std::ostream &  output 
)

Definition at line 188 of file libzip.cpp.

188  {
189  zip_error_t error;
190  zip_error_init(&error);
191 
192  zip_source_t* src = zip_source_buffer_create(nullptr, 0, 0, &error);
193  if (!src) {
194  uerr() << "Failed to create zip source buffer: "
195  << zip_error_strerror(&error) << std::endl;
196  zip_error_fini(&error);
197  return false;
198  }
199 
200  // Prevent zip_close from destroying the source
201  zip_source_keep(src);
202 
203  zip_t* archive = zip_open_from_source(src, ZIP_TRUNCATE, &error);
204  if (!archive) {
205  uerr() << "Failed to open zip archive from source: "
206  << zip_error_strerror(&error) << std::endl;
207  zip_source_free(src);
208  zip_error_fini(&error);
209  return false;
210  }
211 
212  try {
213  add_directory_recursive(archive, dir, dir, "");
214  } catch (const std::exception& e) {
215  uerr() << "Exception while zipping directory: " << e.what() << std::endl;
216  zip_discard(archive); // also frees src
217  zip_error_fini(&error);
218  return false;
219  }
220 
221  if (zip_close(archive) != 0) {
222  uerr() << "Failed to finalize zip archive: "
223  << zip_error_strerror(&error) << std::endl;
224  zip_source_free(src);
225  zip_error_fini(&error);
226  return false;
227  }
228 
229  // At this point, src contains the archive in memory.
230  if (zip_source_open(src) < 0) {
231  uerr() << "Failed to open zip source for reading." << std::endl;
232  zip_source_free(src);
233  zip_error_fini(&error);
234  return false;
235  }
236 
237  // Seek to end to get size
238  if (zip_source_seek(src, 0, SEEK_END) < 0) {
239  uerr() << "Failed to seek to end of zip source." << std::endl;
240  zip_source_close(src);
241  zip_source_free(src);
242  zip_error_fini(&error);
243  return false;
244  }
245 
246  zip_int64_t size = zip_source_tell(src);
247  if (size < 0) {
248  uerr() << "Failed to get size of zip source." << std::endl;
249  zip_source_close(src);
250  zip_source_free(src);
251  zip_error_fini(&error);
252  return false;
253  }
254 
255  if (zip_source_seek(src, 0, SEEK_SET) < 0) {
256  uerr() << "Failed to rewind zip source." << std::endl;
257  zip_source_close(src);
258  zip_source_free(src);
259  zip_error_fini(&error);
260  return false;
261  }
262 
263  if (zip_source_seek(src, 0, SEEK_SET) < 0) {
264  uerr() << "Failed to rewind zip source." << std::endl;
265  zip_source_close(src);
266  zip_source_free(src);
267  zip_error_fini(&error);
268  return false;
269  }
270 
271  // Efficient streaming read/write
272  char buf[8192];
273  zip_int64_t bytes_read;
274 
275  while ((bytes_read = zip_source_read(src, buf, sizeof(buf))) > 0) {
276  output.write(buf, bytes_read);
277  if (!output) {
278  uerr() << "Write error while streaming zip data to output." << std::endl;
279  zip_source_close(src);
280  zip_source_free(src);
281  zip_error_fini(&error);
282  return false;
283  }
284  }
285 
286  zip_source_close(src);
287  zip_source_free(src);
288  zip_error_fini(&error);
289 
290  if (bytes_read < 0) {
291  uerr() << "Error reading from zip source." << std::endl;
292  return false;
293  }
294 
295  return true;
296  }

References add_directory_recursive(), and uerr().

Referenced by casadi_register_archiver_libzip(), and zip_to_path().

Variable Documentation

◆ BLASFEO_DAXPY_DECL

const char* casadi::BLASFEO_DAXPY_DECL
static
Initial value:
=
"extern void blasfeo_blas_daxpy(int* n, double* alpha,\n"
" double* x, int* incx,\n"
" double* y, int* incy);"

Definition at line 88 of file blas_blasfeo.cpp.

Referenced by blasfeo_codegen_axpy_aux().

◆ BLASFEO_DDOT_DECL

const char* casadi::BLASFEO_DDOT_DECL
static
Initial value:
=
"extern double blasfeo_blas_ddot(int* n,\n"
" double* x, int* incx,\n"
" double* y, int* incy);"

Definition at line 93 of file blas_blasfeo.cpp.

Referenced by blasfeo_codegen_dot_aux().

◆ BLASFEO_DECL

const char* casadi::BLASFEO_DECL
static
Initial value:
=
"/* BLAS \"blasfeo\" plugin: namespaced Fortran ABI, link with -lblasfeo */\n"
"extern void blasfeo_blas_dgemm(char* transa, char* transb,\n"
" int* m, int* n, int* k,\n"
" double* alpha,\n"
" double* A, int* lda,\n"
" double* B, int* ldb,\n"
" double* beta,\n"
" double* C, int* ldc);"

Definition at line 78 of file blas_blasfeo.cpp.

Referenced by blasfeo_codegen_mtimes().

◆ 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 409 of file dm_instantiator.cpp.

◆ CLASSIC_DASUM_DECL

const char* casadi::CLASSIC_DASUM_DECL
static
Initial value:
=
"#ifndef CASADI_BLAS_DASUM\n"
"#define CASADI_BLAS_DASUM dasum_\n"
"#endif\n"
"extern double CASADI_BLAS_DASUM(const int* n, const double* x, const int* incx);"

Definition at line 144 of file blas_classic.cpp.

Referenced by classic_codegen_asum_aux().

◆ CLASSIC_DAXPY_DECL

const char* casadi::CLASSIC_DAXPY_DECL
static
Initial value:
=
"#ifndef CASADI_BLAS_DAXPY\n"
"#define CASADI_BLAS_DAXPY daxpy_\n"
"#endif\n"
"extern void CASADI_BLAS_DAXPY(const int* n, const double* alpha,\n"
" const double* x, const int* incx,\n"
" double* y, const int* incy);"

Definition at line 115 of file blas_classic.cpp.

Referenced by classic_codegen_axpy_aux().

◆ CLASSIC_DDOT_DECL

const char* casadi::CLASSIC_DDOT_DECL
static
Initial value:
=
"#ifndef CASADI_BLAS_DDOT\n"
"#define CASADI_BLAS_DDOT ddot_\n"
"#endif\n"
"extern double CASADI_BLAS_DDOT(const int* n,\n"
" const double* x, const int* incx,\n"
" const double* y, const int* incy);"

Definition at line 123 of file blas_classic.cpp.

Referenced by classic_codegen_dot_aux().

◆ CLASSIC_DECL

const char* casadi::CLASSIC_DECL
static
Initial value:
=
"/* BLAS \"classic\" plugin: Fortran ABI dgemm_, link with -lblas/-lopenblas/-lmkl. */\n"
"/* Override the symbol at compile time with -DCASADI_BLAS_DGEMM=my_dgemm. */\n"
"#ifndef CASADI_BLAS_DGEMM\n"
"#define CASADI_BLAS_DGEMM dgemm_\n"
"#endif\n"
"extern void CASADI_BLAS_DGEMM(const char* transa, const char* transb,\n"
" const int* m, const int* n, const int* k,\n"
" const double* alpha,\n"
" const double* A, const int* lda,\n"
" const double* B, const int* ldb,\n"
" const double* beta,\n"
" double* C, const int* ldc);"

Definition at line 101 of file blas_classic.cpp.

Referenced by classic_codegen_mtimes().

◆ CLASSIC_DNRM2_DECL

const char* casadi::CLASSIC_DNRM2_DECL
static
Initial value:
=
"#ifndef CASADI_BLAS_DNRM2\n"
"#define CASADI_BLAS_DNRM2 dnrm2_\n"
"#endif\n"
"extern double CASADI_BLAS_DNRM2(const int* n, const double* x, const int* incx);"

Definition at line 138 of file blas_classic.cpp.

Referenced by classic_codegen_nrm2_aux().

◆ CLASSIC_DSCAL_DECL

const char* casadi::CLASSIC_DSCAL_DECL
static
Initial value:
=
"#ifndef CASADI_BLAS_DSCAL\n"
"#define CASADI_BLAS_DSCAL dscal_\n"
"#endif\n"
"extern void CASADI_BLAS_DSCAL(const int* n, const double* alpha,\n"
" double* x, const int* incx);"

Definition at line 131 of file blas_classic.cpp.

Referenced by classic_codegen_scal_aux().

◆ empty_mutex_set_

const std::set<std::string> casadi::empty_mutex_set_
static

Definition at line 930 of file code_generator.cpp.

Referenced by casadi::CodeGenerator::local_mutexes().

◆ 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 414 of file dm_instantiator.cpp.

Referenced by casadi::Constant< Value >::get_DM().

◆ Matrix< SXElem >

template class CASADI_EXPORT casadi::Matrix< SXElem >

Definition at line 1802 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().

◆ op_map

const OpMapping casadi::op_map[]
static

Definition at line 35 of file onnx_operations.cpp.

Referenced by get_op_mapping(), and get_op_mapping_by_name().

◆ 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.

◆ REFERENCE_DOC

const char* casadi::REFERENCE_DOC
static
Initial value:
=
"Built-in dense BLAS implementation, no external dependency. "
"Used by default and as the fallback when other plugins are unavailable."

Definition at line 127 of file blas.cpp.

Referenced by doc_blas().

◆ s_xpress_init_flag

std::once_flag casadi::s_xpress_init_flag
static

Definition at line 38 of file xpress_interface.cpp.

Referenced by casadi::XpressInterface::init_mem().

◆ s_xpress_init_rc

int casadi::s_xpress_init_rc = 0
static

Definition at line 39 of file xpress_interface.cpp.

Referenced by casadi::XpressInterface::init_mem(), and xpress_global_init().

◆ serialization_check

casadi_int casadi::serialization_check = 123456789012345
static

◆ serialization_protocol_version

casadi_int casadi::serialization_protocol_version = 3
static