Re: count the number of sub-list in a list
- To: mathgroup at smc.vnet.net
- Subject: [mg122248] Re: count the number of sub-list in a list
- From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
- Date: Sat, 22 Oct 2011 06:07:26 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201110211128.HAA18658@smc.vnet.net>
Hi, in your tensor m the elements you want to count have the Form {_Real, _Real, _Real} and they are in the last level (-1) of your structure: Count[m, {_Real, _Real, _Real}, -1] or you just use the Dimension of m with the last level droped and multiply them Times @@ Most@Dimensions[m] both should give the same result. Cheers Patrick On Oct 21, 2011, at 1:28 PM, Gy Peng wrote: > Dear All, > > I have a list like: > > {{{{-0.00201671, 0.87571, 0.482832}, {-0.839678, > 0.260735, -0.476401}, {-0.543081, -0.406384, > 0.734789}}, {{-0.87571, -0.00201671, > 0.482832}, {-0.260735, -0.839678, -0.476401}, {0.406384, -0.543081, > 0.734789}}, {{0.00201671, -0.87571, > 0.482832}, {0.839678, -0.260735, -0.476401}, {0.543081, 0.406384, > 0.734789}}, {{0.87571, 0.00201671, 0.482832}, {0.260735, > 0.839678, -0.476401}, {-0.406384, 0.543081, > 0.734789}}}, {{{0.839678, -0.260735, 0.476401}, {-0.00201671, > 0.87571, 0.482832}, {-0.543081, -0.406384, 0.734789}}, {{0.260735, > 0.839678, 0.476401}, {-0.87571, -0.00201671, > 0.482832}, {0.406384, -0.543081, 0.734789}}, {{-0.839678, > 0.260735, 0.476401}, {0.00201671, -0.87571, 0.482832}, {0.543081, > 0.406384, 0.734789}}, {{-0.260735, -0.839678, 0.476401}, {0.87571, > 0.00201671, 0.482832}, {-0.406384, 0.543081, > 0.734789}}}, {{{0.00201671, -0.87571, -0.482832}, {0.839678, -0.260735, > 0.476401}, {-0.543081, -0.406384, 0.734789}}, {{0.87571, > 0.00201671, -0.482832}, {0.260735, 0.839678, > 0.476401}, {0.406384, -0.543081, 0.734789}}, {{-0.00201671, > 0.87571, -0.482832}, {-0.839678, 0.260735, 0.476401}, {0.543081, > 0.406384, > 0.734789}}, {{-0.87571, -0.00201671, -0.482832}, {-0.260735, -0.839678, > 0.476401}, {-0.406384, 0.543081, 0.734789}}}, {{{-0.839678, > 0.260735, -0.476401}, {0.00201671, -0.87571, -0.482832}, {-0.543081, > -0.406384, > 0.734789}}, {{-0.260735, -0.839678, -0.476401}, {0.87571, > 0.00201671, -0.482832}, {0.406384, -0.543081, > 0.734789}}, {{0.839678, -0.260735, -0.476401}, {-0.00201671, > 0.87571, -0.482832}, {0.543081, 0.406384, 0.734789}}, {{0.260735, > 0.839678, -0.476401}, {-0.87571, -0.00201671, -0.482832}, {-0.406384, > 0.543081, 0.734789}}}} > > I consider each of {{*, *, *}, {*, *, *}, {*,*,*}} is one single element, so > how could I count how many element in the whole list? Thank you very much! > > G >
- References:
- count the number of sub-list in a list
- From: Gy Peng <hitphyopt@gmail.com>
- count the number of sub-list in a list