MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Counting nonzeros

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86865] Counting nonzeros
  • From: carlos at Colorado.EDU
  • Date: Mon, 24 Mar 2008 01:44:20 -0500 (EST)

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]


  • Prev by Date: Re: Which function can do this?
  • Next by Date: Drag and drop in the front end
  • Previous by thread: SoundNote: velocity?
  • Next by thread: Re: Counting nonzeros