posted issue : https://github.com/JuliaLang/julia/issues/15393 

On Friday, March 4, 2016 at 3:48:43 AM UTC-5, [email protected] wrote:
>
> Hello all,
> I was polishing my call and I have found the following definition of 
> daxpy! I was not aware of
>
>
> function axpy!{Ti<:Integer,Tj<:Integer}(α, x::AbstractArray, 
> rx::AbstractArray{Ti}, y::AbstractArray, ry::AbstractArray{Tj})
>     if length(x) != length(y)
>         throw(DimensionMismatch("x has length $(length(x)), but y has 
> length $(length(y))"))
>     elseif minimum(rx) < 1 || maximum(rx) > length(x)
>         throw(BoundsError(x, rx))
>     elseif minimum(ry) < 1 || maximum(ry) > length(y)
>         throw(BoundsError(y, ry))
>     elseif length(rx) != length(ry)
>         throw(ArgumentError("rx has length $(length(rx)), but ry has 
> length $(length(ry))"))
>     end
>     for i = 1:length(rx)
>         @inbounds y[ry[i]] += x[rx[i]]*α
>     end
>     y
> end
>
> Is the first check
>  length(x) != length(y)
> really an intended behavior? 
>
> The multiplication goes over indexes rx and ry, should not be the check 
>  length(rx) != length(ry) ?
>
> Thanks for the clarification.
> Tomas
>
>
>

Reply via email to