Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Generating Two Unit Orthogonal Vectors to a 3D Vector

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36410] Re: Generating Two Unit Orthogonal Vectors to a 3D Vector
  • From: Selwyn Hollis <slhollis at earthlink.net>
  • Date: Wed, 4 Sep 2002 21:22:30 -0400 (EDT)
  • References: <al1i1d$kra$1@smc.vnet.net> <al4bfv$rht$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Here's an interesting side note. It seems that Cross is horribly slow. 
For instance:

In:  vecs = Table[Random[], {10000}, {2}, {3}];
      Timing[Cross[Sequence@@ #]& /@ vecs;]

Out:  {3.14 Second, Null}

A homemade substitute,

   cross = Compile[{{a, _Real, 1}, {b, _Real, 1}},
       {a[[2]]b[[3]] - a[[3]]b[[2]],
        a[[3]]b[[1]] - a[[1]]b[[3]],
        a[[1]]b[[2]] - a[[2]]b[[1]]} ]

is ten times as fast:

In:  Timing[cross[Sequence@@ #]& /@ vecs;]

Out:  {0.3 Second, Null}


---
Selwyn Hollis



  • Prev by Date: Re: List argument
  • Next by Date: Re: List argument
  • Previous by thread: RE: RE: Generating Two Unit Orthogonal Vectors to a 3D Vector
  • Next by thread: RE: Re: Generating Two Unit Orthogonal Vectors to a 3D Vector