Mercurial > repos > public > sbplib
comparison spdiagVariable.m @ 756:f891758ad7a4 feature/d1_staggered
Merge with feature/utux2d.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Sat, 16 Jun 2018 14:30:45 -0700 |
parents | 7368affc8f78 |
children |
comparison
equal
deleted
inserted
replaced
755:14f0058356f2 | 756:f891758ad7a4 |
---|---|
1 function A = spdiagVariable(a,i) | |
2 default_arg('i',0); | |
3 | |
4 if isrow(a) | |
5 a = a'; | |
6 end | |
7 | |
8 n = length(a)+abs(i); | |
9 | |
10 if i > 0 | |
11 a = [sparse(i,1); a]; | |
12 elseif i < 0 | |
13 a = [a; sparse(abs(i),1)]; | |
14 end | |
15 | |
16 A = spdiags(a,i,n,n); | |
17 end |