Re : Fast (compiled) routine for element testing and replacement in large matrices? A more general question about Listable
- To: mathgroup at smc.vnet.net
- Subject: [mg24000] [mg23978] Re : Fast (compiled) routine for element testing and replacement in large matrices? A more general question about Listable
- From: Jacqueline Zizi <jazi at club-internet.fr>
- Date: Mon, 19 Jun 2000 01:45:43 -0400 (EDT)
- References: <8iccl1$9oj@smc.vnet.net> <200006180701.DAA21625@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Bob Abraham wrote: > Hi Gareth --- > > This way should be much faster: > > d2wreal[w_, l_, u_] := Map[If[(# > l) && (# <= u), 1, 0] &, w, {2}] > If this can help the discussion, on my 2 years old Mac 266 MH, I get: In[1]:= d2wreal[w_, l_, u_] := Map[If[(# > l) && (# ? u), 1, 0] &, w, {2}] In[2]:= a = Table[Random[], {i, 1, 1000}, {j, 1, 1000}]; In[3]:= t = Timing[d2wreal[a, 0.2, 0.4]][[1]] Out[3]= 4.2 Second And my poor Mac don't go through the Listable version... It remainds me that in other circumstances, I also encountered a quite large timing difference in 2 ways of closing several palettes, the very slower one use too the Listable attributes. I did ask the question in an open form to the group, without giving my own solutions, quite recently, just to see if I missed something, but I did not get any answer. So I managed and took the less bad of my solutions, but I'm still curious about that... So my more general question is: ====================== Did people notice large timing difference using Listable versus Map? Who can tell me when listable might slow down? In what circumstances? Jacqueline Zizi
- References:
- Re: Fast (compiled) routine for element testing and replacement in large matrices?
- From: "Bob Abraham" <abraham@ast.cam.ac.uk>
- Re: Fast (compiled) routine for element testing and replacement in large matrices?