Questions tagged [hmatrix]

Purely functional interface to basic linear algebra and other numerical computations, internally implemented using GSL, BLAS and LAPACK.

35 questions
16
votes
1 answer

How to get more performance out of automatic differentiation?

I am having a hard time optimizing a program that is relying on ads conjugateGradientDescent function for most of it's work. Basically my code is a translation of an old papers code that is written in Matlab and C. I have not measured it, but that…
fho
  • 6,787
  • 26
  • 71
5
votes
0 answers

How to Set Slices in Haskell's HMatrix?

Haskell's HMatrix allows you to conveniently get slices: m ?? (All, Take 3) But how can you set slices, especially non-rectangular ones? For instance, in Python's Numpy I'd do: >>> x = np.arange(12).reshape(3, 4) >>> x array([[ 0, 1, 2, 3], …
Josh.F
  • 3,666
  • 2
  • 27
  • 37
5
votes
2 answers

Efficient Haskell equivalent to NumPy's argsort

Is there a standard Haskell equivalent to NumPy's argsort function? I'm using HMatrix and, so, would like a function compatible with Vector R which is an alias for Data.Vector.Storable.Vector Double. The argSort function below is the implementation…
Richard Cook
  • 32,523
  • 5
  • 46
  • 71
5
votes
1 answer

How to do automatic differentiation on hmatrix?

Sooooo ... as it turns out going from fake matrices to hmatrix datatypes turns out to be nontrivial :) Preamble for reference: {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ParallelListComp #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE…
fho
  • 6,787
  • 26
  • 71
4
votes
1 answer

How to build hmatrix with BLAS and LAPACK under Windows?

Windows 10 x64 Cabal 1.22 I'm following steps in Windows section https://github.com/AlbertoRuiz/hmatrix/blob/master/INSTALL.md I downloaded hmatrix sources and gsl-lapack-windows.zip. When I try to install hmatrix…
The_Ghost
  • 2,070
  • 15
  • 26
4
votes
2 answers

What is the Haskell / hmatrix equivalent of the MATLAB pos function?

I'm translating some MATLAB code to Haskell using the hmatrix library. It's going well, but I'm stumbling on the pos function, because I don't know what it does or what it's Haskell equivalent will be. The MATLAB code looks like this: [U,S,V] =…
nont
  • 9,322
  • 7
  • 62
  • 82
2
votes
1 answer

How to correctly build cabal project using hmatrix under Windows 10?

Using Windows 10 64-bit, Cabal-3.4.0.0, ghc-8.10.7. I installed OpenBLAS in MSYS2 environment with command pacman -S mingw-w64-x86_64-openblas. Than, I successfully installed hmatrix-0.20.2 with command cabal install --lib hmatrix --flags=openblas…
Palmik
  • 23
  • 4
2
votes
0 answers

How do I convert a R to a C?

How do I convert a Numeric.LinearAlgebra.Static.R to a Numeric.LinearAlgebra.Static.C (with all imaginary parts being zero?). Sounds like a straight forward problem, but from what I see all map-like functions have the same input as the output field.…
fho
  • 6,787
  • 26
  • 71
2
votes
1 answer

haskell hmatrix installation under windows 10

I read all the related subjects on the net (including stackoverflow) and tried to follow clossely their advice, but nothing helps. here is my setup: windows 10. gcc 8.2.2 My command file (ran under normal cmd of windows and under mingw terminal,…
Atir
  • 163
  • 6
2
votes
1 answer

Stack can't find libgfortran-3.dll when trying to build with hmatrix

I am trying to setup hmatrix on my Windows 10 machine with GHC 8.0.2. I was following the answer here but when I try to build it says that it cannot find libgfortran-3.dll although I am sure I added it to the bin folder in the BLAS directory. My…
Yotam Ohad
  • 322
  • 3
  • 12
2
votes
0 answers

Parallel calls to HMatrix (or FFI in general)

I am working with point clouds in haskell using the repa library (3 as well as 4). At least I am trying to. There are a few operations I need to do massively where parallelism really helps a lot. Most of these are simple linear algebra operations on…
Richard Vock
  • 1,286
  • 10
  • 23
2
votes
1 answer

Haskell hmatrix: type errors with vector/scalar interactions?

I run into these strange cases of scalars and matrices behaving odd in hmatrix. If I don't type annotate, the operation works automagically ala matlab/python. But if I do type annotate the scalar with the "R" or type or "Double", I get a type…
daj
  • 6,962
  • 9
  • 45
  • 79
2
votes
2 answers

Cannot successfully install plot Haskell

I'd like to do some graphing in my Haskell program, but when I try to install plot I get the following error. Preprocessing library plot-0.2.3.4... lib/Graphics/Rendering/Plot/Figure/Simple.hs:37:8: Could not find module ‘Numeric.Container’ …
theideasmith
  • 2,835
  • 2
  • 13
  • 20
2
votes
1 answer

How to advance the RNG state when sampling random distributions using hmatrix-gsl-stats?

How do I advance the RNG in the hmatrix-gsl-stats when I'm sampling from a random distribution: For example: λ> CN.random_1p Exponential 235252 1.0 0.8742160459331277 λ> CN.random_1p Exponential 235252 1.0 0.8742160459331277 I don't see an obvious…
daj
  • 6,962
  • 9
  • 45
  • 79
2
votes
1 answer

hmatrix installation error on OS X 10.9.4

Is anyone successfully using hmatrix-0.16.0.4 on OSX 10.9? I get the following error: Prelude> import Numeric.LinearAlgebra Prelude Numeric.LinearAlgebra> let m = (3><4) [1..] :: Matrix Double Loading package array-0.4.0.1 ... linking ...…
tba
  • 6,229
  • 8
  • 43
  • 63
1
2 3