view spdiag.m @ 1257:4d472d020ccf feature/FMMlabb

Assert that the inner radius is positive
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Wed, 12 Feb 2020 13:27:27 +0100
parents e76321b89c1e
children
line wrap: on
line source

function A = spdiag(a,i)
    default_arg('i',0);

    if isrow(a)
        a = a';
    end

    n = length(a)+abs(i);
    A = spdiags(a,i,n,n);
end