haskell-numerics / hmatrix

Linear algebra and numerical computation
381 stars 104 forks source link

Missing (or bad) C libraries: blas, lapack #374

Closed thermohyaena closed 6 months ago

thermohyaena commented 6 months ago

Screenshot 2024-03-21 231735 Couldn't install hmatrix due to issue in the picture

image What should be written in the "package:" section?

thermohyaena commented 6 months ago

image This setup on stack.yaml wouldn't work

stla commented 6 months ago

See the instructions here.

thermohyaena commented 6 months ago

See the instructions here.

Ah I have solved this issue by putting nothing on the package section and add openblas flag in stack.yaml, and put hmatrix under dependence in package.ymal

thermohyaena commented 6 months ago

What I'm currently encountering is that it always outputs the error of "module/package not found" when I write import XXX in .hs file including Lib modules from src folder.

However, importing these modules works in ghci, but not in .hs

stla commented 6 months ago

Sorry, I don't see what you mean.

thermohyaena commented 6 months ago

Sorry, I don't see what you mean.

What i mean is basic in the pictures below that Screenshot 2024-03-25 111236

If i write import in .hs file, it pops error saying no module found for "Lib" and "import Numeric.LinearAlgebra ( (><), linearSolve )". Also i got error saying ambiguous type.

However,

Screenshot 2024-03-25 111411

If i import it only in ghci, that works just fine

thermohyaena commented 6 months ago

btw I got this when i print the type of c in ghci, not sure if that's normal Prelude Numeric.LinearAlgebra> :t c c :: (Foreign.Storable.Storable a, Fractional a) => hmatrix-0.20.2:Internal.Matrix.Matrix a

stla commented 6 months ago

Did you build the package (stack build)? Otherwise it's normal that the module is not found in VS code yet.

thermohyaena commented 6 months ago

Did you build the package (stack build)? Otherwise it's normal that the module is not found in VS code yet.

Yeah I have tried that, nothing changes unfortunately

Despite the error showing, it would still work for imported packages, and Lib would still be imported by the main exec file tho.

What I'm more concerned about is actually the type of matrix, the one I get from :t in ghc looks a bit weird?

Prelude Numeric.LinearAlgebra> :t c c :: (Foreign.Storable.Storable a, Fractional a) => hmatrix-0.20.2:Internal.Matrix.Matrix a

stla commented 6 months ago

I don't find this type is weird.

For your other problem, unfortunately we are off-topic here. This is not related to hmatrix. You could open a question on StackOverflow or Haskell discourse.

thermohyaena commented 6 months ago

I don't find this type is weird.

For your other problem, unfortunately we are off-topic here. This is not related to hmatrix. You could open a question on StackOverflow or Haskell discourse.

Yeah right, thanks for your help!