On Thursday, October 22, 2015 at 9:44:28 AM UTC-4, Gabriel Gellner wrote:
>
> A related discussion is about a special Ones type representing an array 
>> of 1, which would allow efficient generic implementations of 
>> (non-)weighted statistical functions: 
>> https://github.com/JuliaStats/StatsBase.jl/issues/135 
>>
>> But regarding zeros(), there might not be any compelling use case to 
>> return a special type. Anyway, if arrays are changed to initialize to 
>> zero [1], that function go could away entirely
>
>
> lol never thought of this kind of special case. You could simply have a 
> "SameVector" object that just stores the value and the length. * + - ^ 
> would be easy to define and the space/(# of operations) savings could be 
> massive ;). With this you would have no need to special case zeros(n) 
> either just have it return a SameVector with value 0. We could even 
> generalize it to "BlockVector" for sequences of same values storing start 
> and stop locations.
>

Reply via email to