owl icon indicating copy to clipboard operation
owl copied to clipboard

Poly segfault

Open ghost opened this issue 9 months ago • 1 comments

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.

ghost avatar Mar 12 '25 18:03 ghost

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.

ghost avatar Mar 13 '25 14:03 ghost