On 07/29/2012 04:19 PM, Danny Yoo wrote:
On Sun, Jul 29, 2012 at 6:07 PM, Matthias Felleisen
<matth...@ccs.neu.edu> wrote:
For 81 slots, I'd actually use a (define b (make-vector 81 0)) instead and use
an access polynomial. I am almost certain that it is faster.
Probably so. It allocates less and has better cache behavior when
accessing elements in row-major order.
I'm unfamiliar with the term 'access polynomial'. Would it be
accurate to say that it's a function f:
f: (number number -> number)
such as
(define COLUMN-LENGTH 9)
(define (f row col) (+ (* row COLUMN-LENGTH) col))
allows us to treat the flat vector as if it were a two-dimensional
structure, by translating (row,col) into offsets?
That's it. I've never heard it called an "access polynomial" before,
though that's exactly what it is.
When I merge the `math' collection for 5.4, such decisions will mostly
be moot. It has an Array type, which does that for you in any number of
dimensions.
Neil ⊥
____________________
Racket Users list:
http://lists.racket-lang.org/users