Mercurial > repos > public > sbplib
changeset 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 | bbf303c1f0cf |
files | spdiagVariable.m spdiagsVariablePeriodic.m |
diffstat | 2 files changed, 19 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/spdiagVariable.m Thu Jul 26 17:51:48 2018 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -function A = spdiagVariable(a,i) - default_arg('i',0); - - if isrow(a) - a = a'; - end - - n = length(a)+abs(i); - - if i > 0 - a = [sparse(i,1); a]; - elseif i < 0 - a = [a; sparse(abs(i),1)]; - end - - A = spdiags(a,i,n,n); -end \ No newline at end of file
--- a/spdiagsVariablePeriodic.m Thu Jul 26 17:51:48 2018 -0700 +++ b/spdiagsVariablePeriodic.m Thu Jul 26 17:53:51 2018 -0700 @@ -39,4 +39,22 @@ end -end \ No newline at end of file +end + +function A = spdiagVariable(a,i) + default_arg('i',0); + + if isrow(a) + a = a'; + end + + n = length(a)+abs(i); + + if i > 0 + a = [sparse(i,1); a]; + elseif i < 0 + a = [a; sparse(abs(i),1)]; + end + + A = spdiags(a,i,n,n); +end