Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/KPMtools/rand_psd.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function M = rand_psd(d, d2, k) | |
2 % Create a random positive definite matrix of size d by d by k (k defaults to 1) | |
3 % M = rand_psd(d, d2, k) default: d2 = d, k = 1 | |
4 | |
5 if nargin<2, d2 = d; end | |
6 if nargin<3, k = 1; end | |
7 if d2 ~= d, error('must be square'); end | |
8 | |
9 M = zeros(d,d,k); | |
10 for i=1:k | |
11 A = rand(d); | |
12 M(:,:,i) = A*A'; | |
13 end |