Block Structures

These types are used for representing block-structured data common in functional data analysis.

CovIterSolvers.BlockDiagonalType
BlockDiagonal{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 type T being 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  4

See also blocksizes, zero_block_diag, undef_block_diag, rand_block_diag.

source
CovIterSolvers.zero_block_diagFunction
zero_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 to Float64.
  • 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.0

See also undef_block_diag, rand_block_diag.

source
CovIterSolvers.undef_block_diagFunction
undef_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 to Float64.
  • 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.

source
CovIterSolvers.rand_block_diagFunction
rand_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 to Float64.
  • 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 to nothing.

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.190907

See also zero_block_diag, undef_block_diag.

source
CovIterSolvers.block_outerFunction
block_outer(y)
y ⊙ y

Computes 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.0
source
CovIterSolvers.:⊙Function
y ⊙ y

Computes 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. ```

source
E ⊙ 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).

See also BlockOuter.

source
BlockArrays.blocksizesFunction
blocksizes(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
 1
source
CovIterSolvers.BlockOuterType
BlockOuter(E, [workspace])
E ⊙ E

Represents 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
true

See also AdjointBlockOuter.

source
CovIterSolvers.AdjointBlockOuterType
AdjointBlockOuter(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
true

See also BlockOuter.

source
CovIterSolvers.CovFwdTensorType
CovFwdTensor(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
true

See also AdjointCovFwdTensor.

source
CovIterSolvers.AdjointCovFwdTensorType
AdjointCovFwdTensor(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
true

See also CovFwdTensor.

source