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