user3139545
user3139545

Reputation: 7394

Vectorization in functional programming

Im currently doing a machinelerning course where we implement every algorithm using vectorization. The concept of vectorization seems to be most applicable to imperative programming to make the code more compact and to use the highly optimized numerical libraries for the language. However when looking in ml books for functional programming the algorithms are implemented declarative not using vectorization. You win the readability for programmers that are not experts in linear algebra but can this implementation in haskell get close to a vectorization implementation in an imperative language?

My question is how does the concept of vectorization apply in functional languages?

Upvotes: 5

Views: 1302

Answers (2)

sclv
sclv

Reputation: 38901

Deriving from work in http://research.microsoft.com/en-us/um/people/simonpj/papers/ndp/haskell-beats-C.pdf there is a SIMD branch of GHC at https://ghc.haskell.org/trac/ghc/wiki/SIMD and ongoing work at bringing those instructions in as primitive suitable for use by libraries such as vector.

The research described in (https://dorchard.wordpress.com/2013/10/14/automatic-simd-vectorization-for-haskell-and-icfp-2013/) describes another approach that uses vectorization directly in code generation. That sort of approach has not yet landed in any usable form.

Upvotes: 3

azal
azal

Reputation: 1260

This is a kind of theoretical question, but in general, vectorization is used for speeding up the procedures in terms of optimization. The algorithms may be implemented declarative but in the actual implementations they usually are vectorized as well as the functions they use.

Upvotes: 1

Related Questions