Returns the number of the nonzero elements. More...

int nonzeros () const
 Returns the number of the nonzero elements. More...
 

Detailed Description

Returns the number of the nonzero elements.

Gets the number of non-zero elements in the array.

float f[] = {1,2,0,4};
array a(4,1,f);
printf("%d\n",a.nonzeros()); // 3

Function Documentation

int nonzeros ( ) const

Returns the number of the nonzero elements.

Gets the number of non-zero elements in the array.

float f[] = {1,2,0,4};
array a(4,1,f);
printf("%d\n",a.nonzeros()); // 3
Returns
The number of non-zero elements in an array.
See Also
count()