Mercurial > repos > public > sbplib
comparison +sbp/diagInd.m @ 29:32b39dc44474
Removed repository inside +sbp to make it part of the root repo.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 28 Sep 2015 08:47:28 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
28:16acb2775aca | 29:32b39dc44474 |
---|---|
1 function A = diagInd(d,n,m) | |
2 A = zeros(n,length(d)); | |
3 for i = 1:length(d) | |
4 i0 = 1; | |
5 j0 = d(i)+1; | |
6 | |
7 I = i0 + (0:(n-1))'; | |
8 J = j0 + (0:(n-1))'; | |
9 | |
10 A(:,i) = matInd2VecInd(I,J,n); | |
11 | |
12 end | |
13 end | |
14 | |
15 function I = matInd2VecInd(i,j,n) | |
16 I = i + (j-1)*n; | |
17 end |