Skip to content

Commit 4187b82

Browse files
committed
replacement of sortperm with sortperm!
1 parent 9ee15ff commit 4187b82

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- `depestregression` returns `Dict` instead of a `vector` of betas like other regression methods.
88
- `summary()` throws `ErrorException` rather than simply prompting with `@error` macro.
99
- `robcov` doesn't use try and catch any more.
10-
10+
- Replace `sortperm` with `sortperm!` in mve.
1111

1212
# v0.11.3
1313

src/mve.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,24 @@ import ..Diagnostics: mahalanobisSquaredMatrix
1515

1616

1717
function enlargesubset(initialsubset, data::AbstractMatrix, h::Int)
18-
p = size(data, 2)
18+
19+
n, p = size(data)
1920

2021
basicsubset = copy(initialsubset)
2122

2223
meanvector = Array{Float64}(undef, p)
2324

25+
md2sortedindex = Array{Int}(undef, n)
26+
2427
while length(basicsubset) < h
2528
applyColumns!(meanvector, mean, data[basicsubset, :])
2629
covmatrix = cov(data[basicsubset, :])
2730
md2mat =
2831
mahalanobisSquaredMatrix(data, meanvector=meanvector, covmatrix=covmatrix)
2932
if !isnothing(md2mat)
30-
md2 = diag(md2mat)
31-
md2sortedindex = sortperm(md2)
33+
#md2 = diag(md2mat)
34+
#md2sortedindex = sortperm(md2)
35+
sortperm!(md2sortedindex, diag(md2mat))
3236
basicsubset = md2sortedindex[1:(length(basicsubset)+1)]
3337
else
3438
basicsubset = 1:(length(basicsubset)+1)

0 commit comments

Comments
 (0)