From a6940da4b6b161b984de7b7d27c840843c300dbd Mon Sep 17 00:00:00 2001 From: Hua Zhou Date: Thu, 29 Jun 2017 20:40:13 -0700 Subject: [PATCH] accomodate Julia v0.6 --- .travis.yml | 4 ++-- README.md | 2 +- REQUIRE | 2 +- appveyor.yml | 8 ++++---- src/VarianceComponentModels.jl | 2 +- src/two_variance_component.jl | 14 +++++++------- test/REQUIRE | 1 - test/multivariate_calculus_test.jl | 5 ++--- test/two_variance_component_test.jl | 3 +-- test/variance_component_models_test.jl | 3 +-- 10 files changed, 20 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 038fb90..10de15c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ os: - linux - osx julia: - - 0.4 - 0.5 + - 0.6 - nightly matrix: allow_failures: @@ -23,6 +23,6 @@ after_success: notifications: email: on_success: change - on_failure: always + on_failure: always recipients: - esobel@ucla.edu diff --git a/README.md b/README.md index 441b385..1231a9c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Within Julia, use the package manager to install VarianceComponentModels: Pkg.clone("https://github.com/OpenMendel/VarianceComponentModels.jl.git") -This package supports Julia v0.4 and v0.5. +This package supports Julia v0.5 and v0.6. ## Citation diff --git a/REQUIRE b/REQUIRE index 39ec788..d826093 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,4 @@ -julia 0.4 +julia 0.5 Compat MathProgBase diff --git a/appveyor.yml b/appveyor.yml index 8320ed4..bdb84af 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,9 @@ environment: matrix: - - JULIAVERSION: "julialang/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe" - - JULIAVERSION: "julialang/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe" - - JULIAVERSION: "julialang/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe" - - JULIAVERSION: "julialang/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe" + - JULIAVERSION: "julialang/bin/winnt/x86/0.4/julia-0.5-latest-win32.exe" + - JULIAVERSION: "julialang/bin/winnt/x64/0.4/julia-0.5-latest-win64.exe" + - JULIAVERSION: "julialang/bin/winnt/x86/0.5/julia-0.6-latest-win32.exe" + - JULIAVERSION: "julialang/bin/winnt/x64/0.5/julia-0.6-latest-win64.exe" #- JULIAVERSION: "julianightlies/bin/winnt/x86/julia-latest-win32.exe" #- JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe" diff --git a/src/VarianceComponentModels.jl b/src/VarianceComponentModels.jl index 62d3189..644ad34 100644 --- a/src/VarianceComponentModels.jl +++ b/src/VarianceComponentModels.jl @@ -122,7 +122,7 @@ function TwoVarCompModelRotate{T, BT, ΣT}( λ = convert(Vector{T}, F.values) Φ = convert(Matrix{T}, F.vectors) # correct negative eigenvalues due to roundoff - map!(x -> max(x, zero(T)), λ) + @compat map!(x -> max(x, zero(T)), λ, λ) Brot = isempty(vcm.B) ? Array{T}(size(vcm.B)) : vcm.B * Φ logdetΣ2 = convert(T, logdet(vcm.Σ[2])) TwoVarCompModelRotate{T, BT}(Brot, λ, Φ, logdetΣ2) diff --git a/src/two_variance_component.jl b/src/two_variance_component.jl index a75f155..3933088 100644 --- a/src/two_variance_component.jl +++ b/src/two_variance_component.jl @@ -904,11 +904,11 @@ function mle_fs!{T1<:VarianceComponentModel, T2<:TwoVarCompVariateRotate}( Bcov = zeros(T, nmean, nmean) Bcov = pinv(fisher_B(vcmodel, vcdatarot, dd.vcaux)) Bse = similar(vcmodel.B) - copy!(Bse, sqrt(diag(Bcov))) + copy!(Bse, sqrt.(diag(Bcov))) Σcov = pinv(fisher_Σ(vcmodel, vcdatarot)) Σse = (zeros(T, d, d), zeros(T, d, d)) - copy!(Σse[1], sqrt(diag(view(Σcov, 1:d^2, 1:d^2)))) - copy!(Σse[2], sqrt(diag(view(Σcov, d^2+1:2d^2, d^2+1:2d^2)))) + copy!(Σse[1], sqrt.(diag(view(Σcov, 1:d^2, 1:d^2)))) + copy!(Σse[2], sqrt.(diag(view(Σcov, d^2+1:2d^2, d^2+1:2d^2)))) # output maxlogl, vcmodel, Σse, Σcov, Bse, Bcov @@ -1105,11 +1105,11 @@ function mle_mm!{T1 <: VarianceComponentModel, T2 <: TwoVarCompVariateRotate}( # standard errors Bcov = pinv(fisher_B(vcm, vcdatarot, vcaux)) Bse = similar(vcm.B) - copy!(Bse, sqrt(diag(Bcov))) + copy!(Bse, sqrt.(diag(Bcov))) Σcov = pinv(fisher_Σ(vcm, vcdatarot)) Σse = (zeros(T, d, d), zeros(T, d, d)) - copy!(Σse[1], sqrt(diag(view(Σcov, 1:d^2, 1:d^2)))) - copy!(Σse[2], sqrt(diag(view(Σcov, d^2+1:2d^2, d^2+1:2d^2)))) + copy!(Σse[1], sqrt.(diag(view(Σcov, 1:d^2, 1:d^2)))) + copy!(Σse[2], sqrt.(diag(view(Σcov, d^2+1:2d^2, d^2+1:2d^2)))) # output logl, vcm, Σse, Σcov, Bse, Bcov @@ -1240,7 +1240,7 @@ function fit_reml!{ # standard errors and covariance of mean parameters Bcov = inv(fisher_B(vcmodel, vcdatarot, vcaux)) Bse = similar(vcmodel.B) - copy!(Bse, sqrt(diag(Bcov))) + copy!(Bse, sqrt.(diag(Bcov))) # output logpdf(vcmodel, vcdatarot), vcmodel, Σse, Σcov, Bse, Bcov diff --git a/test/REQUIRE b/test/REQUIRE index 94e516f..e69de29 100644 --- a/test/REQUIRE +++ b/test/REQUIRE @@ -1 +0,0 @@ -BaseTestNext diff --git a/test/multivariate_calculus_test.jl b/test/multivariate_calculus_test.jl index 5101cac..ec38c4b 100644 --- a/test/multivariate_calculus_test.jl +++ b/test/multivariate_calculus_test.jl @@ -1,7 +1,6 @@ module MultivariateCalculusTest -using VarianceComponentModels -using BaseTestNext +using VarianceComponentModels, Base.Test srand(123) @@ -102,7 +101,7 @@ end dX2[i, j] = vecdot(Y, M[(i-1)*p+1:i*p, (j-1)*r+1:j*r]) end end - @test_approx_eq_eps vecnorm(dX1 - vec(dX2)) 0.0 1.0e-8 + @test vecnorm(dX1 - vec(dX2)) < 1e-8 end # test duplication diff --git a/test/two_variance_component_test.jl b/test/two_variance_component_test.jl index 61478a1..38e315b 100644 --- a/test/two_variance_component_test.jl +++ b/test/two_variance_component_test.jl @@ -1,7 +1,6 @@ module TwoVarianceComponentTest -using VarianceComponentModels, MathProgBase, Ipopt -using BaseTestNext +using VarianceComponentModels, MathProgBase, Ipopt, Base.Test srand(123) diff --git a/test/variance_component_models_test.jl b/test/variance_component_models_test.jl index 6d56b10..d12477b 100644 --- a/test/variance_component_models_test.jl +++ b/test/variance_component_models_test.jl @@ -1,7 +1,6 @@ module VarianceComponentTypeTest -using VarianceComponentModels, MathProgBase, Ipopt -using BaseTestNext +using VarianceComponentModels, MathProgBase, Ipopt, Base.Test srand(123)