From 0c9184cba55025a84fcbc1abeaa6f04601a5e507 Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Sun, 12 Feb 2017 20:42:21 -0500 Subject: [PATCH] Intialize arrays with all NAs. Flip bits _unsafe_getindex. --- src/dataarray.jl | 2 +- src/indexing.jl | 1 + src/pooleddataarray.jl | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dataarray.jl b/src/dataarray.jl index c4adc4f..31b64c1 100644 --- a/src/dataarray.jl +++ b/src/dataarray.jl @@ -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 diff --git a/src/indexing.jl b/src/indexing.jl index 226ff57..e8b057e 100644 --- a/src/indexing.jl +++ b/src/indexing.jl @@ -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) diff --git a/src/pooleddataarray.jl b/src/pooleddataarray.jl index 0672954..e85d8eb 100644 --- a/src/pooleddataarray.jl +++ b/src/pooleddataarray.jl @@ -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