How to resolve the algorithm Conjugate transpose step by step in the J programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Conjugate transpose step by step in the J programming language
Table of Contents
Problem Statement
Suppose that a matrix
M
{\displaystyle M}
contains complex numbers. Then the conjugate transpose of
M
{\displaystyle M}
is a matrix
M
H
{\displaystyle M^{H}}
containing the complex conjugates of the matrix transposition of
M
{\displaystyle M}
.
This means that row
j
{\displaystyle j}
, column
i
{\displaystyle i}
of the conjugate transpose equals the complex conjugate of row
i
{\displaystyle i}
, column
j
{\displaystyle j}
of the original matrix.
In the next list,
M
{\displaystyle M}
must also be a square matrix.
Given some matrix of complex numbers, find its conjugate transpose. Also determine if the matrix is a:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Conjugate transpose step by step in the J programming language
Source code in the j programming language
ct =: +@|: NB. Conjugate transpose (ct A is A_ct)
X =: +/ . * NB. Matrix Multiply (x)
HERMITIAN =: 3 2j1 ,: 2j_1 1
(-: ct) HERMITIAN NB. A_ct = A
1
NORMAL =: 1 1 0 , 0 1 1 ,: 1 0 1
((X~ -: X) ct) NORMAL NB. A_ct x A = A x A_ct
1
UNITARY =: (-:%:2) * 1 1 0 , 0j_1 0j1 0 ,: 0 0 0j1 * %:2
(ct -: %.) UNITARY NB. A_ct = A^-1
1
HERMITIAN;NORMAL;UNITARY
+--------+-----+--------------------------+
| 3 2j1|1 1 0| 0.707107 0.707107 0|
|2j_1 1|0 1 1|0j_0.707107 0j0.707107 0|
| |1 0 1| 0 0 0j1|
+--------+-----+--------------------------+
NB. In J, PjQ is P + Q*i and the 0.7071... is sqrt(2)
hermitian=: -: ct
normal =: (X~ -: X) ct
unitary=: ct -: %.
(hermitian,normal,unitary)&.>HERMITIAN;NORMAL;UNITARY
+-----+-----+-----+
|1 1 0|0 1 0|0 1 1|
+-----+-----+-----+
You may also check:How to resolve the algorithm Kernighans large earthquake problem step by step in the C programming language
You may also check:How to resolve the algorithm N'th step by step in the Arturo programming language
You may also check:How to resolve the algorithm Phrase reversals step by step in the Quackery programming language
You may also check:How to resolve the algorithm Metaprogramming step by step in the Arturo programming language
You may also check:How to resolve the algorithm Generic swap step by step in the EchoLisp programming language