Skip to content

Commit

Permalink
cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
PharmCat committed Aug 22, 2024
1 parent 6085659 commit 8833bb0
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 104 deletions.
31 changes: 16 additions & 15 deletions src/gmat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
gmat!(gt[r].data, view(θ, covstr.tr[r]), covstr.random[r].covtype.s)
end
end
gt
return gt
end
# Main
@noinline function zgz_base_inc!(mx::AbstractArray, G, covstr, bi)
Expand All @@ -23,7 +23,7 @@ end
end
end
end
mx
return mx
end
################################################################################
################################################################################
Expand All @@ -32,22 +32,22 @@ function gmat!(::Any, ::Any, ::AbstractCovarianceType)
error("No gmat! method defined for thit structure!")
end
function gmat!(mx, ::Any, ::ZERO)
mx
return mx

Check warning on line 35 in src/gmat.jl

View check run for this annotation

Codecov / codecov/patch

src/gmat.jl#L35

Added line #L35 was not covered by tests
end
#SI
Base.@propagate_inbounds function gmat!(mx, θ, ::SI_)
val = θ[1] ^ 2
@inbounds @simd for i = 1:size(mx, 1)
mx[i, i] = val
end
mx
return mx
end
#DIAG
function gmat!(mx, θ, ::DIAG_)
@inbounds @simd for i = 1:size(mx, 1)
mx[i, i] = θ[i] ^ 2
end
mx
return mx
end
#AR
function gmat!(mx, θ, ::AR_)
Expand All @@ -64,7 +64,7 @@ function gmat!(mx, θ, ::AR_)
end
end
end
mx
return mx
end
#ARH
function gmat!(mx, θ, ::ARH_)
Expand All @@ -84,7 +84,7 @@ function gmat!(mx, θ, ::ARH_)
@inbounds @simd for m = 1:s
mx[m, m] *= mx[m, m]
end
mx
return mx
end
#CS
function gmat!(mx, θ, ::CS_)
Expand All @@ -99,7 +99,7 @@ function gmat!(mx, θ, ::CS_)
end
end
end
mx
return mx
end
#CSH
function gmat!(mx, θ, ::CSH_)
Expand All @@ -118,7 +118,7 @@ function gmat!(mx, θ, ::CSH_)
@inbounds @simd for m = 1:s
mx[m, m] *= mx[m, m]
end
mx
return mx
end
################################################################################
#ARMA
Expand All @@ -136,7 +136,7 @@ function gmat!(mx, θ, ::ARMA_)
end
end
end
mx
return mx
end
#TOEP
function gmat!(mx, θ, ::TOEP_)
Expand All @@ -152,7 +152,7 @@ function gmat!(mx, θ, ::TOEP_)
end
end
end
mx
return mx
end
function gmat!(mx, θ, ct::TOEPP_)
de = θ[1] ^ 2 #diagonal element
Expand All @@ -167,7 +167,7 @@ function gmat!(mx, θ, ct::TOEPP_)
end
end
end
mx
return mx
end
#TOEPH
function gmat!(mx, θ, ::TOEPH_)
Expand All @@ -186,7 +186,7 @@ function gmat!(mx, θ, ::TOEPH_)
@inbounds @simd for m = 1:s
mx[m, m] *= mx[m, m]
end
mx
return mx
end
#TOEPHP
function gmat!(mx, θ, ct::TOEPHP_)
Expand All @@ -205,7 +205,7 @@ function gmat!(mx, θ, ct::TOEPHP_)
@inbounds @simd for m = 1:s
mx[m, m] *= mx[m, m]
end
mx
return mx
end
#UN
function gmat!(mx, θ, ::UN_)
Expand All @@ -224,7 +224,7 @@ function gmat!(mx, θ, ::UN_)
@inbounds @simd for m = 1:s
mx[m, m] *= mx[m, m]
end
mx
return mx
end

function tpnum(m, n, s)
Expand All @@ -233,4 +233,5 @@ function tpnum(m, n, s)
b += s - i
end
b -= s - n
return b
end
14 changes: 7 additions & 7 deletions src/linearalgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Change θ (only upper triangle). B is symmetric.
end
end
end
θ
return θ
end
#=
function mulαβαtinc!(θ::AbstractMatrix{T}, A::AbstractMatrix{T}, B::AbstractMatrix{T}) where T <: AbstractFloat
Expand Down Expand Up @@ -55,7 +55,7 @@ Change θ (only upper triangle). B is symmetric.
end
end
end
θ
return θ
end
"""
mulαβαtinc!(θ::AbstractVector{T}, A::AbstractMatrix, B::AbstractMatrix, a::AbstractVector, b::AbstractVector, alpha) where T
Expand All @@ -78,7 +78,7 @@ Change θ (only upper triangle). B is symmetric.
end
end
end
θ
return θ
end

"""
Expand Down Expand Up @@ -137,7 +137,7 @@ Change θ.
end
@inbounds θ[n] += θn
end
θ
return θ
end
# Diagonal(b) * A * Diagonal(b) - chnage only A upper triangle
@noinline function mulβdαβd!(A::AbstractMatrix, b::AbstractVector)
Expand All @@ -149,7 +149,7 @@ end
@inbounds A[m, n] *= b[m] * b[n]
end
end
A
return A
end


Expand All @@ -162,7 +162,7 @@ end
@inbounds vec[r] += rz[r, i] * θi
end
end
vec
return vec
end

@inline function diag!(f, v, m)
Expand All @@ -171,5 +171,5 @@ end
@simd for i = 1:l
@inbounds v[i] = f(m[i, i])
end
v
return v
end
6 changes: 3 additions & 3 deletions src/reml.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function subutri!(a, b)
@inbounds a[m,n] -= b[m,n]
end
end
a
return a

Check warning on line 10 in src/reml.jl

View check run for this annotation

Codecov / codecov/patch

src/reml.jl#L10

Added line #L10 was not covered by tests
end

function fillzeroutri!(a::AbstractArray{T}) where T
Expand All @@ -28,7 +28,7 @@ function checkmatrix!(mx::AbstractMatrix{T}) where T
e = false
end
end
e
return e
end
################################################################################
# REML without provided β
Expand Down Expand Up @@ -270,7 +270,7 @@ function core_sweep_β(lmm, data, θ::Vector{T}, β, n; maxthreads::Int = 16) wh
accθ₃[t] += mulθ₃(data.yv[i], data.xv[i], β, V)
end
end
sum(accθ₁), sum(accθ₂), sum(accθ₃), all(erroracc)
return sum(accθ₁), sum(accθ₂), sum(accθ₃), all(erroracc)
end
###
function reml_sweep_β(lmm, data, θ::Vector{T}, β; kwargs...) where T
Expand Down
36 changes: 18 additions & 18 deletions src/rmat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
rmat!(view(mx, sb, sb), view(θ, rθ[j]), view(zblock, sb, :), covstr.repeated[j].covtype.s, bi)
end
end
mx
return mx
end
################################################################################
function rmat!(::Any, ::Any, ::Any, ::AbstractCovarianceType, ::Int)
Expand All @@ -40,7 +40,7 @@ function rmat!(mx, θ, ::AbstractMatrix, ct::SWC_, sbj::Int)
else
@inbounds mx[1, 1] += de * ct.wtsb[sbj][1, 1]

Check warning on line 41 in src/rmat.jl

View check run for this annotation

Codecov / codecov/patch

src/rmat.jl#L41

Added line #L41 was not covered by tests
end
mx
return mx
end
#DIAG
function rmat!(mx, θ, rz, ::DIAG_, ::Int)
Expand All @@ -49,7 +49,7 @@ function rmat!(mx, θ, rz, ::DIAG_, ::Int)
mx[i, i] += rz[i, c] * θ[c] ^ 2
end
end
mx
return mx
end
#AR
function rmat!(mx, θ, ::AbstractMatrix, ::AR_, ::Int)
Expand All @@ -65,7 +65,7 @@ function rmat!(mx, θ, ::AbstractMatrix, ::AR_, ::Int)
end
end
end
mx
return mx
end
#ARH
function rmat!(mx, θ, rz, ::ARH_, ::Int)
Expand All @@ -81,7 +81,7 @@ function rmat!(mx, θ, rz, ::ARH_, ::Int)
@inbounds for m axes(mx, 1)
mx[m, m] += vec[m] * vec[m]
end
mx
return mx
end
#CS
function rmat!(mx, θ, ::AbstractMatrix, ::CS_, ::Int)
Expand All @@ -98,7 +98,7 @@ function rmat!(mx, θ, ::AbstractMatrix, ::CS_, ::Int)
end
end
end
mx
return mx
end
#CSH
function rmat!(mx, θ, rz, ::CSH_, ::Int)
Expand All @@ -116,7 +116,7 @@ function rmat!(mx, θ, rz, ::CSH_, ::Int)
@inbounds for m axes(mx, 1)
mx[m, m] += vec[m] * vec[m]
end
mx
return mx
end
################################################################################
#ARMA
Expand All @@ -134,7 +134,7 @@ function rmat!(mx, θ, ::AbstractMatrix, ::ARMA_, ::Int)
end
end
end
mx
return mx
end
################################################################################
#TOEPP
Expand All @@ -151,7 +151,7 @@ function rmat!(mx, θ, ::AbstractMatrix, ct::TOEPP_, ::Int)
end
end
end
mx
return mx
end
################################################################################
#TOEPHP
Expand All @@ -169,7 +169,7 @@ function rmat!(mx, θ, rz, ct::TOEPHP_, ::Int)
@inbounds @simd for m = 1:s
mx[m, m] += vec[m] * vec[m]
end
mx
return mx
end
################################################################################
#=
Expand Down Expand Up @@ -213,7 +213,7 @@ function rmat!(mx, θ, rz, ::SPEXP_, ::Int)
end
end
end
mx
return mx
end
################################################################################
#SPPOW
Expand All @@ -233,7 +233,7 @@ function rmat!(mx, θ, rz, ::SPPOW_, ::Int)
end
end
end
mx
return mx
end

#SPGAU
Expand All @@ -255,7 +255,7 @@ function rmat!(mx, θ, rz, ::SPGAU_, ::Int)
end
end
end
mx
return mx
end
################################################################################
#SPEXPD cos(pidij)
Expand All @@ -275,7 +275,7 @@ function rmat!(mx, θ, rz, ::SPEXPD_, ::Int)
end
end
end
mx
return mx
end
#SPPOWD
function rmat!(mx, θ, rz, ::SPPOWD_, ::Int)
Expand All @@ -293,7 +293,7 @@ function rmat!(mx, θ, rz, ::SPPOWD_, ::Int)
end
end
end
mx
return mx
end
#SPGAUD
function rmat!(mx, θ, rz, ::SPGAUD_, ::Int)
Expand All @@ -312,7 +312,7 @@ function rmat!(mx, θ, rz, ::SPGAUD_, ::Int)
end
end
end
mx
return mx
end

#UN
Expand All @@ -333,14 +333,14 @@ function unrmat(θ::AbstractVector{T}, rz) where T
@inbounds @simd for m = 1:rm
mx[m, m] *= mx[m, m]
end
Symmetric(mx)
return Symmetric(mx)
end
function rmat!(mx, θ, rz::AbstractMatrix, ::UN_, ::Int)
vec = tmul_unsafe(rz, θ)
rm = size(mx, 1)
rcov = unrmat(θ, rz)
mulαβαtinc!(mx, rz, rcov)
mx
return mx
end
###############################################################################
###############################################################################
Expand Down
Loading

0 comments on commit 8833bb0

Please sign in to comment.