Re: Re: Could this be improved?---Continued
- To: mathgroup at smc.vnet.net
- Subject: [mg21859] Re: [mg21832] Re: Could this be improved?---Continued
- From: Hartmut Wolf <hwolf at debis.com>
- Date: Wed, 2 Feb 2000 22:54:17 -0500 (EST)
- Organization: debis Systemhaus
- References: <200001300847.DAA08726@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Allan Hayes schrieb:
>
> Jordan Rosenthal posted the problem of timing the evaluation of individual
> members of a list - how to prevent the members evaluating before Timing was
> wrapped round them.
>
> I put the following together in response to an email from Jordan.
>
> Timing[#[vSmall];] & /@ {f1, f2, f3, f4}
>
> More flexible is:
>
> Thread[Unevaluated[
> Timing[#[#2];] &[{f1, f2, f3, f4}, vSmall]]]
>
> The next form allows multiple inputs to the functions.
>
> Thread[Unevaluated[
> Timing[# @@ #2] &[{f1, f2, f3, f4}, {vSmall, vSmall2}]],
> List, 1]
>
> Allan
Dear Allan
Just to look for variants, my answer to Jordan was (obviously we got the
same mail):
List @@ Timing /@ Through[Hold[f1, f2, f3, f4][vSmall]]
This works for any number of arguments. If you want to do several tests
with one stroke you may do
List @@ Timing /@
Flatten[Outer[Apply, Hold[f1, f2, f3, f4],
Hold[{vSmall, vSmall2}, {wSmall, wSmall2}]]]
yours, Hartmut