comparison diags.m @ 412:5eb312dfe2ab feature/diags

Add full matrix equivalent of spdiags
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 07 Feb 2017 13:58:03 +0100
parents
children 0b87863cb29c
comparison
equal deleted inserted replaced
411:16a76db8c279 412:5eb312dfe2ab
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