codac 2.1.2
Loading...
Searching...
No Matches
codac2::symbolic::detail Namespace Reference

Classes

class  FlatSymbolTable
 Symbol table associated with a flattened analytic input domain. More...
class  SympyExporter
 Exports Codac scalar expressions to SymPy expressions. More...
class  SympyImporter
 Imports SymPy scalar expressions into Codac scalar expressions. More...
class  ScalarBridgeContext
 Context gathering the bridge objects needed for one scalar transformation. More...

Typedefs

using SympyTransform
 SymPy transformation applied to an exported scalar expression.

Functions

void ensure_python_runtime ()
 Ensures that the embedded Python runtime is initialized.
const pybind11::object & import_module (const char *module_name)
 Imports a Python module.
const pybind11::object & import_sympy ()
 Imports the SymPy module.
const pybind11::object & import_polyfuncs ()
 Imports the SymPy polyfuncs module.
const pybind11::object & import_builtins ()
 Imports the Python builtins module.
pybind11::object normalize_sympy_expr (const pybind11::object &sympy, pybind11::object expr, bool do_expand=true)
 Normalizes a SymPy expression before import into Codac.
ScalarExpr transform_scalar_expr (const FunctionArgsList &args, const ScalarExpr &y, const SympyTransform &transform, bool do_expand=true)
 Applies a SymPy transformation to a Codac scalar expression.

Function Documentation

◆ import_module()

const pybind11::object & codac2::symbolic::detail::import_module ( const char * module_name)

Imports a Python module.

Imported modules are cached after the first call.

Parameters
module_namePython module name.
Returns
Imported Python module.

◆ import_sympy()

const pybind11::object & codac2::symbolic::detail::import_sympy ( )

Imports the SymPy module.

Returns
SymPy module.

◆ import_polyfuncs()

const pybind11::object & codac2::symbolic::detail::import_polyfuncs ( )

Imports the SymPy polyfuncs module.

Returns
SymPy polyfuncs module.

◆ import_builtins()

const pybind11::object & codac2::symbolic::detail::import_builtins ( )

Imports the Python builtins module.

Returns
Python builtins module.

◆ normalize_sympy_expr()

pybind11::object codac2::symbolic::detail::normalize_sympy_expr ( const pybind11::object & sympy,
pybind11::object expr,
bool do_expand = true )

Normalizes a SymPy expression before import into Codac.

Parameters
sympySymPy module.
exprSymPy expression.
do_expandWhether the expression should be expanded.
Returns
Normalized SymPy expression.

◆ transform_scalar_expr()

ScalarExpr codac2::symbolic::detail::transform_scalar_expr ( const FunctionArgsList & args,
const ScalarExpr & y,
const SympyTransform & transform,
bool do_expand = true )

Applies a SymPy transformation to a Codac scalar expression.

Parameters
argsFunction argument list.
yCodac scalar expression.
transformSymPy transformation.
do_expandWhether the transformed expression should be expanded.
Returns
Transformed Codac scalar expression.