logic
JAX visitors for logic expressions.
Visitors: All, Any, Cond
Lowers the logic AST nodes to traceable JAX functions: All/Any reduce
predicate residuals (satisfied when <= 0) with jnp.all/jnp.any, and
Cond wraps jax.lax.cond so a predicate selects between two lowered
branches at runtime, optionally gated to a set of node ranges. These
branching/boolean nodes have no disciplined-convex form, so they are lowered only
by this JAX backend, never by CVXPy.
Both cond branches are cast to a shared default float dtype
(:func:set_default_float_dtype, configured by Problem.__init__) to avoid
dtype-mismatch errors when JAX traces the two branches separately.
get_default_float_dtype()
¶
set_default_float_dtype(dtype: str) -> None
¶
Set the default float dtype for conditional branches.
This is called by Problem.init to configure the dtype used in jax.lax.cond branches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtype
|
str
|
String like "float32" or "float64" |
required |