ishermitian
Determine if matrix is Hermitian or skew-Hermitian
Description
tf = ishermitian(
specifies
the type of the test. Specify A
,skewOption
)skewOption
as 'skew'
to
determine if A
is skew-Hermitian.
Examples
Test If Symmetric Matrix Is Hermitian
Create a 3-by-3 matrix.
A = [1 0 1i; 0 1 0; 1i 0 1]
A = 3×3 complex
1.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 1.0000i
0.0000 + 0.0000i 1.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 1.0000i 0.0000 + 0.0000i 1.0000 + 0.0000i
The matrix is symmetric with respect to its real-valued diagonal.
Test whether the matrix is Hermitian.
tf = ishermitian(A)
tf = logical
0
The result is logical 0
(false
) because A
is not Hermitian. In this case, A
is equal to its transpose, A.'
, but not its complex conjugate transpose, A'
.
Change the element in A(3,1)
to be -1i
.
A(3,1) = -1i;
Determine if the modified matrix is Hermitian.
tf = ishermitian(A)
tf = logical
1
The matrix, A
, is now Hermitian because it is equal to its complex conjugate transpose, A'
.
Test If Matrix Is Skew-Hermitian
Create a 3-by-3 matrix.
A = [-1i -1 1-i;1 -1i -1;-1-i 1 -1i]
A = 3×3 complex
0.0000 - 1.0000i -1.0000 + 0.0000i 1.0000 - 1.0000i
1.0000 + 0.0000i 0.0000 - 1.0000i -1.0000 + 0.0000i
-1.0000 - 1.0000i 1.0000 + 0.0000i 0.0000 - 1.0000i
The matrix has pure imaginary numbers on the main diagonal.
Specify skewOption
as 'skew'
to determine whether the matrix is skew-Hermitian.
tf = ishermitian(A,'skew')
tf = logical
1
The matrix, A
, is skew-Hermitian since it is equal to the negation of its complex conjugate transpose, -A'
.
Input Arguments
A
— Input matrix
numeric matrix
Input matrix, specified as a numeric matrix. If A
is
not square, then ishermitian
returns logical 0
(false
).
Data Types: single
| double
| logical
Complex Number Support: Yes
skewOption
— Test type
'nonskew'
(default) | 'skew'
Test type, specified as 'nonskew'
or 'skew'
.
Specify 'skew'
to test whether A
is skew-Hermitian.
More About
Hermitian Matrix
A square matrix,
A
, is Hermitian if it is equal to its complex conjugate transpose,A = A'
.In terms of the matrix elements, this means that
The entries on the diagonal of a Hermitian matrix are always real. Since real matrices are unaffected by complex conjugation, a real matrix that is symmetric is also Hermitian. For example, the matrix
is both symmetric and Hermitian.
The eigenvalues of a Hermitian matrix are real.
Skew-Hermitian Matrix
A square matrix,
A
, is skew-Hermitian if it is equal to the negation of its complex conjugate transpose,A = -A'
.In terms of the matrix elements, this means that
The entries on the diagonal of a skew-Hermitian matrix are always pure imaginary or zero. Since real matrices are unaffected by complex conjugation, a real matrix that is skew-symmetric is also skew-Hermitian. For example, the matrix
is both skew-Hermitian and skew-symmetric.
The eigenvalues of a skew-Hermitian matrix are purely imaginary or zero.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
Code generation does not support sparse matrix inputs for this function.
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Distributed Arrays
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Version History
Introduced in R2014a
See Also
issymmetric
| isreal
| eig
| transpose
| ctranspose
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)