Cumulants.IndexPart
— TypeType that stores a partition of multiindex into subests, sizes of subests, size of original multitindex and number of subsets
Cumulants.accesscum
— Methodaccesscum(mulind::Tuple{Int, ...}, ::IndexPart, cum::SymmetricTensor{Float}...)
Returns: vector of blocks from cumulants. Each block correspond to a subests of partition (part) of multiindex (multiind).
```jldoctest julia> cum = SymmetricTensor([1.0 2.0 3.0; 2.0 4.0 6.0; 3.0 6.0 5.0]);
julia> accesscum((1,1,1,1), IndexPart(Array{Int64,1}[[1,2],[3,4]],[2,2],4,2), cum) Array{Float64,N}[ [1.0 2.0; 2.0 4.0], [1.0 2.0; 2.0 4.0]]
julia> accesscum((1,1,1,2), IndexPart(Array{Int64,1}[[1,2],[3,4]],[2,2],4,2), cum)
Array{Float64,N}[ [1.0 2.0; 2.0 4.0], [3.0 0.0; 6.0 0.0]]
julia> accesscum((1,1,1,1), IndexPart(Array{Int64,1}[[1,4],[2,3]],[2,2],4,2), cum)
Array{Float64,N}[ [1.0 2.0; 2.0 4.0], [1.0 2.0; 2.0 4.0]] ```
Cumulants.blockel
— Methodblockel(X::Matrix{T}, i::Tuple, j::Tuple, b::Int)
Returns Float, the element of the block (indexed by j) of the moment's tensor of X, at index cd i inside a block, where b is a standard blocks' size
julia> M = [1. 2. 5. 6. ; 3. 4. 7. 8.];
julia> blockel(M, (1,1), (1,1), 2)
5.0
julia> blockel(M, (1,1), (2,2), 2)
37.0
Cumulants.cumulant
— Methodcumulant(X::Vector{Matrix}, cum::SymmetricTensor...)
Returns: SymmetricTensor{Float, m}, a tensor of the m'th cumulant of X, given Vector of cumulants of order 2, ..., m-2
Cumulants.cumulants
— Methodcumulants(X::Matrix, m::Int, b::Int)
Returns [SymmetricTensor{Float, 1}, SymmetricTensor{Float, 2}, ..., SymmetricTensor{Float, m}], vector of cumulant tensors
julia> M = [[-0.88626 0.279571];[-0.704774 0.131896]];
julia> convert(Array, cumulants(M, 3)[3])
2×2×2 Array{Float64,3}:
[:, :, 1] =
0.0 0.0
0.0 0.0
[:, :, 2] =
0.0 0.0
0.0 0.0
Cumulants.indpart
— Functionindpart(nind::Int, npart::Int, e::Int = 1)
Returns vector of IndexPart type, that includes partitions of set [1, 2, ..., nind] into npart subests of size != e, sizes of each subest, size of original set and number of partitions
julia>indpart(4,2)
3-element Array{Cumulants.IndexPart,1}:
IndexPart(Array{Int64,1}[[1,2],[3,4]],[2,2],4,2)
IndexPart(Array{Int64,1}[[1,3],[2,4]],[2,2],4,2)
IndexPart(Array{Int64,1}[[1,4],[2,3]],[2,2],4,2)
Cumulants.mixel
— Methodmixel(X::Matrix{T}, ind::Tuple)
Returns Float, mixed element for cumulants 4-6 at ind multi-index
julia> M = [[-0.88626 0.279571];[-0.704774 0.131896]];
julia> mixel(M, (1,1,1,1))
-1.232956812564408
mixel(M, (1,1,1,1,1,1))
1.015431116914347
Cumulants.momel
— Methodmomel(X::Matrix{Float}, ind::Tuple)
Returns Float, an element of moment's tensor at ind multiindex
julia> M = [[-0.88626 0.279571];[-0.704774 0.131896]];
julia> momel(M, (1,1,1,1))
0.4318298020613279
Cumulants.moment1c
— Methodmomentn1c(X::Matrix{Float}, m::Int, b::Int)
Returns: SymmetricTensor{Float, m}, a tensor of the m'th moment of X, where b is a block size. Uses 1 core implementation
Cumulants.momentblock
— Methodmomentblock(X::Matrix{T}, j::Tuple, dims::Tuple, b::Int)
Returns a block of a moment's tensor of X. A block is indexed by j and if size dims, b is a standatd block size.
julia> M = [1. 2. 5. 6. ; 3. 4. 7. 8.];
julia> momentblock(M, (1,1), (2,2), 2)
2×2 Array{Float64,2}:
5.0 7.0
7.0 10.0
Cumulants.momentnc
— Methodmomentnc(X::Matrix}, m::Int, b::Int)
Returns: SymmetricTensor{Float, m}, a tensor of the m'th moment of X, where b is a block size. Uses multicore parallel implementation via pmap()
Cumulants.naivecumulant
— Methodnaivecumulant(data::Matrix, m::Int)
Returns Array{Float, m} the m'th cumulant tensor
julia> M = [[-0.88626 0.279571];[-0.704774 0.131896]];
julia> naivecumulant(M, 3)
2×2×2 Array{Float64,3}:
[:, :, 1] =
0.0 0.0
0.0 0.0
[:, :, 2] =
0.0 0.0
0.0 0.0
Cumulants.naivemoment
— Methodnaivemoment(data::Matrix{Float}, m::Int)
Returns Array{Float, m} the m'th moment tensor
julia> M = [[-0.88626 0.279571];[-0.704774 0.131896]];
julia> naivemoment(M, 3)
2×2×2 Array{Float64,3}:
[:, :, 1] =
-0.523092 0.142552
0.142552 -0.0407653
[:, :, 2] =
0.142552 -0.0407653
-0.0407653 0.0120729
Cumulants.outerprodcum
— Methodouterprodcum(retd::Int, npart::Int, cum::SymmetricTensor...; exclpartlen::Int = 1)
Returns retd dims outer products of npart cumulants in SymmetricTensor form. exclpartlen is a length of partitions to be excluded in calculations, in this algorithm exclpartlen = 1
julia> cum = SymmetricTensor([1.0 2.0 3.0; 2.0 4.0 6.0; 3.0 6.0 5.0]);
julia> outerprodcum(4,2,cum, cum)
SymmetricTensors.SymmetricTensor{Float64,4}(Union{Array{Float64,4}, Void}[[3.0 6.0; 6.0 12.0]
[6.0 12.0; 12.0 24.0]
[6.0 12.0; 12.0 24.0]
[12.0 24.0; 24.0 48.0] nothing; nothing nothing]
Union{Array{Float64,4}, Void}[nothing nothing; nothing nothing]
Union{Array{Float64,4}, Void}[[9.0 18.0; 18.0 36.0]
[18.0 36.0; 36.0 72.0] nothing; nothing nothing]
Union{Array{Float64,4}, Void}[[23.0 46.0; 46.0 92.0] [45.0; 90.0]; nothing [75.0]], 2, 2, 3, false)
Cumulants.outprodblocks
— Methodoutprodblocks(n::Int, part::Vector{Vector{Int}}, blocks::Vector{Array{T}}
Returns: n dims Array of outer product of blocks, given partition of indices, part.
julia> blocks = 2-element Array{Array{Float64,N},1}[[1.0 2.0; 2.0 4.0], [1.0 2.0; 2.0 4.0]];
julia> outprodblocks(IndexPart(Array{Int64,1}[[1,2],[3,4]],[2,2],4,2), blocks)
2×2×2×2 Array{Float64,4}:
[:, :, 1, 1] =
1.0 2.0
2.0 4.0
[:, :, 2, 1] =
2.0 4.0
4.0 8.0
[:, :, 1, 2] =
2.0 4.0
4.0 8.0
[:, :, 2, 2] =
4.0 8.0
8.0 16.0
Cumulants.usebl
— Methodusebl(bind::Tuple, n::Int, b::Int, nbar::Int)
Returns: Tuple{Int}, sizes of the last block
StatsBase.moment
— Methodmoment(X::Matrix}, m::Int, b::Int)
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.