view diags.m @ 1275:8ff3a95ad7cc feature/poroelastic

Change metric computation in CurvilinearUpwind so that one can use odd orders for the diffOp
author Martin Almquist <malmquist@stanford.edu>
date Wed, 03 Jun 2020 10:29:53 -0700
parents 0b87863cb29c
children
line wrap: on
line source

function A = diags(B,d,m,n)
    assert(size(B,1) == m);

    A = repmat(B(:,1)*0, [1, n]);

    for i = 1:size(B,2)
        A(:,d(i)+ (1:m)) = A(:,d(i)+ (1:m)) + diag(B(:,i));
    end
end