Skip to content

Commit

Permalink
temporary change of SymmetricTensors name type
Browse files Browse the repository at this point in the history
  • Loading branch information
kdomino committed Jun 5, 2018
1 parent 768485c commit 516e8ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
julia 0.6
SymmetricTensors 0.3.0
SymmetricTensors 0.3.1
Combinatorics
Distributions
12 changes: 6 additions & 6 deletions src/cumulant.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function moment1c(X::Matrix{T}, m::Int, b::Int=2) where T <: AbstractFloat
dims = (mod(n,b) == 0 || !(nbar in j))? (fill(b,m)...): usebl(j, n, b, nbar)
@inbounds ret[j...] = momentblock(X, j, dims, b)
end
SymmetricTensor(ret; testdatstruct = false)
SymmetricTensornew(ret; testdatstruct = false)
end


Expand Down Expand Up @@ -197,7 +197,7 @@ Array{Float64,N}[
```
"""
function accesscum(mulind::Tuple, part::IndexPart,
cum::SymmetricTensor{T}...) where T <: AbstractFloat
cum::SymmetricTensornew{T}...) where T <: AbstractFloat
blocks = Array{Array{T}}(part.npart)
sq = cum[1].sqr || !(cum[1].bln in mulind)
for k in 1:part.npart
Expand Down Expand Up @@ -285,7 +285,7 @@ Union{Array{Float64,4}, Void}[[23.0 46.0; 46.0 92.0] [45.0; 90.0]; nothing [75.0
```
"""
function outerprodcum(retd::Int, npart::Int,
cum::SymmetricTensor{T}...;
cum::SymmetricTensornew{T}...;
exclpartlen::Int = 1) where T <: AbstractFloat
parts = indpart(retd, npart, exclpartlen)
# prodcum = NullableArray(Array{T, retd}, fill(cum[1].bln, retd)...)
Expand All @@ -302,7 +302,7 @@ function outerprodcum(retd::Int, npart::Int,
end
@inbounds prodcum[muli...] = block
end
SymmetricTensor(prodcum; testdatstruct = false)
SymmetricTensornew(prodcum; testdatstruct = false)
end

"""
Expand All @@ -313,7 +313,7 @@ Returns: SymmetricTensor{Float, m}, a tensor of the m'th cumulant of X, given Ve
of cumulants of order 2, ..., m-2
"""

function cumulant(X::Matrix{T}, cum::SymmetricTensor{T}...) where T <: AbstractFloat
function cumulant(X::Matrix{T}, cum::SymmetricTensornew{T}...) where T <: AbstractFloat
m = length(cum) + 2
ret = moment(X, m, cum[1].bls)
for sigma in 2:div(m, 2)
Expand Down Expand Up @@ -344,7 +344,7 @@ julia> convert(Array, cumulants(M, 3)[3])
```
"""
function cumulants(X::Matrix{T}, m::Int = 4, b::Int = 2) where T <: AbstractFloat
cvec = Array{SymmetricTensor{T}}(m)
cvec = Array{SymmetricTensornew{T}}(m)
cvec[1] = moment1c(X, 1, b)
X = X .- mean(X, 1)
for i = 2:m
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ end
end

@testset "operation on blocks" begin
c2 = SymmetricTensor([1.0 2.0 3.0; 2.0 4.0 6.0; 3.0 6.0 5.0])
c2 = SymmetricTensornew([1.0 2.0 3.0; 2.0 4.0 6.0; 3.0 6.0 5.0])
blocks = accesscum((1,1,1,1), indexpart[1], c2,c2)
@test blocks == [[1.0 2.0; 2.0 4.0], [1.0 2.0; 2.0 4.0]]
@test accesscum((1,1,1,2), indexpart[1], c2,c2) == [[1.0 2.0; 2.0 4.0],
Expand Down

0 comments on commit 516e8ba

Please sign in to comment.