Home > manopt > manifolds > rotations > randherm.m

# randherm

## PURPOSE

Generates random Hermitian matrices with normal entries.

## SYNOPSIS

function S = randherm(n, N)

## DESCRIPTION

``` Generates random Hermitian matrices with normal entries.

function S = randherm(n)
function S = randherm(n, N)

S is an n-by-n-by-N array where each slice S(:, :, i) for i = 1..N is a
random Hermitian matrix formed by

S = (randsym(n, N) + 1i*randskew(n, N))/sqrt(2);

By default, N = 1.

## CROSS-REFERENCE INFORMATION

This function calls:
• randskew Generates random skew symmetric matrices with normal entries.
• randsym Generates random symmetric matrices with normal entries.
This function is called by:

## SOURCE CODE

```0001 function S = randherm(n, N)
0002 % Generates random Hermitian matrices with normal entries.
0003 %
0004 % function S = randherm(n)
0005 % function S = randherm(n, N)
0006 %
0007 % S is an n-by-n-by-N array where each slice S(:, :, i) for i = 1..N is a
0008 % random Hermitian matrix formed by
0009 %
0010 %   S = (randsym(n, N) + 1i*randskew(n, N))/sqrt(2);
0011 %
0012 % By default, N = 1.
0013 %
0015
0016 % This file is part of Manopt: www.manopt.org.
0017 % Original author: Nicolas Boumal, June 18, 2019.
0018 % Contributors:
0019 % Change log:
0020
0021     if nargin < 2
0022         N = 1;
0023     end
0024
0025     S = (randsym(n, N) + 1i*randskew(n, N))/sqrt(2);
0026
0027 end```

Generated on Fri 30-Sep-2022 13:18:25 by m2html © 2005