gridap / gridap/Gridap.jl

Specialize `mapreduce` for `VectorValue` etc?

Open
#795 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
879
Forks
119
Avg merge
6d 3h
Merged PRs (30d)
4

Description

Thanks for the nice package. I was playing around with it a bit and wanted to try out a toy problem (in different spatial dimensions) with analytical solution
```julia
u(x) = prod(sinpi, x)
```
However, this does not work right now since `x::VectorValue` and `VectorValue <: Number`. Thus, `prod` hits `mapreduce` with special case
https://github.com/JuliaLang/julia/blob/7dc132cf5a44717dbb619812dc05fd127c9d805a/base/reduce.jl#L438
which tries to handle `x` as a single number instead of an iterable.

Do you think it would make sense to specialize `mapreduce` for cases like this? Right now, I need to use a workaround such as
```julia
u(x) = prod(i -> sinpi(x[i]), eachindex(x))
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.