amcphail / hmatrix-gsl-stats

GSL Statistics functions for Haskell hmatrix
BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

segmentation fault: 11 #14

Closed dmjio closed 5 years ago

dmjio commented 5 years ago

On both OSX and Linux, w/ hmatrix-gsl-stats-0.4.1.7

To reproduce:

module Main where

import Numeric.GSL.Statistics
import Data.Vector.Storable

main :: IO ()
main = print $ mean_w (fromList [0.5,0.5]) (fromList [1,2])
amcphail commented 5 years ago

The following compiles and runs on Ubuntu 16.04 with g++ -g -Wall test.cc `gsl-config --cflags --libs` -o test

test.txt

The functions from Numeric.GSL.Statistics that take one argument do not crash. At least mean_w and tot_sumsq_w crash. These take two arguments. However, covariance, which takes two arguments does not crash. Under the hood all two argument functions use the auxiliary getD2 but this seems not to be the problem as, as stated, covariance does not crash.

The auxiliary wrappers to the GSL functions work (statistics-aux.c).

Work in progress.

amcphail commented 5 years ago

The auxiliary functions for the weighted statistics functions were taking arguments in the incorrect order. Fixed.