owl
owl copied to clipboard
Poly segfault
let test_poly () =
let x = Mat.(uniform 100 1 *$ 9.) in
let y = Mat.(sin x + (gaussian ~sigma:0.1 100 1)) in
let n = 4 in
let p = Regression.D.poly x y n in
let z = Array.init (n + 1) (fun i -> Mat.(pow_scalar x (float_of_int i)))
|> Mat.concatenate ~axis:1
in
Mat.(z *@ p)
Running this example always leads to a segfault for me if I increase n any higher than 2.
I took this example from the examples directory in this repo.
I am runnning owl 1.2.
I tried running it in utop and on one occasion I got:
Fatal glibc error: malloc.c:4376 (_int_malloc): assertion failed: (unsigned long) (size) >= (unsigned long) (nb)
The other times it just segfaulted without any further message.