Re: style question
- To: mathgroup at smc.vnet.net
- Subject: [mg79485] Re: style question
- From: Peter Pein <petsie at dordos.net>
- Date: Fri, 27 Jul 2007 06:05:14 -0400 (EDT)
- References: <200707241008.GAA26147@smc.vnet.net> <f89rdm$6d1$1@smc.vnet.net>
Carl Woll schrieb: > For this particular problem (in version 6), it's faster to use > arithmetic and total: > > In[1]:= k = 10^6; > m1 = RandomInteger[1, {k, 2, 2}]; > m2 = RandomInteger[1, {k, 2, 2}]; > > In[4]:= Timing[ > matches = Thread[temporary[m1, m2]] /. temporary -> Equal; > Count[matches, True]] > > Out[4]= {3.453, 62300} > > In[5]:= Count[Total[Unitize[m1 - m2], {2, 3}], 0] // Timing > > Out[5]= {0.391, 62300} > > Carl Woll > Wolfram Research > Hello Carl, doesn't Unitize[x]==0 imply x==0? And when only zeroes are counted, why the call to Unitize? I can not try to explore the difference (if any) because version 5.2 does not allow Total with a range of levelspecs. Peter
- Follow-Ups:
- Re: Re: style question
- From: Carl Woll <carlw@wolfram.com>
- Re: Re: style question
- References:
- style question
- From: Yaroslav Bulatov <yaroslavvb@gmail.com>
- style question