view +blockmatrix/zero.m @ 1250:8ec777fb473e

Merged in feature/dirac_discr (pull request #17) Add multi-d dirac discretization with tests Approved-by: Vidar Stiernström <vidar.stiernstrom@it.uu.se> Approved-by: Martin Almquist <malmquist@stanford.edu> Approved-by: Jonatan Werpers <jonatan.werpers@it.uu.se>
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Wed, 20 Nov 2019 22:24:06 +0000
parents a5f1b0267dba
children
line wrap: on
line source

% Creates a block matrix according to the division with zeros everywhere.
function bm = zero(div)
    if ~blockmatrix.isDivision(div)
        error('div is not a valid division');
    end

    n = div{1};
    m = div{2};

    N = length(n);
    M = length(m);

    bm = cell(N,M);

    for i = 1:N
        for j = 1:M
            bm{i,j} = sparse(n(i),m(j));
        end
    end
end