Re: Counting nonzeros
- To: mathgroup at smc.vnet.net
- Subject: [mg86893] Re: Counting nonzeros
- From: Peter Pein <petsie at dordos.net>
- Date: Tue, 25 Mar 2008 01:17:31 -0500 (EST)
- References: <fs7iml$gma$1@smc.vnet.net>
carlos at colorado.edu schrieb: > I want to count the # of NZ entries in an arbitrary multilevel list, > say exp, that contains only integers. Is this the easiest way: > > k = Length[Flatten[exp]]-Count[Flatten[exp],0] > Count[Flatten[exp],Except[0]] is a bit shorter Peter