ScaledArrays

DiffinDiffsBase.ScaledArrayType
ScaledArray{T,R,N,RA,P} <: AbstractArray{T,N}

Array type that stores data as indices of a range.

Fields

  • refs::RA<:AbstractArray{R,N}: an array of indices.
  • pool::P<:AbstractRange: a range that covers all possible values stored by the array.
  • invpool::Dict{T,R}: a map from array elements to indices of pool.
DiffinDiffsBase.ScaledArrayType
ScaledArray(x::AbstractArray, start, step[, stop]; reftype=Int32, usepool=true)
ScaledArray(x::AbstractArray, step; reftype=Int32, start, stop, usepool=true)

Construct a ScaledArray from x given the step size. If start or stop is not specified, it will be chosen based on the extrema of x.

Keywords

  • reftype::Type=Int32: the element type of field refs.
  • usepool::Bool=true: find extrema of x based on DataAPI.refpool.
DiffinDiffsBase.alignMethod
align(xs::AbstractArray, sa::ScaledArrOrSub)

Convert xs into a ScaledArray with a pool that has the same first element and step size as the pool from sa.