Skip to content

Commit

Permalink
corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
kdomino committed Sep 19, 2018
1 parent 87e4fbd commit bfeba99
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Cumulants.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ module Cumulants
#naive implementation
include("naivecumulants.jl")

export moment1, cumulants, naivecumulant, naivemoment
export moment, cumulants, naivecumulant, naivemoment
end
4 changes: 2 additions & 2 deletions src/cumulant.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ end
Returns: SymmetricTensor{Float, m}, a tensor of the m'th moment of X, where b
is a block size. Calls 1 core or multicore moment function.
"""
moment1(X::Matrix{T}, m::Int, b::Int=2) where T <: AbstractFloat =
moment(X::Matrix{T}, m::Int, b::Int=2) where T <: AbstractFloat =
(nworkers()>1) ? momentnc(X, m, b) : moment1c(X, m, b)

# ---- following code is used to caclulate cumulants in SymmetricTensor form----
Expand Down Expand Up @@ -294,7 +294,7 @@ of cumulants of order 2, ..., m-2
"""
function cumulant(X::Matrix{T}, cum::SymmetricTensor{T}...) where T <: AbstractFloat
m = length(cum) + 2
ret = moment1(X, m, cum[1].bls)
ret = moment(X, m, cum[1].bls)
for sigma in 2:div(m, 2)
ret -= outerprodcum(m, sigma, cum...)
end
Expand Down
10 changes: 5 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ end
@test isapprox((pyramidmoment(M, 3))[:, :, 2], [0.142552 -0.0407653; -0.0407653 0.0120729], atol=1.0e-5)
end
@testset "2" begin
@test Array(moment1(data, 2)) naivemoment(data, 2)
@test Array(moment(data, 2)) naivemoment(data, 2)
end
@testset "3" begin
@test Array(moment1(data, 3)) naivemoment(data, 3)
@test Array(moment(data, 3)) naivemoment(data, 3)
end
@testset "4" begin
@test Array(moment1(data, 4)) naivemoment(data, 4)
@test Array(moment1(data, 4, 3)) naivemoment(data, 4)
@test Array(moment(data, 4)) naivemoment(data, 4)
@test Array(moment(data, 4, 3)) naivemoment(data, 4)
end
end

@testset "Exceptions" begin
@testset "Size of blocks" begin
@test_throws Exception (DimensionMismatch, moment1(data, 4, 25))
@test_throws Exception (DimensionMismatch, moment(data, 4, 25))
@test_throws Exception (DimensionMismatch, cumulants(data, 3, 25))
end
end
Expand Down

0 comments on commit bfeba99

Please sign in to comment.