stan-dev / stan-dev/math

support complex step derivative approximation

Open
#949 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature new function
Dominant language
C++
Stars
839
Forks
220
Avg merge
2d 4h
Merged PRs (30d)
14

Description

Summary:

This is different from #789, as there is no complex version of var involved.

For a given function f that supports complex number evaluation, calculate its derivative using complex step derivative approximation and generate var using the result.

Description:

Given

std::complex<double> f(const std::complex<double> x) {
/* ... */
}

one can calculate df/dx using complex step derivative approximation, avoiding loss of significance due to cancellation in real-number finite difference. This gives Math support in domains where complex number calculation is common (signal analysis, elector-magnetic solver, etc) and solvers are implemented with complex-number capability.

The connection of CSDA to forward-mode of AD is pointed out in Chap. 10 of GRIEWANK, A. 2000.

Current Version:

v2.18.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files, tests, or entry points are named. Start by reading issue #789 and the linked complex-step differentiation reference, then trace how the library generates var from derivative information. Done means supporting the described complex-valued function case and generating var from the approximation, with coverage for the new behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.