# [−][src]Function arrayfire::count

`pub fn count<T>(input: &Array<T>, dim: i32) -> Array<u32> where`

T: HasAfEnum,

u32: HasAfEnum,

Count number of non-zero elements along a given dimension

# Parameters

`input`

- Input Array`dim`

- Dimension along which the non-zero elements are counted

# Return Values

Result Array with number of non-zero elements along a given dimension

# Examples

use arrayfire::{Dim4, gt, print, randu, count}; let dims = Dim4::new(&[5, 3, 1, 1]); let cnst: f32 = 0.5; let a = gt(&randu::<f32>(dims), &cnst, false); print(&a); let b = count(&a, 0); print(&b); let c = count(&a, 1); print(&c);