In Sparse Matrices is posible condition in "combine"?


sparse(I, J, V[, m, n, combine ])

I must to igore new laue of V of old V is more then 0.

is posible condition in combine ?
e.g: + if V=0 else skip…



Please do make an effort to post something intelligible. If I decipher correctly, you may want something like

function sparse_new(I, J, V, W)
    _pick(w, v) = w > 0 ? w : v
    sparse(I, J, [_pick(W[i, j], v) for (i, j, v) in zip(I, J, V)])

sparse(I, J, V, m, n, (a,b) -> a == 0 ? b : a)



I undestend “a” is existing and “b” is new.

I need:

if b<a -> a-b
if b==a -> a

do it this rule : |
sparse(I, J, V, m, n, (a,b) -> b < a ? a-b)|

W dniu 2017-10-29 o 17:46, kristoffer.carlsson pisze:


You havent said what to do when b > a.