How to generate a random complex unitary matrix whose columns each sum up to 1

51 visualizaciones (últimos 30 días)
Hello everyone,
basically the problem is exactly what is stated in the title. I want to create an unitary (2D) matrix of random complex numbers, such that the elements of each column of this matrix sum up to exactly 1. Is there any way to do this? As long as it's still reasonable, computation speed and/or memory usage are not that important.
Thank you to everyone trying to help!

Respuesta aceptada

David Goodmanson
David Goodmanson el 22 de Nov. de 2020
Editada: David Goodmanson el 4 de Dic. de 2020
MODIFIED to replace previous random function
Hi Michael,
here is one way. It's based on the idea that if the unitary matrix U is nxn, and onz = [1 1 1 1 1 1... ] (length n), then the sum-of-each-column condition is
[1 1 1 1 1 1... ]*U = [1 1 1 1 1 1... ]
so
n = 5;
onz = ones(1,n);
onzc = onz'; % column vector
na = null(onzc');
% construct an (n-1)x(n-1) unitary matrix by employing random numbers
% uniformly distributed on {-1, 1} x {-i, i}
h = 2*(rand(n-1,n-1) + i*rand(n-1,n-1)) -(1+i);
% method 1
[u, ~] = qr(h);
% method 2 (slower)
% [u, ~] = eig(h+h');
% construct the result
U = na*u*na' + (1/n)*onzc*onzc';
% checks, all of these should be small
U'*U -eye(size(U))
U*U' -eye(size(U))
onz*U - onz
onz*U' - onz % U' works too
  17 comentarios
Bruno Luong
Bruno Luong el 5 de Dic. de 2020
Yes I was wrong on the plateau value of qr since I though the RAND/RANDN do not have the effect, so I run my RandUnitary code and the only thing that add is phase shuffle.
Indeed the drop of plateau value is due to RAND as we both observe now. I knew RAND is not a good input at least for QR.
I'm still stumped that EIG can be somewhat pass few uniformity tests when using with RAND. I admit that I still don't fully understand it.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Descriptive Statistics en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by