how to remove element from array ?

21 views
Skip to first unread message

Chi Ng

unread,
May 27, 2021, 7:28:12 PMMay 27
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);
 A.shed_row(2);
A.shed_cols(2,4);

Any function in ArrayFire  equal shed_row ? 

Pradeep Garigipati

unread,
Jun 21, 2021, 1:52:49 AMJun 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.

Regards,
Pradeep.

--
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 arrayfire-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/arrayfire-users/7af99d80-f559-4613-a3db-95aa4f64736an%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages