They are the same. The vector is just a type alias for the array of size 1. Personally I like vector because to me it is clearer to read.
On Tuesday, August 18, 2015 at 12:09:23 PM UTC+2, Sisyphuss wrote: > > 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 <uwe.fec...@gmail.com>: >> >> > 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 >> >>