haskell-numerics / hmatrix

Linear algebra and numerical computation
381 stars 104 forks source link

Fixed #125 build under Windows #148

Closed varosi closed 9 years ago

varosi commented 9 years ago

I was not wrote it well last time.

varosi commented 9 years ago

I have added fix for Windows. Actually Windows compilation works with FreeBSD and OSX versions.

varosi commented 9 years ago

@albertoruiz, did you thought about to use some Haskell library for random numbers generation, like: http://hackage.haskell.org/package/AC-Random or http://hackage.haskell.org/package/tf-random which are not dependent on external C functions?

freeman42x commented 9 years ago

@varosi Did you manage to get it built with stack also?

varosi commented 9 years ago

See this: https://github.com/commercialhaskell/stack/issues/983 Currently hmatrix has no stack.yaml configuration for building with Stack. I could make it in another pull request.

freeman42x commented 9 years ago

@varosi Thank you for reply, I posted the yaml config on that issue. Nothing that I tried managed to detect the required libs during build.

freeman42x commented 9 years ago

This works fine for building latest hmatrix. Did you by any chance happen to build subhask also? It is another dependency needed for HLearn that needs hmatrix 0.16.1.5 and it fails to build when applying your build/stack related patches over hmatrix 0.16.1.5. More details in: https://github.com/mikeizbicki/subhask/issues/22

albertoruiz commented 9 years ago

Thanks! @varosi: In relation to the random numbers, there is of course no problem using other packages. I would like to have a simple and fast reentrant method to get big random arrays, but it is difficult to have something simple and portable in C. I will take a look at those packages, looking for a fast way to fill a vector.

varosi commented 9 years ago

Great! AC-Random looks good. If Vector could be Foldable it will be easy.

albertoruiz commented 9 years ago

There is also mwc-random, which also looks very good. It can obtain directly (uniform) vectors, and the elements can also be filled using safe mutation in the ST monad:

import System.Random.MWC
import qualified System.Random.MWC.Distributions as D
import Numeric.LinearAlgebra
import Numeric.LinearAlgebra.Devel

rvec :: Vector Double
rvec = runSTVector $ do
    v <- newUndefinedVector 10
    g <- initialize (fromList [4, 8, 15, 16, 23, 42])
    mapM_ (\k -> writeVector v k =<< D.standard g) [0..9]
    return v

We just need a simple way to supply the seed.

varosi commented 9 years ago

Is it possible to upload latest hmatrix version (with Windows support) to Hackage? I would like packages like SubHask to use that version.

albertoruiz commented 9 years ago

Yes, I will upload them very shortly.

varosi commented 9 years ago

Great!