# \#complex-math

**URL:** https://discourse.mc-stan.org/tag/complex-math/129.md

[Latest](https://discourse.mc-stan.org/latest.md) · [Categories](https://discourse.mc-stan.org/categories.md) · [Tags](https://discourse.mc-stan.org/tags.md)

---

## [Custom likelihood with if and i](https://discourse.mc-stan.org/t/custom-likelihood-with-if-and-i/36562)

<div class="topic-metadata">

**Author:** [@Ido\_Ben\_Artzi](https://discourse.mc-stan.org/u/Ido_Ben_Artzi)\
**Replies:** 2\
**Last updated:** [September 29, 2024, 8:35am UTC](https://discourse.mc-stan.org/t/custom-likelihood-with-if-and-i/36562 "2024-09-29T08:35:25Z")

</div>

Hello everyone, I’m trying to fit a new model with a custom likelihood. I’m sharing a toy example to get some tips on improving efficiency. Is there a more efficient way to have a different likelihood for each chosen o…

---

## [Help testing release candidate for std::complex](https://discourse.mc-stan.org/t/help-testing-release-candidate-for-std-complex/12314)

<div class="topic-metadata">

**Author:** [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Replies:** 85\
**Last updated:** [June 5, 2020, 10:24pm UTC](https://discourse.mc-stan.org/t/help-testing-release-candidate-for-std-complex/12314 "2020-06-05T22:24:52Z")

</div>

I have a release candidate for var and fvar\<T\> specializations and overloads of std::complex on stan-dev math branch: release candidate: feature/0123-complex-var. It’s passing all of my unit tests using the ad tes…

---

## [Complex numbers and matrix inversion in Stan](https://discourse.mc-stan.org/t/complex-numbers-and-matrix-inversion-in-stan/14331)

<div class="topic-metadata">

**Author:** [@Isaac\_Fradkin](https://discourse.mc-stan.org/u/Isaac_Fradkin)\
**Replies:** 21\
**Last updated:** [May 1, 2020, 11:29am UTC](https://discourse.mc-stan.org/t/complex-numbers-and-matrix-inversion-in-stan/14331 "2020-05-01T11:29:09Z")

</div>

Dear all. I’m trying to figure our whether it is possible to use a model that includes complex matrices, and manipulations on such matrices in STAN. Specifically, I’m trying to fit a semi-markov model, which can be solv…

---

## [Complex scalars, monads, and the return-type metaprogram](https://discourse.mc-stan.org/t/complex-scalars-monads-and-the-return-type-metaprogram/13220)

<div class="topic-metadata">

**Author:** [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Replies:** 5\
**Last updated:** [February 24, 2020, 1:37am UTC](https://discourse.mc-stan.org/t/complex-scalars-monads-and-the-return-type-metaprogram/13220 "2020-02-24T01:37:21Z")

</div>

This post was motivated by comments from @tadej and @bbbales2 on my first complex PR (the details of that aren’t relevant here). They were pushing back at my usage of scalar to mean the value type of a complex number i…

---

## [Fully functional std::complex specializations and overloads](https://discourse.mc-stan.org/t/fully-functional-std-complex-specializations-and-overloads/12113)

<div class="topic-metadata">

**Author:** [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Replies:** 52\
**Last updated:** [December 16, 2019, 5:20pm UTC](https://discourse.mc-stan.org/t/fully-functional-std-complex-specializations-and-overloads/12113 "2019-12-16T17:20:02Z")

</div>

I’m putting this up for comment now. I still need to dot a few Is and cross a few Ts before it’s ready to go. Background This is following on from a previous discourse topic a prior stan-dev:math pull request stan…

---

## [Flatten shape and autodiff type in stan-dev/math down to one file per function](https://discourse.mc-stan.org/t/flatten-shape-and-autodiff-type-in-stan-dev-math-down-to-one-file-per-function/12119)

<div class="topic-metadata">

**Author:** [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Replies:** 7\
**Last updated:** [November 30, 2019, 9:09pm UTC](https://discourse.mc-stan.org/t/flatten-shape-and-autodiff-type-in-stan-dev-math-down-to-one-file-per-function/12119 "2019-11-30T21:09:17Z")

</div>

I’ve been thinking about adding complex number support, which in our current way of looking at things is an alternative to scalars. So the hierarchy would be extended from scalar/matrix/array to scalar/complex/matrix/ar…

---

## [Complex number support in Math library autodiff](https://discourse.mc-stan.org/t/complex-number-support-in-math-library-autodiff/3511)

<div class="topic-metadata">

**Author:** [@seantalts](https://discourse.mc-stan.org/u/seantalts)\
**Replies:** 53\
**Last updated:** [October 9, 2018, 6:37pm UTC](https://discourse.mc-stan.org/t/complex-number-support-in-math-library-autodiff/3511 "2018-10-09T18:37:56Z")

</div>

There’s a thread going on in a Pull Request on the Math repo about complex number support. It looks like we need to take a step back and figure out what applications we’d like to support and then write out a spec for it …
