BlockDiagonalMatrix

BlockDiagonalMatrix[{d1,d2,}]

represents the block diagonal matrix with diagonal blocks di as a structured array.

BlockDiagonalMatrix[mat]

converts the block diagonal matrix mat to a structured array.

Details

  • Block diagonal matrices, when represented as structured arrays, allow for efficient storage and more efficient operations, including Det, Inverse and LinearSolve.
  • Block diagonal matrices occur naturally as the adjacency matrices of graphs with multiple connected components, as the tensor product (Kronecker product) of full matrices with diagonal matrices and as the output from Jordan decompositions and core-nilpotent decompositions.
  • A block diagonal matrix generalizes a diagonal matrix, where the diagonal elements are themselves matrices.
  • The diagonal blocks di must be square matrices.
  • The inverse of a block diagonal matrix is also block diagonal.
  • The determinant of a block diagonal matrix is the product of the determinants of the diagonal blocks.
  • For a BlockDiagonalMatrix sa, the following properties "prop" can be accessed as sa["prop"]:
  • "Blocks"list of diagonal blocks
    "RowPermutation"permutation of the rows, represented as a permutation list
    "ColumnPermutation"permutation of the columns, represented as a permutation list
    "Properties"list of supported properties
    "Structure"type of structured array
    "StructuredData"internal data stored by the structured array
    "StructuredAlgorithms"list of functions with special methods for the structured array
    "Summary"summary information, represented as a Dataset
  • Normal[BlockDiagonalMatrix[]] gives the block diagonal matrix as an ordinary matrix.

Examples

open allclose all

Basic Examples  (1)

Construct a block diagonal matrix with symbolic entries:

Show the elements:

Get the determinant:

Normal can convert a BlockDiagonalMatrix to its ordinary representation:

Scope  (6)

Make a block diagonal matrix from a full matrix:

Extract the diagonal blocks:

BlockDiagonalMatrix objects include properties that give information about the matrix:


The "Blocks" property gives a list of the diagonal blocks:

The "RowPermutation" property encodes row permutations done to the original matrix:

The "ColumnPermutation" property encodes column permutations done to the original matrix:


The "Summary" property gives a brief summary of information about the array:

The "StructuredAlgorithms" property lists the functions that use the structure of the representation:

Structured algorithms are typically faster:

Compute the determinant:

Solve a linear system:

Compute the eigenvalues:

Compute the singular values:

When appropriate, structured algorithms return another BlockDiagonalMatrix object:

Inverting bd gives another block diagonal matrix:

Transposing bd gives another block diagonal matrix:

Multiplying bd by its transpose gives another block diagonal matrix:

Elements in BlockDiagonalMatrix are coerced to the precision of the nonzero elements of the blocks.

Exact matrix:

Machine-number matrix:

Arbitrary-precision number matrix:

Construct a block diagonal matrix from a SparseArray:

Show the elements:

Applications  (5)

The core-nilpotent decomposition of a matrix:

Assemble a block diagonal matrix from the core and nilpotent parts:

Verify the decomposition:

The Jordan decomposition of a matrix:

Split the Jordan blocks:

The Kronecker product of a diagonal matrix and a general square matrix is a block diagonal matrix:

A disconnected graph:

Disconnected graphs have adjacency matrices that can be represented as block diagonal matrices:

Extract the blocks to get the connected components:

This is equivalent to using ConnectedGraphComponents:

The efficiency of the fast Fourier transform (FFT) relies on being able to form a larger Fourier matrix from two smaller ones. Generate two small Fourier matrices of sizes p and q:

The Fourier matrix of size p q can be expressed as a product of four simpler matrices:

Show that the resulting matrix is equivalent to the result of FourierMatrix:

The discrete Fourier transform of a vector can be computed by successively multiplying the factors of the Fourier matrix to the vector:

The result is equivalent to applying Fourier to the vector:

Properties & Relations  (4)

Use SparseArray[BlockDiagonalMatrix[]] to get a representation as a SparseArray:

Diagonal matrices are treated as block diagonal matrices with 1×1 blocks:

BlockDiagonalMatrix objects with BlockDiagonalMatrix blocks are flattened to a single BlockDiagonalMatrix:

If a given matrix cannot be split into diagonal blocks or cannot be transformed into a form with diagonal blocks, BlockDiagonalMatrix returns the matrix itself:

Wolfram Research (2022), BlockDiagonalMatrix, Wolfram Language function, https://reference.wolfram.com/language/ref/BlockDiagonalMatrix.html.

Text

Wolfram Research (2022), BlockDiagonalMatrix, Wolfram Language function, https://reference.wolfram.com/language/ref/BlockDiagonalMatrix.html.

CMS

Wolfram Language. 2022. "BlockDiagonalMatrix." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BlockDiagonalMatrix.html.

APA

Wolfram Language. (2022). BlockDiagonalMatrix. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BlockDiagonalMatrix.html

BibTeX

@misc{reference.wolfram_2022_blockdiagonalmatrix, author="Wolfram Research", title="{BlockDiagonalMatrix}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/BlockDiagonalMatrix.html}", note=[Accessed: 28-November-2022 ]}

BibLaTeX

@online{reference.wolfram_2022_blockdiagonalmatrix, organization={Wolfram Research}, title={BlockDiagonalMatrix}, year={2022}, url={https://reference.wolfram.com/language/ref/BlockDiagonalMatrix.html}, note=[Accessed: 28-November-2022 ]}