Add vectorized variant for functions of complex variable, especially exp

Offen
#3,138 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
cpp
Bereich
backend

Rechercherichtung

Das Issue nennt keine Dateien oder Tests. Beginne mit dem Leitfaden zu den grundlegenden Funktionen mit komplexen Werten und dem bestehenden vektorisierten Verhalten von pow, und verfolge dann, wie komplexe Skalarfunktionen mit Vektor- oder Matrix-Autodiff interagieren. Die Umsetzung sollte das angeforderte vektorisierte Verhalten von exp abdecken und die umfassendere Konsistenzfrage für log und trigonometrische Funktionen klären.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

good first issue

Currently, according to the guide https://mc-stan.org/docs/functions-reference/complex-valued_basic_functions.html it seems that basic arithmetic operators and pow are the only functions that accept complex vectors.

I am modelling some periodicities in data using Fourier series, and I find it the most compact (and computationally efficient) to express what I do in terms of complex numbers. However, it's not efficient to run a function over a matrix using a loop when there's autodiff.

The most striking case is the exp function, which is ubiquitous in complex analysis and I want to be able to run it elementwise over a vector or a matrix.

I figured out a possible workaround is to use pow(exp(1), z) which does work on vectorized z, but still I believe that exp is more fundamental than pow and it should be implemented, because the current state is confusing at best.

Of course then there are all the other functions which accept a real or complex scalar and accept vectorized real, but don't accept vectorized complex, which is inconsistent. This includes log and the trigonometric functions.

Vorherrschende Sprache
C++
Sterne
845
Forks
225
Ø Merge
4 T. 21 Std.
Gemergte PRs (30 T.)
13

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus stan-dev/math

Alle Issues in stan-dev/math

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.