Skip to content
Permalink
a5a5f364e5
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
11 lines (7 sloc) 190 Bytes
% function U = randunitary(N)
% Generates NxN random unitary matrix
% See also ranrealunitary.m
function U = randunitary(N)
A = rand(N,N) + i*rand(N,N);
H = 0.5*(A + A');
U = expm(i*H);