Evaluate an elementwise expression over input arguments, producing a new Buffer. Compilation results are cached by expression structure via [`CompileCache`]. Expressions without `Select` use the flat interpreter. Expressions with `Select` use a lazy tree evaluator so dead branches are not evaluated.
(expr: &Expr, args: &[ArgValue])
| 40 | /// Expressions without `Select` use the flat interpreter. |
| 41 | /// Expressions with `Select` use a lazy tree evaluator so dead branches are not evaluated. |
| 42 | pub fn eval_elementwise(expr: &Expr, args: &[ArgValue]) -> ParsecResult<Buffer> { |
| 43 | let program = global_cache().get_or_compile(expr); |
| 44 | match program.as_ref() { |
| 45 | CompiledProgram::Flat(flat) => crate::ir::flat::eval_flat_elementwise(flat, args), |
| 46 | CompiledProgram::LazyTree(tree) => crate::ir::evaluator::eval_lazy_elementwise(tree, args), |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | fn contains_select(expr: &Expr) -> bool { |
| 51 | match expr { |