about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/KPMtools/softeye.m
diff options
context:
space:
mode:
Diffstat (limited to 'sourcecodes/bnt-master/KPMtools/softeye.m')
-rw-r--r--sourcecodes/bnt-master/KPMtools/softeye.m11
1 files changed, 11 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/KPMtools/softeye.m b/sourcecodes/bnt-master/KPMtools/softeye.m
new file mode 100644
index 00000000..29f45ee4
--- /dev/null
+++ b/sourcecodes/bnt-master/KPMtools/softeye.m
@@ -0,0 +1,11 @@
+function M = softeye(K, p)
+% SOFTEYE Make a stochastic matrix with p on the diagonal, and the remaining mass distributed uniformly
+% M = softeye(K, p)
+%
+% M is a K x K matrix.
+
+M = p*eye(K);
+q = 1-p;
+for i=1:K
+  M(i, [1:i-1  i+1:K]) = q/(K-1);
+end