Hi fellow Julians,

I would like to correctly pre-allocate the space for storing the result of some custom linear operators. In particular, the `eltype`

of the resulting collection should depend on the type of the coefficients (so to speak) of the operator, and on the `eltype`

of the input: given all different types `T <: Real`

and the combinations of `T`

vs `Complex{T}`

, I thought there might be some “best” way to do this using promotions.

Before thinking, I asked myself: how is this done in `LinearAlgebra`

, for example to define `(*)`

for `Matrix`

objects? There, `promote_op`

is used on a helper function `matprod`

to infer the `eltype`

of the array which will store the result:

However, if I look for `promote_op`

, I find a scary warning message attached to it:

Can anyone clarify on this? Is it simply the case that `promote_op`

is safe for linear operations?