Mercurial > repos > public > sbplib
comparison spdiag.m @ 555:8e0067aef5b0
Make spdiag accept both row and column vectors
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 29 Aug 2017 12:22:01 +0200 |
parents | 9c0192cf099f |
children | e76321b89c1e |
comparison
equal
deleted
inserted
replaced
521:bcddbc2beef4 | 555:8e0067aef5b0 |
---|---|
1 function A = spdiag(a,i) | 1 function A = spdiag(a,i) |
2 default_arg('i',0); | 2 default_arg('i',0); |
3 | |
4 if isrow(a) | |
5 a = a'; | |
6 end | |
7 | |
3 n = length(a)-abs(i); | 8 n = length(a)-abs(i); |
4 A = spdiags(a,i,n,n); | 9 A = spdiags(a,i,n,n); |
5 end | 10 end |