add types to greta arrays
- Dominant language
- C++
- Stars
- 607
- Forks
- 67
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 1
Description
currently greta arrays are all implicitly of the same type; reals. They are coerced to integers as and when necessary on the tensorflow side, but always remain reals on the greta side.
That's fine for integers and reals, though perhaps a little confusing to users. E.g. this is fine:
```r
p <- uniform(0, 1)
y <- rnorm(3)
distribution(y) <- bernoulli(p)
```
For complex numbers it's more tricky, since we can't just drop the imaginary part and expect calculations to work. E.g. for a greta implementation of `fft`, the result on the tensorflow side would would need to be complex, and would need coersion back to reals for some subsequent operations to work.
Ideally, all greta arrays would have have types: `real`, `integer`, `imaginary` or `complex`. greta versions of the functions `Re(`, `Im()`, `complex()`, and `to_integer()` (rather than `as.integer()` which refers to R's class system).
The *precision* of those types is a computational issue, so should be handled in `model` or similar.
Contributor guide
Assessment
This issue has not been assessed yet.