MathGroup Archive 1998

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

Search the Archive

Making a large matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14832] Making a large matrix
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Wed, 18 Nov 1998 01:29:37 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Consider the timing experiments below for making a large matrix of
random real numbers.

In[1]:=
Table[Table[Random[],{1000}],{500}];//Timing Out[1]=
{17.47 Second,Null}

In[2]:=
Table[Range[Random[],1000],{500}];//Timing Out[2]=
{9.56 Second,Null}

In[3]:=
MakeMatrix=Compile[{m,n},Table[Range[Random[],n],{m}]];
      (* Make an (m,n) matrix.  *)

In[4]:=
MakeMatrix[500,1000];//Timing
Out[4]=
{5.82 Second,Null}

The last method is the fastest method I can come up with.   Can any of
you find a faster way to make a large matrix with Mathematica? (short
of using MathLink to run an executable program).

Cheers,
Ted Ersek



  • Prev by Date: vector fields on spheres
  • Next by Date: Re: Permutations.
  • Previous by thread: vector fields on spheres
  • Next by thread: Re: Making a large matrix