1. Sequence Multiplication
- Posted by "C. K. Lester" <cklester at yahoo.com> Mar 14, 2002
- 411 views
Where length(seq_a) = length(seq_b), instead of seq_x = seq_a * seq_b should I use for t=1 to length(seq_a) do seq_x[t] = seq_a[t] * seq_b[t] end for I would try it out but it's late and I'm going to bed. Plus, someone may have some additional insights they'd like to share. Thanks (and goodnight), ck
2. Re: Sequence Multiplication
- Posted by "Carl R. White" <euphoria at carlw.legend.uk.com> Mar 15, 2002
- 428 views
C. K. Lester wrote: > Where length(seq_a) = length(seq_b), instead of > > seq_x = seq_a * seq_b > > should I use > > for t=1 to length(seq_a) do > seq_x[t] = seq_a[t] * seq_b[t] > end for > > I would try it out but it's late and I'm going to bed. Plus, someone may > have some additional insights they'd like to share. > > Thanks (and goodnight), > ck If seq_a and seq_b are short (and what qualifies as 'short' varies from machine to machine), the former is the faster method. For longer seq_a and seq_b, the latter is faster. However, if you can, use one of these instead of the latter: -- This has the disadvantage of destroying the original seq_a for t = 1 to length(seq_a) do seq_a[i] *= seq_b[i] end for seq_x = repeat(0, length(seq_a)) do for t = 1 to length(seq_a) do seq_x[i] = seq_a[i] * seq_b[i] end for Carl