Block Structures
These types are used for representing block-structured data common in functional data analysis.
CovIterSolvers.BlockDiagonal — TypeBlockDiagonal{T, R<:(AbstractArray{<:AbstractArray{T, 2}, 1})}Blocked array of square matrices of type T arranged in a block diagonal structure.
Fields
blocks::R: stores the vector of matrices of typeTbeing wrapped.
Supertype Hierarchy
BlockDiagonal{T, R<:(AbstractArray{<:AbstractArray{T, 2}, 1})} <: AbstractArray{T, 1} <: Any
Examples
julia> A = [1 2; 3 4];
julia> B = [5 6; 8 9];
julia> bd = BlockDiagonal([A, B]);
julia> bd.blocks[1]
2×2 Matrix{Int64}:
1 2
3 4See also blocksizes, zero_block_diag, undef_block_diag, rand_block_diag.
CovIterSolvers.zero_block_diag — Functionzero_block_diag([T=Float64], block_sizes)Create a BlockDiagonal matrix with all elements set to zero.
The blocks are created as square matrices according to the specified sizes.
Arguments
T::Type: The element type of the blocks. Defaults toFloat64.block_sizes::Vector{Int}: A vector of integers specifying the size of each square block.
Examples
julia> block_sizes = [2, 1];
julia> bd = zero_block_diag(block_sizes);
julia> eltype(bd)
Float64
julia> bd.blocks[1]
2×2 Matrix{Float64}:
0.0 0.0
0.0 0.0See also undef_block_diag, rand_block_diag.
CovIterSolvers.undef_block_diag — Functionundef_block_diag([T=Float64], block_sizes)Create a BlockDiagonal matrix with uninitialized elements.
The blocks are created as square matrices according to the specified sizes.
Arguments
T::Type: The element type of the blocks. Defaults toFloat64.block_sizes::Vector{Int}: A vector of integers specifying the size of each square block.
Examples
julia> block_sizes = [2, 3];
julia> bd = undef_block_diag(UInt8, block_sizes);
julia> eltype(bd)
UInt8
julia> size(bd.blocks[1])
(2, 2)
julia> size(bd.blocks[2])
(3, 3)See also zero_block_diag, rand_block_diag.
CovIterSolvers.rand_block_diag — Functionrand_block_diag([T=Float64], block_sizes; seed=nothing)Create a BlockDiagonal matrix with random elements.
The blocks are created as square matrices according to the specified sizes.
Arguments
T::Type: The element type of the blocks. Defaults toFloat64.block_sizes::Vector{Int}: A vector of integers specifying the size of each square block.
Keyword Arguments
seed::Union{Nothing, Int}: An integer seed for the random number generator to ensure reproducibility. Defaults tonothing.
Examples
julia> block_sizes = [2, 1];
julia> bd = rand_block_diag(block_sizes; seed=123);
julia> bd.blocks[1]
2×2 Matrix{Float64}:
0.521214 0.890879
0.586807 0.190907See also zero_block_diag, undef_block_diag.
CovIterSolvers.block_outer — Functionblock_outer(y)
y ⊙ yComputes the block-wise outer product of a BlockVector, returning a BlockDiagonal matrix.
For a BlockVector y with blocks y₁, y₂, ..., this function computes a BlockDiagonal matrix where the i-th block is the outer product yᵢ * yᵢ'.
The infix operator ⊙ is an alias for this function. It must be used on the same object (e.g., y ⊙ y).
Arguments
y::AbstractBlockVector: The input block vector.
Examples
julia> v = [1.0, 2.0, 3.0];
julia> y = BlockVector(v, [2, 1]);
julia> (y ⊙ y).blocks[1]
2×2 Matrix{Float64}:
1.0 2.0
2.0 4.0CovIterSolvers.:⊙ — Functiony ⊙ yComputes the block-wise outer product of a BlockVector, returning a BlockDiagonal matrix.
The infix operator ⊙ is an alias for block_outer(y), and must be used on the same object (e.g., y ⊙ y).
See also block_outer. ```
E ⊙ EThe infix operator ⊙ is an alias for the constructor BlockOuter(E). It requires that both operands are the same object (e.g., E ⊙ E).
See also BlockOuter.
BlockArrays.blocksizes — Functionblocksizes(D::BlockDiagonal, d::Int)Returns the sizes of the blocks in a BlockDiagonal matrix along the specified dimension d.
Arguments
D::BlockDiagonal: The block diagonal matrix.d::Int: The dimension along which to get the block sizes (1 for rows, 2 for columns).
Examples
julia> block_sizes = [2, 1];
julia> bd = rand_block_diag(block_sizes; seed=123);
julia> blocksizes(bd, 1)
2-element Vector{Int64}:
2
1CovIterSolvers.AbstractBlockTensor — TypeAbstractBlockTensor{T}Element-free tensor type for block-wise operations.
See also BlockOuter, CovFwdTensor, AdjointBlockOuter, and AdjointCovFwdTensor.
CovIterSolvers.BlockOuter — TypeBlockOuter(E, [workspace])
E ⊙ ERepresents a linear operator L that performs a block-wise outer product.
The operator L is defined by its action on a BlockDiagonal matrix A: B = L(A), where the j-th block of B is computed as B_j = ∑ᵢ Eⱼᵢ Aᵢ Eᵢⱼ'.
The infix operator ⊙ is an alias for the constructor BlockOuter(E). It requires that both operands are the same object (e.g., E ⊙ E).
Fields
E::AbstractBlockMatrix: The block matrix that defines the operator.workspace::Matrix: Pre-allocated matrix to be used for intermediate calculations.
Examples
julia> E = BlockMatrix(rand(3, 2), [2, 1], [1, 1]);
julia> L = E ⊙ E; # Element-free operator
julia> L_adj = L'; # Take the adjoint
julia> L_adj isa AdjointBlockOuter
trueSee also AdjointBlockOuter.
CovIterSolvers.AdjointBlockOuter — TypeAdjointBlockOuter(E, [workspace])Represents the adjoint of the BlockOuter operator.
This type is typically not constructed directly, but rather by taking the adjoint of a BlockOuter object (e.g., L').
The operator L' is defined by its action on a BlockDiagonal matrix A: A = L'(B), where the i-th block of A is computed as A_i = ∑ⱼ Eⱼᵢ' Bⱼ Eᵢⱼ.
Fields
F::AbstractBlockMatrix: The block matrix that defines the original operator.workspace::Matrix: Pre-allocated matrix to be used for intermediate calculations.
Examples
julia> E = BlockMatrix(rand(3, 2), [2, 1], [1, 1]);
julia> L_adj = (E ⊙ E)';
julia> L_adj isa AdjointBlockOuter
trueSee also BlockOuter.
CovIterSolvers.CovFwdTensor — TypeCovFwdTensor(F, [workspace])Represents a covariance-based forward operator L for B-splines or RKHS.
Its action L = O * (F ⊙ F) * O' depends on the block structure of F`.
Fields
F::AbstractBlockMatrix: The block matrix that defines the core of the operator.workspace::Matrix: Pre-allocated matrix to be used for intermediate calculations.
Examples
julia> F = BlockMatrix(rand(3, 2), [2, 1], [1, 1]);
julia> L = CovFwdTensor(F);
julia> L_adj = adjoint(L); # Or L'
julia> L_adj isa AdjointCovFwdTensor
trueSee also AdjointCovFwdTensor.
CovIterSolvers.AdjointCovFwdTensor — TypeAdjointCovFwdTensor(F, [workspace])Represents the adjoint of the CovFwdTensor operator.
Fields
F::AbstractBlockMatrix: The block matrix that defines the core of the operator.workspace::Matrix: Pre-allocated matrix to be used for intermediate calculations.
Examples
julia> F = BlockMatrix(rand(3, 2), [2, 1], [1, 1]);
julia> L = CovFwdTensor(F);
julia> L_adj = L';
julia> L_adj isa AdjointCovFwdTensor
true
julia> L_adj' === L
trueSee also CovFwdTensor.