comparison diags.m @ 419:1adfc42bbc1a

Merged in feature/diags (pull request #7) Add full matrix equivalent of spdiags
author Jonatan Werpers <jonatan.werpers@it.uu.se>
date Tue, 07 Feb 2017 14:37:55 +0000
parents 0b87863cb29c
children
comparison
equal deleted inserted replaced
411:16a76db8c279 419:1adfc42bbc1a
1 function A = diags(B,d,m,n)
2 assert(size(B,1) == m);
3
4 A = repmat(B(:,1)*0, [1, n]);
5
6 for i = 1:size(B,2)
7 A(:,d(i)+ (1:m)) = A(:,d(i)+ (1:m)) + diag(B(:,i));
8 end
9 end