TargetStructure

TargetStructure

is an option for linear algebra functions that specifies the representation of the result produced by the function.

Details

Examples

open allclose all

Basic Examples  (3)

An identity matrix:

Return the identity matrix as a structured array instead:

Return the identity matrix as a sparse array:

For IdentityMatrix, the setting Automatic determines the structure based on matrix size:

Scope  (8)

Matrix Constructors  (4)

A rectangular diagonal matrix:

This is equivalent to the explicit setting TargetStructure"Dense":

Return the diagonal matrix as a sparse array:

Return the diagonal matrix as a structured array:

A Hankel matrix:

Return a Hankel matrix as a structured array:

A Cauchy matrix:

Return a Cauchy matrix as a dense matrix:

A Hilbert matrix:

Return the Hilbert matrix as a Cauchy matrix instead:

Return the Hilbert matrix as a Hankel matrix instead:

Matrix Decompositions  (2)

Cholesky decomposition of a Hilbert matrix:

Represent the Cholesky triangle as an UpperTriangularMatrix:

Core-nilpotent decomposition of a matrix, with the core and nilpotent parts in a single matrix:

With TargetStructure"Structured", the core and nilpotent parts are brought together in a BlockDiagonalMatrix:

Other Functions  (2)

A Hilbert matrix:

With TargetStructure"Dense", the function UpperTriangularize returns a dense matrix:

With TargetStructure"Sparse", a sparse array is returned:

With TargetStructure"Structured", a structured array is returned:

With the setting TargetStructureAutomatic, the function LowerTriangularize gives a dense matrix if the input is a dense matrix:

If the input is a sparse array, the result is also a sparse array:

Applications  (3)

Generate a large identity matrix as a dense matrix:

Computing its determinant takes some time:

Generate the identity matrix as a structured matrix:

Computing the determinant of the structured version is faster:

Generate a Fourier matrix as a dense matrix:

Generate a random complex vector:

This multiplies the Fourier matrix and the vector:

Generate the Fourier matrix as a structured matrix:

Multiplication using the structured version is faster:

The results are equivalent:

Generate a Hilbert matrix as a dense matrix:

Generate a random real vector:

Solve a linear system with the Hilbert matrix:

Generate the Hilbert matrix as a Cauchy matrix:

Solving the linear system using the Cauchy version is faster:

Properties & Relations  (4)

The setting TargetStructureAutomatic produces a dense matrix for small dimensions:

A structured array is returned for large dimensions:

The setting TargetStructure"Dense" produces a dense matrix:

The setting TargetStructureNone does the same thing:

The setting TargetStructure"Sparse" produces a sparse array, whenever possible:

The setting TargetStructure"Structured" produces a structured array, whenever possible:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2024_targetstructure, author="Wolfram Research", title="{TargetStructure}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/TargetStructure.html}", note=[Accessed: 27-April-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_targetstructure, organization={Wolfram Research}, title={TargetStructure}, year={2023}, url={https://reference.wolfram.com/language/ref/TargetStructure.html}, note=[Accessed: 27-April-2024 ]}