Skip to content

Refactor optimization pipeline.#520

Draft
bimalgaudel wants to merge 4 commits into
masterfrom
gaudel/feature/refactor_optimization
Draft

Refactor optimization pipeline.#520
bimalgaudel wants to merge 4 commits into
masterfrom
gaudel/feature/refactor_optimization

Conversation

@bimalgaudel
Copy link
Copy Markdown
Member

@bimalgaudel bimalgaudel commented May 20, 2026

No description provided.

@bimalgaudel bimalgaudel changed the title refactor(optimize): generalize OptRes::flops → ops and extract DP hel… Refactor optimization pipeline. May 20, 2026
…urable

- Add OptFor { Flops, Memsize } and ReorderSum { Reorder, NoReorder } in
  a shared optimize/flags.hpp; thread them through single_term_opt and
  the top-level optimize() API.
- Add index_to_extent_t alias for the type-erased provider used by the
  public API; templated single_term_opt callers still pass callables
  directly via the has_index_extent concept.
- Parallelize the outermost Sum's per-summand single-term optimization
  with sequant::for_each; recurse sequentially on nested Sums.
- Have opt::reorder reuse pre-binarized eval nodes instead of rebuilding
  them inside clusters().
- Harden opt_mixed_product placeholder labels (non-identifier prefix,
  starts_with match, digit-walk suffix parse, asserted invariants).
- Fix std::forward misuse in flops_counter / memsize_counter that
  prevented compilation under clang.
- Rename optimize/flags.hpp → optimize/options.hpp; move OptFor,
  ReorderSum, and index_to_extent_t into it alongside a new
  OptimizeOptions struct (opt_for / reorder / idx_to_extent with
  sensible defaults).
- Collapse the six optimize() overloads into three (ExprPtr&,
  ResultExpr&, ResultExpr&&), each taking OptimizeOptions{} by
  default. Existing default-argument call sites are source-compatible.
- Stop including <SeQuant/core/optimize/single_term.hpp> from
  optimize.hpp. The public optimize() API now needs only the
  lightweight options header, so single_term.hpp (and its range-v3
  transitives) no longer leak into consumers. This fixes the CI
  unity-build failure in utilities/external-interface, where
  range/v3/view/indirect.hpp's use of meta:: became ambiguous against
  sequant::meta once a sibling .cpp in the same TU had issued
  `using namespace sequant;`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant