Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Commit

Permalink
Intialize arrays with all NAs. Flip bits _unsafe_getindex.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnoack committed Feb 13, 2017
1 parent 1416606 commit 0c9184c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dataarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ end
#' dv = @data [false, false, true, false]
#' dv_new = similar(dv, Float64, 2, 2, 2)
function Base.similar(da::DataArray, T::Type, dims::Dims) #-> DataArray{T}
return DataArray(Array{T}(dims), falses(dims))
return DataArray(Array{T}(dims), trues(dims))
end

#' @description
Expand Down
1 change: 1 addition & 0 deletions src/indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ Base.unsafe_getindex(x::Number, i) = (@inbounds xi = x[i]; xi)
N = length(I)
quote
$(Expr(:meta, :inline))
flipbits!(dest.na) # similar initializes with NAs
@nexprs $N d->(J_d = I[d])
srcextr = daextract(src)
destextr = daextract(dest)
Expand Down
4 changes: 2 additions & 2 deletions src/pooleddataarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ function PooledDataVecs(v1::AbstractArray,
## Return two PooledDataVecs that share the same pool.

## TODO: allow specification of REFTYPE
refs1 = Array(DEFAULT_POOLED_REF_TYPE, size(v1))
refs2 = Array(DEFAULT_POOLED_REF_TYPE, size(v2))
refs1 = Array{DEFAULT_POOLED_REF_TYPE}(size(v1))
refs2 = Array{DEFAULT_POOLED_REF_TYPE}(size(v2))
poolref = Dict{promote_type(eltype(v1), eltype(v2)), DEFAULT_POOLED_REF_TYPE}()
maxref = 0

Expand Down

0 comments on commit 0c9184c

Please sign in to comment.