pydae.core.builder.codegen.cffi_builder

Functions

generate_and_compile_cffi(builder_obj)

Generates C code and compiles it using Python's CFFI.

sym2c(full_list)

Converts a list of SymPy expressions into C code strings.

sym2xyup(sys, full_list, inirun)

Replaces variable names in C code strings with C array index syntax.

pydae.core.builder.codegen.cffi_builder.generate_and_compile_cffi(builder_obj)[source]

Generates C code and compiles it using Python’s CFFI.

Sparse backend selection

builder_obj.sparse can be:
  • False / None → dense mode (no sparse solver)

  • True / ‘klu’ → SuiteSparse KLU (original behaviour)

  • ‘pardiso’ → Intel MKL PARDISO

  • ‘accelerate’ → Apple Accelerate Sparse Solvers (macOS only)

pydae.core.builder.codegen.cffi_builder.sym2c(full_list)[source]

Converts a list of SymPy expressions into C code strings.

Parallelised with a process pool when the list is long enough to amortise spawn cost (see PARALLEL_MIN).

pydae.core.builder.codegen.cffi_builder.sym2xyup(sys, full_list, inirun)[source]

Replaces variable names in C code strings with C array index syntax.

Parallelised with a process pool when the list is long enough.