Skip to content

Commit 995b762

Browse files
committed
replace Array with Vector for one dimensional arrays
1 parent b530d69 commit 995b762

File tree

7 files changed

+20
-19
lines changed

7 files changed

+20
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- Update citation of `robhatreg` a.k.a Robust Hat Matrix based Regression Estimator
44
- Fix typos in code, code comments, and documentation
5+
- Replace one dimensional `Array{` definitions with `Vector{`
56

67
# v0.11.5
78

src/bacon.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ It also guarantees that at least m indices are returned and that the selected in
5757
- `m`: The minimum number of points to include in the subset indices.
5858
- `distances`: The distances vector used for selecting minimum distance indices.
5959
"""
60-
function select_subset(X::AbstractMatrix{Float64}, m::Int, distances::Array{Float64})
60+
function select_subset(X::AbstractMatrix{Float64}, m::Int, distances::Vector{Float64})
6161
rank_x = rank(X)
6262
sorted_distances = sortperm(distances)
6363
subset = sorted_distances[1:m]
@@ -152,7 +152,7 @@ This function computes the t distance for each point and returns the distance ve
152152
- `y`: The output vector
153153
- `subset`: The vector which denotes the points inside the subset, used to scale the residuals accordingly.
154154
"""
155-
function compute_t_distance(X::AbstractMatrix{Float64}, y::Array{Float64}, subset::Array{Int64})
155+
function compute_t_distance(X::AbstractMatrix{Float64}, y::Vector{Float64}, subset::Vector{Int64})
156156

157157
n, p = size(X)
158158

@@ -194,7 +194,7 @@ This function computes the initial subset having at least m elements which are l
194194
"""
195195
function bacon_regression_initial_subset(
196196
X::AbstractMatrix{Float64},
197-
y::Array{Float64},
197+
y::Vector{Float64},
198198
m::Int;
199199
method::String = "mahalanobis",
200200
alpha = 0.025,
@@ -266,7 +266,7 @@ Computational statistics & data analysis 34.3 (2000): 279-298.
266266
"""
267267
function bacon(
268268
X::AbstractMatrix{Float64},
269-
y::Array{Float64};
269+
y::Vector{Float64};
270270
m::Int,
271271
method::String = "mahalanobis",
272272
alpha = 0.025,

src/cm97.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ function cm97(X::AbstractMatrix{Float64}, y::AbstractVector{Float64}; maxiter::I
5656
pbar::Float64 = p / n
5757
hat = hatmatrix(X)
5858

59-
w_is = Array{Float64}(undef, n)
60-
betas = Array{Float64}(undef, p)
59+
w_is = Vector{Float64}(undef, n)
60+
betas = Vector{Float64}(undef, p)
6161

6262
converged::Bool = false
6363
iter::Int = 0

src/hadi1992.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function hadi1992(multivariateData::AbstractMatrix{Float64}; alpha = 0.05)
115115
basic_subset = Int[]
116116
sorted_mah1 = Float64[]
117117

118-
Cb = Array{Float64}(undef, p)
118+
Cb = Vector{Float64}(undef, p)
119119
Sb = Matrix{Float64}(undef, p, p)
120120
newSb = Matrix{Float64}(undef, p, p)
121121

src/lms.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ function lms(X::AbstractMatrix{Float64}, y::AbstractVector{Float64}; iters = not
6868
iters = minimum([500 * p, 3000])
6969
end
7070
bestobjective = Inf
71-
bestparameters = Array{Float64}(undef, p)
72-
bestres = Array{Float64}(undef, n)
71+
bestparameters = Vector{Float64}(undef, p)
72+
bestres = Vector{Float64}(undef, n)
7373
indices = collect(1:n)
7474
kindices = collect(p:n)
75-
betas = Array{Float64}(undef, p)
76-
res = Array{Float64}(undef, n)
75+
betas = Vector{Float64}(undef, p)
76+
res = Vector{Float64}(undef, n)
7777

7878
for _ = 1:iters
7979
try

src/mve.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ function enlargesubset(initialsubset, data::AbstractMatrix, h::Int)
2020

2121
basicsubset = copy(initialsubset)
2222

23-
meanvector = Array{Float64}(undef, p)
23+
meanvector = Vector{Float64}(undef, p)
2424

25-
md2sortedindex = Array{Int}(undef, n)
25+
md2sortedindex = Vector{Int}(undef, n)
2626

2727
while length(basicsubset) < h
2828
applyColumns!(meanvector, mean, data[basicsubset, :])
@@ -55,14 +55,14 @@ function robcov(data::Matrix; alpha=0.01, estimator=:mve)
5555

5656
maxiter = minimum([p * 500, 3000])
5757

58-
initialsubset = Array{Int}(undef, k)
59-
bestinitialsubset = Array{Int}(undef, k)
58+
initialsubset = Vector{Int}(undef, k)
59+
bestinitialsubset = Vector{Int}(undef, k)
6060

61-
hsubset = Array{Int}(undef, h)
62-
besthsubset = Array{Int}(undef, h)
61+
hsubset = Vector{Int}(undef, h)
62+
besthsubset = Vector{Int}(undef, h)
6363

6464

65-
meanvector = Array{Float64}(undef, p)
65+
meanvector = Vector{Float64}(undef, p)
6666
fill!(meanvector, 0.0)
6767

6868

src/smr98.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import ..Basis:
1010
import Distributions: mean, std
1111
import ..OrdinaryLeastSquares: ols, residuals, predict, coef
1212

13-
function distances(resids::AbstractVector{Float64}, fitteds::Array{Float64})::AbstractMatrix{Float64}
13+
function distances(resids::AbstractVector{Float64}, fitteds::Vector{Float64})::AbstractMatrix{Float64}
1414
n = length(resids)
1515
d = zeros(Float64, n, n)
1616
for i = 1:n

0 commit comments

Comments
 (0)