Mercurial > repos > public > sbplib
comparison spdiagVariable.m @ 717:8e4274ee6dd8 feature/utux2D
Merge with feature/poroelastic
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Sat, 03 Mar 2018 14:58:21 -0800 |
parents | 7368affc8f78 |
children |
comparison
equal
deleted
inserted
replaced
666:2d85f17a8aec | 717:8e4274ee6dd8 |
---|---|
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 |