How to simulate a random unitary matrix with the condition that each entry is a complex number with the absolute value 1 in matlab

465 Views Asked by At

I have a code to create a random unitary matrix. However is it possible to get an unitary matrix in which the absolute value of each element is one ?

clear all
close all

%define a random matrix
R=randn(512,512)+1i*randn(512,512);
[U V]=svd(R); %performing SVD
% T=exp(1i*rand(512,512));
T=U; %required unitary matrix
1

There are 1 best solutions below

1
On

For all $z \in \mathbb C - \{0\}$:

$|\frac{z}{|z|}| = 1$

Divide each entry by its modulus.