Skip to content

Commit 5240121

Browse files
committed
StoredArray -> DenseArray for JuliaLang/julia#6258
Eventually we may also work with DArrays and sparse matrices, but as far as I know, we don't yet.
1 parent 957f5ec commit 5240121

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/GLM.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ module GLM
6666
wrkresp # working response
6767

6868
typealias FP FloatingPoint
69-
typealias FPStoredVector{T<:FloatingPoint} StoredArray{T,1}
69+
typealias FPVector{T<:FloatingPoint} DenseArray{T,1}
7070

7171
abstract ModResp # model response
7272

src/glmfit.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
type GlmResp{V<:FPStoredVector} <: ModResp # response in a glm model
1+
type GlmResp{V<:FPVector} <: ModResp # response in a glm model
22
y::V # response
33
d::UnivariateDistribution
44
l::Link
@@ -43,14 +43,14 @@ linkinv!(r::GlmResp) = linkinv!(r.l, r.mu, r.eta)
4343
# evaluate the mueta vector (derivative of mu w.r.t. eta) from the linear predictor (eta)
4444
mueta!(r::GlmResp) = mueta!(r.l, r.mueta, r.eta)
4545

46-
function updatemu!{T<:FPStoredVector}(r::GlmResp{T}, linPr::T)
46+
function updatemu!{T<:FPVector}(r::GlmResp{T}, linPr::T)
4747
n = length(linPr)
4848
length(r.offset) == n ? map!(Add(), r.eta, linPr, r.offset) : copy!(r.eta, linPr)
4949
linkinv!(r); mueta!(r); var!(r); wrkresid!(r); devresid!(r)
5050
sum(r.devresid)
5151
end
5252

53-
updatemu!{T<:FPStoredVector}(r::GlmResp{T}, linPr) = updatemu!(r, convert(T,vec(linPr)))
53+
updatemu!{T<:FPVector}(r::GlmResp{T}, linPr) = updatemu!(r, convert(T,vec(linPr)))
5454

5555
var!(r::GlmResp) = var!(r.d, r.var, r.mu)
5656

@@ -142,7 +142,7 @@ function StatsBase.fit(m::GlmMod, y; wts=nothing, offset=nothing, fitargs...)
142142
dofit ? fit(m; fitargs...) : m
143143
end
144144

145-
function StatsBase.fit{T<:FloatingPoint,V<:FPStoredVector}(::Type{GlmMod},
145+
function StatsBase.fit{T<:FloatingPoint,V<:FPVector}(::Type{GlmMod},
146146
X::Matrix{T}, y::V, d::UnivariateDistribution,
147147
l::Link=canonicallink(d);
148148
dofit::Bool=true,

src/lm.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
type LmResp{V<:FPStoredVector} <: ModResp # response in a linear model
1+
type LmResp{V<:FPVector} <: ModResp # response in a linear model
22
mu::V # mean response
33
offset::V # offset added to linear predictor (may have length 0)
44
wts::V # prior weights (may have length 0)
@@ -10,14 +10,14 @@ type LmResp{V<:FPStoredVector} <: ModResp # response in a linear model
1010
new(mu,off,wts,y)
1111
end
1212
end
13-
LmResp{V<:FPStoredVector}(y::V) = LmResp{V}(fill!(similar(y), zero(eltype(V))), similar(y, 0), similar(y, 0), y)
13+
LmResp{V<:FPVector}(y::V) = LmResp{V}(fill!(similar(y), zero(eltype(V))), similar(y, 0), similar(y, 0), y)
1414

15-
function updatemu!{V<:FPStoredVector}(r::LmResp{V}, linPr::V)
15+
function updatemu!{V<:FPVector}(r::LmResp{V}, linPr::V)
1616
n = length(linPr); length(r.y) == n || error("length(linPr) is $n, should be $(length(r.y))")
1717
length(r.offset) == 0 ? copy!(r.mu, linPr) : map!(Add(), r.mu, linPr, r.offset)
1818
deviance(r)
1919
end
20-
updatemu!{V<:FPStoredVector}(r::LmResp{V}, linPr) = updatemu!(r, convert(V,vec(linPr)))
20+
updatemu!{V<:FPVector}(r::LmResp{V}, linPr) = updatemu!(r, convert(V,vec(linPr)))
2121

2222
type WtResid <: Functor{3} end
2323
evaluate{T<:FP}(::WtResid,wt::T,y::T,mu::T) = (y - mu)*sqrt(wt)

0 commit comments

Comments
 (0)