MathGroup Archive 2005

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

Search the Archive

Vectorization


It's possible to initialize a vector starting from an elementary functions:

In[1]:=
Table[Sin[Random[]],{10000000}]//Timing//First

Out[1]=
3.203 Second

The same problem can be done a bit more efficiently if the elementary function is applied to the numerical vector:

In[2]:=
Sin[Table[Random[],{10000000}]]//Timing//First

Out[2]=
1.969 Second

But why the tendency is opposed when the numbers are complex ? Is this a bug ?

In[3]:=
Table[Sin[I Random[]],{1000000}]//Timing//First
Sin[Table[I Random[],{1000000}]]//Timing//First

Out[3]=
2.484 Second

Out[4]=
2.656 Second


Thanks,

Marcelo Mayall


  • Prev by Date: text in 3d graph
  • Next by Date: Generate polynomial of specified degree
  • Previous by thread: Re: text in 3d graph
  • Next by thread: Re: Vectorization