MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / tiny_codegen_with_sensitivity

Function tiny_codegen_with_sensitivity

src/tinympc/codegen.cpp:82–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82int tiny_codegen_with_sensitivity(TinySolver* solver, const char* output_dir,
83 tinyMatrix* dK, tinyMatrix* dP,
84 tinyMatrix* dC1, tinyMatrix* dC2, int verbose) {
85 if (!solver) {
86 std::cout << "Error in tiny_codegen_with_sensitivity: solver is nullptr" << std::endl;
87 return 1;
88 }
89
90 // Only store sensitivity matrices if adaptive rho is enabled
91 if (solver->settings->adaptive_rho) {
92 // Store the sensitivity matrices in the solver's cache
93 solver->cache->dKinf_drho = *dK;
94 solver->cache->dPinf_drho = *dP;
95 solver->cache->dC1_drho = *dC1;
96 solver->cache->dC2_drho = *dC2;
97 }
98
99 // Call the regular codegen function which will now include the sensitivity matrices if adaptive_rho is enabled
100 return tiny_codegen(solver, output_dir, verbose);
101}
102
103// Create code generation folder structure in whichever directory the executable calling tiny_codegen was called
104int codegen_create_directories(const char* output_dir, int verbose) {

Callers

nothing calls this directly

Calls 1

tiny_codegenFunction · 0.85

Tested by

no test coverage detected