Is `function sum{T<:FloatingPoint}(x::AbstractArray{T,1}) ` or
`function sum{T<:FloatingPoint}(x::AbstractVector{T}) ` better?
On Tuesday, August 18, 2015 at 11:29:15 AM UTC+2, René Donner wrote:
>
> Hi,
>
> I think this does what you want:
>
> function sum{T<:FloatingPoint}(x::Array{T,1})
> println("hi")
> end
>
> Cheers,
>
> Rene
>
>
>
>
>
>
> Am 18.08.2015 um 11:22 schrieb Uwe Fechner <[email protected]
> <javascript:>>:
>
> > Ok, the following definition works on Julia 0.4, but not with 0.3:
> >
> > FloatArray = Union{Array{Float32, 1}, Array{Float64, 1}}
> >
> > function sum(x::FloatArray).
> >
> > Any idea?
> >
> > Am Dienstag, 18. August 2015 11:07:16 UTC+2 schrieb Uwe Fechner:
> > Hello,
> >
> > I want to write a function, that can operate on any one dimensional
> array of floating point numbers.
> >
> > The following works, but only for Float64:
> >
> > function sum(x::Array{Float64,1})
> >
> > The following does not work:
> >
> > function sum(x::Array{AbstractFloat,1})
> >
> > Any idea?
> >
> > Uwe
>
>