how to remove element from array ?

Skip to first unread message

Chi Ng

May 27, 2021, 7:28:12 PM5/27/21
to ArrayFire Users
if array size 4 x 4 matrix 

how to remove 2 row data ? 

in armadillo ,
mat A(5, 10, fill::randu);'
 mat B(5, 10, fill::randu);

Any function in ArrayFire  equal shed_row ? 

Pradeep Garigipati

Jun 21, 2021, 1:52:49 AM6/21/21
to Chi Ng, ArrayFire Users
Hello Chi,

Exact operation is not possible via function/array-method I believe, but an equivalent operation can be done using indexing.

join(A(seq(0,1), span), A(seq(3, 4), span), 0) instead of A.shed_row(2)

similarly for shed_cols

join(A(span, seq(0, 1)), A(span, seq(3, 4)), 1) instead of A.shed_cols(2,4)

I haven't benchmarked the code, please run for some numbers before employing it in production code.

You are welcome to raise a feature request and we will look into it as soon as we can. You are also welcome to contribute the feature should you be interested.


You received this message because you are subscribed to the Google Groups "ArrayFire Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Reply all
Reply to author
0 new messages