Mercurial > repos > public > sbplib
comparison spdiagsVariablePeriodic.m @ 800:87ea9cac3287 feature/poroelastic
Make spdiagVariable a local functions
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 26 Jul 2018 17:53:51 -0700 |
parents | 8c65ef13df89 |
children |
comparison
equal
deleted
inserted
replaced
799:8c65ef13df89 | 800:87ea9cac3287 |
---|---|
38 end | 38 end |
39 | 39 |
40 end | 40 end |
41 | 41 |
42 end | 42 end |
43 | |
44 function A = spdiagVariable(a,i) | |
45 default_arg('i',0); | |
46 | |
47 if isrow(a) | |
48 a = a'; | |
49 end | |
50 | |
51 n = length(a)+abs(i); | |
52 | |
53 if i > 0 | |
54 a = [sparse(i,1); a]; | |
55 elseif i < 0 | |
56 a = [a; sparse(abs(i),1)]; | |
57 end | |
58 | |
59 A = spdiags(a,i,n,n); | |
60 end |