Packed vectors : use these whenever possible. The regular vector type is
just a gussied up linked list, but when vector functions are applied to
these types, bracketed by pack and unpack, then things unfold into
neatly optimized code.
Storable, Num, Fractional, Fold, Map, and ZipWith instances are provided for
packed vectors, so some operations do not require pack/unpack. For example,
dot does not require pack/unpack because it is defined in terms of
zipWith and fold. However transpose, det, gaussElim and
most others are recursive, and so you'll still need to use pack/unpack with
these. This goes for multmm as well because it uses transpose, and
multmv does not need its arguments to be unpacked, but the result will
be a polymorphic vector of type (:.), so you will want to pack it again.
This is all very experimental and likely to change.
|