|
Janus 2.0.0
High-performance C++20 dual-mode numerical framework
|
Namespaces | |
| namespace | detail |
| Smooth approximation of ReLU function: softplus(x) = (1/beta) * log(1 + exp(beta * x)). | |
| namespace | utils |
Classes | |
| struct | StructuralSensitivityOptions |
| Output-selection options shared by the structural diagnostics helpers. More... | |
| struct | DiagnosticInputRef |
| One scalarized element of the selected input block. More... | |
| struct | DiagnosticOutputRef |
| One scalarized row in the selected output stack. More... | |
| struct | StructuralDeficiencyGroup |
| One structurally deficient connected component in the sensitivity graph. More... | |
| struct | StructuralDiagnosticIssue |
| One user-facing structural diagnostic with an attached remediation hint. More... | |
| struct | StructuralSensitivityReport |
| Structural rank analysis of selected outputs with respect to one input block. More... | |
| struct | StructuralDiagnosticsOptions |
| Combined observability and identifiability analysis options. More... | |
| struct | StructuralDiagnosticsReport |
| Combined structural diagnostics report. More... | |
| class | Function |
| Wrapper around casadi::Function providing Eigen-native IO. More... | |
| class | JanusError |
| Base exception for all Janus errors. More... | |
| class | InvalidArgument |
| Input validation failed (e.g., mismatched sizes, invalid parameters). More... | |
| class | RuntimeError |
| Operation failed at runtime (e.g., CasADi eval with free variables). More... | |
| class | InterpolationError |
| Interpolation-specific errors. More... | |
| class | IntegrationError |
| Integration/ODE solver errors. More... | |
| class | SymbolicArg |
| Universal symbolic argument wrapper for Function inputs/outputs. More... | |
| class | SparsityPattern |
| class | GraphColoring |
| Wrapper around a CasADi graph coloring assignment. More... | |
| class | SparseJacobianEvaluator |
| Cached sparse Jacobian evaluator with fixed structural ordering. More... | |
| class | SparseHessianEvaluator |
| Cached sparse Hessian evaluator with fixed structural ordering. More... | |
| struct | NaNSparsityOptions |
| Options for NaN-propagation sparsity detection. More... | |
| struct | StructuralTransformOptions |
| Options for structural simplification and analysis passes. More... | |
| struct | AliasSubstitution |
| A single eliminated alias or trivial affine variable relation. More... | |
| struct | AliasEliminationResult |
| Result of alias elimination on a selected residual block. More... | |
| struct | StructuralBlock |
| One diagonal block in a block-triangular decomposition. More... | |
| struct | BLTDecomposition |
| Block-triangular decomposition and tearing metadata for a selected block. More... | |
| struct | StructuralAnalysis |
| Combined alias-elimination and BLT analysis pass. More... | |
| struct | SensitivitySwitchOptions |
| Heuristics controlling automatic forward-vs-adjoint selection. More... | |
| struct | SensitivityRecommendation |
| Result of Janus sensitivity regime selection. More... | |
| struct | OdeResult |
| Result structure for ODE solvers. More... | |
| struct | SecondOrderOdeResult |
| Result structure for second-order IVP solvers. More... | |
| struct | SecondOrderIvpOptions |
| Options for second-order structure-preserving trajectory integration. More... | |
| struct | MassMatrixIvpOptions |
| Options for stiff mass-matrix integration. More... | |
| struct | QuadResult |
| Result structure for quadrature (definite integration). More... | |
| struct | SecondOrderStepResult |
| Result of a second-order integration step. More... | |
| struct | RK45Result |
| Result of RK45 step with error estimate. More... | |
| struct | ExtrapolationConfig |
| Configuration for extrapolation behavior. More... | |
| class | Interpolator |
| struct | LinearSolvePolicy |
| Configuration for linear system solve backend and algorithm. More... | |
| struct | EigenDecomposition |
| Result of eigendecomposition: eigenvalues and eigenvectors. More... | |
| struct | BooleanType |
| struct | BooleanType< SymbolicScalar > |
| struct | PolynomialChaosDimension |
| One stochastic dimension in a polynomial chaos basis. More... | |
| struct | PolynomialChaosBasisOptions |
| Basis construction controls for multidimensional PCE. More... | |
| struct | PolynomialChaosTerm |
| One multidimensional chaos basis term. More... | |
| class | PolynomialChaosBasis |
| Multidimensional polynomial chaos basis with fixed truncation/order. More... | |
| struct | UnivariateQuadratureRule |
| One-dimensional stochastic quadrature rule on a probability measure. More... | |
| struct | StochasticQuadratureGrid |
| Multidimensional stochastic quadrature grid with row-major sample layout. More... | |
| struct | SmolyakQuadratureOptions |
| Options for Smolyak sparse-grid construction. More... | |
| class | Quaternion |
| Quaternion class for rotation representation. More... | |
| struct | RootFinderOptions |
| Options for root finding algorithms. More... | |
| struct | ImplicitFunctionOptions |
| Options for building differentiable implicit solve wrappers. More... | |
| struct | RootResult |
| Result of a root finding operation. More... | |
| class | NewtonSolver |
| Persistent nonlinear root solver. More... | |
| class | ScatteredInterpolator |
| struct | BirkhoffPseudospectralOptions |
| Options for BirkhoffPseudospectral setup. More... | |
| class | BirkhoffPseudospectral |
| Birkhoff pseudospectral transcription. More... | |
| struct | CollocationOptions |
| Options for DirectCollocation setup. More... | |
| class | DirectCollocation |
| Direct collocation transcription. More... | |
| struct | MultiShootingOptions |
| Options for MultipleShooting. More... | |
| class | MultipleShooting |
| Multiple shooting transcription. More... | |
| struct | VariableOptions |
| Options for variable creation. More... | |
| class | Opti |
| Main optimization environment class. More... | |
| struct | SNOPTOptions |
| SNOPT-specific solver options. More... | |
| struct | OptiOptions |
| Options for solving optimization problems. More... | |
| class | OptiSol |
| Solution wrapper for optimization results. More... | |
| struct | SweepResult |
| Result of a parametric sweep. More... | |
| struct | PseudospectralOptions |
| Options for Pseudospectral setup. More... | |
| class | Pseudospectral |
| Pseudospectral (Gauss-Lobatto) transcription. More... | |
| struct | ScalingAnalysisOptions |
| Thresholds controlling Opti scaling diagnostics. More... | |
| struct | ScalingIssue |
| One diagnostic item produced by Opti::analyze_scaling(). More... | |
| struct | VariableScalingInfo |
| Scaling metadata for one declared variable block. More... | |
| struct | ConstraintScalingInfo |
| Scaling metadata for one scalarized constraint row. More... | |
| struct | ObjectiveScalingInfo |
| Scaling metadata for the current objective. More... | |
| struct | ScalingSummary |
| Top-level scalar summary for an Opti scaling report. More... | |
| struct | ScalingReport |
| Aggregate result returned by Opti::analyze_scaling(). More... | |
| class | TranscriptionBase |
| Shared CRTP base for transcription methods. More... | |
Concepts | |
| concept | JanusScalar |
| Concept for valid Janus scalars. | |
Typedefs | |
| template<typename Scalar> | |
| using | JanusMatrix = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> |
| Dynamic-size matrix for both numeric and symbolic backends. | |
| template<typename Scalar> | |
| using | JanusVector = Eigen::Matrix<Scalar, Eigen::Dynamic, 1> |
| Dynamic-size column vector for both numeric and symbolic backends. | |
| template<typename Scalar> | |
| using | Vec2 = Eigen::Matrix<Scalar, 2, 1> |
| Fixed-size vectors and matrices for performance-critical code. | |
| template<typename Scalar> | |
| using | Vec3 = Eigen::Matrix<Scalar, 3, 1> |
| template<typename Scalar> | |
| using | Vec4 = Eigen::Matrix<Scalar, 4, 1> |
| template<typename Scalar> | |
| using | Mat2 = Eigen::Matrix<Scalar, 2, 2> |
| template<typename Scalar> | |
| using | Mat3 = Eigen::Matrix<Scalar, 3, 3> |
| template<typename Scalar> | |
| using | Mat4 = Eigen::Matrix<Scalar, 4, 4> |
| using | NumericScalar = double |
| Numeric scalar type. | |
| using | NumericMatrix = JanusMatrix<NumericScalar> |
| Eigen::MatrixXd equivalent. | |
| using | NumericVector = JanusVector<NumericScalar> |
| Eigen::VectorXd equivalent. | |
| using | SymbolicScalar = casadi::MX |
| CasADi MX symbolic scalar. | |
| using | SymbolicMatrix = JanusMatrix<SymbolicScalar> |
| Eigen matrix of MX elements. | |
| using | SymbolicVector = JanusVector<SymbolicScalar> |
| Eigen vector of MX elements. | |
| using | SparseMatrix = Eigen::SparseMatrix<double> |
| Sparse matrix types for efficient storage of large, sparse numeric data. | |
| using | SparseTriplet = Eigen::Triplet<double> |
| (row, col, value) triplet | |
| template<typename T> | |
| using | BooleanType_t = typename BooleanType<T>::type |
Enumerations | |
| enum class | StructuralProperty { Observability , Identifiability } |
| Structural property being analyzed from a symbolic sensitivity pattern. More... | |
| enum class | MapParallelization { Parallel , Serial , Unroll } |
| Batch mapping backend for janus::Function::map(). More... | |
| enum class | DeepGraphFormat { DOT , HTML , PDF } |
| Export format for deep graph visualization. More... | |
| enum class | SparseJacobianMode { Forward , Reverse } |
| Preferred directional mode for a sparse Jacobian evaluator. More... | |
| enum class | SensitivityRegime { Forward , Adjoint , CheckpointedAdjoint } |
| Sensitivity regime selected for a Jacobian-like derivative workload. More... | |
| enum class | CheckpointInterpolation { None , Hermite , Polynomial } |
| Checkpoint interpolation recommendation for long-horizon adjoints. More... | |
| enum class | IntegrationMethod { ForwardEuler , BackwardEuler , Trapezoidal , Midpoint } |
| Integration/differentiation method for trajectory optimization. More... | |
| enum class | SecondOrderIntegratorMethod { StormerVerlet , RungeKuttaNystrom4 } |
| Stepper selection for second-order systems q'' = a(t, q). More... | |
| enum class | MassMatrixIntegratorMethod { RosenbrockEuler , Bdf1 } |
| Stepper selection for mass-matrix systems M(t, y) y' = f(t, y). More... | |
| enum class | InterpolationMethod { Linear , Hermite , BSpline , Nearest } |
| Supported interpolation methods. More... | |
| enum class | ExtrapolationMode { Clamp , Linear } |
| Controls behavior when query points fall outside grid bounds. More... | |
| enum class | LinearSolveBackend { Dense , SparseDirect , IterativeKrylov } |
| Backend selection for linear system solves. More... | |
| enum class | DenseLinearSolver { ColPivHouseholderQR , PartialPivLU , FullPivLU , LLT , LDLT } |
| Dense linear solver algorithm. More... | |
| enum class | SparseDirectLinearSolver { SparseLU , SparseQR , SimplicialLLT , SimplicialLDLT } |
| Sparse direct solver algorithm. More... | |
| enum class | IterativeKrylovSolver { BiCGSTAB , GMRES } |
| Iterative Krylov solver algorithm. More... | |
| enum class | IterativePreconditioner { None , Diagonal } |
| Preconditioner for iterative solvers. More... | |
| enum class | NormType { L1 , L2 , Inf , Frobenius } |
| Norm type selection. More... | |
| enum class | PolynomialChaosFamily { Hermite , Legendre , Jacobi , Laguerre } |
| Univariate Askey-scheme family used for a PCE input dimension. More... | |
| enum class | PolynomialChaosTruncation { TotalOrder , TensorProduct } |
| Multi-index truncation strategy for a multidimensional basis. More... | |
| enum class | StochasticQuadratureRule { Gauss , ClenshawCurtis , GaussKronrod15 , AutoNested } |
| One-dimensional rule family used to generate stochastic quadrature nodes. More... | |
| enum class | RootSolveStrategy { Auto , TrustRegionNewton , LineSearchNewton , QuasiNewtonBroyden , PseudoTransientContinuation } |
| Numeric nonlinear solver strategy selection. More... | |
| enum class | RootSolveMethod { None , TrustRegionNewton , LineSearchNewton , QuasiNewtonBroyden , PseudoTransientContinuation } |
| Numeric nonlinear solver method actually used. More... | |
| enum class | RBFKernel { ThinPlateSpline , Multiquadric , Gaussian , Linear , Cubic } |
| Radial basis function kernel types for scattered interpolation. More... | |
| enum class | SigmoidType { Tanh , Logistic , Arctan , Polynomial } |
| Sigmoid shape selection. More... | |
| enum class | BirkhoffScheme { LGL , CGL } |
| Available Birkhoff node distributions. More... | |
| enum class | CollocationScheme { Trapezoidal , HermiteSimpson } |
| Collocation scheme for dynamics discretization. More... | |
| enum class | Solver { Ipopt , Snopt , QpOases } |
| Available NLP solvers. More... | |
| enum class | PseudospectralScheme { LGL , CGL } |
| Available pseudospectral node distributions. More... | |
| enum class | ScalingIssueLevel { Warning , Critical } |
| Severity used by Opti scaling diagnostics. More... | |
| enum class | ScalingIssueKind { Variable , Constraint , Objective , Summary } |
| Diagnostic category for a scaling issue. More... | |
Functions | |
| StructuralSensitivityReport | analyze_structural_observability (const Function &fn, int state_input_idx=0, const StructuralSensitivityOptions &opts={}) |
| Analyze which states are structurally observable from selected outputs. | |
| StructuralSensitivityReport | analyze_structural_identifiability (const Function &fn, int parameter_input_idx, const StructuralSensitivityOptions &opts={}) |
| Analyze which parameters are structurally identifiable from selected outputs. | |
| StructuralDiagnosticsReport | analyze_structural_diagnostics (const Function &fn, const StructuralDiagnosticsOptions &opts) |
| Run structural observability and identifiability checks together. | |
| template<int NInputs, int NOutputs, typename Func> | |
| Function | make_function (const std::string &name, Func &&fn) |
| Create a Function from a lambda expression. | |
| template<int NInputs, typename Func> | |
| Function | make_function (const std::string &name, const std::vector< std::string > &input_names, Func &&fn) |
| Create a Function from a lambda with named inputs. | |
| template<typename Derived> | |
| void | print (const std::string &label, const Eigen::MatrixBase< Derived > &mat) |
| Print a matrix to stdout with a label. | |
| template<typename Derived> | |
| void | disp (const std::string &label, const Eigen::MatrixBase< Derived > &mat) |
| Deprecated alias for print. | |
| template<typename Derived> | |
| auto | eval (const Eigen::MatrixBase< Derived > &mat) |
| Evaluate a symbolic matrix to a numeric Eigen matrix. | |
| double | eval (const SymbolicScalar &val) |
| Evaluate a symbolic scalar to a double. | |
| template<typename T, std::enable_if_t< std::is_arithmetic_v< T >, int > = 0> | |
| T | eval (const T &val) |
| Passthrough eval for numeric types. | |
| void | export_graph_dot (const SymbolicScalar &expr, const std::string &filename, const std::string &name="expression") |
| Export a symbolic expression to DOT format for visualization. | |
| bool | render_graph (const std::string &dot_file, const std::string &output_file) |
| Export a janus::Function to DOT format for visualization. | |
| bool | visualize_graph (const SymbolicScalar &expr, const std::string &output_base) |
| Convenience function: export expression to DOT and render to PDF. | |
| void | export_graph_html (const SymbolicScalar &expr, const std::string &filename, const std::string &name="expression") |
| Export a symbolic expression to an interactive HTML file. | |
| void | export_sx_graph_dot (const casadi::SX &expr, const std::string &filename, const std::string &name="expression") |
| Export an SX expression to DOT format for deep visualization. | |
| void | export_sx_graph_html (const casadi::SX &expr, const std::string &filename, const std::string &name="expression") |
| Export an SX expression to an interactive HTML file for deep visualization. | |
| void | export_graph_deep (const casadi::Function &fn, const std::string &filename, DeepGraphFormat format=DeepGraphFormat::HTML, const std::string &name="") |
| Export a CasADi Function to deep graph format showing all operations. | |
| bool | visualize_graph_deep (const casadi::Function &fn, const std::string &output_base) |
| Convenience function: export Function to deep graph and render to PDF. | |
| SymbolicScalar | sym (const std::string &name) |
| Create a named symbolic scalar variable. | |
| SymbolicScalar | sym (const std::string &name, int rows, int cols=1) |
| Create a named symbolic matrix variable. | |
| SymbolicVector | sym_vector (const std::string &name, int size) |
| Create a named symbolic vector (returns SymbolicVector). | |
| SymbolicVector | sym_vec (const std::string &name, int size) |
| Create a symbolic vector preserving the CasADi primitive connection. | |
| std::pair< SymbolicVector, SymbolicScalar > | sym_vec_pair (const std::string &name, int size) |
| Create symbolic vector and return both SymbolicVector and underlying MX. | |
| SymbolicScalar | as_mx (const SymbolicVector &v) |
| Get the underlying MX representation of a SymbolicVector. | |
| template<typename Derived> | |
| casadi::MX | to_mx (const Eigen::MatrixBase< Derived > &e) |
| Convert Eigen matrix of MX (or numeric) to CasADi MX. | |
| Eigen::Matrix< casadi::MX, Eigen::Dynamic, Eigen::Dynamic > | to_eigen (const casadi::MX &m) |
| Convert CasADi MX to Eigen matrix of MX. | |
| SymbolicVector | as_vector (const casadi::MX &m) |
| Convert CasADi MX vector to SymbolicVector (Eigen container of MX). | |
| SymbolicVector | to_eigen_vec (const casadi::MX &m) |
| Backwards compatibility alias for as_vector. | |
| SparsityPattern | sparsity_of_jacobian (const SymbolicScalar &expr, const SymbolicScalar &vars) |
| Get Jacobian sparsity without computing the full Jacobian. | |
| SparsityPattern | sparsity_of_hessian (const SymbolicScalar &expr, const SymbolicScalar &vars) |
| Get Hessian sparsity of a scalar expression. | |
| SparsityPattern | get_jacobian_sparsity (const Function &fn, int output_idx=0, int input_idx=0) |
| Get sparsity of a janus::Function Jacobian. | |
| SparsityPattern | get_hessian_sparsity (const Function &fn, int output_idx=0, int input_idx=0) |
| Get Hessian sparsity of a scalar janus::Function output. | |
| SparsityPattern | get_sparsity_in (const Function &fn, int input_idx=0) |
| Get input sparsity of a janus::Function. | |
| SparsityPattern | get_sparsity_out (const Function &fn, int output_idx=0) |
| Get output sparsity of a janus::Function. | |
| SparseJacobianEvaluator | sparse_jacobian (const SymbolicArg &expression, const SymbolicArg &variables, const std::string &name="") |
| Compile a sparse Jacobian evaluator from symbolic expressions. | |
| SparseJacobianEvaluator | sparse_jacobian (const std::vector< SymbolicArg > &expressions, const std::vector< SymbolicArg > &variables, const std::string &name="") |
| Compile a sparse Jacobian evaluator from vector arguments. | |
| SparseJacobianEvaluator | sparse_jacobian (const Function &fn, int output_idx=0, int input_idx=0, const std::string &name="") |
| Compile a sparse Jacobian evaluator from a janus::Function. | |
| SparseHessianEvaluator | sparse_hessian (const SymbolicArg &expression, const SymbolicArg &variables, const std::string &name="") |
| Compile a sparse Hessian evaluator from symbolic expressions. | |
| SparseHessianEvaluator | sparse_hessian (const SymbolicArg &expression, const std::vector< SymbolicArg > &variables, const std::string &name="") |
| Compile a sparse Hessian evaluator from vector arguments. | |
| SparseHessianEvaluator | sparse_hessian (const Function &fn, int output_idx=0, int input_idx=0, const std::string &name="") |
| Compile a sparse Hessian evaluator from a janus::Function. | |
| template<typename Func> | |
| SparsityPattern | nan_propagation_sparsity (Func &&fn, int n_inputs, int n_outputs, const NaNSparsityOptions &opts={}) |
| Detect Jacobian sparsity using NaN propagation. | |
| SparsityPattern | nan_propagation_sparsity (const Function &fn, const NaNSparsityOptions &opts={}) |
| Detect Jacobian sparsity of a janus::Function using NaN propagation. | |
| AliasEliminationResult | alias_eliminate (const Function &fn, const StructuralTransformOptions &opts={}) |
| Eliminate trivial affine alias rows from a selected residual block. | |
| BLTDecomposition | block_triangularize (const Function &fn, const StructuralTransformOptions &opts={}) |
| Compute a block-triangular decomposition of a selected residual block. | |
| StructuralAnalysis | structural_analyze (const Function &fn, const StructuralTransformOptions &opts={}) |
| Run alias elimination followed by BLT decomposition. | |
| template<JanusScalar T> | |
| T | abs (const T &x) |
| Computes the absolute value of a scalar. | |
| template<typename Derived> | |
| auto | abs (const Eigen::MatrixBase< Derived > &x) |
| Computes absolute value element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | sqrt (const T &x) |
| Computes the square root of a scalar. | |
| template<typename Derived> | |
| auto | sqrt (const Eigen::MatrixBase< Derived > &x) |
| Computes square root element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | pow (const T &base, const T &exponent) |
| Computes the power function: base^exponent. | |
| template<JanusScalar T> requires (!std::is_same_v<T, double>) | |
| T | pow (const T &base, double exponent) |
| Computes power function base^exponent for scalars (mixed types). | |
| template<JanusScalar T> requires (!std::is_same_v<T, double>) | |
| T | pow (double base, const T &exponent) |
| Computes power function base^exponent for scalars (mixed types: double base). | |
| template<typename Derived, typename Scalar> | |
| auto | pow (const Eigen::MatrixBase< Derived > &base, const Scalar &exponent) |
| Computes power function element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | exp (const T &x) |
| Computes the exponential function e^x. | |
| template<typename Derived> | |
| auto | exp (const Eigen::MatrixBase< Derived > &x) |
| Computes exponential function element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | log (const T &x) |
| Computes the natural logarithm of x. | |
| template<typename Derived> | |
| auto | log (const Eigen::MatrixBase< Derived > &x) |
| Computes natural logarithm element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | log10 (const T &x) |
| Computes the base-10 logarithm of x. | |
| template<typename Derived> | |
| auto | log10 (const Eigen::MatrixBase< Derived > &x) |
| Computes base-10 logarithm element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | sinh (const T &x) |
| Computes hyperbolic sine. | |
| template<typename Derived> | |
| auto | sinh (const Eigen::MatrixBase< Derived > &x) |
| Computes hyperbolic sine element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | cosh (const T &x) |
| Computes hyperbolic cosine of x. | |
| template<typename Derived> | |
| auto | cosh (const Eigen::MatrixBase< Derived > &x) |
| Computes hyperbolic cosine element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | tanh (const T &x) |
| Computes hyperbolic tangent of x. | |
| template<typename Derived> | |
| auto | tanh (const Eigen::MatrixBase< Derived > &x) |
| Computes hyperbolic tangent element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | floor (const T &x) |
| Computes floor of x. | |
| template<typename Derived> | |
| auto | floor (const Eigen::MatrixBase< Derived > &x) |
| Computes floor element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | ceil (const T &x) |
| Computes ceiling of x. | |
| template<typename Derived> | |
| auto | ceil (const Eigen::MatrixBase< Derived > &x) |
| Computes ceiling element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | sign (const T &x) |
| Computes sign of x. | |
| template<typename Derived> | |
| auto | sign (const Eigen::MatrixBase< Derived > &x) |
| Computes sign element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | fmod (const T &x, const T &y) |
| Computes floating-point remainder of x/y. | |
| template<typename Derived, typename Scalar> | |
| auto | fmod (const Eigen::MatrixBase< Derived > &x, const Scalar &y) |
| Computes floating-point remainder element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | log2 (const T &x) |
| Computes base-2 logarithm of x. | |
| template<typename Derived> | |
| auto | log2 (const Eigen::MatrixBase< Derived > &x) |
| Computes base-2 logarithm element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | exp2 (const T &x) |
| Computes 2^x. | |
| template<typename Derived> | |
| auto | exp2 (const Eigen::MatrixBase< Derived > &x) |
| Computes 2^x element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | cbrt (const T &x) |
| Computes cube root of x. | |
| template<typename Derived> | |
| auto | cbrt (const Eigen::MatrixBase< Derived > &x) |
| Computes cube root element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | round (const T &x) |
| Rounds x to the nearest integer. | |
| template<typename Derived> | |
| auto | round (const Eigen::MatrixBase< Derived > &x) |
| Rounds element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | trunc (const T &x) |
| Truncates x toward zero. | |
| template<typename Derived> | |
| auto | trunc (const Eigen::MatrixBase< Derived > &x) |
| Truncates element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | hypot (const T &x, const T &y) |
| Computes sqrt(x^2 + y^2) without undue overflow/underflow. | |
| template<JanusScalar T> requires (!std::is_same_v<T, double>) | |
| T | hypot (const T &x, double y) |
| Computes hypot(x, y) with mixed types. | |
| template<JanusScalar T> requires (!std::is_same_v<T, double>) | |
| T | hypot (double x, const T &y) |
| Computes hypot(x, y) with mixed types (double first). | |
| template<typename Derived> | |
| auto | hypot (const Eigen::MatrixBase< Derived > &x, const Eigen::MatrixBase< Derived > &y) |
| Computes hypot element-wise for matrices. | |
| template<JanusScalar T> | |
| T | expm1 (const T &x) |
| Computes exp(x) - 1, accurate for small x. | |
| template<typename Derived> | |
| auto | expm1 (const Eigen::MatrixBase< Derived > &x) |
| Computes expm1 element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | log1p (const T &x) |
| Computes log(1 + x), accurate for small x. | |
| template<typename Derived> | |
| auto | log1p (const Eigen::MatrixBase< Derived > &x) |
| Computes log1p element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | copysign (const T &x, const T &y) |
| Returns magnitude of x with sign of y. | |
| template<JanusScalar T> requires (!std::is_same_v<T, double>) | |
| T | copysign (const T &x, double y) |
| Copysign with mixed types. | |
| template<JanusScalar T> requires (!std::is_same_v<T, double>) | |
| T | copysign (double x, const T &y) |
| Copysign with mixed types (double magnitude). | |
| template<typename Derived> | |
| auto | copysign (const Eigen::MatrixBase< Derived > &x, const Eigen::MatrixBase< Derived > &y) |
| Copysign element-wise for matrices. | |
| template<JanusScalar T> | |
| T | square (const T &x) |
| Computes x^2 (more efficient than pow(x, 2)). | |
| template<typename Derived> | |
| auto | square (const Eigen::MatrixBase< Derived > &x) |
| Computes square element-wise for a matrix. | |
| template<typename Expr, typename... Vars> | |
| auto | jacobian (const Expr &expression, const Vars &...variables) |
| Computes Jacobian of an expression with respect to variables. | |
| SensitivityRecommendation | select_sensitivity_regime (int parameter_count, int output_count, int horizon_length=1, bool stiff=false, const SensitivitySwitchOptions &opts=SensitivitySwitchOptions()) |
| Recommend a sensitivity regime from parameter/output counts. | |
| SensitivityRecommendation | select_sensitivity_regime (const Function &fn, int output_idx=0, int input_idx=0, int horizon_length=1, bool stiff=false, const SensitivitySwitchOptions &opts=SensitivitySwitchOptions()) |
| Recommend a sensitivity regime for a selected janus::Function block. | |
| Function | sensitivity_jacobian (const Function &fn, int output_idx=0, int input_idx=0, int horizon_length=1, bool stiff=false, const SensitivitySwitchOptions &opts=SensitivitySwitchOptions()) |
| Build a Jacobian function for one output/input block using the recommended regime. | |
| auto | jacobian (const std::vector< SymbolicArg > &expressions, const std::vector< SymbolicArg > &variables) |
| Computes Jacobian with vector arguments (expressions and variables). | |
| SymbolicVector | sym_gradient (const SymbolicArg &expr, const SymbolicArg &vars) |
| Symbolic gradient (for scalar-output functions). | |
| SymbolicMatrix | hessian (const SymbolicArg &expr, const SymbolicArg &vars) |
| Hessian matrix (second-order derivatives). | |
| SymbolicMatrix | hessian_lagrangian (const SymbolicArg &objective, const SymbolicArg &constraints, const SymbolicArg &vars, const SymbolicArg &multipliers) |
| Hessian of Lagrangian for constrained optimization. | |
| SymbolicMatrix | hessian_vector_product (const SymbolicArg &expr, const SymbolicArg &vars, const SymbolicArg &direction) |
| Hessian-vector product for a scalar expression without forming the dense Hessian. | |
| SymbolicMatrix | lagrangian_hessian_vector_product (const SymbolicArg &objective, const SymbolicArg &constraints, const SymbolicArg &vars, const SymbolicArg &multipliers, const SymbolicArg &direction) |
| Hessian-vector product of a Lagrangian, i.e. a second-order adjoint action. | |
| Function | hessian_vector_product (const Function &fn, int output_idx=0, int input_idx=0) |
| Build a matrix-free Hessian-vector product function for one scalar output/input block. | |
| Function | lagrangian_hessian_vector_product (const Function &fn, int objective_output_idx, int constraint_output_idx, int input_idx=0) |
| Build a Lagrangian Hessian-vector product function for optimization workflows. | |
| SymbolicVector | sym_gradient (const SymbolicArg &expr, const std::vector< SymbolicArg > &vars) |
| Symbolic gradient with vector of variables. | |
| SymbolicMatrix | hessian (const SymbolicArg &expr, const std::vector< SymbolicArg > &vars) |
| Hessian with vector of variables. | |
| SymbolicMatrix | hessian_lagrangian (const SymbolicArg &objective, const SymbolicArg &constraints, const std::vector< SymbolicArg > &vars, const SymbolicArg &multipliers) |
| Hessian of Lagrangian with vector inputs. | |
| SymbolicMatrix | hessian_vector_product (const SymbolicArg &expr, const std::vector< SymbolicArg > &vars, const SymbolicArg &direction) |
| Hessian-vector product with vector of variables. | |
| SymbolicMatrix | lagrangian_hessian_vector_product (const SymbolicArg &objective, const SymbolicArg &constraints, const std::vector< SymbolicArg > &vars, const SymbolicArg &multipliers, const SymbolicArg &direction) |
| Lagrangian Hessian-vector product with vector of variables. | |
| template<typename Derived> | |
| auto | diff (const Eigen::MatrixBase< Derived > &v) |
| Computes adjacent differences of a vector Returns a vector of size N-1 where out[i] = v[i+1] - v[i]. | |
| template<typename DerivedY, typename DerivedX> | |
| auto | trapz (const Eigen::MatrixBase< DerivedY > &y, const Eigen::MatrixBase< DerivedX > &x) |
| Computes trapezoidal integration Approximation of integral of y(x) using trapezoidal rule. | |
| template<typename DerivedY, typename DerivedX> | |
| auto | cumtrapz (const Eigen::MatrixBase< DerivedY > &y, const Eigen::MatrixBase< DerivedX > &x) |
| Computes the cumulative trapezoidal integral. | |
| template<typename DerivedY, JanusScalar Spacing = double> | |
| auto | cumtrapz (const Eigen::MatrixBase< DerivedY > &y, const Spacing &dx=1.0) |
| Computes the cumulative trapezoidal integral with uniform spacing. | |
| template<typename DerivedY, typename DerivedX> | |
| auto | gradient_1d (const Eigen::MatrixBase< DerivedY > &y, const Eigen::MatrixBase< DerivedX > &x) |
| Computes gradient of 1D data using central differences. | |
| template<typename DerivedF, typename Spacing = double> | |
| auto | gradient (const Eigen::MatrixBase< DerivedF > &f, const Spacing &dx=1.0, int edge_order=1, int n=1) |
| Computes gradient using second-order accurate central differences. | |
| template<typename DerivedF, typename Spacing = double, typename Period> | |
| auto | gradient_periodic (const Eigen::MatrixBase< DerivedF > &f, const Spacing &dx, const Period &period, int edge_order=1, int n=1) |
| Computes gradient with periodic boundary conditions. | |
| IntegrationMethod | parse_integration_method (const std::string &method) |
| Parse integration method from string. | |
| template<typename Scalar> | |
| std::pair< Scalar, Scalar > | forward_euler_weights (Scalar h) |
| Forward Euler (explicit) differentiation weights. | |
| template<typename Scalar> | |
| std::pair< Scalar, Scalar > | backward_euler_weights (Scalar h) |
| Backward Euler (implicit) differentiation weights. | |
| template<typename Scalar> | |
| std::pair< Scalar, Scalar > | central_difference_weights (Scalar h) |
| Central difference differentiation weights. | |
| template<typename Scalar> | |
| std::pair< Scalar, Scalar > | trapezoidal_weights (Scalar h) |
| Trapezoidal integration weights. | |
| template<typename Scalar> | |
| JanusVector< Scalar > | forward_difference (const JanusVector< Scalar > &f, const JanusVector< Scalar > &x) |
| Compute derivative using forward difference. | |
| template<typename Scalar> | |
| JanusVector< Scalar > | backward_difference (const JanusVector< Scalar > &f, const JanusVector< Scalar > &x) |
| Compute derivative using backward difference. | |
| template<typename Scalar> | |
| JanusVector< Scalar > | central_difference (const JanusVector< Scalar > &f, const JanusVector< Scalar > &x) |
| Compute derivative using central difference. | |
| template<typename Scalar> | |
| JanusVector< Scalar > | integration_defects (const JanusVector< Scalar > &x, const JanusVector< Scalar > &xdot, const JanusVector< Scalar > &t, IntegrationMethod method=IntegrationMethod::Trapezoidal) |
| Compute integration defects for derivative constraints. | |
| template<typename Scalar> | |
| JanusVector< Scalar > | finite_difference_coefficients (const JanusVector< Scalar > &x, Scalar x0=Scalar(0.0), int derivative_degree=1) |
| Computes finite difference coefficients for arbitrary grids. | |
| template<typename Func, typename T> | |
| QuadResult< T > | quad (Func &&func, T a, T b, double abstol=1e-8, double reltol=1e-6) |
| Compute definite integral using adaptive quadrature (numeric) or CVODES (symbolic). | |
| QuadResult< SymbolicScalar > | quad (const SymbolicScalar &expr, const SymbolicScalar &variable, double a, double b, double abstol=1e-8, double reltol=1e-6) |
| Compute definite integral of a symbolic expression using CasADi CVODES. | |
| template<typename Func> | |
| OdeResult< double > | solve_ivp (Func &&fun, std::pair< double, double > t_span, const NumericVector &y0, int n_eval=100, double abstol=1e-8, double reltol=1e-6) |
| Solve initial value problem: dy/dt = f(t, y), y(t0) = y0. | |
| template<typename Func> | |
| OdeResult< double > | solve_ivp (Func &&fun, std::pair< double, double > t_span, std::initializer_list< double > y0_init, int n_eval=100, double abstol=1e-8, double reltol=1e-6) |
| Convenience overload: solve_ivp with initializer list for y0. | |
| template<typename AccelFunc> | |
| SecondOrderOdeResult< double > | solve_second_order_ivp (AccelFunc &&acceleration, std::pair< double, double > t_span, const NumericVector &q0, const NumericVector &v0, int n_eval=100, const SecondOrderIvpOptions &opts={}) |
| Solve a second-order IVP q'' = a(t, q), q(t0) = q0, v(t0) = v0. | |
| template<typename AccelFunc> | |
| SecondOrderOdeResult< double > | solve_second_order_ivp (AccelFunc &&acceleration, std::pair< double, double > t_span, std::initializer_list< double > q0_init, std::initializer_list< double > v0_init, int n_eval=100, const SecondOrderIvpOptions &opts={}) |
| Convenience overload for second-order IVPs using initializer lists. | |
| template<typename RhsFunc, typename MassFunc> | |
| OdeResult< double > | solve_ivp_mass_matrix (RhsFunc &&rhs, MassFunc &&mass_matrix, std::pair< double, double > t_span, const NumericVector &y0, int n_eval=100, const MassMatrixIvpOptions &opts={}) |
| Solve M(t, y) y' = f(t, y) with a native numeric stiff integrator. | |
| template<typename RhsFunc, typename MassFunc> | |
| OdeResult< double > | solve_ivp_mass_matrix (RhsFunc &&rhs, MassFunc &&mass_matrix, std::pair< double, double > t_span, std::initializer_list< double > y0_init, int n_eval=100, const MassMatrixIvpOptions &opts={}) |
| Convenience overload for mass-matrix IVPs using initializer lists. | |
| OdeResult< double > | solve_ivp_mass_matrix_expr (const SymbolicScalar &rhs_expr, const SymbolicScalar &mass_expr, const SymbolicScalar &t_var, const SymbolicScalar &y_var, std::pair< double, double > t_span, const NumericVector &y0, int n_eval=100, const MassMatrixIvpOptions &opts={}) |
| Solve a symbolic mass-matrix IVP using CasADi IDAS. | |
| template<typename Func> | |
| OdeResult< SymbolicScalar > | solve_ivp_symbolic (Func &&fun, std::pair< double, double > t_span, const Eigen::VectorXd &y0, int n_eval=100, double abstol=1e-8, double reltol=1e-6) |
| Solve IVP with symbolic ODE function (CasADi CVODES backend). | |
| OdeResult< double > | solve_ivp_expr (const SymbolicScalar &ode_expr, const SymbolicScalar &t_var, const SymbolicScalar &y_var, std::pair< double, double > t_span, const NumericVector &y0, int n_eval=100, double abstol=1e-8, double reltol=1e-6) |
| Solve IVP with a symbolic expression directly (expression-based API). | |
| template<typename DerivedF, typename DerivedX> | |
| JanusVector< typename DerivedF::Scalar > | integrate_discrete_intervals (const Eigen::MatrixBase< DerivedF > &f, const Eigen::MatrixBase< DerivedX > &x, bool multiply_by_dx=true, const std::string &method="trapezoidal", const std::string &method_endpoints="lower_order") |
| Integrates discrete samples using reconstruction methods. | |
| template<typename DerivedF, typename DerivedX> | |
| JanusVector< typename DerivedF::Scalar > | integrate_discrete_squared_curvature (const Eigen::MatrixBase< DerivedF > &f, const Eigen::MatrixBase< DerivedX > &x, const std::string &method="simpson") |
| Computes the integral of squared curvature over each interval. | |
| template<typename Scalar, typename Func> | |
| JanusVector< Scalar > | euler_step (Func &&f, const JanusVector< Scalar > &x, Scalar t, Scalar dt) |
| Forward Euler integration step. | |
| template<typename Scalar, typename Func> | |
| JanusVector< Scalar > | rk2_step (Func &&f, const JanusVector< Scalar > &x, Scalar t, Scalar dt) |
| Heun's method (RK2) integration step. | |
| template<typename Scalar, typename Func> | |
| JanusVector< Scalar > | rk4_step (Func &&f, const JanusVector< Scalar > &x, Scalar t, Scalar dt) |
| Classic 4th-order Runge-Kutta integration step. | |
| template<typename Scalar, typename AccelFunc> | |
| SecondOrderStepResult< Scalar > | stormer_verlet_step (AccelFunc &&acceleration, const JanusVector< Scalar > &q, const JanusVector< Scalar > &v, Scalar t, Scalar dt) |
| Stormer-Verlet / velocity-Verlet step for q'' = a(t, q). | |
| template<typename Scalar, typename AccelFunc> | |
| SecondOrderStepResult< Scalar > | rkn4_step (AccelFunc &&acceleration, const JanusVector< Scalar > &q, const JanusVector< Scalar > &v, Scalar t, Scalar dt) |
| Classical 4th-order Runge-Kutta-Nystrom step for q'' = a(t, q). | |
| template<typename Scalar, typename Func> | |
| RK45Result< Scalar > | rk45_step (Func &&f, const JanusVector< Scalar > &x, Scalar t, Scalar dt) |
| Dormand-Prince RK45 integration step with embedded error estimate. | |
| template<typename Scalar> | |
| JanusVector< Scalar > | interpn (const std::vector< NumericVector > &points, const NumericVector &values_flat, const JanusMatrix< Scalar > &xi, InterpolationMethod method=InterpolationMethod::Linear, std::optional< Scalar > fill_value=std::nullopt) |
| N-dimensional interpolation on regular grids (backwards compatibility). | |
| template<typename Scalar> | |
| SymbolicVector | interpn (const std::vector< NumericVector > &points, const SymbolicVector &values_flat, const JanusMatrix< Scalar > &xi, InterpolationMethod method=InterpolationMethod::Linear, std::optional< SymbolicScalar > fill_value=std::nullopt) |
| N-dimensional interpolation with symbolic table values. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | solve (const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &b) |
| Solves linear system Ax = b using the default backend policy. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | solve (const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &b, const LinearSolvePolicy &policy) |
| Solves linear system Ax = b using an explicit backend policy. | |
| template<typename DerivedB> | |
| auto | solve (const SparseMatrix &A, const Eigen::MatrixBase< DerivedB > &b) |
| Solve a numeric sparse linear system with a sparse-aware default backend. | |
| template<typename DerivedB> | |
| auto | solve (const SparseMatrix &A, const Eigen::MatrixBase< DerivedB > &b, const LinearSolvePolicy &policy) |
| Solve a numeric sparse linear system using an explicit backend policy. | |
| template<typename DerivedX, typename DerivedY> | |
| auto | outer (const Eigen::MatrixBase< DerivedX > &x, const Eigen::MatrixBase< DerivedY > &y) |
| Computes outer product x * y^T. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | dot (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Computes dot product of two vectors. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | cross (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Computes 3D cross product. | |
| template<typename Derived> | |
| auto | inv (const Eigen::MatrixBase< Derived > &A) |
| Computes matrix inverse. | |
| template<typename Derived> | |
| auto | det (const Eigen::MatrixBase< Derived > &A) |
| Computes matrix determinant. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | inner (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Computes inner product of two vectors (dot product). | |
| template<typename Derived> | |
| auto | pinv (const Eigen::MatrixBase< Derived > &A) |
| Computes Moore-Penrose pseudo-inverse. | |
| template<typename Derived> | |
| auto | norm (const Eigen::MatrixBase< Derived > &x, NormType type=NormType::L2) |
| Computes vector/matrix norm. | |
| template<typename Derived> | |
| auto | eig (const Eigen::MatrixBase< Derived > &A) |
| Computes the eigendecomposition of a square matrix with a real spectrum. | |
| template<typename Derived> | |
| auto | eig_symmetric (const Eigen::MatrixBase< Derived > &A) |
| Computes the eigendecomposition of a symmetric matrix. | |
| template<typename T> | |
| std::tuple< T, T, T, T, T, T > | inv_symmetric_3x3_explicit (const T &m11, const T &m22, const T &m33, const T &m12, const T &m23, const T &m13) |
| Explicit inverse of a symmetric 3x3 matrix. | |
| SparseMatrix | sparse_from_triplets (int rows, int cols, const std::vector< SparseTriplet > &triplets) |
| Create sparse matrix from triplets. | |
| SparseMatrix | to_sparse (const NumericMatrix &dense, double tol=0.0) |
| Convert dense matrix to sparse. | |
| NumericMatrix | to_dense (const SparseMatrix &sparse) |
| Convert sparse matrix to dense. | |
| SparseMatrix | sparse_identity (int n) |
| Create identity sparse matrix. | |
| template<typename Cond, JanusScalar T1, JanusScalar T2> | |
| auto | where (const Cond &cond, const T1 &if_true, const T2 &if_false) |
| Select values based on condition (ternary operator) Returns: cond ? if_true : if_false Supports mixed types. | |
| template<typename DerivedCond, typename DerivedTrue, typename DerivedFalse> | |
| auto | where (const Eigen::ArrayBase< DerivedCond > &cond, const Eigen::MatrixBase< DerivedTrue > &if_true, const Eigen::MatrixBase< DerivedFalse > &if_false) |
| Element-wise select. | |
| template<JanusScalar T1, JanusScalar T2> | |
| auto | min (const T1 &a, const T2 &b) |
| Computes minimum of two values. | |
| template<typename Derived> | |
| auto | min (const Eigen::MatrixBase< Derived > &a, const Eigen::MatrixBase< Derived > &b) |
| Computes minimum element-wise for a matrix/vector. | |
| template<JanusScalar T1, JanusScalar T2> | |
| auto | max (const T1 &a, const T2 &b) |
| Computes maximum of two values. | |
| template<typename Derived> | |
| auto | max (const Eigen::MatrixBase< Derived > &a, const Eigen::MatrixBase< Derived > &b) |
| Computes maximum element-wise for a matrix/vector. | |
| template<JanusScalar T, JanusScalar TLow, JanusScalar THigh> | |
| auto | clamp (const T &val, const TLow &low, const THigh &high) |
| Clamps value between low and high. | |
| template<typename Derived, typename Scalar> | |
| auto | clamp (const Eigen::MatrixBase< Derived > &val, const Scalar &low, const Scalar &high) |
| Clamps values element-wise for a matrix/vector. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | lt (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Element-wise less than comparison. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | gt (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Element-wise greater than comparison. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | le (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Element-wise less than or equal comparison. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | ge (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Element-wise greater than or equal comparison. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | eq (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Element-wise equality comparison. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | neq (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Element-wise inequality comparison. | |
| template<JanusScalar T, JanusScalar TLow, JanusScalar THigh, JanusScalar Sharpness = double> | |
| auto | sigmoid_blend (const T &x, const TLow &val_low, const THigh &val_high, const Sharpness &sharpness=1.0) |
| Smoothly blends between val_low and val_high using a sigmoid function blend = val_low + (val_high - val_low) * (1 / (1 + exp(-sharpness * x))). | |
| template<typename Derived, typename Scalar> | |
| auto | sigmoid_blend (const Eigen::MatrixBase< Derived > &x, const Scalar &val_low, const Scalar &val_high, const Scalar &sharpness=1.0) |
| Smoothly blends element-wise for a matrix using a sigmoid function. | |
| template<JanusScalar T1, JanusScalar T2> | |
| auto | logical_and (const T1 &x1, const T2 &x2) |
| Logical AND (x && y). | |
| template<typename DerivedA, typename DerivedB> | |
| auto | logical_and (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Element-wise logical AND for matrices. | |
| template<JanusScalar T1, JanusScalar T2> | |
| auto | logical_or (const T1 &x1, const T2 &x2) |
| Logical OR (x || y). | |
| template<typename DerivedA, typename DerivedB> | |
| auto | logical_or (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Element-wise logical OR for matrices. | |
| template<JanusScalar T> | |
| auto | logical_not (const T &x) |
| Logical NOT (!x). | |
| template<typename Derived> | |
| auto | logical_not (const Eigen::MatrixBase< Derived > &a) |
| Element-wise logical NOT for a matrix. | |
| template<typename Derived> | |
| auto | all (const Eigen::MatrixBase< Derived > &a) |
| Returns true if all elements are true (non-zero). | |
| template<typename Derived> | |
| auto | any (const Eigen::MatrixBase< Derived > &a) |
| Returns true if any element is true (non-zero). | |
| template<typename CondType, typename Scalar> | |
| Scalar | select (const std::vector< CondType > &conditions, const std::vector< Scalar > &values, const Scalar &default_value) |
| Multi-way conditional selection (cleaner alternative to nested where). | |
| template<typename CondType, typename Scalar> | |
| Scalar | select (std::initializer_list< CondType > conditions, std::initializer_list< Scalar > values, const Scalar &default_value) |
| std::pair< double, double > | legendre_poly (int n, double x) |
| Evaluate Legendre polynomial P_n(x) and derivative P'_n(x). | |
| std::pair< NumericVector, NumericVector > | gauss_legendre_rule (int n) |
| Gauss-Legendre nodes and weights on [-1, 1]. | |
| NumericVector | legendre_poly_vec (int n, const NumericVector &x) |
| Evaluate P_n(x) at each x in vector. | |
| NumericVector | lgl_nodes (int N) |
| Compute Legendre-Gauss-Lobatto nodes on [-1, 1]. | |
| NumericVector | cgl_nodes (int N) |
| Compute Chebyshev-Gauss-Lobatto nodes on [-1, 1]. | |
| NumericVector | lgl_weights (int N, const NumericVector &nodes) |
| LGL quadrature weights. | |
| NumericVector | cgl_weights (int N, const NumericVector &nodes) |
| CGL (Clenshaw-Curtis) quadrature weights on [-1, 1]. | |
| NumericVector | barycentric_weights (const NumericVector &nodes) |
| Compute barycentric interpolation weights for the given nodes. | |
| double | barycentric_basis_eval (const NumericVector &nodes, const NumericVector &bary_w, int j, double s) |
| Evaluate the j-th Lagrange basis polynomial at s using barycentric form. | |
| NumericMatrix | birkhoff_integration_matrix (const NumericVector &nodes) |
| Compute Birkhoff integration matrix B^a for the node set. | |
| NumericMatrix | spectral_diff_matrix (const NumericVector &nodes) |
| Spectral differentiation matrix using barycentric weights. | |
| PolynomialChaosDimension | hermite_dimension () |
| Create a standard normal (Hermite) dimension. | |
| PolynomialChaosDimension | legendre_dimension () |
| Create a uniform (Legendre) dimension on [-1, 1]. | |
| PolynomialChaosDimension | jacobi_dimension (double alpha, double beta) |
| Create a Beta-family (Jacobi) dimension on [-1, 1]. | |
| PolynomialChaosDimension | laguerre_dimension (double alpha=0.0) |
| Create a Gamma-family (Laguerre) dimension on [0, inf). | |
| template<JanusScalar Scalar> | |
| Scalar | pce_polynomial (const PolynomialChaosDimension &dimension, int degree, const Scalar &x, bool normalized=true) |
| Evaluate a univariate chaos basis polynomial. | |
| double | pce_squared_norm (const PolynomialChaosDimension &dimension, int degree, bool normalized=true) |
| Return the probability-measure squared norm of a univariate basis term. | |
| template<JanusScalar Scalar> | |
| JanusVector< Scalar > | pce_projection_coefficients (const PolynomialChaosBasis &basis, const NumericMatrix &samples, const NumericVector &weights, const JanusVector< Scalar > &sample_values) |
| Compute PCE projection coefficients from weighted samples (vector). | |
| template<JanusScalar Scalar> | |
| JanusMatrix< Scalar > | pce_projection_coefficients (const PolynomialChaosBasis &basis, const NumericMatrix &samples, const NumericVector &weights, const JanusMatrix< Scalar > &sample_values) |
| Compute PCE projection coefficients from weighted samples (matrix). | |
| template<JanusScalar Scalar> | |
| JanusVector< Scalar > | pce_regression_coefficients (const PolynomialChaosBasis &basis, const NumericMatrix &samples, const JanusVector< Scalar > &sample_values, double ridge=1e-12) |
| Compute PCE coefficients via least-squares regression (vector). | |
| template<JanusScalar Scalar> | |
| JanusMatrix< Scalar > | pce_regression_coefficients (const PolynomialChaosBasis &basis, const NumericMatrix &samples, const JanusMatrix< Scalar > &sample_values, double ridge=1e-12) |
| Compute PCE coefficients via least-squares regression (matrix). | |
| template<JanusScalar Scalar> | |
| Scalar | pce_mean (const JanusVector< Scalar > &coefficients) |
| Extract PCE mean (zeroth coefficient). | |
| template<JanusScalar Scalar> | |
| Scalar | pce_variance (const PolynomialChaosBasis &basis, const JanusVector< Scalar > &coefficients) |
| Compute PCE variance from coefficients. | |
| UnivariateQuadratureRule | stochastic_quadrature_rule (const PolynomialChaosDimension &dimension, int order, StochasticQuadratureRule rule=StochasticQuadratureRule::Gauss) |
| Build a one-dimensional stochastic quadrature rule with a fixed order. | |
| UnivariateQuadratureRule | stochastic_quadrature_level (const PolynomialChaosDimension &dimension, int level, StochasticQuadratureRule rule=StochasticQuadratureRule::AutoNested) |
| Build a one-dimensional stochastic quadrature rule from a refinement level. | |
| StochasticQuadratureGrid | tensor_product_quadrature (const std::vector< UnivariateQuadratureRule > &rules) |
| Build the tensor-product grid from a list of one-dimensional rules. | |
| StochasticQuadratureGrid | smolyak_sparse_grid (const std::vector< PolynomialChaosDimension > &dimensions, int level, SmolyakQuadratureOptions options={}) |
| Build a Smolyak sparse grid on probability measures. | |
| template<JanusScalar Scalar> | |
| JanusVector< Scalar > | pce_projection_coefficients (const PolynomialChaosBasis &basis, const UnivariateQuadratureRule &rule, const JanusVector< Scalar > &sample_values) |
| Compute PCE projection coefficients using a univariate quadrature rule (vector). | |
| template<JanusScalar Scalar> | |
| JanusMatrix< Scalar > | pce_projection_coefficients (const PolynomialChaosBasis &basis, const UnivariateQuadratureRule &rule, const JanusMatrix< Scalar > &sample_values) |
| Compute PCE projection coefficients using a univariate quadrature rule (matrix). | |
| template<JanusScalar Scalar> | |
| JanusVector< Scalar > | pce_projection_coefficients (const PolynomialChaosBasis &basis, const StochasticQuadratureGrid &grid, const JanusVector< Scalar > &sample_values) |
| Compute PCE projection coefficients using a stochastic quadrature grid (vector). | |
| template<JanusScalar Scalar> | |
| JanusMatrix< Scalar > | pce_projection_coefficients (const PolynomialChaosBasis &basis, const StochasticQuadratureGrid &grid, const JanusMatrix< Scalar > &sample_values) |
| Compute PCE projection coefficients using a stochastic quadrature grid (matrix). | |
| template<typename Scalar> | |
| Quaternion< Scalar > | slerp (const Quaternion< Scalar > &q0, const Quaternion< Scalar > &q1, Scalar t) |
| Spherical Linear Interpolation (full fidelity). | |
| template<typename Scalar> | |
| RootResult< Scalar > | rootfinder (const janus::Function &F, const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > &x0, const RootFinderOptions &opts={}) |
| Solve F(x) = 0 for x given an initial guess. | |
| janus::Function | create_implicit_function (const janus::Function &G, const Eigen::VectorXd &x_guess, const RootFinderOptions &opts={}, const ImplicitFunctionOptions &implicit_opts={}) |
| Create a differentiable implicit solve wrapper for G(...) = 0. | |
| template<typename T> | |
| Mat2< T > | rotation_matrix_2d (const T &theta) |
| Creates a 2x2 rotation matrix. | |
| template<typename T> | |
| Mat3< T > | rotation_matrix_3d (const T &theta, int axis) |
| Creates a 3x3 rotation matrix about a principal axis. | |
| template<typename T> | |
| Mat3< T > | rotation_matrix_from_euler_angles (const T &roll, const T &pitch, const T &yaw) |
| Creates a 3x3 rotation matrix from Euler angles (Yaw-Pitch-Roll sequence). | |
| template<typename Derived> | |
| auto | is_valid_rotation_matrix (const Eigen::MatrixBase< Derived > &a, double tol=1e-9) |
| Checks if matrix is a valid rotation matrix Checks determinant approx 1 and orthogonality (A^T * A approx I). | |
| template<typename T> | |
| JanusVector< T > | linspace (const T &start, const T &end, int n) |
| Generates linearly spaced vector. | |
| template<typename T> | |
| JanusVector< T > | cosine_spacing (const T &start, const T &end, int n) |
| Generates cosine spaced vector (denser at ends). | |
| template<typename T> | |
| JanusVector< T > | sinspace (const T &start, const T &end, int n, bool reverse_spacing=false) |
| Generates sine spaced vector (denser at start by default). | |
| template<typename T> | |
| JanusVector< T > | logspace (const T &start, const T &end, int n) |
| Generates logarithmically spaced vector (base 10). | |
| template<typename T> | |
| JanusVector< T > | geomspace (const T &start, const T &end, int n) |
| Generates geometrically spaced vector. | |
| template<typename T> | |
| auto | softmax (const std::vector< T > &args, double softness=1.0) |
| Computes the smooth maximum (LogSumExp) of a collection of values. | |
| template<typename T1, typename T2> | |
| auto | softmax (const T1 &a, const T2 &b, double softness=1.0) |
| template<typename T> | |
| auto | softmin (const std::vector< T > &args, double softness=1.0) |
| Computes the smooth minimum of a collection of values. softmin(x) = -softmax(-x). | |
| template<typename T1, typename T2> | |
| auto | softmin (const T1 &a, const T2 &b, double softness=1.0) |
| template<JanusScalar T> | |
| auto | softplus (const T &x, double beta=1.0, double=20.0) |
| template<typename Derived> | |
| auto | softplus (const Eigen::MatrixBase< Derived > &x, double beta=1.0, double threshold=20.0) |
| template<typename T> | |
| auto | smooth_abs (const T &x, double hardness=1.0) |
| Smooth approximation of absolute value. | |
| template<typename T1, typename T2> | |
| auto | smooth_max (const T1 &a, const T2 &b, double hardness=1.0) |
| Pairwise smooth maximum. | |
| template<typename T1, typename T2> | |
| auto | smooth_min (const T1 &a, const T2 &b, double hardness=1.0) |
| Pairwise smooth minimum. | |
| template<typename TX, typename TLow, typename THigh> | |
| auto | smooth_clamp (const TX &x, const TLow &low, const THigh &high, double hardness=1.0) |
| Smooth approximation of clamp(x, low, high). | |
| template<JanusScalar T> | |
| auto | ks_max (const std::vector< T > &values, double rho=1.0) |
| Kreisselmeier-Steinhauser smooth maximum aggregator. | |
| template<typename Derived> | |
| auto | ks_max (const Eigen::MatrixBase< Derived > &values, double rho=1.0) |
| template<typename T> | |
| auto | sigmoid (const T &x, SigmoidType type=SigmoidType::Tanh, double norm_min=0.0, double norm_max=1.0) |
| Sigmoid function with normalization capability. | |
| template<typename T> | |
| auto | swish (const T &x, double beta=1.0) |
| Swish activation function: x / (1 + exp(-beta * x)). | |
| template<typename TSwitch, typename THigh, typename TLow> | |
| auto | blend (const TSwitch &switch_val, const THigh &val_high, const TLow &val_low) |
| Smoothly blends between two values based on a switch parameter. | |
| template<JanusScalar T> | |
| T | sin (const T &x) |
| Computes sine of x. | |
| template<typename Derived> | |
| auto | sin (const Eigen::MatrixBase< Derived > &x) |
| Computes sine element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | cos (const T &x) |
| Computes cosine of x. | |
| template<typename Derived> | |
| auto | cos (const Eigen::MatrixBase< Derived > &x) |
| Computes cosine element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | tan (const T &x) |
| Computes tangent of x. | |
| template<typename Derived> | |
| auto | tan (const Eigen::MatrixBase< Derived > &x) |
| Computes tangent element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | asin (const T &x) |
| Computes arc sine of x. | |
| template<typename Derived> | |
| auto | asin (const Eigen::MatrixBase< Derived > &x) |
| Computes arc sine element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | acos (const T &x) |
| Computes arc cosine of x. | |
| template<typename Derived> | |
| auto | acos (const Eigen::MatrixBase< Derived > &x) |
| Computes arc cosine element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | atan (const T &x) |
| Computes arc tangent of x. | |
| template<typename Derived> | |
| auto | atan (const Eigen::MatrixBase< Derived > &x) |
| Computes arc tangent element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | atan2 (const T &y, const T &x) |
| Computes arc tangent of y/x using signs of both arguments. | |
| template<JanusScalar T> | |
| T | asinh (const T &x) |
| Computes inverse hyperbolic sine of x. | |
| template<typename Derived> | |
| auto | asinh (const Eigen::MatrixBase< Derived > &x) |
| Computes inverse hyperbolic sine element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | acosh (const T &x) |
| Computes inverse hyperbolic cosine of x. | |
| template<typename Derived> | |
| auto | acosh (const Eigen::MatrixBase< Derived > &x) |
| Computes inverse hyperbolic cosine element-wise for a matrix. | |
| template<JanusScalar T> | |
| T | atanh (const T &x) |
| Computes inverse hyperbolic tangent of x. | |
| template<typename Derived> | |
| auto | atanh (const Eigen::MatrixBase< Derived > &x) |
| Computes inverse hyperbolic tangent element-wise for a matrix. | |
| bool | solver_available (Solver solver) |
| Check if a solver is available in the current CasADi build. | |
| const char * | solver_name (Solver solver) |
| Get the CasADi solver name string. | |
Variables | |
| template<typename Scalar> | |
| constexpr bool | is_numeric_scalar_v = std::is_floating_point_v<Scalar> || std::is_integral_v<Scalar> |
| Compile-time check for numeric scalar types. | |
| using janus::BooleanType_t = typename BooleanType<T>::type |
| using janus::JanusMatrix = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> |
Dynamic-size matrix for both numeric and symbolic backends.
| Scalar | Element type (double or casadi::MX) |
| using janus::JanusVector = Eigen::Matrix<Scalar, Eigen::Dynamic, 1> |
Dynamic-size column vector for both numeric and symbolic backends.
| Scalar | Element type (double or casadi::MX) |
| using janus::Mat2 = Eigen::Matrix<Scalar, 2, 2> |
| using janus::Mat3 = Eigen::Matrix<Scalar, 3, 3> |
| using janus::Mat4 = Eigen::Matrix<Scalar, 4, 4> |
| using janus::NumericMatrix = JanusMatrix<NumericScalar> |
Eigen::MatrixXd equivalent.
| using janus::NumericScalar = double |
Numeric scalar type.
| using janus::NumericVector = JanusVector<NumericScalar> |
Eigen::VectorXd equivalent.
| using janus::SparseMatrix = Eigen::SparseMatrix<double> |
Sparse matrix types for efficient storage of large, sparse numeric data.
| using janus::SparseTriplet = Eigen::Triplet<double> |
(row, col, value) triplet
Eigen matrix of MX elements.
| using janus::SymbolicScalar = casadi::MX |
CasADi MX symbolic scalar.
Eigen vector of MX elements.
| using janus::Vec2 = Eigen::Matrix<Scalar, 2, 1> |
Fixed-size vectors and matrices for performance-critical code.
| Scalar | Element type (double or casadi::MX) |
| using janus::Vec3 = Eigen::Matrix<Scalar, 3, 1> |
| using janus::Vec4 = Eigen::Matrix<Scalar, 4, 1> |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
Integration/differentiation method for trajectory optimization.
|
strong |
Supported interpolation methods.
Controls the interpolation algorithm used for both 1D and N-D interpolation.
|
strong |
|
strong |
|
strong |
|
strong |
Batch mapping backend for janus::Function::map().
| Enumerator | |
|---|---|
| Parallel | CasADi OpenMP map backend (falls back to serial if unavailable). |
| Serial | CasADi serial map backend. |
| Unroll | CasADi unrolled map backend. |
|
strong |
|
strong |
|
strong |
Univariate Askey-scheme family used for a PCE input dimension.
|
strong |
|
strong |
|
strong |
Radial basis function kernel types for scattered interpolation.
|
strong |
Numeric nonlinear solver method actually used.
|
strong |
Numeric nonlinear solver strategy selection.
|
strong |
|
strong |
Severity used by Opti scaling diagnostics.
| Enumerator | |
|---|---|
| Warning | Potential scaling concern. |
| Critical | Severe scaling issue likely to cause solver failure. |
|
strong |
|
strong |
|
strong |
|
strong |
Available NLP solvers.
Solvers are provided via CasADi's nlpsol interface. IPOPT is always available. Others require separate installation.
| Enumerator | |
|---|---|
| Ipopt | Interior Point OPTimizer (default, always available). |
| Snopt | Sparse Nonlinear OPTimizer (requires license). |
| QpOases | QP solver for QP subproblems. |
|
strong |
|
strong |
|
strong |
One-dimensional rule family used to generate stochastic quadrature nodes.
|
strong |
| auto janus::abs | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes absolute value element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::abs | ( | const T & | x | ) |
Computes the absolute value of a scalar.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::acos | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes arc cosine element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::acos | ( | const T & | x | ) |
Computes arc cosine of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::acosh | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes inverse hyperbolic cosine element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::acosh | ( | const T & | x | ) |
Computes inverse hyperbolic cosine of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value (must be >= 1) |
|
inline |
Eliminate trivial affine alias rows from a selected residual block.
| fn | Function containing the residual system |
| opts | Transform options (input/output indices, alias thresholds) |
| auto janus::all | ( | const Eigen::MatrixBase< Derived > & | a | ) |
Returns true if all elements are true (non-zero).
| a | Input matrix/array |
|
inline |
Run structural observability and identifiability checks together.
| fn | Function to analyze |
| opts | Combined analysis options (at least one input index must be non-negative) |
|
inline |
Analyze which parameters are structurally identifiable from selected outputs.
| fn | Function whose Jacobian sparsity is analyzed |
| parameter_input_idx | Index of the parameter input block |
| opts | Output selection options |
|
inline |
Analyze which states are structurally observable from selected outputs.
| fn | Function whose Jacobian sparsity is analyzed |
| state_input_idx | Index of the state input block |
| opts | Output selection options |
| auto janus::any | ( | const Eigen::MatrixBase< Derived > & | a | ) |
Returns true if any element is true (non-zero).
| a | Input matrix/array |
|
inline |
Get the underlying MX representation of a SymbolicVector.
This packs an Eigen container of MX elements back into a single CasADi MX for use with janus::Function or janus::jacobian.
| v | SymbolicVector to convert |
|
inline |
Convert CasADi MX vector to SymbolicVector (Eigen container of MX).
| m | Input CasADi MX (column vector) |
| auto janus::asin | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes arc sine element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::asin | ( | const T & | x | ) |
Computes arc sine of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::asinh | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes inverse hyperbolic sine element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::asinh | ( | const T & | x | ) |
Computes inverse hyperbolic sine of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::atan | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes arc tangent element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::atan | ( | const T & | x | ) |
Computes arc tangent of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| T janus::atan2 | ( | const T & | y, |
| const T & | x ) |
Computes arc tangent of y/x using signs of both arguments.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| y | Numerator |
| x | Denominator |
| auto janus::atanh | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes inverse hyperbolic tangent element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::atanh | ( | const T & | x | ) |
Computes inverse hyperbolic tangent of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value (must be in (-1, 1)) |
| JanusVector< Scalar > janus::backward_difference | ( | const JanusVector< Scalar > & | f, |
| const JanusVector< Scalar > & | x ) |
Compute derivative using backward difference.
Returns vector of size N-1 where out[i] ≈ df/dx at point i+1
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| f | Function values (size N) |
| x | Grid points (size N) |
| std::pair< Scalar, Scalar > janus::backward_euler_weights | ( | Scalar | h | ) |
Backward Euler (implicit) differentiation weights.
For approximating df/dx at point i+1: df/dx ≈ (f[i+1] - f[i]) / h Same formula as forward, but used at i+1 instead of i
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| h | Step size |
|
inline |
Evaluate the j-th Lagrange basis polynomial at s using barycentric form.
| nodes | Interpolation nodes |
| bary_w | Barycentric weights |
| j | Basis index |
| s | Evaluation point |
|
inline |
Compute barycentric interpolation weights for the given nodes.
| nodes | Interpolation nodes |
|
inline |
Compute Birkhoff integration matrix B^a for the node set.
B^a_{ij} = integral_{nodes(0)}^{nodes(i)} ell_j(s) ds where ell_j is the j-th Lagrange basis polynomial.
| nodes | Interpolation nodes |
| auto janus::blend | ( | const TSwitch & | switch_val, |
| const THigh & | val_high, | ||
| const TLow & | val_low ) |
Smoothly blends between two values based on a switch parameter.
| switch_val | Control value. 0 -> average, -inf -> low, +inf -> high. |
| val_high | Value when switch is high |
| val_low | Value when switch is low |
|
inline |
Compute a block-triangular decomposition of a selected residual block.
| fn | Function with a square residual system |
| opts | Transform options (input/output indices) |
| auto janus::cbrt | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes cube root element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::cbrt | ( | const T & | x | ) |
Computes cube root of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::ceil | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes ceiling element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::ceil | ( | const T & | x | ) |
Computes ceiling of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| JanusVector< Scalar > janus::central_difference | ( | const JanusVector< Scalar > & | f, |
| const JanusVector< Scalar > & | x ) |
Compute derivative using central difference.
Returns vector of size N-2 where out[i] ≈ df/dx at point i+1
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| f | Function values (size N) |
| x | Grid points (size N) |
| std::pair< Scalar, Scalar > janus::central_difference_weights | ( | Scalar | h | ) |
Central difference differentiation weights.
For approximating df/dx at point i: df/dx ≈ (f[i+1] - f[i-1]) / (2h) Returns [weight_{i-1}, weight_{i+1}] = [-1/(2h), 1/(2h)]
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| h | Step size |
|
inline |
Compute Chebyshev-Gauss-Lobatto nodes on [-1, 1].
| N | Number of nodes (>= 2) |
|
inline |
CGL (Clenshaw-Curtis) quadrature weights on [-1, 1].
| N | Number of nodes |
| nodes | CGL node vector |
| auto janus::clamp | ( | const Eigen::MatrixBase< Derived > & | val, |
| const Scalar & | low, | ||
| const Scalar & | high ) |
Clamps values element-wise for a matrix/vector.
| Derived | Eigen matrix type |
| Scalar | Bounds type |
| val | Input matrix |
| low | Lower bound |
| high | Upper bound |
| auto janus::clamp | ( | const T & | val, |
| const TLow & | low, | ||
| const THigh & | high ) |
Clamps value between low and high.
| val | Input value |
| low | Lower bound |
| high | Upper bound |
| auto janus::copysign | ( | const Eigen::MatrixBase< Derived > & | x, |
| const Eigen::MatrixBase< Derived > & | y ) |
Copysign element-wise for matrices.
| Derived | Eigen matrix type |
| x | Magnitude matrix |
| y | Sign matrix |
| T janus::copysign | ( | const T & | x, |
| const T & | y ) |
Returns magnitude of x with sign of y.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Magnitude source |
| y | Sign source |
| T janus::copysign | ( | const T & | x, |
| double | y ) |
Copysign with mixed types.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Magnitude source |
| y | Sign source (double) |
| T janus::copysign | ( | double | x, |
| const T & | y ) |
Copysign with mixed types (double magnitude).
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Magnitude source (double) |
| y | Sign source |
| auto janus::cos | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes cosine element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::cos | ( | const T & | x | ) |
Computes cosine of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value (radians) |
| auto janus::cosh | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes hyperbolic cosine element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::cosh | ( | const T & | x | ) |
Computes hyperbolic cosine of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| JanusVector< T > janus::cosine_spacing | ( | const T & | start, |
| const T & | end, | ||
| int | n ) |
Generates cosine spaced vector (denser at ends).
| T | Scalar type (NumericScalar or SymbolicScalar) |
| start | Start value |
| end | End value |
| n | Number of points |
|
inline |
Create a differentiable implicit solve wrapper for G(...) = 0.
All non-implicit inputs of G become inputs of the returned function, in their original order and original shapes. CasADi's rootfinder provides the implicit sensitivities, so the returned function remains differentiable with respect to every remaining input.
| G | Implicit function containing the unknown input and residual output |
| x_guess | Fixed initial guess for the implicit solve |
| opts | Solver options |
| implicit_opts | Selects which input/output pair defines the rootfinding problem |
| auto janus::cross | ( | const Eigen::MatrixBase< DerivedA > & | a, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Computes 3D cross product.
| a | First 3-element vector |
| b | Second 3-element vector |
| InvalidArgument | if vectors are not 3 elements |
| auto janus::cumtrapz | ( | const Eigen::MatrixBase< DerivedY > & | y, |
| const Eigen::MatrixBase< DerivedX > & | x ) |
Computes the cumulative trapezoidal integral.
Returns a running integral with the same length as the inputs: out(0) = 0 and out(i) = integral from x(0) to x(i) using trapezoids.
| y | Values of function at x points |
| x | Grid points |
| auto janus::cumtrapz | ( | const Eigen::MatrixBase< DerivedY > & | y, |
| const Spacing & | dx = 1.0 ) |
Computes the cumulative trapezoidal integral with uniform spacing.
Returns a running integral with the same length as the input: out(0) = 0 and out(i) = integral over the first i intervals.
| DerivedY | Eigen vector type for Y |
| Spacing | Scalar spacing type |
| y | Values of function samples |
| dx | Uniform spacing between samples |
| auto janus::det | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Computes matrix determinant.
| A | Input matrix |
| auto janus::diff | ( | const Eigen::MatrixBase< Derived > & | v | ) |
Computes adjacent differences of a vector Returns a vector of size N-1 where out[i] = v[i+1] - v[i].
| Derived | Eigen matrix type |
| v | Input vector |
| void janus::disp | ( | const std::string & | label, |
| const Eigen::MatrixBase< Derived > & | mat ) |
| auto janus::dot | ( | const Eigen::MatrixBase< DerivedA > & | a, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Computes dot product of two vectors.
| a | First vector |
| b | Second vector |
| auto janus::eig | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Computes the eigendecomposition of a square matrix with a real spectrum.
Returns eigenvalues in ascending order and eigenvectors as columns of the returned matrix. Numeric matrices use Eigen's general eigensolver. Symbolic MX matrices are not supported in the general case because CasADi does not expose a compatible MX eigendecomposition.
| auto janus::eig_symmetric | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Computes the eigendecomposition of a symmetric matrix.
Returns eigenvalues in ascending order and orthonormal eigenvectors as columns. Numeric matrices delegate to Eigen's SelfAdjointEigenSolver. Symbolic MX matrices support only 1x1, 2x2, and 3x3 symmetric inputs.
| auto janus::eq | ( | const Eigen::MatrixBase< DerivedA > & | a, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Element-wise equality comparison.
| DerivedA | First matrix type |
| DerivedB | Second matrix type |
| a | First matrix |
| b | Second matrix |
| JanusVector< Scalar > janus::euler_step | ( | Func && | f, |
| const JanusVector< Scalar > & | x, | ||
| Scalar | t, | ||
| Scalar | dt ) |
Forward Euler integration step.
Computes x_{n+1} = x_n + dt * f(t_n, x_n)
| Scalar | Numeric or symbolic scalar type |
| Func | Callable type f(t, x) -> dx/dt |
| f | Right-hand side function |
| x | Current state vector |
| t | Current time |
| dt | Time step |
| auto janus::eval | ( | const Eigen::MatrixBase< Derived > & | mat | ) |
Evaluate a symbolic matrix to a numeric Eigen matrix.
| Derived | Eigen expression type |
| mat | Symbolic or numeric matrix (must contain no free variables) |
|
inline |
Evaluate a symbolic scalar to a double.
| val | Symbolic scalar (must be 1x1 and contain no free variables) |
| RuntimeError | if val is not 1x1 or contains free variables |
| T janus::eval | ( | const T & | val | ) |
Passthrough eval for numeric types.
| T | Arithmetic type |
| val | Numeric value |
| auto janus::exp | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes exponential function element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::exp | ( | const T & | x | ) |
Computes the exponential function e^x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::exp2 | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes 2^x element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::exp2 | ( | const T & | x | ) |
Computes 2^x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::expm1 | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes expm1 element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::expm1 | ( | const T & | x | ) |
Computes exp(x) - 1, accurate for small x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
|
inline |
Export a CasADi Function to deep graph format showing all operations.
This function expands the given Function to SX form, inlining all nested function calls, then exports the fully-expanded computational graph.
| fn | The CasADi Function to visualize |
| filename | Output filename (without extension) |
| format | Output format (DOT, HTML, or PDF) |
| name | Optional graph name |
|
inline |
Export a symbolic expression to DOT format for visualization.
Creates a DOT file representing the computational graph of the expression. Traverses the full expression tree showing all intermediate operations.
| expr | The symbolic expression to visualize |
| filename | Output filename (without extension, .dot will be added) |
| name | Optional graph name for DOT file |
|
inline |
Export a symbolic expression to an interactive HTML file.
Creates a self-contained HTML file with embedded Viz.js for rendering the computational graph. Supports pan and zoom via mouse interaction.
| expr | The symbolic expression to visualize |
| filename | Output filename (without extension, .html will be added) |
| name | Optional graph name |
|
inline |
Export an SX expression to DOT format for deep visualization.
Traverses the full SX expression tree showing all primitive operations. Unlike MX graphs, this shows the fully-expanded computational graph.
| expr | The SX expression to visualize |
| filename | Output filename (without extension, .dot will be added) |
| name | Optional graph name for DOT file |
|
inline |
Export an SX expression to an interactive HTML file for deep visualization.
Creates a self-contained HTML file with embedded Viz.js for rendering the fully-expanded computational graph.
| expr | The SX expression to visualize |
| filename | Output filename (without extension, .html will be added) |
| name | Optional graph name |
| JanusVector< Scalar > janus::finite_difference_coefficients | ( | const JanusVector< Scalar > & | x, |
| Scalar | x0 = Scalar(0.0), | ||
| int | derivative_degree = 1 ) |
Computes finite difference coefficients for arbitrary grids.
Based on Fornberg 1988: "Generation of Finite Difference Formulas on Arbitrarily Spaced Grids"
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| x | Grid points (JanusVector<Scalar>) |
| x0 | Evaluation point |
| derivative_degree | Order of derivative to approximate |
| auto janus::floor | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes floor element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::floor | ( | const T & | x | ) |
Computes floor of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::fmod | ( | const Eigen::MatrixBase< Derived > & | x, |
| const Scalar & | y ) |
Computes floating-point remainder element-wise for a matrix.
| Derived | Eigen matrix type |
| Scalar | Scalar type |
| x | Numerator matrix |
| y | Denominator scalar |
| T janus::fmod | ( | const T & | x, |
| const T & | y ) |
Computes floating-point remainder of x/y.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Numerator |
| y | Denominator |
| JanusVector< Scalar > janus::forward_difference | ( | const JanusVector< Scalar > & | f, |
| const JanusVector< Scalar > & | x ) |
Compute derivative using forward difference.
Returns vector of size N-1 where out[i] ≈ df/dx at point i
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| f | Function values (size N) |
| x | Grid points (size N) |
| std::pair< Scalar, Scalar > janus::forward_euler_weights | ( | Scalar | h | ) |
Forward Euler (explicit) differentiation weights.
For approximating df/dx at point i: df/dx ≈ (f[i+1] - f[i]) / h Returns [weight_i, weight_i+1] = [-1/h, 1/h]
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| h | Step size |
|
inline |
Gauss-Legendre nodes and weights on [-1, 1].
| n | Number of quadrature points |
| auto janus::ge | ( | const Eigen::MatrixBase< DerivedA > & | a, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Element-wise greater than or equal comparison.
| DerivedA | First matrix type |
| DerivedB | Second matrix type |
| a | First matrix |
| b | Second matrix |
| JanusVector< T > janus::geomspace | ( | const T & | start, |
| const T & | end, | ||
| int | n ) |
Generates geometrically spaced vector.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| start | Start value |
| end | End value |
| n | Number of points |
|
inline |
Get Hessian sparsity of a scalar janus::Function output.
| fn | The function |
| output_idx | Scalar output index (default 0) |
| input_idx | Input index to differentiate with respect to (default 0) |
|
inline |
Get sparsity of a janus::Function Jacobian.
| fn | The function |
| output_idx | Output index (default 0) |
| input_idx | Input index (default 0) |
|
inline |
Get input sparsity of a janus::Function.
| fn | The function |
| input_idx | Input index (default 0) |
|
inline |
Get output sparsity of a janus::Function.
| fn | The function |
| output_idx | Output index (default 0) |
| auto janus::gradient | ( | const Eigen::MatrixBase< DerivedF > & | f, |
| const Spacing & | dx = 1.0, | ||
| int | edge_order = 1, | ||
| int | n = 1 ) |
Computes gradient using second-order accurate central differences.
Returns the gradient of a 1D array using second-order accurate central differences in the interior and first or second-order accurate one-sided differences at boundaries.
| Derived | Eigen vector type |
| f | Function values (vector) |
| dx | Spacing (scalar or vector). If scalar, uniform spacing is assumed. |
| edge_order | Order of accuracy at boundaries (1 or 2) |
| n | Derivative order (1 for first derivative, 2 for second derivative) |
| auto janus::gradient_1d | ( | const Eigen::MatrixBase< DerivedY > & | y, |
| const Eigen::MatrixBase< DerivedX > & | x ) |
Computes gradient of 1D data using central differences.
Simple gradient with first-order boundaries. For more control over boundary accuracy and derivative order, use gradient() instead.
Returns vector of same size as inputs. Uses forward/backward difference at boundaries.
| y | Values |
| x | Grid points |
| auto janus::gradient_periodic | ( | const Eigen::MatrixBase< DerivedF > & | f, |
| const Spacing & | dx, | ||
| const Period & | period, | ||
| int | edge_order = 1, | ||
| int | n = 1 ) |
Computes gradient with periodic boundary conditions.
For data defined on a periodic domain, this computes the gradient assuming the final sample wraps around to the first sample. Samples should span one cycle without repeating the first point at the end; the wrap interval is inferred from period - covered_span.
| DerivedF | Eigen vector type |
| Spacing | Spacing type (scalar or vector) |
| f | Function values (vector) |
| dx | Spacing |
| period | Period of the data (e.g., 360 for degrees) |
| edge_order | Order of accuracy at boundaries (1 or 2) |
| n | Derivative order (1 or 2) |
| auto janus::gt | ( | const Eigen::MatrixBase< DerivedA > & | a, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Element-wise greater than comparison.
| DerivedA | First matrix type |
| DerivedB | Second matrix type |
| a | First matrix |
| b | Second matrix |
|
inline |
Create a standard normal (Hermite) dimension.
|
inline |
Hessian with vector of variables.
|
inline |
Hessian matrix (second-order derivatives).
Computes the matrix of second derivatives: H_ij = d²f / (dx_i dx_j)
| expr | Scalar expression |
| vars | Variables |
|
inline |
Hessian of Lagrangian with vector inputs.
|
inline |
Hessian of Lagrangian for constrained optimization.
Computes ∇²L where L = f(x) + λᵀg(x) This is the exact matrix needed for IPOPT's hessian_lagrangian callback.
| objective | Objective function f(x) (scalar) |
| constraints | Constraint functions g(x) (vector) |
| vars | Decision variables x (vector) |
| multipliers | Lagrange multipliers λ (vector, same size as constraints) |
|
inline |
Build a matrix-free Hessian-vector product function for one scalar output/input block.
The returned function takes the original function inputs followed by one extra direction input matching the selected input block shape. Its single output is ∇²y_i / ∇x_j² times that direction, reshaped like the selected input block.
|
inline |
Hessian-vector product with vector of variables.
|
inline |
Hessian-vector product for a scalar expression without forming the dense Hessian.
This uses CasADi's directional derivative of the reverse-mode gradient, i.e. forward-over-reverse AD.
| expr | Scalar expression f(x) |
| vars | Differentiation variables x |
| direction | Direction vector/matrix v with the same shape as x |
| auto janus::hypot | ( | const Eigen::MatrixBase< Derived > & | x, |
| const Eigen::MatrixBase< Derived > & | y ) |
Computes hypot element-wise for matrices.
| Derived | Eigen matrix type |
| x | First matrix |
| y | Second matrix |
| T janus::hypot | ( | const T & | x, |
| const T & | y ) |
Computes sqrt(x^2 + y^2) without undue overflow/underflow.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | First value |
| y | Second value |
| T janus::hypot | ( | const T & | x, |
| double | y ) |
Computes hypot(x, y) with mixed types.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | First value |
| y | Second value (double) |
| T janus::hypot | ( | double | x, |
| const T & | y ) |
Computes hypot(x, y) with mixed types (double first).
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | First value (double) |
| y | Second value |
| auto janus::inner | ( | const Eigen::MatrixBase< DerivedA > & | a, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Computes inner product of two vectors (dot product).
| x | First vector |
| y | Second vector |
| JanusVector< typename DerivedF::Scalar > janus::integrate_discrete_intervals | ( | const Eigen::MatrixBase< DerivedF > & | f, |
| const Eigen::MatrixBase< DerivedX > & | x, | ||
| bool | multiply_by_dx = true, | ||
| const std::string & | method = "trapezoidal", | ||
| const std::string & | method_endpoints = "lower_order" ) |
Integrates discrete samples using reconstruction methods.
| f | Function values |
| x | Grid points |
| multiply_by_dx | If true, returns interval integrals; if false, returns average values |
| method | "forward_euler", "backward_euler", "trapezoidal", "simpson", or "cubic" |
| method_endpoints | "lower_order" or "ignore" |
| JanusVector< typename DerivedF::Scalar > janus::integrate_discrete_squared_curvature | ( | const Eigen::MatrixBase< DerivedF > & | f, |
| const Eigen::MatrixBase< DerivedX > & | x, | ||
| const std::string & | method = "simpson" ) |
Computes the integral of squared curvature over each interval.
Useful for regularization of smooth curves in optimization (penalizes high curvature).
| f | Function values |
| x | Grid points |
| method | "simpson" (default) or "hybrid_simpson_cubic" |
| JanusVector< Scalar > janus::integration_defects | ( | const JanusVector< Scalar > & | x, |
| const JanusVector< Scalar > & | xdot, | ||
| const JanusVector< Scalar > & | t, | ||
| IntegrationMethod | method = IntegrationMethod::Trapezoidal ) |
Compute integration defects for derivative constraints.
Returns the "defects" that should be zero if the derivative relationship holds: defect[i] = (x[i+1] - x[i]) - integral(xdot) over [t[i], t[i+1]]
These defects are used as equality constraints in trajectory optimization.
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| x | Variable values (size N) |
| xdot | Derivative values (size N) |
| t | Time grid (size N) |
| method | Integration method |
| JanusVector< Scalar > janus::interpn | ( | const std::vector< NumericVector > & | points, |
| const NumericVector & | values_flat, | ||
| const JanusMatrix< Scalar > & | xi, | ||
| InterpolationMethod | method = InterpolationMethod::Linear, | ||
| std::optional< Scalar > | fill_value = std::nullopt ) |
N-dimensional interpolation on regular grids (backwards compatibility).
This function creates a new Interpolator for each call. For repeated queries, construct an Interpolator once and reuse it.
| Scalar | Scalar type (double or casadi::MX) |
| points | Vector of 1D coordinate arrays for each dimension |
| values_flat | Flattened values in Fortran order (column-major) |
| xi | Query points, shape (n_points, n_dimensions) |
| method | Interpolation method |
| fill_value | Optional value for out-of-bounds queries (extrapolates if nullopt) |
| SymbolicVector janus::interpn | ( | const std::vector< NumericVector > & | points, |
| const SymbolicVector & | values_flat, | ||
| const JanusMatrix< Scalar > & | xi, | ||
| InterpolationMethod | method = InterpolationMethod::Linear, | ||
| std::optional< SymbolicScalar > | fill_value = std::nullopt ) |
N-dimensional interpolation with symbolic table values.
This overload keeps the table coefficients symbolic so they can participate in optimization and automatic differentiation. It currently supports Linear and BSpline methods.
| Scalar | Query scalar type (double or casadi::MX) |
| points | Vector of 1D coordinate arrays for each dimension |
| values_flat | Flattened symbolic table values in Fortran order |
| xi | Query points, shape (n_points, n_dimensions) |
| method | Interpolation method |
| fill_value | Optional value for out-of-bounds queries |
| auto janus::inv | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Computes matrix inverse.
| A | Input matrix |
| std::tuple< T, T, T, T, T, T > janus::inv_symmetric_3x3_explicit | ( | const T & | m11, |
| const T & | m22, | ||
| const T & | m33, | ||
| const T & | m12, | ||
| const T & | m23, | ||
| const T & | m13 ) |
Explicit inverse of a symmetric 3x3 matrix.
Input matrix: [m11, m12, m13] [m12, m22, m23] [m13, m23, m33]
Returns the six unique inverse coefficients in Eigen-compatible packed column-major order for the lower triangle: (0,0), (1,0), (2,0), (1,1), (2,1), (2,2), i.e. {a11, a12, a13, a22, a23, a33} for
[a11, a12, a13] [a12, a22, a23] [a13, a23, a33]
| auto janus::is_valid_rotation_matrix | ( | const Eigen::MatrixBase< Derived > & | a, |
| double | tol = 1e-9 ) |
Checks if matrix is a valid rotation matrix Checks determinant approx 1 and orthogonality (A^T * A approx I).
| a | Input matrix |
| tol | Tolerance |
|
inline |
Create a Beta-family (Jacobi) dimension on [-1, 1].
| alpha | Jacobi alpha parameter (> -1) |
| beta | Jacobi beta parameter (> -1) |
| auto janus::jacobian | ( | const Expr & | expression, |
| const Vars &... | variables ) |
Computes Jacobian of an expression with respect to variables.
Wraps CasADi's jacobian function. Automatic Jacobian only supported for Symbolic types currently.
| Expr | Expression type (must be convertible to MX) |
| Vars | Variable types (must be convertible to MX) |
| expression | Expression to differentiate |
| variables | Variables to differentiate with respect to |
|
inline |
Computes Jacobian with vector arguments (expressions and variables).
| expressions | Vector of symbolic expressions |
| variables | Vector of symbolic variables |
| auto janus::ks_max | ( | const Eigen::MatrixBase< Derived > & | values, |
| double | rho = 1.0 ) |
| auto janus::ks_max | ( | const std::vector< T > & | values, |
| double | rho = 1.0 ) |
Kreisselmeier-Steinhauser smooth maximum aggregator.
Commonly used to aggregate many constraints into one smooth surrogate: ks_max(values, rho) = (1/rho) * log(sum(exp(rho * values_i)))
| values | Values to aggregate |
| rho | Aggregation sharpness. Higher values approach max(values). |
|
inline |
Build a Lagrangian Hessian-vector product function for optimization workflows.
The returned function takes the original function inputs, then the constraint multipliers λ for the selected constraint output block, and finally the direction v for the selected input block. The output is ∇²L(x, λ) v, reshaped like the selected input block.
|
inline |
Lagrangian Hessian-vector product with vector of variables.
|
inline |
Hessian-vector product of a Lagrangian, i.e. a second-order adjoint action.
Computes ∇²L(x, λ) v for L(x, λ) = f(x) + λᵀ g(x) without forming the dense Hessian.
| objective | Objective function f(x) (scalar) |
| constraints | Constraint function g(x) |
| vars | Decision variables x |
| multipliers | Lagrange multipliers λ (same number of entries as g) |
| direction | Direction vector/matrix v with the same shape as x |
|
inline |
Create a Gamma-family (Laguerre) dimension on [0, inf).
| alpha | Laguerre alpha parameter (> -1) |
| auto janus::le | ( | const Eigen::MatrixBase< DerivedA > & | a, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Element-wise less than or equal comparison.
| DerivedA | First matrix type |
| DerivedB | Second matrix type |
| a | First matrix |
| b | Second matrix |
|
inline |
Create a uniform (Legendre) dimension on [-1, 1].
|
inline |
Evaluate Legendre polynomial P_n(x) and derivative P'_n(x).
| n | Polynomial degree |
| x | Evaluation point |
|
inline |
Evaluate P_n(x) at each x in vector.
| n | Polynomial degree |
| x | Evaluation points |
|
inline |
Compute Legendre-Gauss-Lobatto nodes on [-1, 1].
| N | Number of nodes (>= 2) |
|
inline |
LGL quadrature weights.
| N | Number of nodes |
| nodes | LGL node vector |
| JanusVector< T > janus::linspace | ( | const T & | start, |
| const T & | end, | ||
| int | n ) |
Generates linearly spaced vector.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| start | Start value |
| end | End value |
| n | Number of points |
| auto janus::log | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes natural logarithm element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::log | ( | const T & | x | ) |
Computes the natural logarithm of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::log10 | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes base-10 logarithm element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::log10 | ( | const T & | x | ) |
Computes the base-10 logarithm of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::log1p | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes log1p element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::log1p | ( | const T & | x | ) |
Computes log(1 + x), accurate for small x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::log2 | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes base-2 logarithm element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::log2 | ( | const T & | x | ) |
Computes base-2 logarithm of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::logical_and | ( | const Eigen::MatrixBase< DerivedA > & | a, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Element-wise logical AND for matrices.
| DerivedA | First matrix type |
| DerivedB | Second matrix type |
| a | First matrix |
| b | Second matrix |
| auto janus::logical_and | ( | const T1 & | x1, |
| const T2 & | x2 ) |
Logical AND (x && y).
| x1 | First operand |
| x2 | Second operand |
| auto janus::logical_not | ( | const Eigen::MatrixBase< Derived > & | a | ) |
Element-wise logical NOT for a matrix.
| Derived | Eigen matrix type |
| a | Input matrix |
| auto janus::logical_not | ( | const T & | x | ) |
Logical NOT (!x).
| x | Operand |
| auto janus::logical_or | ( | const Eigen::MatrixBase< DerivedA > & | a, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Element-wise logical OR for matrices.
| DerivedA | First matrix type |
| DerivedB | Second matrix type |
| a | First matrix |
| b | Second matrix |
| auto janus::logical_or | ( | const T1 & | x1, |
| const T2 & | x2 ) |
Logical OR (x || y).
| x1 | First operand |
| x2 | Second operand |
| JanusVector< T > janus::logspace | ( | const T & | start, |
| const T & | end, | ||
| int | n ) |
Generates logarithmically spaced vector (base 10).
| T | Scalar type (NumericScalar or SymbolicScalar) |
| start | Start exponent (10^start) |
| end | End exponent (10^end) |
| n | Number of points |
| auto janus::lt | ( | const Eigen::MatrixBase< DerivedA > & | a, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Element-wise less than comparison.
| DerivedA | First matrix type |
| DerivedB | Second matrix type |
| a | First matrix |
| b | Second matrix |
| Function janus::make_function | ( | const std::string & | name, |
| const std::vector< std::string > & | input_names, | ||
| Func && | fn ) |
Create a Function from a lambda with named inputs.
| NInputs | Number of inputs (must match input_names.size()) |
| Func | Lambda type |
| name | Function name |
| input_names | Names for input variables |
| fn | Lambda taking NInputs symbolic scalars |
| Function janus::make_function | ( | const std::string & | name, |
| Func && | fn ) |
Create a Function from a lambda expression.
Automatically creates symbolic input variables and constructs a Function from the lambda's return value(s).
| NInputs | Number of scalar inputs |
| NOutputs | Number of scalar outputs (for validation) |
| Func | Lambda type |
| name | Function name |
| fn | Lambda taking NInputs symbolic scalars |
| auto janus::max | ( | const Eigen::MatrixBase< Derived > & | a, |
| const Eigen::MatrixBase< Derived > & | b ) |
Computes maximum element-wise for a matrix/vector.
| Derived | Eigen matrix type |
| a | First matrix |
| b | Second matrix |
| auto janus::max | ( | const T1 & | a, |
| const T2 & | b ) |
Computes maximum of two values.
| a | First value |
| b | Second value |
| auto janus::min | ( | const Eigen::MatrixBase< Derived > & | a, |
| const Eigen::MatrixBase< Derived > & | b ) |
Computes minimum element-wise for a matrix/vector.
| Derived | Eigen matrix type |
| a | First matrix |
| b | Second matrix |
| auto janus::min | ( | const T1 & | a, |
| const T2 & | b ) |
Computes minimum of two values.
| a | First value |
| b | Second value |
|
inline |
Detect Jacobian sparsity of a janus::Function using NaN propagation.
Convenience overload that uses the Function's internal structure.
| fn | Function to analyze (must have single vector input/output) |
| opts | Options for NaN propagation |
| SparsityPattern janus::nan_propagation_sparsity | ( | Func && | fn, |
| int | n_inputs, | ||
| int | n_outputs, | ||
| const NaNSparsityOptions & | opts = {} ) |
Detect Jacobian sparsity using NaN propagation.
This provides black-box sparsity detection for functions where symbolic sparsity analysis is not available. The algorithm:
| Func | Function type: (const NumericVector&) -> NumericVector |
| fn | Function to analyze |
| n_inputs | Number of scalar inputs |
| n_outputs | Number of scalar outputs |
| opts | Options (reference point, etc.) |
| auto janus::neq | ( | const Eigen::MatrixBase< DerivedA > & | a, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Element-wise inequality comparison.
| DerivedA | First matrix type |
| DerivedB | Second matrix type |
| a | First matrix |
| b | Second matrix |
| auto janus::norm | ( | const Eigen::MatrixBase< Derived > & | x, |
| NormType | type = NormType::L2 ) |
Computes vector/matrix norm.
| x | Input vector/matrix |
| type | Norm type (L1, L2, Inf, Frobenius) |
| auto janus::outer | ( | const Eigen::MatrixBase< DerivedX > & | x, |
| const Eigen::MatrixBase< DerivedY > & | y ) |
Computes outer product x * y^T.
| x | First vector |
| y | Second vector |
|
inline |
Parse integration method from string.
Accepted names (case-sensitive):
| method | Method name string |
| InvalidArgument | if the method name is not recognized |
| Scalar janus::pce_mean | ( | const JanusVector< Scalar > & | coefficients | ) |
Extract PCE mean (zeroth coefficient).
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| coefficients | PCE coefficient vector |
| Scalar janus::pce_polynomial | ( | const PolynomialChaosDimension & | dimension, |
| int | degree, | ||
| const Scalar & | x, | ||
| bool | normalized = true ) |
Evaluate a univariate chaos basis polynomial.
The input x is assumed to already be expressed on the natural support of the chosen family:
| JanusMatrix< Scalar > janus::pce_projection_coefficients | ( | const PolynomialChaosBasis & | basis, |
| const NumericMatrix & | samples, | ||
| const NumericVector & | weights, | ||
| const JanusMatrix< Scalar > & | sample_values ) |
Compute PCE projection coefficients from weighted samples (matrix).
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| basis | Polynomial chaos basis |
| samples | Sample matrix (rows = samples, cols = dimensions) |
| weights | Quadrature weights |
| sample_values | Function values at sample points (matrix) |
| JanusVector< Scalar > janus::pce_projection_coefficients | ( | const PolynomialChaosBasis & | basis, |
| const NumericMatrix & | samples, | ||
| const NumericVector & | weights, | ||
| const JanusVector< Scalar > & | sample_values ) |
Compute PCE projection coefficients from weighted samples (vector).
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| basis | Polynomial chaos basis |
| samples | Sample matrix (rows = samples, cols = dimensions) |
| weights | Quadrature weights |
| sample_values | Function values at sample points |
| JanusMatrix< Scalar > janus::pce_projection_coefficients | ( | const PolynomialChaosBasis & | basis, |
| const StochasticQuadratureGrid & | grid, | ||
| const JanusMatrix< Scalar > & | sample_values ) |
Compute PCE projection coefficients using a stochastic quadrature grid (matrix).
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| basis | Polynomial chaos basis |
| grid | Stochastic quadrature grid |
| sample_values | Function values at grid points (matrix) |
| JanusVector< Scalar > janus::pce_projection_coefficients | ( | const PolynomialChaosBasis & | basis, |
| const StochasticQuadratureGrid & | grid, | ||
| const JanusVector< Scalar > & | sample_values ) |
Compute PCE projection coefficients using a stochastic quadrature grid (vector).
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| basis | Polynomial chaos basis |
| grid | Stochastic quadrature grid |
| sample_values | Function values at grid points |
| JanusMatrix< Scalar > janus::pce_projection_coefficients | ( | const PolynomialChaosBasis & | basis, |
| const UnivariateQuadratureRule & | rule, | ||
| const JanusMatrix< Scalar > & | sample_values ) |
Compute PCE projection coefficients using a univariate quadrature rule (matrix).
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| basis | Polynomial chaos basis |
| rule | Univariate quadrature rule |
| sample_values | Function values at quadrature nodes (matrix) |
| JanusVector< Scalar > janus::pce_projection_coefficients | ( | const PolynomialChaosBasis & | basis, |
| const UnivariateQuadratureRule & | rule, | ||
| const JanusVector< Scalar > & | sample_values ) |
Compute PCE projection coefficients using a univariate quadrature rule (vector).
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| basis | Polynomial chaos basis |
| rule | Univariate quadrature rule |
| sample_values | Function values at quadrature nodes |
| JanusMatrix< Scalar > janus::pce_regression_coefficients | ( | const PolynomialChaosBasis & | basis, |
| const NumericMatrix & | samples, | ||
| const JanusMatrix< Scalar > & | sample_values, | ||
| double | ridge = 1e-12 ) |
Compute PCE coefficients via least-squares regression (matrix).
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| basis | Polynomial chaos basis |
| samples | Sample matrix |
| sample_values | Function values at sample points (matrix) |
| ridge | Ridge regularization parameter |
| JanusVector< Scalar > janus::pce_regression_coefficients | ( | const PolynomialChaosBasis & | basis, |
| const NumericMatrix & | samples, | ||
| const JanusVector< Scalar > & | sample_values, | ||
| double | ridge = 1e-12 ) |
Compute PCE coefficients via least-squares regression (vector).
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| basis | Polynomial chaos basis |
| samples | Sample matrix |
| sample_values | Function values at sample points |
| ridge | Ridge regularization parameter |
|
inline |
Return the probability-measure squared norm of a univariate basis term.
| Scalar janus::pce_variance | ( | const PolynomialChaosBasis & | basis, |
| const JanusVector< Scalar > & | coefficients ) |
Compute PCE variance from coefficients.
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| basis | Polynomial chaos basis |
| coefficients | PCE coefficient vector |
| auto janus::pinv | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Computes Moore-Penrose pseudo-inverse.
| A | Input matrix |
| auto janus::pow | ( | const Eigen::MatrixBase< Derived > & | base, |
| const Scalar & | exponent ) |
Computes power function element-wise for a matrix.
| Derived | Eigen matrix type |
| Scalar | Exponent type |
| base | Base matrix |
| exponent | Exponent |
| T janus::pow | ( | const T & | base, |
| const T & | exponent ) |
Computes the power function: base^exponent.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| base | Base value |
| exponent | Exponent value |
| T janus::pow | ( | const T & | base, |
| double | exponent ) |
Computes power function base^exponent for scalars (mixed types).
| T | Non-double Janus scalar (e.g., SymbolicScalar) |
| base | Base value |
| exponent | Exponent value |
| T janus::pow | ( | double | base, |
| const T & | exponent ) |
Computes power function base^exponent for scalars (mixed types: double base).
| T | Non-double Janus scalar (e.g., SymbolicScalar) |
| base | Base value |
| exponent | Exponent value |
| void janus::print | ( | const std::string & | label, |
| const Eigen::MatrixBase< Derived > & | mat ) |
Print a matrix to stdout with a label.
| Derived | Eigen expression type |
| label | Descriptive label printed before the matrix |
| mat | Matrix to display |
|
inline |
Compute definite integral of a symbolic expression using CasADi CVODES.
| expr | Symbolic expression to integrate |
| variable | Variable of integration (MX symbol) |
| a | Lower bound (numeric) |
| b | Upper bound (numeric) |
| abstol | Absolute tolerance |
| reltol | Relative tolerance |
| QuadResult< T > janus::quad | ( | Func && | func, |
| T | a, | ||
| T | b, | ||
| double | abstol = 1e-8, | ||
| double | reltol = 1e-6 ) |
Compute definite integral using adaptive quadrature (numeric) or CVODES (symbolic).
Numeric backend uses Gauss-Kronrod adaptive quadrature. Symbolic backend wraps CasADi's CVODES integrator.
| func | Function to integrate (callable taking Scalar, returning Scalar) |
| a | Lower bound |
| b | Upper bound |
| abstol | Absolute tolerance (default 1e-8) |
| reltol | Relative tolerance (default 1e-6) |
|
inline |
Export a janus::Function to DOT format for visualization.
| func | The function to visualize (uses underlying CasADi function) |
| filename | Output filename (without extension) |
Render a DOT file to an image using Graphviz
Requires Graphviz to be installed and dot command available in PATH.
| dot_file | Path to the DOT file (with .dot extension) |
| output_file | Path for output image (extension determines format: .pdf, .png, .svg) |
| JanusVector< Scalar > janus::rk2_step | ( | Func && | f, |
| const JanusVector< Scalar > & | x, | ||
| Scalar | t, | ||
| Scalar | dt ) |
Heun's method (RK2) integration step.
Computes x_{n+1} using the average of Euler and corrector slopes: k1 = f(t, x) k2 = f(t + dt, x + dt * k1) x_{n+1} = x + dt/2 * (k1 + k2)
| Scalar | Numeric or symbolic scalar type |
| Func | Callable type f(t, x) -> dx/dt |
| f | Right-hand side function |
| x | Current state vector |
| t | Current time |
| dt | Time step |
| RK45Result< Scalar > janus::rk45_step | ( | Func && | f, |
| const JanusVector< Scalar > & | x, | ||
| Scalar | t, | ||
| Scalar | dt ) |
Dormand-Prince RK45 integration step with embedded error estimate.
Computes both 4th and 5th order solutions using the Dormand-Prince coefficients. The difference provides a local error estimate for adaptive step size control.
| Scalar | Numeric or symbolic scalar type |
| Func | Callable type f(t, x) -> dx/dt |
| f | Right-hand side function |
| x | Current state vector |
| t | Current time |
| dt | Time step |
| JanusVector< Scalar > janus::rk4_step | ( | Func && | f, |
| const JanusVector< Scalar > & | x, | ||
| Scalar | t, | ||
| Scalar | dt ) |
Classic 4th-order Runge-Kutta integration step.
The workhorse of explicit integration. Computes: k1 = f(t, x) k2 = f(t + dt/2, x + dt/2 * k1) k3 = f(t + dt/2, x + dt/2 * k2) k4 = f(t + dt, x + dt * k3) x_{n+1} = x + dt/6 * (k1 + 2*k2 + 2*k3 + k4)
| Scalar | Numeric or symbolic scalar type |
| Func | Callable type f(t, x) -> dx/dt |
| f | Right-hand side function |
| x | Current state vector |
| t | Current time |
| dt | Time step |
| SecondOrderStepResult< Scalar > janus::rkn4_step | ( | AccelFunc && | acceleration, |
| const JanusVector< Scalar > & | q, | ||
| const JanusVector< Scalar > & | v, | ||
| Scalar | t, | ||
| Scalar | dt ) |
Classical 4th-order Runge-Kutta-Nystrom step for q'' = a(t, q).
This method targets second-order systems directly, avoiding the need to rewrite them as first-order state-space systems before stepping them.
| Scalar | Numeric or symbolic scalar type |
| AccelFunc | Callable type a(t, q) -> qdd |
| acceleration | Acceleration function |
| q | Current generalized coordinates |
| v | Current generalized velocities |
| t | Current time |
| dt | Time step |
| RootResult< Scalar > janus::rootfinder | ( | const janus::Function & | F, |
| const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > & | x0, | ||
| const RootFinderOptions & | opts = {} ) |
Solve F(x) = 0 for x given an initial guess.
Numeric mode uses Janus' globalization stack. Symbolic mode embeds CasADi's differentiable rootfinder.
| Scalar | double (numeric) or SymbolicScalar (symbolic) |
| Mat2< T > janus::rotation_matrix_2d | ( | const T & | theta | ) |
Creates a 2x2 rotation matrix.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| theta | Rotation angle (radians) |
| Mat3< T > janus::rotation_matrix_3d | ( | const T & | theta, |
| int | axis ) |
Creates a 3x3 rotation matrix about a principal axis.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| theta | Rotation angle (radians) |
| axis | Axis index (0=X, 1=Y, 2=Z) |
| Mat3< T > janus::rotation_matrix_from_euler_angles | ( | const T & | roll, |
| const T & | pitch, | ||
| const T & | yaw ) |
Creates a 3x3 rotation matrix from Euler angles (Yaw-Pitch-Roll sequence).
| T | Scalar type (NumericScalar or SymbolicScalar) |
| roll | Roll angle (X-axis, radians) |
| pitch | Pitch angle (Y-axis, radians) |
| yaw | Yaw angle (Z-axis, radians) |
| auto janus::round | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Rounds element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::round | ( | const T & | x | ) |
Rounds x to the nearest integer.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| Scalar janus::select | ( | const std::vector< CondType > & | conditions, |
| const std::vector< Scalar > & | values, | ||
| const Scalar & | default_value ) |
Multi-way conditional selection (cleaner alternative to nested where).
Evaluates conditions in order and returns the first matching value. Similar to NumPy's select() or a switch statement.
Example: select({x < 0, x < 10, x < 100}, {-1, 0, 1}, 2) // Returns: -1 if x<0, 0 if 0<=x<10, 1 if 10<=x<100, else 2
| CondType | Condition type (result of comparison, e.g., bool or Scalar) |
| Scalar | Scalar type for values (numeric or symbolic) |
| conditions | Vector of conditions to check (in order) |
| values | Vector of values to return (same size as conditions) |
| default_value | Value to return if no condition matches |
| Scalar janus::select | ( | std::initializer_list< CondType > | conditions, |
| std::initializer_list< Scalar > | values, | ||
| const Scalar & | default_value ) |
|
inline |
Recommend a sensitivity regime for a selected janus::Function block.
|
inline |
Recommend a sensitivity regime from parameter/output counts.
|
inline |
Build a Jacobian function for one output/input block using the recommended regime.
The returned Jacobian is always dense and uses column-major vectorization of the selected output and input blocks, matching CasADi/Eigen storage order.
| auto janus::sigmoid | ( | const T & | x, |
| SigmoidType | type = SigmoidType::Tanh, | ||
| double | norm_min = 0.0, | ||
| double | norm_max = 1.0 ) |
Sigmoid function with normalization capability.
| x | Input value |
| type | Type of sigmoid shape (Tanh, Arctan, Polynomial) |
| norm_min | Minimum output value (asymptote at -inf) |
| norm_max | Maximum output value (asymptote at +inf) |
| auto janus::sigmoid_blend | ( | const Eigen::MatrixBase< Derived > & | x, |
| const Scalar & | val_low, | ||
| const Scalar & | val_high, | ||
| const Scalar & | sharpness = 1.0 ) |
Smoothly blends element-wise for a matrix using a sigmoid function.
| Derived | Eigen matrix type |
| Scalar | Scalar type |
| x | Control variable matrix |
| val_low | Low value |
| val_high | High value |
| sharpness | Steepness |
| auto janus::sigmoid_blend | ( | const T & | x, |
| const TLow & | val_low, | ||
| const THigh & | val_high, | ||
| const Sharpness & | sharpness = 1.0 ) |
Smoothly blends between val_low and val_high using a sigmoid function blend = val_low + (val_high - val_low) * (1 / (1 + exp(-sharpness * x))).
| x | Control variable (0 centers the sigmoid) |
| val_low | Value when x is negative large |
| val_high | Value when x is positive large |
| sharpness | Steepness of the transition |
| auto janus::sign | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes sign element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::sign | ( | const T & | x | ) |
Computes sign of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::sin | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes sine element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::sin | ( | const T & | x | ) |
Computes sine of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value (radians) |
| auto janus::sinh | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes hyperbolic sine element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::sinh | ( | const T & | x | ) |
Computes hyperbolic sine.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| JanusVector< T > janus::sinspace | ( | const T & | start, |
| const T & | end, | ||
| int | n, | ||
| bool | reverse_spacing = false ) |
Generates sine spaced vector (denser at start by default).
| T | Scalar type (NumericScalar or SymbolicScalar) |
| start | Start value |
| end | End value |
| n | Number of points |
| reverse_spacing | If true, bunches points at the end instead of start |
| Quaternion< Scalar > janus::slerp | ( | const Quaternion< Scalar > & | q0, |
| const Quaternion< Scalar > & | q1, | ||
| Scalar | t ) |
Spherical Linear Interpolation (full fidelity).
Shortest-path aware with nlerp fallback for near-identity angles.
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| q0 | Start quaternion |
| q1 | End quaternion |
| t | Interpolation parameter in [0, 1] |
|
inline |
Build a Smolyak sparse grid on probability measures.
The level follows the standard convention with one-dimensional indices i_j >= 1 and total-index band level <= |i| <= level + d - 1.
| dimensions | Stochastic dimension descriptors |
| level | Sparse grid level (>= 1) |
| options | Smolyak construction options |
| auto janus::smooth_abs | ( | const T & | x, |
| double | hardness = 1.0 ) |
Smooth approximation of absolute value.
Implemented as smooth_max(x, -x), which is C-infinity and approaches |x| as hardness -> infinity.
| x | Input value |
| hardness | Sharpness parameter. Higher values approach abs(x). |
| auto janus::smooth_clamp | ( | const TX & | x, |
| const TLow & | low, | ||
| const THigh & | high, | ||
| double | hardness = 1.0 ) |
Smooth approximation of clamp(x, low, high).
Implemented by composing smooth_max and smooth_min.
| x | Input value |
| low | Lower bound |
| high | Upper bound |
| hardness | Sharpness parameter. Higher values approach hard clamping. |
| auto janus::smooth_max | ( | const T1 & | a, |
| const T2 & | b, | ||
| double | hardness = 1.0 ) |
Pairwise smooth maximum.
Uses the identity max(a, b) = b + relu(a - b), replacing relu with softplus. This remains C-infinity and approaches max(a, b) as hardness -> infinity.
| a | First value |
| b | Second value |
| hardness | Sharpness parameter. Higher values approach max(a, b). |
| auto janus::smooth_min | ( | const T1 & | a, |
| const T2 & | b, | ||
| double | hardness = 1.0 ) |
Pairwise smooth minimum.
Uses the identity min(a, b) = a - relu(a - b), replacing relu with softplus. This remains C-infinity and approaches min(a, b) as hardness -> infinity.
| a | First value |
| b | Second value |
| hardness | Sharpness parameter. Higher values approach min(a, b). |
| auto janus::softmax | ( | const std::vector< T > & | args, |
| double | softness = 1.0 ) |
Computes the smooth maximum (LogSumExp) of a collection of values.
Approximation of max(x1, x2, ...) that is differentiable. out = softness * log(sum(exp(x_i / softness)))
Implemented with shift for numerical stability: out = max_val + softness * log(sum(exp((x_i - max_val) / softness)))
| args | Vector of values (scalars or matrices) |
| softness | Smoothing parameter (default 1.0). Higher = smoother (further from max). |
| auto janus::softmax | ( | const T1 & | a, |
| const T2 & | b, | ||
| double | softness = 1.0 ) |
| auto janus::softmin | ( | const std::vector< T > & | args, |
| double | softness = 1.0 ) |
Computes the smooth minimum of a collection of values. softmin(x) = -softmax(-x).
| args | Vector of values |
| softness | Smoothing parameter |
| auto janus::softmin | ( | const T1 & | a, |
| const T2 & | b, | ||
| double | softness = 1.0 ) |
| auto janus::softplus | ( | const Eigen::MatrixBase< Derived > & | x, |
| double | beta = 1.0, | ||
| double | threshold = 20.0 ) |
| auto janus::softplus | ( | const T & | x, |
| double | beta = 1.0, | ||
| double | = 20.0 ) |
| auto janus::solve | ( | const Eigen::MatrixBase< DerivedA > & | A, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Solves linear system Ax = b using the default backend policy.
Numeric dense matrices default to column-pivoted Householder QR. Symbolic MX matrices keep CasADi's default linear solver selection.
| A | Coefficient matrix |
| b | Right-hand side vector |
| auto janus::solve | ( | const Eigen::MatrixBase< DerivedA > & | A, |
| const Eigen::MatrixBase< DerivedB > & | b, | ||
| const LinearSolvePolicy & | policy ) |
Solves linear system Ax = b using an explicit backend policy.
| auto janus::solve | ( | const SparseMatrix & | A, |
| const Eigen::MatrixBase< DerivedB > & | b ) |
Solve a numeric sparse linear system with a sparse-aware default backend.
Sparse input defaults to SparseLU, since there was no previous sparse overload to preserve.
| auto janus::solve | ( | const SparseMatrix & | A, |
| const Eigen::MatrixBase< DerivedB > & | b, | ||
| const LinearSolvePolicy & | policy ) |
Solve a numeric sparse linear system using an explicit backend policy.
| OdeResult< double > janus::solve_ivp | ( | Func && | fun, |
| std::pair< double, double > | t_span, | ||
| const NumericVector & | y0, | ||
| int | n_eval = 100, | ||
| double | abstol = 1e-8, | ||
| double | reltol = 1e-6 ) |
Solve initial value problem: dy/dt = f(t, y), y(t0) = y0.
Numeric backend uses fixed-step RK4 integrator. Symbolic backend uses CasADi CVODES for automatic differentiation through the ODE.
| Func | Callable type f(t, y) -> dy/dt |
| fun | Right-hand side function f(t, y) returning derivative |
| t_span | Integration interval (t0, tf) |
| y0 | Initial state vector (NumericVector or initializer list) |
| n_eval | Number of output points (default 100) |
| abstol | Absolute tolerance |
| reltol | Relative tolerance |
| OdeResult< double > janus::solve_ivp | ( | Func && | fun, |
| std::pair< double, double > | t_span, | ||
| std::initializer_list< double > | y0_init, | ||
| int | n_eval = 100, | ||
| double | abstol = 1e-8, | ||
| double | reltol = 1e-6 ) |
Convenience overload: solve_ivp with initializer list for y0.
|
inline |
Solve IVP with a symbolic expression directly (expression-based API).
This is the most flexible symbolic API, allowing the user to provide the ODE as a CasADi expression with explicit variable specification.
| ode_expr | Symbolic ODE expression (dy/dt) |
| t_var | Time variable (MX symbol) |
| y_var | State variable(s) (MX symbol vector) |
| t_span | Integration interval |
| y0 | Initial state |
| n_eval | Number of output points |
| abstol | Absolute tolerance |
| reltol | Relative tolerance |
| OdeResult< double > janus::solve_ivp_mass_matrix | ( | RhsFunc && | rhs, |
| MassFunc && | mass_matrix, | ||
| std::pair< double, double > | t_span, | ||
| const NumericVector & | y0, | ||
| int | n_eval = 100, | ||
| const MassMatrixIvpOptions & | opts = {} ) |
Solve M(t, y) y' = f(t, y) with a native numeric stiff integrator.
RosenbrockEuler is a one-stage linearly implicit method that handles stiff ODEs well when the mass matrix is nonsingular. Bdf1 works on the residual equation directly and also supports singular mass matrices that encode simple index-1 constrained systems.
| RhsFunc | Callable type f(t, y) -> rhs |
| MassFunc | Callable type M(t, y) -> mass matrix |
| rhs | Right-hand side function |
| mass_matrix | Mass matrix function |
| t_span | Integration interval |
| y0 | Initial state |
| n_eval | Number of output points |
| opts | Integration options |
| OdeResult< double > janus::solve_ivp_mass_matrix | ( | RhsFunc && | rhs, |
| MassFunc && | mass_matrix, | ||
| std::pair< double, double > | t_span, | ||
| std::initializer_list< double > | y0_init, | ||
| int | n_eval = 100, | ||
| const MassMatrixIvpOptions & | opts = {} ) |
Convenience overload for mass-matrix IVPs using initializer lists.
|
inline |
Solve a symbolic mass-matrix IVP using CasADi IDAS.
The original real-time system M(t, y) y' = f(t, y) is converted into the semi-explicit DAE
x' = z 0 = M(t, x) z - f(t, x)
after the same time normalization already used by solve_ivp_expr.
| rhs_expr | Symbolic right-hand side f(t, y) |
| mass_expr | Symbolic mass matrix M(t, y) |
| t_var | Time variable symbol |
| y_var | State variable symbol(s) |
| t_span | Integration interval |
| y0 | Initial state |
| n_eval | Number of output points |
| opts | Integration options |
| OdeResult< SymbolicScalar > janus::solve_ivp_symbolic | ( | Func && | fun, |
| std::pair< double, double > | t_span, | ||
| const Eigen::VectorXd & | y0, | ||
| int | n_eval = 100, | ||
| double | abstol = 1e-8, | ||
| double | reltol = 1e-6 ) |
Solve IVP with symbolic ODE function (CasADi CVODES backend).
This overload accepts a callable that takes symbolic arguments and returns symbolic expressions, enabling automatic differentiation through the ODE.
| Func | Callable type f(MX t, MX y) -> MX dy/dt |
| fun | Symbolic ODE function |
| t_span | Integration interval (t0, tf) |
| y0 | Initial state (numeric, will be used for evaluation) |
| n_eval | Number of output points |
| abstol | Absolute tolerance |
| reltol | Relative tolerance |
| SecondOrderOdeResult< double > janus::solve_second_order_ivp | ( | AccelFunc && | acceleration, |
| std::pair< double, double > | t_span, | ||
| const NumericVector & | q0, | ||
| const NumericVector & | v0, | ||
| int | n_eval = 100, | ||
| const SecondOrderIvpOptions & | opts = {} ) |
Solve a second-order IVP q'' = a(t, q), q(t0) = q0, v(t0) = v0.
This interface targets mechanical and orbital systems directly instead of forcing them through a first-order state augmentation. StormerVerlet preserves the geometric structure of separable Hamiltonian systems, while RungeKuttaNystrom4 provides a higher-order non-symplectic alternative.
| AccelFunc | Callable type a(t, q) -> qdd |
| acceleration | Acceleration function |
| t_span | Integration interval |
| q0 | Initial generalized coordinates |
| v0 | Initial generalized velocities |
| n_eval | Number of output points |
| opts | Integration options |
| SecondOrderOdeResult< double > janus::solve_second_order_ivp | ( | AccelFunc && | acceleration, |
| std::pair< double, double > | t_span, | ||
| std::initializer_list< double > | q0_init, | ||
| std::initializer_list< double > | v0_init, | ||
| int | n_eval = 100, | ||
| const SecondOrderIvpOptions & | opts = {} ) |
Convenience overload for second-order IVPs using initializer lists.
|
inline |
|
inline |
|
inline |
Create sparse matrix from triplets.
Triplets specify (row, col, value) entries. Duplicate entries are summed.
| rows | Number of rows |
| cols | Number of columns |
| triplets | Vector of (row, col, value) triplets |
|
inline |
Compile a sparse Hessian evaluator from a janus::Function.
| fn | Function with scalar output |
| output_idx | Scalar output index |
| input_idx | Input index |
| name | Optional function name |
|
inline |
Compile a sparse Hessian evaluator from vector arguments.
| expression | Scalar expression |
| variables | Input variable blocks |
| name | Optional function name |
|
inline |
Compile a sparse Hessian evaluator from symbolic expressions.
| expression | Scalar expression |
| variables | Input variables |
| name | Optional function name |
|
inline |
Create identity sparse matrix.
| n | Size (n x n) |
|
inline |
Compile a sparse Jacobian evaluator from a janus::Function.
| fn | Function to differentiate |
| output_idx | Output index |
| input_idx | Input index |
| name | Optional function name |
|
inline |
Compile a sparse Jacobian evaluator from vector arguments.
| expressions | Output expressions |
| variables | Input variables |
| name | Optional function name |
|
inline |
Compile a sparse Jacobian evaluator from symbolic expressions.
| expression | Output expression |
| variables | Input variables |
| name | Optional function name |
|
inline |
Get Hessian sparsity of a scalar expression.
Named sparsity_of_hessian to avoid collision with potential CasADi functions.
| expr | Scalar expression |
| vars | Variables |
|
inline |
Get Jacobian sparsity without computing the full Jacobian.
This is more efficient than computing the Jacobian and extracting its sparsity. Named sparsity_of_jacobian to avoid collision with casadi::jacobian_sparsity.
| expr | Expression to differentiate (output) |
| vars | Variables to differentiate with respect to (input) |
|
inline |
Spectral differentiation matrix using barycentric weights.
| nodes | Interpolation nodes |
| auto janus::sqrt | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes square root element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::sqrt | ( | const T & | x | ) |
Computes the square root of a scalar.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
| auto janus::square | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes square element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::square | ( | const T & | x | ) |
Computes x^2 (more efficient than pow(x, 2)).
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
|
inline |
Build a one-dimensional stochastic quadrature rule from a refinement level.
| dimension | Stochastic dimension descriptor |
| level | Refinement level (>= 1) |
| rule | Quadrature rule family |
|
inline |
Build a one-dimensional stochastic quadrature rule with a fixed order.
| dimension | Stochastic dimension descriptor |
| order | Number of quadrature points |
| rule | Quadrature rule family |
| SecondOrderStepResult< Scalar > janus::stormer_verlet_step | ( | AccelFunc && | acceleration, |
| const JanusVector< Scalar > & | q, | ||
| const JanusVector< Scalar > & | v, | ||
| Scalar | t, | ||
| Scalar | dt ) |
Stormer-Verlet / velocity-Verlet step for q'' = a(t, q).
This method is symplectic for separable Hamiltonian systems where the acceleration depends only on the generalized coordinates. It is particularly useful for long-horizon orbital and mechanical propagation because it keeps energy error bounded instead of exhibiting the secular drift common to generic explicit Runge-Kutta methods.
| Scalar | Numeric or symbolic scalar type |
| AccelFunc | Callable type a(t, q) -> qdd |
| acceleration | Acceleration function |
| q | Current generalized coordinates |
| v | Current generalized velocities |
| t | Current time |
| dt | Time step |
|
inline |
Run alias elimination followed by BLT decomposition.
| fn | Function containing the residual system |
| opts | Transform options |
| auto janus::swish | ( | const T & | x, |
| double | beta = 1.0 ) |
Swish activation function: x / (1 + exp(-beta * x)).
| x | Input |
| beta | Beta parameter |
|
inline |
Create a named symbolic scalar variable.
| name | Name of the variable |
|
inline |
Create a named symbolic matrix variable.
| name | Name of the variable |
| rows | Number of rows |
| cols | Number of columns (default 1) |
|
inline |
Symbolic gradient with vector of variables.
|
inline |
Symbolic gradient (for scalar-output functions).
Computes the symbolic gradient of a scalar expression with respect to variables. Note: Named sym_gradient to distinguish from numerical gradient() in Calculus.hpp.
| expr | Scalar expression to differentiate |
| vars | Variables to differentiate with respect to |
|
inline |
Create a symbolic vector preserving the CasADi primitive connection.
| name | Name of the variable |
| size | Number of elements |
|
inline |
Create symbolic vector and return both SymbolicVector and underlying MX.
| name | Name of the variable |
| size | Number of elements |
|
inline |
Create a named symbolic vector (returns SymbolicVector).
| name | Name of the variable |
| size | Number of elements |
| auto janus::tan | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes tangent element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::tan | ( | const T & | x | ) |
Computes tangent of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value (radians) |
| auto janus::tanh | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Computes hyperbolic tangent element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::tanh | ( | const T & | x | ) |
Computes hyperbolic tangent of x.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
|
inline |
Build the tensor-product grid from a list of one-dimensional rules.
| rules | Vector of univariate quadrature rules |
|
inline |
Convert sparse matrix to dense.
| sparse | Sparse matrix |
|
inline |
|
inline |
Backwards compatibility alias for as_vector.
| m | Input CasADi MX (column vector) |
| casadi::MX janus::to_mx | ( | const Eigen::MatrixBase< Derived > & | e | ) |
|
inline |
Convert dense matrix to sparse.
Elements with absolute value <= tol are treated as zero.
| dense | Dense numeric matrix |
| tol | Tolerance for zero (default 0.0 = exact zeros only) |
| std::pair< Scalar, Scalar > janus::trapezoidal_weights | ( | Scalar | h | ) |
Trapezoidal integration weights.
For integrating: integral(f, x[i], x[i+1]) ≈ 0.5 * (f[i] + f[i+1]) * h Returns [weight_i, weight_{i+1}] for the two points
| Scalar | Scalar type (NumericScalar or SymbolicScalar) |
| h | Step size |
| auto janus::trapz | ( | const Eigen::MatrixBase< DerivedY > & | y, |
| const Eigen::MatrixBase< DerivedX > & | x ) |
| auto janus::trunc | ( | const Eigen::MatrixBase< Derived > & | x | ) |
Truncates element-wise for a matrix.
| Derived | Eigen matrix type |
| x | Input matrix |
| T janus::trunc | ( | const T & | x | ) |
Truncates x toward zero.
| T | Scalar type (NumericScalar or SymbolicScalar) |
| x | Input value |
|
inline |
Convenience function: export expression to DOT and render to PDF.
Creates both a .dot file and a .pdf file with the given base name.
| expr | The symbolic expression to visualize |
| output_base | Base filename (creates output_base.dot and output_base.pdf) |
|
inline |
| auto janus::where | ( | const Cond & | cond, |
| const T1 & | if_true, | ||
| const T2 & | if_false ) |
Select values based on condition (ternary operator) Returns: cond ? if_true : if_false Supports mixed types.
| cond | Condition |
| if_true | Value if true |
| if_false | Value if false |
| auto janus::where | ( | const Eigen::ArrayBase< DerivedCond > & | cond, |
| const Eigen::MatrixBase< DerivedTrue > & | if_true, | ||
| const Eigen::MatrixBase< DerivedFalse > & | if_false ) |
Element-wise select.
| cond | Condition matrix/array |
| if_true | Matrix of values if true |
| if_false | Matrix of values if false |
|
constexpr |
Compile-time check for numeric scalar types.
This prevents confusing errors when someone tries to use sparse matrices with symbolic types in templated code.